Mercurial > pidgin
annotate src/toc.c @ 1694:bea407767ac1
[gaim-migrate @ 1704]
Sounds on buddy pounce. This may need a better AU file, im not sure yet.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Mon, 09 Apr 2001 08:33:09 +0000 |
parents | a843efee692a |
children | 1e0613d9526b |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
22 | |
23 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
25 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
26 #endif |
1 | 27 #include <netdb.h> |
28 #include <gtk/gtk.h> | |
29 #include <unistd.h> | |
30 #include <errno.h> | |
31 #include <netinet/in.h> | |
32 #include <arpa/inet.h> | |
33 #include <string.h> | |
34 #include <stdlib.h> | |
35 #include <stdio.h> | |
36 #include <time.h> | |
37 #include <sys/socket.h> | |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
38 #include <sys/types.h> |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
39 #include <sys/stat.h> |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
40 #include "prpl.h" |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
41 #include "multi.h" |
1 | 42 #include "gaim.h" |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
43 #include "proxy.h" |
1 | 44 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
45 #include "pixmaps/admin_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
46 #include "pixmaps/aol_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
47 #include "pixmaps/away_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
48 #include "pixmaps/dt_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
49 #include "pixmaps/free_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
50 |
1623
8684c0315818
[gaim-migrate @ 1633]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1615
diff
changeset
|
51 #define REVISION "penguin" |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
52 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
53 #define TYPE_SIGNON 1 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
54 #define TYPE_DATA 2 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
55 #define TYPE_ERROR 3 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
56 #define TYPE_SIGNOFF 4 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
57 #define TYPE_KEEPALIVE 5 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
58 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
59 #define FLAPON "FLAPON\r\n\r\n" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
60 #define ROAST "Tic/Toc" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
61 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
62 #define TOC_HOST "toc.oscar.aol.com" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
63 #define TOC_PORT 9898 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
64 #define AUTH_HOST "login.oscar.aol.com" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
65 #define AUTH_PORT 5190 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
66 #define LANGUAGE "english" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
67 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
68 #define STATE_OFFLINE 0 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
69 #define STATE_FLAPON 1 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
70 #define STATE_SIGNON_REQUEST 2 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
71 #define STATE_ONLINE 3 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
72 #define STATE_PAUSE 4 |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
73 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
74 #define VOICE_UID "09461341-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
75 #define FILE_SEND_UID "09461343-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
76 #define IMAGE_UID "09461345-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
77 #define B_ICON_UID "09461346-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
78 #define STOCKS_UID "09461347-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
79 #define FILE_GET_UID "09461348-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
80 #define GAMES_UID "0946134a-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
81 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
82 struct ft_request { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
83 struct gaim_connection *gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
84 char *user; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
85 char UID[2048]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
86 char *cookie; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
87 char *ip; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
88 int port; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
89 char *message; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
90 char *filename; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
91 int files; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
92 int size; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
93 }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
94 |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
95 struct toc_data { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
96 int toc_fd; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
97 int seqno; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
98 int state; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
99 }; |
1 | 100 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
101 struct sflap_hdr { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
102 unsigned char ast; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
103 unsigned char type; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
104 unsigned short seqno; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
105 unsigned short len; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
106 }; |
1 | 107 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
108 struct signon { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
109 unsigned int ver; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
110 unsigned short tag; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
111 unsigned short namelen; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
112 char username[80]; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
113 }; |
1 | 114 |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
115 /* constants to identify proto_opts */ |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
116 #define USEROPT_AUTH 0 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
117 #define USEROPT_AUTHPORT 1 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
118 #define USEROPT_SOCKSHOST 2 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
119 #define USEROPT_SOCKSPORT 3 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
120 #define USEROPT_PROXYTYPE 4 |
1 | 121 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
122 static void toc_callback(gpointer, gint, GdkInputCondition); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
123 static unsigned char *roast_password(char *); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
124 static void accept_file_dialog(struct ft_request *); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
125 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
126 /* ok. this function used to take username/password, and return 0 on success. |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
127 * now, it takes username/password, and returns NULL on error or a new gaim_connection |
976
2586b2a3725e
[gaim-migrate @ 986]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
975
diff
changeset
|
128 * on success. */ |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
129 static void toc_login(struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
130 { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
131 struct gaim_connection *gc; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
132 struct toc_data *tdt; |
1 | 133 char buf[80]; |
134 | |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
135 gc = new_gaim_conn(user); |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
136 gc->proto_data = tdt = g_new0(struct toc_data, 1); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
137 |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1660
diff
changeset
|
138 g_snprintf(buf, sizeof buf, "Looking up %s", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
139 user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
140 /* this is such a hack */ |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
141 set_login_progress(gc, 1, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
142 while (gtk_events_pending()) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
143 gtk_main_iteration(); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
144 if (!g_slist_find(connections, gc)) |
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
145 return; |
1 | 146 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
147 tdt->toc_fd = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
148 proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
149 user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user-> |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
150 proto_opt[USEROPT_AUTHPORT]) : |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
151 TOC_PORT, user->proto_opt[USEROPT_SOCKSHOST], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
152 atoi(user->proto_opt[USEROPT_SOCKSPORT]), |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
153 atoi(user->proto_opt[USEROPT_PROXYTYPE])); |
1 | 154 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
155 debug_printf("* Client connects to TOC\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
156 if (tdt->toc_fd < 0) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
157 g_snprintf(buf, sizeof(buf), "Connect to %s failed", user->proto_opt[USEROPT_AUTH]); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
158 hide_login_progress(gc, buf); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
159 signoff(gc); |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
160 return; |
1 | 161 } |
162 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
163 debug_printf("* Client sends \"FLAPON\\r\\n\\r\\n\"\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
164 if (write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
165 hide_login_progress(gc, "Disconnected."); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
166 signoff(gc); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
167 return; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
168 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
169 tdt->state = STATE_FLAPON; |
1 | 170 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
171 /* i know a lot of people like to look at gaim to see how TOC works. so i'll comment |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
172 * on what this does. it's really simple. when there's data ready to be read from the |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
173 * toc_fd file descriptor, toc_callback is called, with gc passed as its data arg. */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
174 gc->inpa = gdk_input_add(tdt->toc_fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_callback, gc); |
1 | 175 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
176 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
177 set_login_progress(gc, 2, buf); |
1 | 178 } |
179 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
180 static void toc_close(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
181 { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
182 if (gc->inpa > 0) |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
183 gdk_input_remove(gc->inpa); |
1667
b5635d882116
[gaim-migrate @ 1677]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
184 gc->inpa = 0; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
185 close(((struct toc_data *)gc->proto_data)->toc_fd); |
1 | 186 } |
187 | |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
188 static int sflap_send(struct gaim_connection *gc, char *buf, int olen, int type) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
189 { |
1 | 190 int len; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
191 int slen = 0; |
1 | 192 struct sflap_hdr hdr; |
193 char obuf[MSG_LEN]; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
194 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
1 | 195 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
196 if (tdt->state == STATE_PAUSE) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
197 /* TOC has given us the PAUSE message; sending could cause a disconnect |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
198 * so we just return here like everything went through fine */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
199 return 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
200 |
970 | 201 /* One _last_ 2048 check here! This shouldn't ever |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
202 * get hit though, hopefully. If it gets hit on an IM |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
203 * It'll lose the last " and the message won't go through, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
204 * but this'll stop a segfault. */ |
970 | 205 if (strlen(buf) > (MSG_LEN - sizeof(hdr))) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
206 debug_printf("message too long, truncating\n"); |
970 | 207 buf[MSG_LEN - sizeof(hdr) - 3] = '"'; |
208 buf[MSG_LEN - sizeof(hdr) - 2] = '\0'; | |
209 } | |
1 | 210 |
211 if (olen < 0) | |
212 len = escape_message(buf); | |
213 else | |
214 len = olen; | |
215 hdr.ast = '*'; | |
216 hdr.type = type; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
217 hdr.seqno = htons(tdt->seqno++ & 0xffff); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
218 hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1)); |
1 | 219 |
220 memcpy(obuf, &hdr, sizeof(hdr)); | |
221 slen += sizeof(hdr); | |
222 memcpy(&obuf[slen], buf, len); | |
223 slen += len; | |
224 if (type != TYPE_SIGNON) { | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
225 obuf[slen] = '\0'; |
1 | 226 slen += 1; |
227 } | |
228 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
229 return write(tdt->toc_fd, obuf, slen); |
1 | 230 } |
231 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
232 static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
233 { |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
234 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
235 struct sflap_hdr *hdr; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
236 int ret; |
1 | 237 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
238 if (read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
239 debug_printf("error, couldn't read flap header\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
240 return -1; |
79 | 241 } |
242 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
243 hdr = (struct sflap_hdr *)buffer; |
1 | 244 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
245 if (buflen < ntohs(hdr->len)) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
246 /* fake like there's a read error */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
247 debug_printf("buffer too small (have %d, need %d)\n", buflen, ntohs(hdr->len)); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
248 return -1; |
1 | 249 } |
250 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
251 if (ntohs(hdr->len) > 0) { |
1234
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
252 int count = 0; |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
253 ret = 0; |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
254 do { |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
255 count += ret; |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
256 ret = read(tdt->toc_fd, |
1533
b6fe5cab70d6
[gaim-migrate @ 1543]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1521
diff
changeset
|
257 buffer + sizeof(struct sflap_hdr) + count, ntohs(hdr->len) - count); |
1234
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
258 } while (count + ret < ntohs(hdr->len) && ret > 0); |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
259 buffer[sizeof(struct sflap_hdr) + count + ret] = '\0'; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
260 return ret; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
261 } else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
262 return 0; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
263 } |
1 | 264 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
265 static unsigned char *roast_password(char *pass) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
266 { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
267 /* Trivial "encryption" */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
268 static char rp[256]; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
269 static char *roast = ROAST; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
270 int pos = 2; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
271 int x; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
272 strcpy(rp, "0x"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
273 for (x = 0; (x < 150) && pass[x]; x++) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
274 pos += sprintf(&rp[pos], "%02x", pass[x] ^ roast[x % strlen(roast)]); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
275 rp[pos] = '\0'; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
276 return rp; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
277 } |
1 | 278 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
279 static void toc_callback(gpointer data, gint source, GdkInputCondition condition) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
280 { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
281 struct gaim_connection *gc = (struct gaim_connection *)data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
282 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
283 struct sflap_hdr *hdr; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
284 struct signon so; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
285 char buf[8 * 1024], *c; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
286 char snd[BUF_LEN * 2]; |
1 | 287 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
288 if (condition & GDK_INPUT_EXCEPTION) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
289 debug_printf("gdk_input exception! check internet connection\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
290 hide_login_progress(gc, _("Connection Closed")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
291 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
292 return; |
79 | 293 } |
1 | 294 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
295 /* there's data waiting to be read, so read it. */ |
1412
47413c49bbee
[gaim-migrate @ 1422]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
296 if (wait_reply(gc, buf, 8 * 1024) <= 0) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
297 hide_login_progress(gc, _("Connection Closed")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
298 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
299 return; |
1 | 300 } |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
301 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
302 if (tdt->state == STATE_FLAPON) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
303 hdr = (struct sflap_hdr *)buf; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
304 if (hdr->type != TYPE_SIGNON) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
305 debug_printf("problem, hdr->type != TYPE_SIGNON\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
306 else |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
307 debug_printf("* TOC sends Client FLAP SIGNON\n"); |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
308 tdt->seqno = ntohs(hdr->seqno); |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
309 tdt->state = STATE_SIGNON_REQUEST; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
310 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
311 debug_printf("* Client sends TOC FLAP SIGNON\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
312 g_snprintf(so.username, sizeof(so.username), "%s", gc->username); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
313 so.ver = htonl(1); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
314 so.tag = htons(1); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
315 so.namelen = htons(strlen(so.username)); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
316 if (sflap_send(gc, (char *)&so, ntohs(so.namelen) + 8, TYPE_SIGNON) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
317 hide_login_progress(gc, _("Disconnected.")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
318 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
319 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
320 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
321 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
322 debug_printf("* Client sends TOC \"toc_signon\" message\n"); |
1491
5a5284be5d66
[gaim-migrate @ 1501]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1469
diff
changeset
|
323 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
324 AUTH_HOST, AUTH_PORT, normalize(gc->username), |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
325 roast_password(gc->password), LANGUAGE, REVISION); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
326 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
327 hide_login_progress(gc, _("Disconnected.")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
328 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
329 return; |
1 | 330 } |
331 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
332 set_login_progress(gc, 3, _("Waiting for reply...")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
333 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
334 } |
1 | 335 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
336 if (tdt->state == STATE_SIGNON_REQUEST) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
337 debug_printf("* TOC sends client SIGN_ON reply\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
338 if (strncasecmp(buf + sizeof(struct sflap_hdr), "SIGN_ON", strlen("SIGN_ON"))) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
339 debug_printf("Didn't get SIGN_ON! buf was: %s\n", |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
340 buf + sizeof(struct sflap_hdr)); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
341 hide_login_progress(gc, _("Authentication Failed")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
342 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
343 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
344 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
345 /* we're supposed to check that it's really TOC v1 here but we know it is ;) */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
346 debug_printf("TOC version: %s\n", buf + sizeof(struct sflap_hdr) + 4); |
1 | 347 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
348 /* we used to check for the CONFIG here, but we'll wait until we've sent our |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
349 * version of the config and then the toc_init_done message. we'll come back to |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
350 * the callback in a better state if we get CONFIG anyway */ |
1 | 351 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
352 tdt->state = STATE_ONLINE; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
353 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
354 account_online(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
355 serv_finish_login(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
356 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
357 do_import(0, gc); |
1 | 358 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
359 /* Client sends TOC toc_init_done message */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
360 debug_printf("* Client sends TOC toc_init_done message\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
361 g_snprintf(snd, sizeof snd, "toc_init_done"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
362 sflap_send(gc, snd, -1, TYPE_DATA); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
363 |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
364 g_snprintf(snd, sizeof snd, "toc_set_caps %s %s", FILE_SEND_UID, FILE_GET_UID); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
365 sflap_send(gc, snd, -1, TYPE_DATA); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
366 |
1 | 367 return; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
368 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
369 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
370 debug_printf("From TOC server: %s\n", buf + sizeof(struct sflap_hdr)); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
371 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
372 c = strtok(buf + sizeof(struct sflap_hdr), ":"); /* Ditch the first part */ |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
373 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
374 if (!strcasecmp(c, "SIGN_ON")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
375 /* we should only get here after a PAUSE */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
376 if (tdt->state != STATE_PAUSE) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
377 debug_printf("got SIGN_ON but not PAUSE!\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
378 else { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
379 tdt->state = STATE_ONLINE; |
1146
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
380 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
381 AUTH_HOST, AUTH_PORT, normalize(gc->username), |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
382 roast_password(gc->password), LANGUAGE, REVISION); |
1146
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
383 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) { |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
384 hide_login_progress(gc, _("Disconnected.")); |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
385 signoff(gc); |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
386 return; |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
387 } |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
388 do_import(0, gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
389 g_snprintf(snd, sizeof snd, "toc_init_done"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
390 sflap_send(gc, snd, -1, TYPE_DATA); |
1146
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
391 do_error_dialog(_("TOC has come back from its pause. You may now send" |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
392 " messages again."), _("TOC Resume")); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
393 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
394 } else if (!strcasecmp(c, "CONFIG")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
395 c = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
396 parse_toc_buddy_list(gc, c, 0); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
397 } else if (!strcasecmp(c, "NICK")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
398 c = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
399 g_snprintf(gc->username, sizeof(gc->username), "%s", c); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
400 } else if (!strcasecmp(c, "IM_IN")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
401 char *away, *message; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
402 int a = 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
403 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
404 c = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
405 away = strtok(NULL, ":"); |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
406 |
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
407 message = away; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
408 while (*message && (*message != ':')) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
409 message++; |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
410 message++; |
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
411 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
412 a = (away && (*away == 'T')) ? 1 : 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
413 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
414 serv_got_im(gc, c, message, a); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
415 } else if (!strcasecmp(c, "UPDATE_BUDDY")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
416 char *l, *uc; |
1 | 417 int logged, evil, idle, type = 0; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
418 time_t signon, time_idle; |
1 | 419 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
420 c = strtok(NULL, ":"); /* name */ |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
421 l = strtok(NULL, ":"); /* online */ |
1 | 422 sscanf(strtok(NULL, ":"), "%d", &evil); |
1114
c61f9c384413
[gaim-migrate @ 1124]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1113
diff
changeset
|
423 sscanf(strtok(NULL, ":"), "%ld", &signon); |
1 | 424 sscanf(strtok(NULL, ":"), "%d", &idle); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
425 uc = strtok(NULL, ":"); |
1 | 426 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
427 logged = (l && (*l == 'T')) ? 1 : 0; |
1 | 428 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
429 if (uc[0] == 'A') |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
430 type |= UC_AOL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
431 switch (uc[1]) { |
1 | 432 case 'A': |
433 type |= UC_ADMIN; | |
434 break; | |
435 case 'U': | |
436 type |= UC_UNCONFIRMED; | |
437 break; | |
438 case 'O': | |
439 type |= UC_NORMAL; | |
440 break; | |
441 default: | |
442 break; | |
443 } | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
444 if (uc[2] == 'U') |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
445 type |= UC_UNAVAILABLE; |
1 | 446 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
447 if (idle) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
448 time(&time_idle); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
449 time_idle -= idle * 60; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
450 } else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
451 time_idle = 0; |
1 | 452 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
453 serv_got_update(gc, c, logged, evil, signon, time_idle, type, 0); |
1 | 454 } else if (!strcasecmp(c, "ERROR")) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
455 c = strtok(NULL, ":"); |
1 | 456 show_error_dialog(c); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
457 } else if (!strcasecmp(c, "EVILED")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
458 int lev; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
459 char *name; |
1 | 460 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
461 sscanf(strtok(NULL, ":"), "%d", &lev); |
1 | 462 name = strtok(NULL, ":"); |
463 | |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
464 serv_got_eviled(gc, name, lev); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
465 } else if (!strcasecmp(c, "CHAT_JOIN")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
466 char *name; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
467 int id; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
468 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
469 sscanf(strtok(NULL, ":"), "%d", &id); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
470 name = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
471 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
472 serv_got_joined_chat(gc, id, name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
473 } else if (!strcasecmp(c, "CHAT_IN")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
474 int id, w; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
475 char *m, *who, *whisper; |
1 | 476 |
477 sscanf(strtok(NULL, ":"), "%d", &id); | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
478 who = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
479 whisper = strtok(NULL, ":"); |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
480 m = whisper; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
481 while (*m && (*m != ':')) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
482 m++; |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
483 m++; |
1 | 484 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
485 w = (whisper && (*whisper == 'T')) ? 1 : 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
486 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
487 serv_got_chat_in(gc, id, who, w, m); |
1 | 488 } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) { |
489 int id; | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
490 char *in, *buddy; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
491 GSList *bcs = gc->buddy_chats; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
492 struct conversation *b = NULL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
493 |
1 | 494 sscanf(strtok(NULL, ":"), "%d", &id); |
495 in = strtok(NULL, ":"); | |
496 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
497 while (bcs) { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
498 b = (struct conversation *)bcs->data; |
1 | 499 if (id == b->id) |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
500 break; |
1 | 501 bcs = bcs->next; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
502 b = NULL; |
44 | 503 } |
1 | 504 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
505 if (!b) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
506 return; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
507 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
508 if (in && (*in == 'T')) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
509 while ((buddy = strtok(NULL, ":")) != NULL) |
1 | 510 add_chat_buddy(b, buddy); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
511 else |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
512 while ((buddy = strtok(NULL, ":")) != NULL) |
1 | 513 remove_chat_buddy(b, buddy); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
514 } else if (!strcasecmp(c, "CHAT_INVITE")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
515 char *name, *who, *message; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
516 int id; |
1 | 517 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
518 name = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
519 sscanf(strtok(NULL, ":"), "%d", &id); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
520 who = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
521 message = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
522 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
523 serv_got_chat_invite(gc, name, id, who, message); |
1 | 524 } else if (!strcasecmp(c, "CHAT_LEFT")) { |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
525 GSList *bcs = gc->buddy_chats; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
526 struct conversation *b = NULL; |
1 | 527 int id; |
528 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
529 sscanf(strtok(NULL, ":"), "%d", &id); |
1 | 530 |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
531 while (bcs) { |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
532 b = (struct conversation *)bcs->data; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
533 if (id == b->id) |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
534 break; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
535 b = NULL; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
536 bcs = bcs->next; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
537 } |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
538 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
539 if (!b) |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
540 return; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
541 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
542 if (b->window) { |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
543 char error_buf[BUF_LONG]; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
544 b->gc = NULL; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
545 g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected" |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
546 " from chat room %s."), b->name); |
1669
a843efee692a
[gaim-migrate @ 1679]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1667
diff
changeset
|
547 do_error_dialog(error_buf, _("Chat Error")); |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
548 } else |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
549 serv_got_chat_left(gc, id); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
550 } else if (!strcasecmp(c, "GOTO_URL")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
551 char *name, *url, tmp[256]; |
1 | 552 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
553 name = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
554 url = strtok(NULL, ":"); |
1 | 555 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
556 g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", TOC_HOST, TOC_PORT, url); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
557 g_show_info(gc->user, tmp); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
558 } else if (!strcasecmp(c, "DIR_STATUS")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
559 } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
560 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
561 do_error_dialog(_("Password Change Successeful"), _("Gaim - Password Change")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
562 } else if (!strcasecmp(c, "PAUSE")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
563 tdt->state = STATE_PAUSE; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
564 do_error_dialog(_("TOC has sent a PAUSE command. When this happens, TOC ignores" |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
565 " any messages sent to it, and may kick you off if you send a" |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
566 " message. Gaim will prevent anything from going through. This" |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
567 " is only temporary, please be patient."), _("TOC Pause")); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
568 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
569 char *user, *uuid, *cookie; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
570 int seq; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
571 char *rip, *pip, *vip; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
572 int port; |
1 | 573 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
574 user = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
575 uuid = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
576 cookie = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
577 sscanf(strtok(NULL, ":"), "%d", &seq); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
578 rip = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
579 pip = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
580 vip = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
581 sscanf(strtok(NULL, ":"), "%d", &port); |
1 | 582 |
197
24f0fef56a73
[gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
196
diff
changeset
|
583 if (!strcmp(uuid, FILE_SEND_UID)) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
584 /* they want us to get a file */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
585 int unk[4], i; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
586 char *messages[4], *tmp, *name; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
587 int subtype, files, totalsize = 0; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
588 struct ft_request *ft; |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
589 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
590 for (i = 0; i < 4; i++) { |
1113
4efa1ca61a2a
[gaim-migrate @ 1123]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1112
diff
changeset
|
591 sscanf(strtok(NULL, ":"), "%d", &unk[i]); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
592 if (unk[i] == 10001) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
593 break; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
594 messages[i] = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
595 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
596 tmp = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
597 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
598 subtype = tmp[1]; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
599 files = tmp[3]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
600 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
601 totalsize |= (tmp[4] << 24) & 0xff000000; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
602 totalsize |= (tmp[5] << 16) & 0x00ff0000; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
603 totalsize |= (tmp[6] << 8) & 0x0000ff00; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
604 totalsize |= (tmp[7] << 0) & 0x000000ff; |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
605 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
606 if (!totalsize) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
607 g_free(tmp); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
608 for (i--; i >= 0; i--) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
609 g_free(messages[i]); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
610 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
611 } |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
612 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
613 name = tmp + 8; |
1 | 614 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
615 ft = g_new0(struct ft_request, 1); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
616 ft->cookie = g_strdup(cookie); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
617 ft->ip = g_strdup(pip); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
618 ft->port = port; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
619 if (i) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
620 ft->message = g_strdup(messages[0]); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
621 else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
622 ft->message = NULL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
623 ft->filename = g_strdup(name); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
624 ft->user = g_strdup(user); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
625 ft->size = totalsize; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
626 ft->files = files; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
627 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_SEND_UID); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
628 ft->gc = gc; |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
629 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
630 g_free(tmp); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
631 for (i--; i >= 0; i--) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
632 g_free(messages[i]); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
633 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
634 debug_printf("English translation of RVOUS_PROPOSE: %s requests Send File (i.e." |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
635 " send a file to you); %s:%d (verified_ip:port), %d files at" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
636 " total size of %ld bytes.\n", user, vip, port, files, totalsize); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
637 accept_file_dialog(ft); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
638 } else if (!strcmp(uuid, FILE_GET_UID)) { |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
639 /* they want us to send a file */ |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
640 int unk[4], i; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
641 char *messages[4], *tmp; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
642 struct ft_request *ft; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
643 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
644 for (i = 0; i < 4; i++) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
645 sscanf(strtok(NULL, ":"), "%d", unk + i); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
646 if (unk[i] == 10001) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
647 break; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
648 messages[i] = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
649 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
650 tmp = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
651 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
652 ft = g_new0(struct ft_request, 1); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
653 ft->cookie = g_strdup(cookie); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
654 ft->ip = g_strdup(pip); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
655 ft->port = port; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
656 if (i) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
657 ft->message = g_strdup(messages[0]); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
658 else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
659 ft->message = NULL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
660 ft->user = g_strdup(user); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
661 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_GET_UID); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
662 ft->gc = gc; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
663 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
664 g_free(tmp); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
665 for (i--; i >= 0; i--) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
666 g_free(messages[i]); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
667 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
668 accept_file_dialog(ft); |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
669 } else if (!strcmp(uuid, VOICE_UID)) { |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
670 /* oh goody. voice over ip. fun stuff. */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
671 } else if (!strcmp(uuid, B_ICON_UID)) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
672 /* buddy icon... */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
673 } else if (!strcmp(uuid, IMAGE_UID)) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
674 /* aka Direct IM */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
675 } else { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
676 debug_printf("Don't know what to do with RVOUS UUID %s\n", uuid); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
677 /* do we have to do anything here? i think it just times out */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
678 } |
1 | 679 } else { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
680 debug_printf("don't know what to do with %s\n", c); |
1 | 681 } |
682 } | |
683 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
684 static char *toc_name() |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
685 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
686 return "TOC"; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
687 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
688 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
689 static void toc_send_im(struct gaim_connection *gc, char *name, char *message, int away) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
690 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
691 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
692 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
693 escape_text(message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
694 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name), |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
695 message, ((away) ? " auto" : "")); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
696 sflap_send(gc, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
697 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
698 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
699 static void toc_set_config(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
700 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
701 char buf[MSG_LEN], snd[BUF_LEN * 2]; |
1118
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
702 toc_build_config(gc, buf, MSG_LEN, FALSE); |
1412
47413c49bbee
[gaim-migrate @ 1422]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
703 g_snprintf(snd, MSG_LEN, "toc_set_config {%s}", buf); |
1118
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
704 sflap_send(gc, snd, -1, TYPE_DATA); |
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
705 } |
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
706 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
707 static void toc_get_info(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
708 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
709 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
710 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
711 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
712 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
713 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
714 static void toc_get_dir(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
715 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
716 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
717 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
718 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
719 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
720 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
721 static void toc_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
722 char *maiden, char *city, char *state, char *country, int web) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
723 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
724 char buf2[BUF_LEN * 4], buf[BUF_LEN]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
725 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
726 middle, last, maiden, city, state, country, (web == 1) ? "Y" : ""); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
727 escape_text(buf2); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
728 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
729 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
730 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
731 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
732 static void toc_dir_search(struct gaim_connection *g, char *first, char *middle, char *last, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
733 char *maiden, char *city, char *state, char *country, char *email) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
734 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
735 char buf[BUF_LONG]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
736 g_snprintf(buf, sizeof(buf) / 2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
737 last, maiden, city, state, country, email); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
738 debug_printf("Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
739 city, state, country); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
740 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
741 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
742 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
743 static void toc_set_away(struct gaim_connection *g, char *state, char *message) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
744 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
745 char buf[BUF_LEN * 2]; |
1521
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
746 if (g->away) |
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
747 g_free (g->away); |
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
748 g->away = NULL; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
749 if (message) { |
1521
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
750 g->away = g_strdup (message); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
751 escape_text(message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
752 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
753 } else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
754 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
755 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
756 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
757 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
758 static void toc_set_info(struct gaim_connection *g, char *info) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
759 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
760 char buf[BUF_LEN * 2], buf2[BUF_LEN * 2]; |
1368
12365cb601cb
[gaim-migrate @ 1378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
761 g_snprintf(buf2, sizeof buf2, "%s", info); |
12365cb601cb
[gaim-migrate @ 1378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
762 escape_text(buf2); |
12365cb601cb
[gaim-migrate @ 1378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
763 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", buf2); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
764 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
765 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
766 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
767 static void toc_change_passwd(struct gaim_connection *g, char *orig, char *new) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
768 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
769 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
770 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
771 sflap_send(g, buf, strlen(buf), TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
772 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
773 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
774 static void toc_add_buddy(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
775 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
776 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
777 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
778 sflap_send(g, buf, -1, TYPE_DATA); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
779 toc_set_config(g); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
780 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
781 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
782 static void toc_add_buddies(struct gaim_connection *g, GList * buddies) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
783 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
784 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
785 int n; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
786 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
787 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
788 while (buddies) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
789 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 16) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
790 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
791 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
792 } |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
793 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
794 buddies = buddies->next; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
795 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
796 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
797 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
798 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
799 static void toc_remove_buddy(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
800 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
801 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
802 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
803 sflap_send(g, buf, -1, TYPE_DATA); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
804 toc_set_config(g); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
805 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
806 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
807 static void toc_set_idle(struct gaim_connection *g, int time) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
808 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
809 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
810 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
811 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
812 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
813 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
814 static void toc_warn(struct gaim_connection *g, char *name, int anon) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
815 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
816 char send[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
817 g_snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm")); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
818 sflap_send(g, send, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
819 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
820 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
821 static void toc_accept_chat(struct gaim_connection *g, int i) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
822 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
823 char buf[BUF_LEN * 2]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
824 g_snprintf(buf, 255, "toc_chat_accept %d", i); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
825 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
826 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
827 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
828 static void toc_join_chat(struct gaim_connection *g, int exchange, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
829 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
830 char buf[BUF_LONG]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
831 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", exchange, name); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
832 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
833 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
834 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
835 static void toc_chat_invite(struct gaim_connection *g, int id, char *message, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
836 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
837 char buf[BUF_LONG]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
838 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
839 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
840 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
841 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
842 static void toc_chat_leave(struct gaim_connection *g, int id) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
843 { |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
844 GSList *bcs = g->buddy_chats; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
845 struct conversation *b = NULL; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
846 char buf[BUF_LEN * 2]; |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
847 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
848 while (bcs) { |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
849 b = (struct conversation *)bcs->data; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
850 if (id == b->id) |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
851 break; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
852 b = NULL; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
853 bcs = bcs->next; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
854 } |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
855 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
856 if (!b) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
857 return; /* can this happen? */ |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
858 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
859 if (!b->gc) /* TOC already kicked us out of this room */ |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
860 serv_got_chat_left(g, id); |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
861 else { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
862 g_snprintf(buf, 255, "toc_chat_leave %d", id); |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
863 sflap_send(g, buf, -1, TYPE_DATA); |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
864 } |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
865 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
866 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
867 static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
868 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
869 char buf2[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
870 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
871 sflap_send(g, buf2, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
872 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
873 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
874 static void toc_chat_send(struct gaim_connection *g, int id, char *message) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
875 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
876 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
877 escape_text(message); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
878 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"", id, message); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
879 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
880 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
881 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
882 static void toc_keepalive(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
883 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
884 sflap_send(gc, "", 0, TYPE_KEEPALIVE); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
885 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
886 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
887 static char **toc_list_icon(int uc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
888 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
889 if (uc & UC_UNAVAILABLE) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
890 return (char **)away_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
891 if (uc & UC_AOL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
892 return (char **)aol_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
893 if (uc & UC_NORMAL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
894 return (char **)free_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
895 if (uc & UC_ADMIN) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
896 return (char **)admin_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
897 if (uc & UC_UNCONFIRMED) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
898 return (char **)dt_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
899 return NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
900 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
901 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
902 static void toc_info(GtkObject * obj, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
903 { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
904 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
905 serv_get_info(gc, who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
906 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
907 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
908 static void toc_dir_info(GtkObject * obj, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
909 { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
910 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
911 serv_get_dir(gc, who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
912 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
913 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
914 static void toc_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
915 { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
916 GtkWidget *button; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
917 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
918 button = gtk_menu_item_new_with_label(_("Get Info")); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
919 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(toc_info), who); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
920 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
921 gtk_menu_append(GTK_MENU(menu), button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
922 gtk_widget_show(button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
923 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
924 button = gtk_menu_item_new_with_label(_("Get Dir Info")); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
925 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(toc_dir_info), who); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
926 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
927 gtk_menu_append(GTK_MENU(menu), button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
928 gtk_widget_show(button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
929 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
930 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
931 static void toc_print_option(GtkEntry * entry, struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
932 { |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
933 int entrynum; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
934 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
935 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
936 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
937 if (entrynum == USEROPT_AUTH) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
938 g_snprintf(user->proto_opt[USEROPT_AUTH], |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
939 sizeof(user->proto_opt[USEROPT_AUTH]), "%s", gtk_entry_get_text(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
940 } else if (entrynum == USEROPT_AUTHPORT) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
941 g_snprintf(user->proto_opt[USEROPT_AUTHPORT], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
942 sizeof(user->proto_opt[USEROPT_AUTHPORT]), "%s", gtk_entry_get_text(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
943 } else if (entrynum == USEROPT_SOCKSHOST) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
944 g_snprintf(user->proto_opt[USEROPT_SOCKSHOST], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
945 sizeof(user->proto_opt[USEROPT_SOCKSHOST]), "%s", gtk_entry_get_text(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
946 } else if (entrynum == USEROPT_SOCKSPORT) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
947 g_snprintf(user->proto_opt[USEROPT_SOCKSPORT], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
948 sizeof(user->proto_opt[USEROPT_SOCKSPORT]), "%s", gtk_entry_get_text(entry)); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
949 } |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
950 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
951 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
952 static void toc_print_optionrad(GtkRadioButton * entry, struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
953 { |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
954 int entrynum; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
955 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
956 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
957 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
958 g_snprintf(user->proto_opt[USEROPT_PROXYTYPE], |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
959 sizeof(user->proto_opt[USEROPT_PROXYTYPE]), "%d", entrynum); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
960 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
961 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
962 static void toc_user_opts(GtkWidget *book, struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
963 { |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
964 /* so here, we create the new notebook page */ |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
965 GtkWidget *vbox; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
966 GtkWidget *hbox; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
967 GtkWidget *label; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
968 GtkWidget *entry; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
969 GtkWidget *first, *opt; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
970 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
971 vbox = gtk_vbox_new(FALSE, 5); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
972 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
973 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("TOC Options")); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
974 gtk_widget_show(vbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
975 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
976 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
977 hbox = gtk_hbox_new(FALSE, 5); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
978 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
979 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
980 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
981 label = gtk_label_new("TOC Host:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
982 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
983 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
984 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
985 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
986 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
987 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
988 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
989 if (user->proto_opt[USEROPT_AUTH][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
990 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
991 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
992 } else |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
993 gtk_entry_set_text(GTK_ENTRY(entry), "toc.oscar.aol.com"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
994 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
995 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
996 hbox = gtk_hbox_new(FALSE, 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
997 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
998 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
999 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1000 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1001 label = gtk_label_new("TOC Port:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1002 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1003 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1004 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1005 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1006 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1007 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1008 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1009 if (user->proto_opt[USEROPT_AUTHPORT][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1010 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1011 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1012 } else |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1013 gtk_entry_set_text(GTK_ENTRY(entry), "9898"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1014 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1015 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1016 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1017 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1018 hbox = gtk_hbox_new(FALSE, 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1019 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1020 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1021 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1022 label = gtk_label_new("Proxy Host:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1023 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1024 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1025 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1026 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1027 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1028 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1029 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1030 if (user->proto_opt[USEROPT_SOCKSHOST][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1031 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSHOST]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1032 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSHOST]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1033 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1034 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1035 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1036 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1037 hbox = gtk_hbox_new(FALSE, 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1038 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1039 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1040 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1041 label = gtk_label_new("Proxy Port:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1042 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1043 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1044 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1045 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1046 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1047 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1048 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1049 if (user->proto_opt[USEROPT_SOCKSPORT][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1050 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1051 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1052 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1053 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1054 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1055 |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1056 first = gtk_radio_button_new_with_label(NULL, "No proxy"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1057 gtk_box_pack_start(GTK_BOX(vbox), first, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1058 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1059 gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1060 gtk_widget_show(first); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1061 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1062 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1063 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1064 opt = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1065 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4"); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1066 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1067 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1068 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1069 gtk_widget_show(opt); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1070 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1071 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1072 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1073 opt = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1074 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1075 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1076 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1077 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1078 gtk_widget_show(opt); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1079 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1080 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1081 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1082 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1083 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1084 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1085 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1086 gtk_widget_show(opt); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1087 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1088 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1089 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1090 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1091 static void toc_add_permit(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1092 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1093 char buf2[BUF_LEN * 2]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1094 if (gc->permdeny != 3) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1095 return; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1096 g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who)); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1097 sflap_send(gc, buf2, -1, TYPE_DATA); |
1660
e001fb1b9418
[gaim-migrate @ 1670]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1623
diff
changeset
|
1098 toc_set_config(gc); |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1099 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1100 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1101 static void toc_add_deny(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1102 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1103 char buf2[BUF_LEN * 2]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1104 if (gc->permdeny != 4) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1105 return; |
1208
66a70fbb2b09
[gaim-migrate @ 1218]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1182
diff
changeset
|
1106 g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", normalize(who)); |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1107 sflap_send(gc, buf2, -1, TYPE_DATA); |
1660
e001fb1b9418
[gaim-migrate @ 1670]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1623
diff
changeset
|
1108 toc_set_config(gc); |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1109 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1110 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1111 static void toc_set_permit_deny(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1112 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1113 char buf2[BUF_LEN * 2]; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1114 GSList *list; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1115 int at; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1116 |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1117 switch (gc->permdeny) { |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1118 case 1: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1119 /* permit all, deny none. to get here reliably we need to have been in permit |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1120 * mode, and send an empty toc_add_deny message, which will switch us to deny none */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1121 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1122 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1123 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1124 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1125 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1126 case 2: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1127 /* deny all, permit none. to get here reliably we need to have been in deny |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1128 * mode, and send an empty toc_add_permit message, which will switch us to permit none */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1129 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1130 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1131 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1132 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1133 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1134 case 3: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1135 /* permit some. we want to switch to deny mode first, then send the toc_add_permit |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1136 * message, which will clear and set our permit list. toc sucks. */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1137 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1138 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1139 |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1140 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1141 list = gc->permit; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1142 while (list) { |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1143 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1144 if (at > MSG_LEN + 32) { /* from out my ass comes greatness */ |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1145 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1146 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1147 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1148 list = list->next; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1149 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1150 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1151 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1152 case 4: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1153 /* deny some. we want to switch to permit mode first, then send the toc_add_deny |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1154 * message, which will clear and set our deny list. toc sucks. */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1155 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1156 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1157 |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1158 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1159 list = gc->deny; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1160 while (list) { |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1161 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1162 if (at > MSG_LEN + 32) { /* from out my ass comes greatness */ |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1163 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1164 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1165 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1166 list = list->next; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1167 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1168 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1169 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1170 default: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1171 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1172 } |
1660
e001fb1b9418
[gaim-migrate @ 1670]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1623
diff
changeset
|
1173 toc_set_config(gc); |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1174 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1175 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1176 static void toc_rem_permit(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1177 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1178 if (gc->permdeny != 3) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1179 return; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1180 toc_set_permit_deny(gc); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1181 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1182 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1183 static void toc_rem_deny(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1184 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1185 if (gc->permdeny != 4) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1186 return; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1187 toc_set_permit_deny(gc); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1188 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1189 |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1190 static void toc_draw_new_user(GtkWidget *box) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1191 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1192 GtkWidget *label; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1193 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1194 label = gtk_label_new(_("Unfortunately, currently TOC only allows new user registration by " |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1195 "going to http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no" |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1196 ". Clicking the Register button will open the URL for you.")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1197 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1198 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1199 gtk_widget_show(label); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1200 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1201 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1202 static void toc_do_new_user() |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1203 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1204 open_url(NULL, "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1205 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1206 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1207 static GList *toc_away_states() |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1208 { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1209 return g_list_append(NULL, GAIM_AWAY_CUSTOM); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1210 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1211 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1212 static void toc_do_action(struct gaim_connection *gc, char *act) |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1213 { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1214 if (!strcmp(act, "Set User Info")) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1215 show_set_info(gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1216 } else if (!strcmp(act, "Set Dir Info")) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1217 show_set_dir(gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1218 } else if (!strcmp(act, "Change Password")) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1219 show_change_passwd(gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1220 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1221 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1222 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1223 static GList *toc_actions() |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1224 { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1225 GList *m = NULL; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1226 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1227 m = g_list_append(m, "Set User Info"); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1228 m = g_list_append(m, "Set Dir Info"); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1229 m = g_list_append(m, "Change Password"); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1230 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1231 return m; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1232 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1233 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1234 void toc_init(struct prpl *ret) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1235 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1236 ret->protocol = PROTO_TOC; |
1435
f16e17d42b43
[gaim-migrate @ 1445]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1412
diff
changeset
|
1237 ret->options = OPT_PROTO_HTML | OPT_PROTO_CORRECT_TIME; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1238 ret->name = toc_name; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1239 ret->list_icon = toc_list_icon; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1240 ret->away_states = toc_away_states; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1241 ret->actions = toc_actions; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1242 ret->do_action = toc_do_action; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1243 ret->buddy_menu = toc_buddy_menu; |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1244 ret->user_opts = toc_user_opts; |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1245 ret->draw_new_user = toc_draw_new_user; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1246 ret->do_new_user = toc_do_new_user; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1247 ret->login = toc_login; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1248 ret->close = toc_close; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1249 ret->send_im = toc_send_im; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1250 ret->set_info = toc_set_info; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1251 ret->get_info = toc_get_info; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1252 ret->set_away = toc_set_away; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1253 ret->get_away_msg = NULL; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1254 ret->set_dir = toc_set_dir; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1255 ret->get_dir = toc_get_dir; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1256 ret->dir_search = toc_dir_search; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1257 ret->set_idle = toc_set_idle; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1258 ret->change_passwd = toc_change_passwd; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1259 ret->add_buddy = toc_add_buddy; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1260 ret->add_buddies = toc_add_buddies; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1261 ret->remove_buddy = toc_remove_buddy; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1262 ret->add_permit = toc_add_permit; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1263 ret->add_deny = toc_add_deny; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1264 ret->rem_permit = toc_rem_permit; |
1208
66a70fbb2b09
[gaim-migrate @ 1218]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1182
diff
changeset
|
1265 ret->rem_deny = toc_rem_deny; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1266 ret->set_permit_deny = toc_set_permit_deny; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1267 ret->warn = toc_warn; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1268 ret->accept_chat = toc_accept_chat; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1269 ret->join_chat = toc_join_chat; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1270 ret->chat_invite = toc_chat_invite; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1271 ret->chat_leave = toc_chat_leave; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1272 ret->chat_whisper = toc_chat_whisper; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1273 ret->chat_send = toc_chat_send; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1274 ret->keepalive = toc_keepalive; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1275 } |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1276 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1277 /********* |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1278 * RVOUS ACTIONS |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1279 ********/ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1280 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1281 struct file_header { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1282 char magic[4]; /* 0 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1283 short hdrlen; /* 4 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1284 short hdrtype; /* 6 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1285 char bcookie[8]; /* 8 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1286 short encrypt; /* 16 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1287 short compress; /* 18 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1288 short totfiles; /* 20 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1289 short filesleft; /* 22 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1290 short totparts; /* 24 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1291 short partsleft; /* 26 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1292 long totsize; /* 28 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1293 long size; /* 32 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1294 long modtime; /* 36 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1295 long checksum; /* 40 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1296 long rfrcsum; /* 44 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1297 long rfsize; /* 48 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1298 long cretime; /* 52 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1299 long rfcsum; /* 56 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1300 long nrecvd; /* 60 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1301 long recvcsum; /* 64 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1302 char idstring[32]; /* 68 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1303 char flags; /* 100 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1304 char lnameoffset; /* 101 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1305 char lsizeoffset; /* 102 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1306 char dummy[69]; /* 103 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1307 char macfileinfo[16]; /* 172 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1308 short nencode; /* 188 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1309 short nlanguage; /* 190 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1310 char name[64]; /* 192 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1311 /* 256 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1312 }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1313 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1314 struct file_transfer { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1315 struct file_header hdr; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1316 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1317 struct gaim_connection *gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1318 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1319 char *user; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1320 char *cookie; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1321 char *ip; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1322 int port; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1323 long size; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1324 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1325 GtkWidget *window; |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1326 int files; |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1327 char *filename; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1328 FILE *file; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1329 int recvsize; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1330 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1331 gint inpa; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1332 }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1333 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1334 static void debug_header(struct file_transfer *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1335 struct file_header *f = (struct file_header *)ft; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1336 debug_printf("TOC FT HEADER:\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1337 "\t%s %d 0x%04x\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1338 "\t%s %d %d\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1339 "\t%d %d %d %d %ld %ld\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1340 "\t%ld %ld %ld %ld %ld %ld %ld %ld\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1341 "\t%s\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1342 "\t0x%02x, 0x%02x, 0x%02x\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1343 "\t%s %s\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1344 "\t%d %d\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1345 "\t%s\n", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1346 f->magic, ntohs(f->hdrlen), f->hdrtype, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1347 f->bcookie, ntohs(f->encrypt), ntohs(f->compress), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1348 ntohs(f->totfiles), ntohs(f->filesleft), ntohs(f->totparts), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1349 ntohs(f->partsleft), ntohl(f->totsize), ntohl(f->size), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1350 ntohl(f->modtime), ntohl(f->checksum), ntohl(f->rfrcsum), ntohl(f->rfsize), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1351 ntohl(f->cretime), ntohl(f->rfcsum), ntohl(f->nrecvd), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1352 ntohl(f->recvcsum), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1353 f->idstring, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1354 f->flags, f->lnameoffset, f->lsizeoffset, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1355 f->dummy, f->macfileinfo, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1356 ntohs(f->nencode), ntohs(f->nlanguage), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1357 f->name); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1358 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1359 |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1360 static void toc_send_file_callback(gpointer data, gint source, GdkInputCondition cond) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1361 { |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1362 char buf[BUF_LONG]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1363 int rt, i; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1364 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1365 struct file_transfer *ft = data; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1366 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1367 if (cond & GDK_INPUT_EXCEPTION) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1368 gdk_input_remove(ft->inpa); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1369 close(source); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1370 g_free(ft->filename); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1371 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1372 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1373 g_free(ft->cookie); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1374 if (ft->file) |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1375 fclose(ft->file); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1376 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1377 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1378 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1379 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1380 if (ft->hdr.hdrtype != 0x202) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1381 char *buf = frombase64(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1382 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1383 read(source, ft, 8); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1384 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1385 debug_header(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1386 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1387 ft->hdr.hdrtype = 0x202; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1388 memcpy(ft->hdr.bcookie, buf, 8); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1389 g_free(buf); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1390 ft->hdr.encrypt = 0; ft->hdr.compress = 0; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1391 debug_header(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1392 write(source, ft, 256); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1393 |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1394 if (ft->files == 1) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1395 ft->file = fopen(ft->filename, "w"); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1396 if (!ft->file) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1397 buf = g_strdup_printf("Could not open %s for writing!", ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1398 do_error_dialog(buf, _("Error")); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1399 g_free(buf); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1400 gdk_input_remove(ft->inpa); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1401 close(source); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1402 g_free(ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1403 g_free(ft->user); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1404 g_free(ft->ip); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1405 g_free(ft->cookie); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1406 g_free(ft); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1407 } |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1408 } else { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1409 buf = g_strdup_printf("%s/%s", ft->filename, ft->hdr.name); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1410 ft->file = fopen(buf, "w"); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1411 g_free(buf); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1412 if (!ft->file) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1413 buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename, |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1414 ft->hdr.name); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1415 do_error_dialog(buf, _("Error")); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1416 g_free(buf); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1417 gdk_input_remove(ft->inpa); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1418 close(source); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1419 g_free(ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1420 g_free(ft->user); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1421 g_free(ft->ip); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1422 g_free(ft->cookie); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1423 g_free(ft); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1424 } |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1425 } |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1426 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1427 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1428 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1429 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1430 rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1431 if (rt < 0) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1432 do_error_dialog("File transfer failed; other side probably canceled.", "Error"); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1433 gdk_input_remove(ft->inpa); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1434 close(source); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1435 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1436 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1437 g_free(ft->cookie); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1438 if (ft->file) |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1439 fclose(ft->file); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1440 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1441 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1442 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1443 ft->recvsize += rt; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1444 for (i = 0; i < rt; i++) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1445 fprintf(ft->file, "%c", buf[i]); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1446 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1447 if (ft->recvsize == ntohl(ft->hdr.size)) { |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1448 ft->hdr.hdrtype = htons(0x0204); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1449 ft->hdr.filesleft = htons(ntohs(ft->hdr.filesleft) - 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1450 ft->hdr.partsleft = htons(ntohs(ft->hdr.partsleft) - 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1451 ft->hdr.recvcsum = ft->hdr.checksum; /* uh... */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1452 ft->hdr.nrecvd = htons(ntohs(ft->hdr.nrecvd) + 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1453 ft->hdr.flags = 0; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1454 write(source, ft, 256); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1455 debug_header(ft); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1456 ft->recvsize = 0; |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1457 fclose(ft->file); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1458 if (ft->hdr.filesleft == 0) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1459 gdk_input_remove(ft->inpa); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1460 close(source); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1461 g_free(ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1462 g_free(ft->user); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1463 g_free(ft->ip); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1464 g_free(ft->cookie); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1465 g_free(ft); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1466 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1467 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1468 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1469 |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1470 static void toc_send_file(gpointer a, struct file_transfer *old_ft) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1471 { |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1472 struct file_transfer *ft; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1473 char *dirname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(old_ft->window)); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1474 int fd; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1475 struct aim_user *user; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1476 char buf[BUF_LEN * 2]; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1477 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1478 if (file_is_dir(dirname, old_ft->window)) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1479 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1480 ft = g_new0(struct file_transfer, 1); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1481 if (old_ft->files == 1) |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1482 ft->filename = g_strdup(dirname); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1483 else |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1484 ft->filename = g_dirname(dirname); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1485 ft->cookie = g_strdup(old_ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1486 ft->user = g_strdup(old_ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1487 ft->ip = g_strdup(old_ft->ip); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1488 ft->files = old_ft->files; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1489 ft->port = old_ft->port; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1490 ft->gc = old_ft->gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1491 user = ft->gc->user; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1492 gtk_widget_destroy(old_ft->window); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1493 |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1494 g_snprintf(buf, sizeof(buf), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_SEND_UID); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1495 sflap_send(ft->gc, buf, -1, TYPE_DATA); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1496 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1497 fd = |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1498 proxy_connect(ft->ip, ft->port, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1499 user->proto_opt[USEROPT_SOCKSHOST], |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1500 atoi(user->proto_opt[USEROPT_SOCKSPORT]), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1501 atoi(user->proto_opt[USEROPT_PROXYTYPE])); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1502 if (fd < 0) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1503 do_error_dialog(_("Could not connect for transfer!"), _("Error")); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1504 g_free(ft->filename); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1505 g_free(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1506 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1507 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1508 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1509 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1510 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1511 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1512 ft->inpa = gdk_input_add(fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_send_file_callback, ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1513 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1514 |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1515 static void toc_get_file_callback(gpointer data, gint source, GdkInputCondition cond) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1516 { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1517 char buf[BUF_LONG]; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1518 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1519 struct file_transfer *ft = data; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1520 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1521 if (cond & GDK_INPUT_EXCEPTION) { |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1522 do_error_dialog("The file tranfer has been aborted; the other side most likely" |
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1523 " cancelled.", "Error"); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1524 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1525 close(source); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1526 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1527 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1528 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1529 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1530 if (ft->file) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1531 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1532 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1533 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1534 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1535 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1536 if (cond & GDK_INPUT_WRITE) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1537 int remain = MIN(ntohl(ft->hdr.totsize) - ft->recvsize, 1024); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1538 int i; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1539 for (i = 0; i < remain; i++) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1540 fscanf(ft->file, "%c", &buf[i]); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1541 write(source, buf, remain); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1542 ft->recvsize += remain; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1543 if (ft->recvsize == ntohl(ft->hdr.totsize)) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1544 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1545 ft->inpa = gdk_input_add(source, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1546 toc_get_file_callback, ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1547 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1548 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1549 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1550 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1551 if (ft->hdr.hdrtype == htons(0x1108)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1552 struct tm *fortime; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1553 struct stat st; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1554 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1555 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1556 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1557 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1558 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1559 stat(ft->filename, &st); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1560 fortime = localtime(&st.st_mtime); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1561 g_snprintf(buf, sizeof(buf), "%2d/%2d/%4d %2d:%2d %8ld %s\r\n", |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1562 fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1563 fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1564 g_basename(ft->filename)); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1565 write(source, buf, ntohl(ft->hdr.size)); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1566 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1567 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1568 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1569 if (ft->hdr.hdrtype == htons(0x1209)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1570 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1571 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1572 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1573 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1574 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1575 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1576 if (ft->hdr.hdrtype == htons(0x120b)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1577 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1578 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1579 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1580 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1581 if (ft->hdr.hdrtype != htons(0x120c)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1582 g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1583 do_error_dialog(buf, "Error"); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1584 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1585 close(source); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1586 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1587 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1588 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1589 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1590 if (ft->file) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1591 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1592 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1593 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1594 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1595 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1596 ft->hdr.hdrtype = 0x0101; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1597 ft->hdr.totfiles = htons(1); ft->hdr.filesleft = htons(1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1598 ft->hdr.flags = 0x20; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1599 write(source, ft, 256); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1600 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1601 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1602 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1603 if (ft->hdr.hdrtype == 0x0101) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1604 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1605 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1606 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1607 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1608 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1609 ft->inpa = gdk_input_add(source, GDK_INPUT_WRITE | GDK_INPUT_EXCEPTION, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1610 toc_get_file_callback, ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1611 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1612 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1613 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1614 if (ft->hdr.hdrtype == 0x0202) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1615 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1616 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1617 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1618 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1619 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1620 close(source); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1621 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1622 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1623 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1624 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1625 if (ft->file) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1626 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1627 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1628 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1629 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1630 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1631 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1632 static void toc_get_file(gpointer a, struct file_transfer *old_ft) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1633 { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1634 struct file_transfer *ft; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1635 struct file_header *hdr; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1636 char *dirname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(old_ft->window)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1637 int fd; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1638 struct aim_user *user; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1639 char *buf, buf2[BUF_LEN * 2]; |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1640 struct stat st; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1641 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1642 if (file_is_dir(dirname, old_ft->window)) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1643 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1644 ft = g_new0(struct file_transfer, 1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1645 ft->filename = g_strdup(dirname); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1646 ft->file = fopen(ft->filename, "r"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1647 if (!ft->file) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1648 buf = g_strdup_printf("Unable to open %s for transfer!", ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1649 do_error_dialog(buf, "Error"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1650 g_free(buf); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1651 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1652 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1653 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1654 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1655 if (stat(dirname, &st)) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1656 buf = g_strdup_printf("Unable to examine %s!", dirname); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1657 do_error_dialog(buf, "Error"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1658 g_free(buf); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1659 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1660 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1661 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1662 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1663 ft->cookie = g_strdup(old_ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1664 ft->user = g_strdup(old_ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1665 ft->ip = g_strdup(old_ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1666 ft->port = old_ft->port; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1667 ft->gc = old_ft->gc; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1668 user = ft->gc->user; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1669 gtk_widget_destroy(old_ft->window); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1670 |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1671 g_snprintf(buf2, sizeof(buf2), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_GET_UID); |
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1672 sflap_send(ft->gc, buf2, -1, TYPE_DATA); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1673 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1674 fd = |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1675 proxy_connect(ft->ip, ft->port, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1676 user->proto_opt[USEROPT_SOCKSHOST], |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1677 atoi(user->proto_opt[USEROPT_SOCKSPORT]), |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1678 atoi(user->proto_opt[USEROPT_PROXYTYPE])); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1679 if (fd < 0) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1680 do_error_dialog(_("Could not connect for transfer!"), _("Error")); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1681 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1682 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1683 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1684 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1685 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1686 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1687 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1688 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1689 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1690 hdr = (struct file_header *)ft; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1691 hdr->magic[0] = 'O'; hdr->magic[1] = 'F'; hdr->magic[2] = 'T'; hdr->magic[3] = '2'; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1692 hdr->hdrlen = htons(256); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1693 hdr->hdrtype = htons(0x1108); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1694 buf = frombase64(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1695 g_snprintf(hdr->bcookie, 8, "%s", buf); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1696 g_free(buf); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1697 hdr->totfiles = htons(1); hdr->filesleft = htons(1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1698 hdr->totparts = htons(1); hdr->partsleft = htons(1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1699 hdr->totsize = htonl((long)st.st_size); /* combined size of all files */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1700 /* size = strlen("mm/dd/yyyy hh:mm sizesize 'name'\r\n") */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1701 hdr->size = htonl(28 + strlen(g_basename(ft->filename))); /* size of listing.txt */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1702 hdr->modtime = htonl(st.st_mtime); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1703 hdr->checksum = htonl(0x89f70000); /* uh... */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1704 g_snprintf(hdr->idstring, 32, "OFT_Windows ICBMFT V1.1 32"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1705 hdr->flags = 0x02; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1706 hdr->lnameoffset = 0x1A; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1707 hdr->lsizeoffset = 0x10; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1708 g_snprintf(hdr->name, 64, "listing.txt"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1709 if (write(fd, hdr, 256) < 0) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1710 do_error_dialog(_("Could not write file header!"), _("Error")); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1711 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1712 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1713 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1714 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1715 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1716 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1717 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1718 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1719 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1720 ft->inpa = gdk_input_add(fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_get_file_callback, ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1721 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1722 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1723 static void cancel_callback(gpointer a, struct file_transfer *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1724 gtk_widget_destroy(ft->window); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1725 if (a == ft->window) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1726 g_free(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1727 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1728 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1729 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1730 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1731 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1732 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1733 static void toc_accept_ft(gpointer a, struct ft_request *fr) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1734 GtkWidget *window; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1735 char buf[BUF_LEN]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1736 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1737 struct file_transfer *ft = g_new0(struct file_transfer, 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1738 ft->gc = fr->gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1739 ft->user = g_strdup(fr->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1740 ft->cookie = g_strdup(fr->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1741 ft->ip = g_strdup(fr->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1742 ft->port = fr->port; |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1743 ft->files = fr->files; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1744 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1745 ft->window = window = gtk_file_selection_new(_("Gaim - Save As...")); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1746 g_snprintf(buf, sizeof(buf), "%s/%s", g_get_home_dir(), fr->filename ? fr->filename : ""); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1747 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1748 gtk_signal_connect(GTK_OBJECT(window), "destroy", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1749 GTK_SIGNAL_FUNC(cancel_callback), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1750 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1751 GTK_SIGNAL_FUNC(cancel_callback), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1752 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1753 if (!strcmp(fr->UID, FILE_SEND_UID)) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1754 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1755 GTK_SIGNAL_FUNC(toc_send_file), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1756 else |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1757 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1758 GTK_SIGNAL_FUNC(toc_get_file), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1759 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1760 gtk_widget_show(window); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1761 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1762 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1763 static void toc_reject_ft(gpointer a, struct ft_request *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1764 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1765 g_free(ft->filename); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1766 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1767 g_free(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1768 if (ft->message) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1769 g_free(ft->message); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1770 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1771 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1772 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1773 static void accept_file_dialog(struct ft_request *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1774 char buf[BUF_LONG]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1775 if (!strcmp(ft->UID, FILE_SEND_UID)) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1776 /* holy crap. who the fuck would transfer gigabytes through AIM?! */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1777 static char *sizes[4] = { "bytes", "KB", "MB", "GB" }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1778 float size = ft->size; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1779 int index = 0; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1780 while ((index < 4) && (size > 1024)) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1781 size /= 1024; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1782 index++; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1783 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1784 g_snprintf(buf, sizeof(buf), _("%s requests %s to accept %d file%s: %s (%.2f %s)%s%s"), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1785 ft->user, ft->gc->username, ft->files, (ft->files == 1) ? "" : "s", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1786 ft->filename, size, sizes[index], (ft->message) ? "\n" : "", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1787 (ft->message) ? ft->message : ""); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1788 } else { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1789 g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1790 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1791 do_ask_dialog(buf, ft, toc_accept_ft, toc_reject_ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1792 } |