Mercurial > pidgin
annotate src/protocols/toc/toc.c @ 6705:cebd49f42b56
[gaim-migrate @ 7231]
Oops, MSN users can read their messages now.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 02 Sep 2003 05:12:45 +0000 |
parents | 0c5637b5462e |
children | faa491042c66 |
rev | line source |
---|---|
2086 | 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 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
21 #include "internal.h" |
3630 | 22 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
23 #include "account.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
24 #include "accountopt.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
25 #include "conversation.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
26 #include "debug.h" |
2086 | 27 #include "prpl.h" |
28 #include "multi.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
29 #include "notify.h" |
2086 | 30 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
31 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
32 #include "util.h" |
6115
11bedb793a44
[gaim-migrate @ 6578]
Christian Hammond <chipx86@chipx86.com>
parents:
6061
diff
changeset
|
33 #include "html.h" |
2086 | 34 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
35 /* XXX */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
36 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
37 #include "gaim.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
38 #include "ui.h" |
5966 | 39 #include "gtkutils.h" |
3630 | 40 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
41 static GaimPlugin *my_protocol = NULL; |
4249 | 42 |
2086 | 43 #define REVISION "penguin" |
44 | |
45 #define TYPE_SIGNON 1 | |
46 #define TYPE_DATA 2 | |
47 #define TYPE_ERROR 3 | |
48 #define TYPE_SIGNOFF 4 | |
49 #define TYPE_KEEPALIVE 5 | |
50 | |
51 #define FLAPON "FLAPON\r\n\r\n" | |
52 #define ROAST "Tic/Toc" | |
53 | |
54 #define TOC_HOST "toc.oscar.aol.com" | |
55 #define TOC_PORT 9898 | |
56 #define AUTH_HOST "login.oscar.aol.com" | |
57 #define AUTH_PORT 5190 | |
58 #define LANGUAGE "english" | |
59 | |
60 #define STATE_OFFLINE 0 | |
61 #define STATE_FLAPON 1 | |
62 #define STATE_SIGNON_REQUEST 2 | |
63 #define STATE_ONLINE 3 | |
64 #define STATE_PAUSE 4 | |
65 | |
66 #define VOICE_UID "09461341-4C7F-11D1-8222-444553540000" | |
67 #define FILE_SEND_UID "09461343-4C7F-11D1-8222-444553540000" | |
68 #define IMAGE_UID "09461345-4C7F-11D1-8222-444553540000" | |
69 #define B_ICON_UID "09461346-4C7F-11D1-8222-444553540000" | |
70 #define STOCKS_UID "09461347-4C7F-11D1-8222-444553540000" | |
71 #define FILE_GET_UID "09461348-4C7F-11D1-8222-444553540000" | |
72 #define GAMES_UID "0946134a-4C7F-11D1-8222-444553540000" | |
73 | |
6500 | 74 #define UC_AOL 0x02 |
75 #define UC_ADMIN 0x04 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2453
diff
changeset
|
76 #define UC_UNCONFIRMED 0x08 |
6500 | 77 #define UC_NORMAL 0x10 |
78 #define UC_WIRELESS 0x20 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2453
diff
changeset
|
79 |
2086 | 80 struct ft_request { |
5605 | 81 GaimConnection *gc; |
6500 | 82 char *user; |
2086 | 83 char UID[2048]; |
6500 | 84 char *cookie; |
85 char *ip; | |
86 int port; | |
87 char *message; | |
88 char *filename; | |
2086 | 89 int files; |
6500 | 90 int size; |
2086 | 91 }; |
92 | |
93 struct buddy_icon { | |
94 guint32 hash; | |
95 guint32 len; | |
96 time_t time; | |
97 void *data; | |
98 }; | |
99 | |
100 struct toc_data { | |
101 int toc_fd; | |
4597 | 102 char toc_ip[20]; |
2086 | 103 int seqno; |
104 int state; | |
105 }; | |
106 | |
107 struct sflap_hdr { | |
108 unsigned char ast; | |
109 unsigned char type; | |
110 unsigned short seqno; | |
111 unsigned short len; | |
112 }; | |
113 | |
114 struct signon { | |
115 unsigned int ver; | |
116 unsigned short tag; | |
117 unsigned short namelen; | |
118 char username[80]; | |
119 }; | |
120 | |
121 /* constants to identify proto_opts */ | |
122 #define USEROPT_AUTH 0 | |
123 #define USEROPT_AUTHPORT 1 | |
124 | |
6061 | 125 #define TOC_CONNECT_STEPS 4 |
5605 | 126 |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
127 static void toc_login_callback(gpointer, gint, GaimInputCondition); |
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
128 static void toc_callback(gpointer, gint, GaimInputCondition); |
2086 | 129 static void accept_file_dialog(struct ft_request *); |
130 | |
3630 | 131 /* The following were added for win32 port - Herman */ |
132 | |
133 int toc_write(int fd, const void *buffer, int len) | |
134 { | |
135 #ifndef _WIN32 | |
6500 | 136 return write(fd, buffer, len); |
3630 | 137 #else |
6500 | 138 return send(fd, buffer, len, 0); |
3630 | 139 #endif |
140 } | |
141 | |
142 int toc_read(int fd, void *buffer, int size) | |
143 { | |
144 #ifndef _WIN32 | |
6500 | 145 return read(fd, buffer, size); |
3630 | 146 #else |
6500 | 147 return recv(fd, buffer, size, 0); |
3630 | 148 #endif |
149 } | |
150 | |
151 int toc_soc_close( int fd ) | |
152 { | |
153 #ifndef _WIN32 | |
6500 | 154 return close(fd); |
3630 | 155 #else |
6500 | 156 return closesocket(fd); |
3630 | 157 #endif |
158 } | |
159 | |
160 | |
2086 | 161 /* ok. this function used to take username/password, and return 0 on success. |
162 * now, it takes username/password, and returns NULL on error or a new gaim_connection | |
163 * on success. */ | |
5605 | 164 static void toc_login(GaimAccount *account) |
2086 | 165 { |
5605 | 166 GaimConnection *gc; |
2086 | 167 struct toc_data *tdt; |
168 char buf[80]; | |
169 | |
5605 | 170 gc = gaim_account_get_connection(account); |
2086 | 171 gc->proto_data = tdt = g_new0(struct toc_data, 1); |
6622 | 172 gc->flags |= GAIM_CONNECTION_HTML; |
173 gc->flags |= GAIM_CONNECTION_AUTO_RESP; | |
2086 | 174 |
4834 | 175 g_snprintf(buf, sizeof buf, _("Looking up %s"), |
5605 | 176 gaim_account_get_string(account, "server", TOC_HOST)); |
177 gaim_connection_update_progress(gc, buf, 1, TOC_CONNECT_STEPS); | |
2086 | 178 |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
179 gaim_debug(GAIM_DEBUG_INFO, "toc", "Client connects to TOC\n"); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
180 if (gaim_proxy_connect(account, |
5605 | 181 gaim_account_get_string(account, "server", TOC_HOST), |
182 gaim_account_get_int(account, "port", TOC_PORT), | |
4491 | 183 toc_login_callback, gc) != 0 || !account->gc) { |
6321 | 184 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), |
5605 | 185 gaim_account_get_string(account, "server", TOC_HOST)); |
186 gaim_connection_error(gc, buf); | |
2086 | 187 return; |
188 } | |
189 } | |
190 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
191 static void toc_login_callback(gpointer data, gint source, GaimInputCondition cond) |
2086 | 192 { |
5605 | 193 GaimConnection *gc = data; |
2086 | 194 struct toc_data *tdt; |
195 char buf[80]; | |
4597 | 196 struct sockaddr_in name; |
197 socklen_t namelen; | |
2086 | 198 |
5605 | 199 if (!g_list_find(gaim_connections_get_all(), data)) { |
3630 | 200 toc_soc_close(source); |
2086 | 201 return; |
202 } | |
203 | |
204 tdt = gc->proto_data; | |
205 | |
206 if (source == -1) { | |
207 /* we didn't successfully connect. tdt->toc_fd is valid here */ | |
6321 | 208 gaim_connection_error(gc, _("Unable to connect.")); |
2086 | 209 return; |
210 } | |
4452 | 211 tdt->toc_fd = source; |
2086 | 212 |
4597 | 213 /* |
214 * Copy the IP that we're connected to. We need this because "GOTO_URL"'s | |
215 * should open on the exact server we're connected to. toc.oscar.aol.com | |
216 * doesn't work because that hostname resolves to multiple IP addresses. | |
217 */ | |
218 if (getpeername(tdt->toc_fd, (struct sockaddr *)&name, &namelen) == 0) | |
219 strncpy(tdt->toc_ip, inet_ntoa(name.sin_addr), sizeof(tdt->toc_ip)); | |
220 else | |
5605 | 221 strncpy(tdt->toc_ip, gaim_account_get_string(gc->account, "server", TOC_HOST), sizeof(tdt->toc_ip)); |
4597 | 222 |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
223 gaim_debug(GAIM_DEBUG_INFO, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
224 "Client sends \"FLAPON\\r\\n\\r\\n\"\n"); |
3630 | 225 if (toc_write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) { |
6321 | 226 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 227 return; |
228 } | |
229 tdt->state = STATE_FLAPON; | |
230 | |
231 /* i know a lot of people like to look at gaim to see how TOC works. so i'll comment | |
232 * on what this does. it's really simple. when there's data ready to be read from the | |
233 * toc_fd file descriptor, toc_callback is called, with gc passed as its data arg. */ | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
234 gc->inpa = gaim_input_add(tdt->toc_fd, GAIM_INPUT_READ, toc_callback, gc); |
2086 | 235 |
5605 | 236 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(gc->account)); |
237 gaim_connection_update_progress(gc, buf, 2, TOC_CONNECT_STEPS); | |
2086 | 238 } |
239 | |
5605 | 240 static void toc_close(GaimConnection *gc) |
2086 | 241 { |
242 if (gc->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
243 gaim_input_remove(gc->inpa); |
2086 | 244 gc->inpa = 0; |
3630 | 245 toc_soc_close(((struct toc_data *)gc->proto_data)->toc_fd); |
2086 | 246 g_free(gc->proto_data); |
247 } | |
248 | |
5605 | 249 static void toc_build_config(GaimAccount *account, char *s, int len, gboolean show) |
4687 | 250 { |
6695 | 251 GaimBlistNode *gnode, *cnode, *bnode; |
252 GaimGroup *g; | |
253 GaimBuddy *b; | |
4687 | 254 GSList *plist = account->permit; |
255 GSList *dlist = account->deny; | |
256 | |
257 int pos = 0; | |
258 | |
5605 | 259 if (!account->perm_deny) |
260 account->perm_deny = 1; | |
4687 | 261 |
5605 | 262 pos += g_snprintf(&s[pos], len - pos, "m %d\n", account->perm_deny); |
4785 | 263 for(gnode = gaim_get_blist()->root; gnode && len > pos; gnode = gnode->next) { |
6695 | 264 g = (GaimGroup *)gnode; |
4785 | 265 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
266 continue; | |
4687 | 267 if(gaim_group_on_account(g, account)) { |
268 pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name); | |
6695 | 269 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
270 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 271 continue; |
6695 | 272 for(bnode = gnode->child; bnode && len > pos; bnode = bnode->next) { |
273 b = (GaimBuddy *)bnode; | |
274 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
275 continue; | |
276 if(b->account == account) { | |
277 pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", | |
278 b->name, | |
279 (show && b->alias) ? ":" : "", | |
280 (show && b->alias) ? b->alias : ""); | |
281 } | |
4687 | 282 } |
283 } | |
284 } | |
285 } | |
286 | |
287 while (len > pos && plist) { | |
288 pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data); | |
289 plist = plist->next; | |
290 } | |
291 | |
292 while (len > pos && dlist) { | |
293 pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data); | |
294 dlist = dlist->next; | |
295 } | |
296 } | |
297 | |
6306 | 298 char *escape_message(const char *msg) |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
299 { |
6306 | 300 char *ret; |
301 int i, j; | |
302 | |
303 if (!msg) | |
304 return NULL; | |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
305 |
6306 | 306 /* Calculate the length after escaping */ |
307 for (i=0, j=0; msg[i]; i++) | |
308 switch (msg[i]) { | |
309 case '$': | |
310 case '[': | |
311 case ']': | |
312 case '(': | |
313 case ')': | |
314 j++; | |
315 default: | |
316 j++; | |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
317 } |
6306 | 318 |
319 /* Allocate a string */ | |
320 ret = (char *)malloc((j+1) * sizeof(char)); | |
321 | |
322 /* Copy the string */ | |
323 for (i=0, j=0; msg[i]; i++) | |
324 switch (msg[i]) { | |
325 case '$': | |
326 case '[': | |
327 case ']': | |
328 case '(': | |
329 case ')': | |
330 ret[j++] = '\\'; | |
331 default: | |
332 ret[j++] = msg[i]; | |
333 } | |
334 ret[j] = '\0'; | |
335 | |
336 return ret; | |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
337 } |
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
338 |
6059 | 339 /* |
340 * Duplicates the input string, replacing each \n with a <BR>, and | |
341 * escaping a few other characters. | |
342 */ | |
343 char *escape_text(const char *msg) | |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
344 { |
6059 | 345 char *ret; |
346 int i, j; | |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
347 |
6059 | 348 if (!msg) |
349 return NULL; | |
350 | |
351 /* Calculate the length after escaping */ | |
6306 | 352 for (i=0, j=0; msg[i]; i++) |
6059 | 353 switch (msg[i]) { |
6306 | 354 case '\n': |
355 j += 4; | |
356 break; | |
357 case '{': | |
358 case '}': | |
359 case '\\': | |
360 case '"': | |
361 j += 1; | |
362 default: | |
363 j += 1; | |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
364 } |
6059 | 365 |
366 /* Allocate a string */ | |
367 ret = (char *)malloc((j+1) * sizeof(char)); | |
368 | |
369 /* Copy the string */ | |
6306 | 370 for (i=0, j=0; msg[i]; i++) |
6059 | 371 switch (msg[i]) { |
6306 | 372 case '\n': |
373 ret[j++] = '<'; | |
374 ret[j++] = 'B'; | |
375 ret[j++] = 'R'; | |
376 ret[j++] = '>'; | |
377 break; | |
378 case '{': | |
379 case '}': | |
380 case '\\': | |
381 case '"': | |
382 ret[j++] = '\\'; | |
383 default: | |
384 ret[j++] = msg[i]; | |
6059 | 385 } |
386 ret[j] = '\0'; | |
387 | |
388 return ret; | |
2371
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
389 } |
db02399a9ad7
[gaim-migrate @ 2384]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2343
diff
changeset
|
390 |
6306 | 391 static int sflap_send(GaimConnection *gc, const char *buf, int olen, int type) |
2086 | 392 { |
6306 | 393 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
2086 | 394 int len; |
395 int slen = 0; | |
6306 | 396 int ret; |
2086 | 397 struct sflap_hdr hdr; |
6306 | 398 char *escaped, *obuf; |
2086 | 399 |
400 if (tdt->state == STATE_PAUSE) | |
401 /* TOC has given us the PAUSE message; sending could cause a disconnect | |
402 * so we just return here like everything went through fine */ | |
403 return 0; | |
404 | |
6306 | 405 if (olen < 0) { |
406 escaped = escape_message(buf); | |
6500 | 407 len = strlen(escaped); |
6306 | 408 } else { |
409 escaped = g_memdup(buf, olen); | |
2281
cc462108c101
[gaim-migrate @ 2291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
410 len = olen; |
6306 | 411 } |
2281
cc462108c101
[gaim-migrate @ 2291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
412 |
6306 | 413 /* |
414 * One _last_ 2048 check here! This shouldn't ever | |
415 * get hit though, hopefully. If it gets hit on an IM | |
416 * It'll lose the last " and the message won't go through, | |
417 * but this'll stop a segfault. | |
418 */ | |
2281
cc462108c101
[gaim-migrate @ 2291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
419 if (len > MSG_LEN) { |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
420 gaim_debug(GAIM_DEBUG_WARNING, "toc", "message too long, truncating\n"); |
6306 | 421 escaped[MSG_LEN - 1] = '\0'; |
2281
cc462108c101
[gaim-migrate @ 2291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
422 len = MSG_LEN; |
2086 | 423 } |
424 | |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
425 if (olen < 0) |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
426 gaim_debug(GAIM_DEBUG_INFO, "toc", "C: %s\n", escaped); |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
427 |
2086 | 428 hdr.ast = '*'; |
429 hdr.type = type; | |
430 hdr.seqno = htons(tdt->seqno++ & 0xffff); | |
431 hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1)); | |
432 | |
6306 | 433 obuf = (char *)malloc((sizeof(hdr)+len+1) * sizeof(char)); |
2086 | 434 memcpy(obuf, &hdr, sizeof(hdr)); |
435 slen += sizeof(hdr); | |
6306 | 436 |
437 memcpy(&obuf[slen], escaped, len); | |
2086 | 438 slen += len; |
6306 | 439 |
2086 | 440 if (type != TYPE_SIGNON) { |
441 obuf[slen] = '\0'; | |
442 slen += 1; | |
443 } | |
444 | |
6306 | 445 ret = toc_write(tdt->toc_fd, obuf, slen); |
446 free(obuf); | |
447 free(escaped); | |
448 | |
449 return ret; | |
2086 | 450 } |
451 | |
5605 | 452 static int wait_reply(GaimConnection *gc, char *buffer, size_t buflen) |
2086 | 453 { |
454 struct toc_data *tdt = (struct toc_data *)gc->proto_data; | |
455 struct sflap_hdr *hdr; | |
456 int ret; | |
457 | |
3630 | 458 if (toc_read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) { |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
459 gaim_debug(GAIM_DEBUG_ERROR, "toc", "Couldn't read flap header\n"); |
2086 | 460 return -1; |
461 } | |
462 | |
463 hdr = (struct sflap_hdr *)buffer; | |
464 | |
465 if (buflen < ntohs(hdr->len)) { | |
466 /* fake like there's a read error */ | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
467 gaim_debug(GAIM_DEBUG_ERROR, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
468 "buffer too small (have %d, need %d)\n", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
469 buflen, ntohs(hdr->len)); |
2086 | 470 return -1; |
471 } | |
472 | |
473 if (ntohs(hdr->len) > 0) { | |
474 int count = 0; | |
475 ret = 0; | |
476 do { | |
477 count += ret; | |
3630 | 478 ret = toc_read(tdt->toc_fd, |
2086 | 479 buffer + sizeof(struct sflap_hdr) + count, ntohs(hdr->len) - count); |
480 } while (count + ret < ntohs(hdr->len) && ret > 0); | |
481 buffer[sizeof(struct sflap_hdr) + count + ret] = '\0'; | |
482 return ret; | |
483 } else | |
484 return 0; | |
485 } | |
486 | |
5605 | 487 static unsigned char *roast_password(const char *pass) |
2086 | 488 { |
489 /* Trivial "encryption" */ | |
490 static unsigned char rp[256]; | |
491 static char *roast = ROAST; | |
492 int pos = 2; | |
493 int x; | |
494 strcpy(rp, "0x"); | |
495 for (x = 0; (x < 150) && pass[x]; x++) | |
496 pos += sprintf(&rp[pos], "%02x", pass[x] ^ roast[x % strlen(roast)]); | |
497 rp[pos] = '\0'; | |
498 return rp; | |
499 } | |
500 | |
4322 | 501 static void toc_got_info(gpointer data, char *url_text, unsigned long len) |
2086 | 502 { |
503 if (!url_text) | |
504 return; | |
505 | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
506 g_show_info_text(NULL, NULL, 2, url_text, NULL); |
2086 | 507 } |
508 | |
2453
b72143059ad4
[gaim-migrate @ 2466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
509 static char *show_error_message() |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
510 { |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
511 int no = atoi(strtok(NULL, ":")); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
512 char *w = strtok(NULL, ":"); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
513 static char buf[256]; |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
514 |
6500 | 515 switch(no) { |
516 case 69: | |
517 g_snprintf(buf, sizeof(buf), _("Unable to write file %s."), w); | |
518 break; | |
519 case 169: | |
520 g_snprintf(buf, sizeof(buf), _("Unable to read file %s."), w); | |
521 break; | |
522 case 269: | |
523 g_snprintf(buf, sizeof(buf), _("Message too long, last %s bytes truncated."), w); | |
524 break; | |
525 case 901: | |
526 g_snprintf(buf, sizeof(buf), _("%s not currently logged in."), w); | |
527 break; | |
528 case 902: | |
529 g_snprintf(buf, sizeof(buf), _("Warning of %s not allowed."), w); | |
530 break; | |
531 case 903: | |
532 g_snprintf(buf, sizeof(buf), _("A message has been dropped, you are exceeding the server speed limit.")); | |
533 break; | |
534 case 950: | |
535 g_snprintf(buf, sizeof(buf), _("Chat in %s is not available."), w); | |
536 break; | |
537 case 960: | |
538 g_snprintf(buf, sizeof(buf), _("You are sending messages too fast to %s."), w); | |
539 break; | |
540 case 961: | |
541 g_snprintf(buf, sizeof(buf), _("You missed an IM from %s because it was too big."), w); | |
542 break; | |
543 case 962: | |
544 g_snprintf(buf, sizeof(buf), _("You missed an IM from %s because it was sent too fast."), w); | |
545 break; | |
546 case 970: | |
547 g_snprintf(buf, sizeof(buf), _("Failure.")); | |
548 break; | |
549 case 971: | |
550 g_snprintf(buf, sizeof(buf), _("Too many matches.")); | |
551 break; | |
552 case 972: | |
553 g_snprintf(buf, sizeof(buf), _("Need more qualifiers.")); | |
554 break; | |
555 case 973: | |
556 g_snprintf(buf, sizeof(buf), _("Dir service temporarily unavailable.")); | |
557 break; | |
558 case 974: | |
559 g_snprintf(buf, sizeof(buf), _("Email lookup restricted.")); | |
560 break; | |
561 case 975: | |
562 g_snprintf(buf, sizeof(buf), _("Keyword ignored.")); | |
563 break; | |
564 case 976: | |
565 g_snprintf(buf, sizeof(buf), _("No keywords.")); | |
566 break; | |
567 case 977: | |
568 g_snprintf(buf, sizeof(buf), _("User has no directory information.")); | |
569 /* g_snprintf(buf, sizeof(buf), _("Language not supported.")); */ | |
570 break; | |
571 case 978: | |
572 g_snprintf(buf, sizeof(buf), _("Country not supported.")); | |
573 break; | |
574 case 979: | |
575 g_snprintf(buf, sizeof(buf), _("Failure unknown: %s."), w); | |
576 break; | |
577 case 980: | |
578 g_snprintf(buf, sizeof(buf), _("Incorrect nickname or password.")); | |
579 break; | |
580 case 981: | |
581 g_snprintf(buf, sizeof(buf), _("The service is temporarily unavailable.")); | |
582 break; | |
583 case 982: | |
584 g_snprintf(buf, sizeof(buf), _("Your warning level is currently too high to log in.")); | |
585 break; | |
586 case 983: | |
587 g_snprintf(buf, sizeof(buf), _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); | |
588 break; | |
589 g_snprintf(buf, sizeof(buf), _("An unknown signon error has occurred: %s."), w); | |
590 break; | |
591 default: | |
592 g_snprintf(buf, sizeof(buf), _("An unknown error, %d, has occurred. Info: %s"), no, w); | |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
593 } |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
594 |
6500 | 595 return buf; |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
596 } |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
597 |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
598 static void toc_callback(gpointer data, gint source, GaimInputCondition condition) |
2086 | 599 { |
5605 | 600 GaimConnection *gc = (GaimConnection *)data; |
2086 | 601 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
602 struct sflap_hdr *hdr; | |
603 struct signon so; | |
604 char buf[8 * 1024], *c; | |
605 char snd[BUF_LEN * 2]; | |
606 | |
5605 | 607 const char *username = gaim_account_get_username(gc->account); |
608 char *password; | |
609 | |
2086 | 610 /* there's data waiting to be read, so read it. */ |
611 if (wait_reply(gc, buf, 8 * 1024) <= 0) { | |
5605 | 612 gaim_connection_error(gc, _("Connection Closed")); |
2086 | 613 return; |
614 } | |
615 | |
616 if (tdt->state == STATE_FLAPON) { | |
617 hdr = (struct sflap_hdr *)buf; | |
618 if (hdr->type != TYPE_SIGNON) | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
619 gaim_debug(GAIM_DEBUG_ERROR, "toc", "hdr->type != TYPE_SIGNON\n"); |
2086 | 620 else |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
621 gaim_debug(GAIM_DEBUG_INFO, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
622 "TOC sends Client FLAP SIGNON\n"); |
2086 | 623 tdt->seqno = ntohs(hdr->seqno); |
624 tdt->state = STATE_SIGNON_REQUEST; | |
625 | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
626 gaim_debug(GAIM_DEBUG_INFO, "toc", "Client sends TOC FLAP SIGNON\n"); |
5605 | 627 g_snprintf(so.username, sizeof(so.username), "%s", username); |
2086 | 628 so.ver = htonl(1); |
629 so.tag = htons(1); | |
630 so.namelen = htons(strlen(so.username)); | |
631 if (sflap_send(gc, (char *)&so, ntohs(so.namelen) + 8, TYPE_SIGNON) < 0) { | |
5605 | 632 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 633 return; |
634 } | |
635 | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
636 gaim_debug(GAIM_DEBUG_INFO, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
637 "Client sends TOC \"toc_signon\" message\n"); |
2853
f0633f458a1c
[gaim-migrate @ 2866]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
638 /* i hate icq. */ |
5605 | 639 if (username[0] >= '0' && username[0] <= '9') |
640 password = g_strndup(gaim_account_get_password(gc->account), 8); | |
641 else | |
642 password = g_strdup(gaim_account_get_password(gc->account)); | |
2086 | 643 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"", |
5605 | 644 AUTH_HOST, AUTH_PORT, normalize(username), |
645 roast_password(password), LANGUAGE, REVISION); | |
646 g_free(password); | |
2086 | 647 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) { |
5605 | 648 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 649 return; |
650 } | |
651 | |
5605 | 652 gaim_connection_update_progress(gc, _("Waiting for reply..."), 3, TOC_CONNECT_STEPS); |
2086 | 653 return; |
654 } | |
655 | |
656 if (tdt->state == STATE_SIGNON_REQUEST) { | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
657 gaim_debug(GAIM_DEBUG_INFO, "toc", "TOC sends client SIGN_ON reply\n"); |
4793 | 658 if (g_ascii_strncasecmp(buf + sizeof(struct sflap_hdr), "SIGN_ON", strlen("SIGN_ON"))) { |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
659 gaim_debug(GAIM_DEBUG_ERROR, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
660 "Didn't get SIGN_ON! buf was: %s\n", |
2086 | 661 buf + sizeof(struct sflap_hdr)); |
4793 | 662 if (!g_ascii_strncasecmp(buf + sizeof(struct sflap_hdr), "ERROR", 5)) { |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
663 strtok(buf + sizeof(struct sflap_hdr), ":"); |
5605 | 664 gaim_connection_error(gc, show_error_message()); |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
665 } else |
6623 | 666 gaim_connection_error(gc, _("Authentication failed")); |
2086 | 667 return; |
668 } | |
669 /* we're supposed to check that it's really TOC v1 here but we know it is ;) */ | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
670 gaim_debug(GAIM_DEBUG_INFO, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
671 "TOC version: %s\n", buf + sizeof(struct sflap_hdr) + 8); |
2086 | 672 |
673 /* we used to check for the CONFIG here, but we'll wait until we've sent our | |
674 * version of the config and then the toc_init_done message. we'll come back to | |
675 * the callback in a better state if we get CONFIG anyway */ | |
676 | |
677 tdt->state = STATE_ONLINE; | |
678 | |
5605 | 679 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2086 | 680 serv_finish_login(gc); |
681 | |
682 /* Client sends TOC toc_init_done message */ | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
683 gaim_debug(GAIM_DEBUG_INFO, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
684 "Client sends TOC toc_init_done message\n"); |
2086 | 685 g_snprintf(snd, sizeof snd, "toc_init_done"); |
686 sflap_send(gc, snd, -1, TYPE_DATA); | |
687 | |
688 /* | |
689 g_snprintf(snd, sizeof snd, "toc_set_caps %s %s %s", | |
690 FILE_SEND_UID, FILE_GET_UID, B_ICON_UID); | |
691 */ | |
692 g_snprintf(snd, sizeof snd, "toc_set_caps %s %s", FILE_SEND_UID, FILE_GET_UID); | |
693 sflap_send(gc, snd, -1, TYPE_DATA); | |
694 | |
695 return; | |
696 } | |
697 | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
698 gaim_debug(GAIM_DEBUG_INFO, "toc", "S: %s\n", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
699 buf + sizeof(struct sflap_hdr)); |
2086 | 700 |
701 c = strtok(buf + sizeof(struct sflap_hdr), ":"); /* Ditch the first part */ | |
702 | |
4793 | 703 if (!g_ascii_strcasecmp(c, "SIGN_ON")) { |
2086 | 704 /* we should only get here after a PAUSE */ |
705 if (tdt->state != STATE_PAUSE) | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
706 gaim_debug(GAIM_DEBUG_ERROR, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
707 "got SIGN_ON but not PAUSE!\n"); |
2086 | 708 else { |
709 tdt->state = STATE_ONLINE; | |
710 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"", | |
5605 | 711 AUTH_HOST, AUTH_PORT, |
712 normalize(gaim_account_get_username(gc->account)), | |
713 roast_password(gaim_account_get_password(gc->account)), | |
714 LANGUAGE, REVISION); | |
2086 | 715 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) { |
5605 | 716 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 717 return; |
718 } | |
719 g_snprintf(snd, sizeof snd, "toc_init_done"); | |
720 sflap_send(gc, snd, -1, TYPE_DATA); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
721 gaim_notify_info(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
722 _("TOC has come back from its pause. You may " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
723 "now send messages again."), NULL); |
2086 | 724 } |
4793 | 725 } else if (!g_ascii_strcasecmp(c, "CONFIG")) { |
2086 | 726 c = strtok(NULL, ":"); |
4491 | 727 parse_toc_buddy_list(gc->account, c); |
4793 | 728 } else if (!g_ascii_strcasecmp(c, "NICK")) { |
2086 | 729 /* ignore NICK so that things get imported/exported properly |
730 c = strtok(NULL, ":"); | |
731 g_snprintf(gc->username, sizeof(gc->username), "%s", c); | |
732 */ | |
4793 | 733 } else if (!g_ascii_strcasecmp(c, "IM_IN")) { |
2086 | 734 char *away, *message; |
735 int a = 0; | |
736 | |
737 c = strtok(NULL, ":"); | |
738 away = strtok(NULL, ":"); | |
739 | |
740 message = away; | |
741 while (*message && (*message != ':')) | |
742 message++; | |
743 message++; | |
744 | |
6622 | 745 a = (away && (*away == 'T')) ? GAIM_IM_AUTO_RESP : 0; |
2086 | 746 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2853
diff
changeset
|
747 serv_got_im(gc, c, message, a, time(NULL), -1); |
4793 | 748 } else if (!g_ascii_strcasecmp(c, "UPDATE_BUDDY")) { |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
749 char *l, *uc, *tmp; |
2086 | 750 int logged, evil, idle, type = 0; |
751 time_t signon, time_idle; | |
752 | |
753 c = strtok(NULL, ":"); /* name */ | |
754 l = strtok(NULL, ":"); /* online */ | |
755 sscanf(strtok(NULL, ":"), "%d", &evil); | |
756 sscanf(strtok(NULL, ":"), "%ld", &signon); | |
757 sscanf(strtok(NULL, ":"), "%d", &idle); | |
758 uc = strtok(NULL, ":"); | |
759 | |
760 logged = (l && (*l == 'T')) ? 1 : 0; | |
761 | |
762 if (uc[0] == 'A') | |
763 type |= UC_AOL; | |
764 switch (uc[1]) { | |
765 case 'A': | |
766 type |= UC_ADMIN; | |
767 break; | |
768 case 'U': | |
769 type |= UC_UNCONFIRMED; | |
770 break; | |
771 case 'O': | |
772 type |= UC_NORMAL; | |
773 break; | |
3083 | 774 case 'C': |
775 type |= UC_WIRELESS; | |
776 break; | |
2086 | 777 default: |
778 break; | |
779 } | |
780 if (uc[2] == 'U') | |
781 type |= UC_UNAVAILABLE; | |
782 | |
783 if (idle) { | |
784 time(&time_idle); | |
785 time_idle -= idle * 60; | |
786 } else | |
787 time_idle = 0; | |
788 | |
5605 | 789 tmp = g_strdup(normalize(gaim_account_get_username(gc->account))); |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
790 if (!strcmp(tmp, normalize(c))) |
5605 | 791 gaim_connection_set_display_name(gc, c); |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
792 g_free(tmp); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
793 |
4732 | 794 serv_got_update(gc, c, logged, evil, signon, time_idle, type); |
4793 | 795 } else if (!g_ascii_strcasecmp(c, "ERROR")) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
796 gaim_notify_error(gc, NULL, show_error_message(), NULL); |
4793 | 797 } else if (!g_ascii_strcasecmp(c, "EVILED")) { |
2086 | 798 int lev; |
799 char *name; | |
800 | |
801 sscanf(strtok(NULL, ":"), "%d", &lev); | |
802 name = strtok(NULL, ":"); | |
803 | |
804 serv_got_eviled(gc, name, lev); | |
4793 | 805 } else if (!g_ascii_strcasecmp(c, "CHAT_JOIN")) { |
2086 | 806 char *name; |
807 int id; | |
808 | |
809 sscanf(strtok(NULL, ":"), "%d", &id); | |
810 name = strtok(NULL, ":"); | |
811 | |
812 serv_got_joined_chat(gc, id, name); | |
4793 | 813 } else if (!g_ascii_strcasecmp(c, "CHAT_IN")) { |
2086 | 814 int id, w; |
815 char *m, *who, *whisper; | |
816 | |
817 sscanf(strtok(NULL, ":"), "%d", &id); | |
818 who = strtok(NULL, ":"); | |
819 whisper = strtok(NULL, ":"); | |
820 m = whisper; | |
821 while (*m && (*m != ':')) | |
822 m++; | |
823 m++; | |
824 | |
825 w = (whisper && (*whisper == 'T')) ? 1 : 0; | |
826 | |
827 serv_got_chat_in(gc, id, who, w, m, time((time_t)NULL)); | |
4793 | 828 } else if (!g_ascii_strcasecmp(c, "CHAT_UPDATE_BUDDY")) { |
2086 | 829 int id; |
830 char *in, *buddy; | |
831 GSList *bcs = gc->buddy_chats; | |
5679 | 832 GaimConversation *b = NULL; |
833 GaimChat *chat; | |
2086 | 834 |
835 sscanf(strtok(NULL, ":"), "%d", &id); | |
836 in = strtok(NULL, ":"); | |
837 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
838 chat = GAIM_CHAT(b); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
839 |
2086 | 840 while (bcs) { |
5679 | 841 b = (GaimConversation *)bcs->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
842 if (id == gaim_chat_get_id(chat)) |
2086 | 843 break; |
844 bcs = bcs->next; | |
845 b = NULL; | |
846 } | |
847 | |
848 if (!b) | |
849 return; | |
850 | |
851 if (in && (*in == 'T')) | |
852 while ((buddy = strtok(NULL, ":")) != NULL) | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
853 gaim_chat_add_user(chat, buddy, NULL); |
2086 | 854 else |
855 while ((buddy = strtok(NULL, ":")) != NULL) | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
856 gaim_chat_remove_user(chat, buddy, NULL); |
4793 | 857 } else if (!g_ascii_strcasecmp(c, "CHAT_INVITE")) { |
2086 | 858 char *name, *who, *message; |
5234 | 859 int id; |
860 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, | |
861 g_free, g_free); | |
2086 | 862 |
863 name = strtok(NULL, ":"); | |
5234 | 864 sscanf(strtok(NULL, ":"), "%d", &id); |
2086 | 865 who = strtok(NULL, ":"); |
866 message = strtok(NULL, ":"); | |
867 | |
5234 | 868 g_hash_table_replace(components, g_strdup("id"), g_strdup_printf("%d", id)); |
869 | |
870 serv_got_chat_invite(gc, name, who, message, components); | |
4793 | 871 } else if (!g_ascii_strcasecmp(c, "CHAT_LEFT")) { |
2086 | 872 GSList *bcs = gc->buddy_chats; |
5679 | 873 GaimConversation *b = NULL; |
2086 | 874 int id; |
875 | |
876 sscanf(strtok(NULL, ":"), "%d", &id); | |
877 | |
878 while (bcs) { | |
5679 | 879 b = (GaimConversation *)bcs->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
880 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 881 break; |
882 b = NULL; | |
883 bcs = bcs->next; | |
884 } | |
885 | |
886 if (!b) | |
887 return; | |
888 | |
889 if (b->window) { | |
890 char error_buf[BUF_LONG]; | |
4491 | 891 gaim_conversation_set_account(b, NULL); |
2086 | 892 g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected" |
893 " from chat room %s."), b->name); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
894 gaim_notify_error(gc, NULL, error_buf, NULL); |
2086 | 895 } else |
896 serv_got_chat_left(gc, id); | |
4793 | 897 } else if (!g_ascii_strcasecmp(c, "GOTO_URL")) { |
2086 | 898 char *name, *url, tmp[256]; |
899 | |
900 name = strtok(NULL, ":"); | |
901 url = strtok(NULL, ":"); | |
902 | |
4597 | 903 g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", tdt->toc_ip, |
5605 | 904 gaim_account_get_int(gc->account, "port", TOC_PORT), |
2086 | 905 url); |
6516 | 906 grab_url(tmp, FALSE, toc_got_info, NULL, NULL, 0); |
4793 | 907 } else if (!g_ascii_strcasecmp(c, "DIR_STATUS")) { |
908 } else if (!g_ascii_strcasecmp(c, "ADMIN_NICK_STATUS")) { | |
909 } else if (!g_ascii_strcasecmp(c, "ADMIN_PASSWD_STATUS")) { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
910 gaim_notify_info(gc, NULL, _("Password Change Successful"), NULL); |
4793 | 911 } else if (!g_ascii_strcasecmp(c, "PAUSE")) { |
2086 | 912 tdt->state = STATE_PAUSE; |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
913 gaim_notify_warning(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
914 _("TOC has sent a PAUSE command."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
915 _("When this happens, TOC ignores any messages " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
916 "sent to it, and may kick you off if you send a" |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
917 " message. Gaim will prevent anything from " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
918 "going through. This is only temporary, please " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
919 "be patient.")); |
4793 | 920 } else if (!g_ascii_strcasecmp(c, "RVOUS_PROPOSE")) { |
2086 | 921 char *user, *uuid, *cookie; |
922 int seq; | |
3159 | 923 char *rip, *pip, *vip, *trillian = NULL; |
2086 | 924 int port; |
3126 | 925 |
2086 | 926 user = strtok(NULL, ":"); |
927 uuid = strtok(NULL, ":"); | |
928 cookie = strtok(NULL, ":"); | |
929 sscanf(strtok(NULL, ":"), "%d", &seq); | |
930 rip = strtok(NULL, ":"); | |
931 pip = strtok(NULL, ":"); | |
932 vip = strtok(NULL, ":"); | |
933 sscanf(strtok(NULL, ":"), "%d", &port); | |
934 | |
935 if (!strcmp(uuid, FILE_SEND_UID)) { | |
936 /* they want us to get a file */ | |
937 int unk[4], i; | |
938 char *messages[4], *tmp, *name; | |
939 int subtype, files, totalsize = 0; | |
940 struct ft_request *ft; | |
941 | |
942 for (i = 0; i < 4; i++) { | |
3126 | 943 trillian = strtok(NULL, ":"); |
944 sscanf(trillian, "%d", &unk[i]); | |
2086 | 945 if (unk[i] == 10001) |
946 break; | |
3126 | 947 /* Trillian likes to send an empty token as a message, rather than |
948 no message at all. */ | |
949 if (*(trillian + strlen(trillian) +1) != ':') | |
950 frombase64(strtok(NULL, ":"), &messages[i], NULL); | |
2086 | 951 } |
3126 | 952 |
2086 | 953 frombase64(strtok(NULL, ":"), &tmp, NULL); |
954 | |
955 subtype = tmp[1]; | |
956 files = tmp[3]; | |
957 | |
958 totalsize |= (tmp[4] << 24) & 0xff000000; | |
959 totalsize |= (tmp[5] << 16) & 0x00ff0000; | |
960 totalsize |= (tmp[6] << 8) & 0x0000ff00; | |
961 totalsize |= (tmp[7] << 0) & 0x000000ff; | |
962 | |
963 if (!totalsize) { | |
964 g_free(tmp); | |
965 for (i--; i >= 0; i--) | |
966 g_free(messages[i]); | |
967 return; | |
968 } | |
969 | |
970 name = tmp + 8; | |
971 | |
972 ft = g_new0(struct ft_request, 1); | |
973 ft->cookie = g_strdup(cookie); | |
974 ft->ip = g_strdup(pip); | |
975 ft->port = port; | |
976 if (i) | |
977 ft->message = g_strdup(messages[0]); | |
978 else | |
979 ft->message = NULL; | |
980 ft->filename = g_strdup(name); | |
981 ft->user = g_strdup(user); | |
982 ft->size = totalsize; | |
983 ft->files = files; | |
984 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_SEND_UID); | |
985 ft->gc = gc; | |
986 | |
987 g_free(tmp); | |
988 for (i--; i >= 0; i--) | |
989 g_free(messages[i]); | |
990 | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
991 gaim_debug(GAIM_DEBUG_MISC, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
992 "English translation of RVOUS_PROPOSE: %s requests " |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
993 "Send File (i.e. send a file to you); %s:%d " |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
994 "(verified_ip:port), %d files at total size of " |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
995 "%d bytes.\n", user, vip, port, files, totalsize); |
2086 | 996 accept_file_dialog(ft); |
997 } else if (!strcmp(uuid, FILE_GET_UID)) { | |
998 /* they want us to send a file */ | |
999 int unk[4], i; | |
1000 char *messages[4], *tmp; | |
1001 struct ft_request *ft; | |
1002 | |
1003 for (i = 0; i < 4; i++) { | |
1004 sscanf(strtok(NULL, ":"), "%d", unk + i); | |
1005 if (unk[i] == 10001) | |
1006 break; | |
3126 | 1007 /* Trillian likes to send an empty token as a message, rather than |
1008 no message at all. */ | |
1009 if (*(trillian + strlen(trillian) +1) != ':') | |
1010 frombase64(strtok(NULL, ":"), &messages[i], NULL); | |
2086 | 1011 } |
1012 frombase64(strtok(NULL, ":"), &tmp, NULL); | |
1013 | |
1014 ft = g_new0(struct ft_request, 1); | |
1015 ft->cookie = g_strdup(cookie); | |
1016 ft->ip = g_strdup(pip); | |
1017 ft->port = port; | |
1018 if (i) | |
1019 ft->message = g_strdup(messages[0]); | |
1020 else | |
1021 ft->message = NULL; | |
1022 ft->user = g_strdup(user); | |
1023 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_GET_UID); | |
1024 ft->gc = gc; | |
1025 | |
1026 g_free(tmp); | |
1027 for (i--; i >= 0; i--) | |
1028 g_free(messages[i]); | |
1029 | |
1030 accept_file_dialog(ft); | |
1031 } else if (!strcmp(uuid, VOICE_UID)) { | |
1032 /* oh goody. voice over ip. fun stuff. */ | |
1033 } else if (!strcmp(uuid, B_ICON_UID)) { | |
1034 /* | |
1035 int unk[4], i; | |
1036 char *messages[4]; | |
1037 struct buddy_icon *icon; | |
1038 | |
1039 for (i = 0; i < 4; i++) { | |
1040 sscanf(strtok(NULL, ":"), "%d", unk + i); | |
1041 if (unk[i] == 10001) | |
1042 break; | |
1043 frombase64(strtok(NULL, ":"), &messages[i], NULL); | |
1044 } | |
1045 frombase64(strtok(NULL, ":"), (char **)&icon, NULL); | |
1046 | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1047 gaim_debug(GAIM_DEBUG_MISC, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1048 "received icon of length %d\n", icon->len); |
2086 | 1049 g_free(icon); |
1050 for (i--; i >= 0; i--) | |
1051 g_free(messages[i]); | |
1052 */ | |
1053 } else if (!strcmp(uuid, IMAGE_UID)) { | |
1054 /* aka Direct IM */ | |
1055 } else { | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1056 gaim_debug(GAIM_DEBUG_ERROR, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1057 "Don't know what to do with RVOUS UUID %s\n", uuid); |
2086 | 1058 /* do we have to do anything here? i think it just times out */ |
1059 } | |
1060 } else { | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1061 gaim_debug(GAIM_DEBUG_ERROR, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1062 "don't know what to do with %s\n", c); |
2086 | 1063 } |
1064 } | |
1065 | |
6622 | 1066 static int toc_send_im(GaimConnection *gc, const char *name, const char *message, int len, GaimImFlags flags) |
2086 | 1067 { |
6061 | 1068 char *buf1, *buf2; |
2086 | 1069 |
6500 | 1070 gaim_debug(GAIM_DEBUG_ERROR, "xxx", "1 - Sending message %s\n", message); |
6061 | 1071 buf1 = escape_text(message); |
1072 if (strlen(buf1) + 52 > MSG_LEN) { | |
1073 g_free(buf1); | |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
1074 return -E2BIG; |
2136
73253b36c3cb
[gaim-migrate @ 2146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2130
diff
changeset
|
1075 } |
6061 | 1076 |
6500 | 1077 gaim_debug(GAIM_DEBUG_ERROR, "xxx", "1 - Sending message %s\n", buf1); |
6061 | 1078 buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", normalize(name), buf1, |
6622 | 1079 ((flags & GAIM_IM_AUTO_RESP) ? " auto" : "")); |
6061 | 1080 g_free(buf1); |
6500 | 1081 gaim_debug(GAIM_DEBUG_ERROR, "xxx", "1 - Sending message %s\n", buf2); |
6061 | 1082 sflap_send(gc, buf2, -1, TYPE_DATA); |
1083 g_free(buf2); | |
1084 | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2281
diff
changeset
|
1085 return 1; |
2086 | 1086 } |
1087 | |
5605 | 1088 static void toc_set_config(GaimConnection *gc) |
2086 | 1089 { |
2281
cc462108c101
[gaim-migrate @ 2291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
1090 char *buf = g_malloc(MSG_LEN), snd[BUF_LEN * 2]; |
4491 | 1091 toc_build_config(gc->account, buf, MSG_LEN - strlen("toc_set_config \\{\\}"), FALSE); |
2086 | 1092 g_snprintf(snd, MSG_LEN, "toc_set_config {%s}", buf); |
1093 sflap_send(gc, snd, -1, TYPE_DATA); | |
2281
cc462108c101
[gaim-migrate @ 2291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
1094 g_free(buf); |
2086 | 1095 } |
1096 | |
5605 | 1097 static void toc_get_info(GaimConnection *g, const char *name) |
2086 | 1098 { |
1099 char buf[BUF_LEN * 2]; | |
1100 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); | |
1101 sflap_send(g, buf, -1, TYPE_DATA); | |
1102 } | |
1103 | |
5605 | 1104 static void toc_get_dir(GaimConnection *g, const char *name) |
2086 | 1105 { |
1106 char buf[BUF_LEN * 2]; | |
1107 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); | |
1108 sflap_send(g, buf, -1, TYPE_DATA); | |
1109 } | |
1110 | |
5605 | 1111 static void toc_set_dir(GaimConnection *g, const char *first, const char *middle, const char *last, |
3466 | 1112 const char *maiden, const char *city, const char *state, const char *country, int web) |
2086 | 1113 { |
6059 | 1114 char *buf3, buf2[BUF_LEN * 4], buf[BUF_LEN]; |
2086 | 1115 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, |
1116 middle, last, maiden, city, state, country, (web == 1) ? "Y" : ""); | |
6059 | 1117 buf3 = escape_text(buf2); |
1118 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf3); | |
1119 g_free(buf3); | |
2086 | 1120 sflap_send(g, buf, -1, TYPE_DATA); |
1121 } | |
1122 | |
5605 | 1123 static void toc_dir_search(GaimConnection *g, const char *first, const char *middle, const char *last, |
3466 | 1124 const char *maiden, const char *city, const char *state, const char *country, const char *email) |
2086 | 1125 { |
1126 char buf[BUF_LONG]; | |
1127 g_snprintf(buf, sizeof(buf) / 2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, | |
1128 last, maiden, city, state, country, email); | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1129 gaim_debug(GAIM_DEBUG_INFO, "toc", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1130 "Searching for: %s,%s,%s,%s,%s,%s,%s\n", |
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1131 first, middle, last, maiden, |
2086 | 1132 city, state, country); |
1133 sflap_send(g, buf, -1, TYPE_DATA); | |
1134 } | |
1135 | |
6059 | 1136 static void toc_set_away(GaimConnection *g, const char *state, const char *message) |
2086 | 1137 { |
1138 char buf[BUF_LEN * 2]; | |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
1139 if (g->away) { |
2086 | 1140 g_free (g->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
1141 g->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
1142 } |
2086 | 1143 if (message) { |
6059 | 1144 char *tmp; |
1145 g->away = g_strdup(message); | |
1146 tmp = escape_text(message); | |
3188 | 1147 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", tmp); |
1148 g_free(tmp); | |
2086 | 1149 } else |
1150 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); | |
1151 sflap_send(g, buf, -1, TYPE_DATA); | |
1152 } | |
1153 | |
5954 | 1154 static void toc_set_info(GaimConnection *g, const char *info) |
2086 | 1155 { |
6059 | 1156 char buf[BUF_LEN * 2], *buf2; |
1157 buf2 = escape_text(info); | |
2086 | 1158 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", buf2); |
6059 | 1159 g_free(buf2); |
2086 | 1160 sflap_send(g, buf, -1, TYPE_DATA); |
1161 } | |
1162 | |
5605 | 1163 static void toc_change_passwd(GaimConnection *g, const char *orig, const char *new) |
2086 | 1164 { |
1165 char buf[BUF_LEN * 2]; | |
1166 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); | |
6306 | 1167 sflap_send(g, buf, -1, TYPE_DATA); |
2086 | 1168 } |
1169 | |
5605 | 1170 static void toc_add_buddy(GaimConnection *g, const char *name) |
2086 | 1171 { |
1172 char buf[BUF_LEN * 2]; | |
1173 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); | |
1174 sflap_send(g, buf, -1, TYPE_DATA); | |
1175 toc_set_config(g); | |
1176 } | |
1177 | |
5605 | 1178 static void toc_add_buddies(GaimConnection *g, GList *buddies) |
2086 | 1179 { |
1180 char buf[BUF_LEN * 2]; | |
1181 int n; | |
1182 | |
1183 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); | |
1184 while (buddies) { | |
2130
50c7a704ee56
[gaim-migrate @ 2140]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2128
diff
changeset
|
1185 if (strlen(normalize(buddies->data)) + n + 32 > MSG_LEN) { |
2086 | 1186 sflap_send(g, buf, -1, TYPE_DATA); |
1187 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); | |
1188 } | |
1189 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); | |
1190 buddies = buddies->next; | |
1191 } | |
1192 sflap_send(g, buf, -1, TYPE_DATA); | |
1193 } | |
1194 | |
6059 | 1195 static void toc_remove_buddy(GaimConnection *g, const char *name, const char *group) |
2086 | 1196 { |
1197 char buf[BUF_LEN * 2]; | |
1198 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); | |
1199 sflap_send(g, buf, -1, TYPE_DATA); | |
1200 toc_set_config(g); | |
1201 } | |
1202 | |
5605 | 1203 static void toc_remove_buddies(GaimConnection *g, GList *buddies, const char *group) |
2334
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1204 { |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1205 char buf[BUF_LEN * 2]; |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1206 int n; |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1207 |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1208 n = g_snprintf(buf, sizeof(buf), "toc_remove_buddy"); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1209 while (buddies) { |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1210 if (strlen(normalize(buddies->data)) + n + 32 > MSG_LEN) { |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1211 sflap_send(g, buf, -1, TYPE_DATA); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1212 n = g_snprintf(buf, sizeof(buf), "toc_remove_buddy"); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1213 } |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1214 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1215 buddies = buddies->next; |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1216 } |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1217 sflap_send(g, buf, -1, TYPE_DATA); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1218 toc_set_config(g); |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1219 } |
b53cd5b63a99
[gaim-migrate @ 2347]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2309
diff
changeset
|
1220 |
5605 | 1221 static void toc_set_idle(GaimConnection *g, int time) |
2086 | 1222 { |
1223 char buf[BUF_LEN * 2]; | |
1224 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); | |
1225 sflap_send(g, buf, -1, TYPE_DATA); | |
1226 } | |
1227 | |
6059 | 1228 static void toc_warn(GaimConnection *g, const char *name, int anon) |
2086 | 1229 { |
1230 char send[BUF_LEN * 2]; | |
1231 g_snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm")); | |
1232 sflap_send(g, send, -1, TYPE_DATA); | |
1233 } | |
1234 | |
5605 | 1235 static GList *toc_chat_info(GaimConnection *gc) |
2086 | 1236 { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1237 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1238 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1239 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1240 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1241 pce->label = _("Join what group:"); |
5234 | 1242 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1243 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1244 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1245 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1246 pce->label = _("Exchange:"); |
5234 | 1247 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1248 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1249 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1250 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1251 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1252 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1253 return m; |
2086 | 1254 } |
1255 | |
5605 | 1256 static void toc_join_chat(GaimConnection *g, GHashTable *data) |
2086 | 1257 { |
1258 char buf[BUF_LONG]; | |
5234 | 1259 char *name, *exchange; |
1260 char *id; | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1261 |
5234 | 1262 name = g_hash_table_lookup(data, "room"); |
1263 exchange = g_hash_table_lookup(data, "exchange"); | |
1264 id = g_hash_table_lookup(data, "id"); | |
1265 | |
1266 if (id) { | |
1267 g_snprintf(buf, 255, "toc_chat_accept %d", atoi(id)); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1268 } else { |
5234 | 1269 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", atoi(exchange), name); |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1270 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
1271 |
2086 | 1272 sflap_send(g, buf, -1, TYPE_DATA); |
1273 } | |
1274 | |
5605 | 1275 static void toc_chat_invite(GaimConnection *g, int id, const char *message, const char *name) |
2086 | 1276 { |
1277 char buf[BUF_LONG]; | |
2719
9747583279d1
[gaim-migrate @ 2732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1278 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_invite %d \"%s\" %s", id, |
9747583279d1
[gaim-migrate @ 2732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1279 message ? message : "", normalize(name)); |
2086 | 1280 sflap_send(g, buf, -1, TYPE_DATA); |
1281 } | |
1282 | |
5605 | 1283 static void toc_chat_leave(GaimConnection *g, int id) |
2086 | 1284 { |
1285 GSList *bcs = g->buddy_chats; | |
5679 | 1286 GaimConversation *b = NULL; |
2086 | 1287 char buf[BUF_LEN * 2]; |
1288 | |
1289 while (bcs) { | |
5679 | 1290 b = (GaimConversation *)bcs->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1291 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 1292 break; |
1293 b = NULL; | |
1294 bcs = bcs->next; | |
1295 } | |
1296 | |
1297 if (!b) | |
1298 return; /* can this happen? */ | |
1299 | |
4491 | 1300 if (gaim_conversation_get_account(b) == NULL) { |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1301 /* TOC already kicked us out of this room */ |
2086 | 1302 serv_got_chat_left(g, id); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1303 } |
2086 | 1304 else { |
1305 g_snprintf(buf, 255, "toc_chat_leave %d", id); | |
1306 sflap_send(g, buf, -1, TYPE_DATA); | |
1307 } | |
1308 } | |
1309 | |
6059 | 1310 static void toc_chat_whisper(GaimConnection *g, int id, const char *who, const char *message) |
2086 | 1311 { |
6059 | 1312 char *buf1, *buf2; |
1313 buf1 = escape_text(message); | |
1314 buf2 = g_strdup_printf("toc_chat_whisper %d %s \"%s\"", id, normalize(who), buf1); | |
1315 g_free(buf1); | |
2086 | 1316 sflap_send(g, buf2, -1, TYPE_DATA); |
6059 | 1317 g_free(buf2); |
2086 | 1318 } |
1319 | |
6059 | 1320 static int toc_chat_send(GaimConnection *g, int id, const char *message) |
2086 | 1321 { |
6059 | 1322 char *buf1, *buf2; |
1323 buf1 = escape_text(message); | |
1324 if (strlen(buf1) > 2000) { | |
1325 g_free(buf1); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1326 return -E2BIG; |
6059 | 1327 } |
1328 buf2 = g_strdup_printf("toc_chat_send %d \"%s\"", id, buf1); | |
1329 g_free(buf1); | |
1330 sflap_send(g, buf2, -1, TYPE_DATA); | |
1331 g_free(buf2); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1332 return 0; |
2086 | 1333 } |
1334 | |
5605 | 1335 static void toc_keepalive(GaimConnection *gc) |
2086 | 1336 { |
1337 sflap_send(gc, "", 0, TYPE_KEEPALIVE); | |
1338 } | |
1339 | |
6695 | 1340 static const char *toc_list_icon(GaimAccount *a, GaimBuddy *b) |
2086 | 1341 { |
5971 | 1342 if (!b || (b && b->name && b->name[0] == '+')) { |
6695 | 1343 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
5971 | 1344 return "icq"; |
1345 else | |
1346 return "aim"; | |
1347 } | |
1348 | |
1349 if (b && b->name && isdigit(b->name[0])) | |
1350 return "icq"; | |
4687 | 1351 return "aim"; |
1352 } | |
4916 | 1353 |
6695 | 1354 static void toc_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
4916 | 1355 { |
1356 char *emblems[4] = {NULL,NULL,NULL,NULL}; | |
1357 int i = 0; | |
1358 | |
5971 | 1359 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
4916 | 1360 *se = "offline"; |
1361 return; | |
1362 } else { | |
1363 if (b->uc & UC_UNAVAILABLE) | |
1364 emblems[i++] = "away"; | |
1365 if (b->uc & UC_AOL) | |
1366 emblems[i++] = "aol"; | |
1367 if (b->uc & UC_ADMIN) | |
1368 emblems[i++] = "admin"; | |
1369 if (b->uc & UC_WIRELESS) | |
1370 emblems[i++] = "wireless"; | |
1371 } | |
1372 *se = emblems[0]; | |
1373 *sw = emblems[1]; | |
1374 *nw = emblems[2]; | |
1375 *ne = emblems[3]; | |
1376 } | |
2086 | 1377 |
5605 | 1378 static GList *toc_buddy_menu(GaimConnection *gc, const char *who) |
2086 | 1379 { |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1380 GList *m = NULL; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1381 struct proto_buddy_menu *pbm; |
2086 | 1382 |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1383 pbm = g_new0(struct proto_buddy_menu, 1); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1384 pbm->label = _("Get Dir Info"); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1385 pbm->callback = toc_get_dir; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1386 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1387 m = g_list_append(m, pbm); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1388 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
1389 return m; |
2086 | 1390 } |
1391 | |
5605 | 1392 static void toc_add_permit(GaimConnection *gc, const char *who) |
2086 | 1393 { |
1394 char buf2[BUF_LEN * 2]; | |
5605 | 1395 if (gc->account->perm_deny != 3) |
2086 | 1396 return; |
1397 g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who)); | |
1398 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1399 toc_set_config(gc); | |
1400 } | |
1401 | |
5605 | 1402 static void toc_add_deny(GaimConnection *gc, const char *who) |
2086 | 1403 { |
1404 char buf2[BUF_LEN * 2]; | |
5605 | 1405 if (gc->account->perm_deny != 4) |
2086 | 1406 return; |
1407 g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", normalize(who)); | |
1408 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1409 toc_set_config(gc); | |
1410 } | |
1411 | |
5605 | 1412 static void toc_set_permit_deny(GaimConnection *gc) |
2086 | 1413 { |
1414 char buf2[BUF_LEN * 2]; | |
1415 GSList *list; | |
1416 int at; | |
1417 | |
5605 | 1418 switch (gc->account->perm_deny) { |
2086 | 1419 case 1: |
1420 /* permit all, deny none. to get here reliably we need to have been in permit | |
1421 * mode, and send an empty toc_add_deny message, which will switch us to deny none */ | |
1422 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1423 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1424 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1425 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1426 break; | |
1427 case 2: | |
1428 /* deny all, permit none. to get here reliably we need to have been in deny | |
1429 * mode, and send an empty toc_add_permit message, which will switch us to permit none */ | |
1430 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1431 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1432 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1433 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1434 break; | |
1435 case 3: | |
1436 /* permit some. we want to switch to deny mode first, then send the toc_add_permit | |
1437 * message, which will clear and set our permit list. toc sucks. */ | |
1438 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1439 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1440 | |
1441 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
4491 | 1442 list = gc->account->permit; |
2086 | 1443 while (list) { |
1444 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); | |
1445 if (at > MSG_LEN + 32) { /* from out my ass comes greatness */ | |
1446 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1447 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1448 } | |
1449 list = list->next; | |
1450 } | |
1451 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1452 break; | |
1453 case 4: | |
1454 /* deny some. we want to switch to permit mode first, then send the toc_add_deny | |
1455 * message, which will clear and set our deny list. toc sucks. */ | |
1456 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1457 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1458 | |
1459 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
4491 | 1460 list = gc->account->deny; |
2086 | 1461 while (list) { |
1462 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); | |
1463 if (at > MSG_LEN + 32) { /* from out my ass comes greatness */ | |
1464 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1465 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1466 } | |
1467 list = list->next; | |
1468 } | |
1469 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1470 break; | |
1471 default: | |
1472 break; | |
1473 } | |
1474 toc_set_config(gc); | |
1475 } | |
1476 | |
5605 | 1477 static void toc_rem_permit(GaimConnection *gc, const char *who) |
2086 | 1478 { |
5605 | 1479 if (gc->account->perm_deny != 3) |
2086 | 1480 return; |
1481 toc_set_permit_deny(gc); | |
1482 } | |
1483 | |
5605 | 1484 static void toc_rem_deny(GaimConnection *gc, const char *who) |
2086 | 1485 { |
5605 | 1486 if (gc->account->perm_deny != 4) |
2086 | 1487 return; |
1488 toc_set_permit_deny(gc); | |
1489 } | |
1490 | |
5605 | 1491 static GList *toc_away_states(GaimConnection *gc) |
2086 | 1492 { |
1493 return g_list_append(NULL, GAIM_AWAY_CUSTOM); | |
1494 } | |
1495 | |
5605 | 1496 static GList *toc_actions(GaimConnection *gc) |
2086 | 1497 { |
1498 GList *m = NULL; | |
4333 | 1499 struct proto_actions_menu *pam; |
2086 | 1500 |
4333 | 1501 pam = g_new0(struct proto_actions_menu, 1); |
1502 pam->label = _("Set User Info"); | |
1503 pam->callback = show_set_info; | |
1504 pam->gc = gc; | |
1505 m = g_list_append(m, pam); | |
1506 | |
1507 pam = g_new0(struct proto_actions_menu, 1); | |
1508 pam->label = _("Set Dir Info"); | |
1509 pam->callback = show_set_dir; | |
1510 pam->gc = gc; | |
1511 m = g_list_append(m, pam); | |
1512 | |
1513 pam = g_new0(struct proto_actions_menu, 1); | |
1514 pam->label = _("Change Password"); | |
1515 pam->callback = show_change_passwd; | |
1516 pam->gc = gc; | |
1517 m = g_list_append(m, pam); | |
2086 | 1518 |
1519 return m; | |
1520 } | |
1521 | |
1522 /********* | |
1523 * RVOUS ACTIONS | |
1524 ********/ | |
1525 | |
1526 struct file_header { | |
1527 char magic[4]; /* 0 */ | |
1528 short hdrlen; /* 4 */ | |
1529 short hdrtype; /* 6 */ | |
1530 char bcookie[8]; /* 8 */ | |
1531 short encrypt; /* 16 */ | |
1532 short compress; /* 18 */ | |
1533 short totfiles; /* 20 */ | |
1534 short filesleft; /* 22 */ | |
1535 short totparts; /* 24 */ | |
1536 short partsleft; /* 26 */ | |
1537 long totsize; /* 28 */ | |
1538 long size; /* 32 */ | |
1539 long modtime; /* 36 */ | |
1540 long checksum; /* 40 */ | |
1541 long rfrcsum; /* 44 */ | |
1542 long rfsize; /* 48 */ | |
1543 long cretime; /* 52 */ | |
1544 long rfcsum; /* 56 */ | |
1545 long nrecvd; /* 60 */ | |
1546 long recvcsum; /* 64 */ | |
1547 char idstring[32]; /* 68 */ | |
1548 char flags; /* 100 */ | |
1549 char lnameoffset; /* 101 */ | |
1550 char lsizeoffset; /* 102 */ | |
1551 char dummy[69]; /* 103 */ | |
1552 char macfileinfo[16]; /* 172 */ | |
1553 short nencode; /* 188 */ | |
1554 short nlanguage; /* 190 */ | |
1555 char name[64]; /* 192 */ | |
1556 /* 256 */ | |
1557 }; | |
1558 | |
1559 struct file_transfer { | |
1560 struct file_header hdr; | |
1561 | |
5605 | 1562 GaimConnection *gc; |
2086 | 1563 |
1564 char *user; | |
1565 char *cookie; | |
1566 char *ip; | |
1567 int port; | |
1568 long size; | |
1569 struct stat st; | |
1570 | |
1571 GtkWidget *window; | |
1572 int files; | |
1573 char *filename; | |
1574 FILE *file; | |
1575 int recvsize; | |
1576 | |
1577 gint inpa; | |
1578 }; | |
1579 | |
1580 static void debug_header(struct file_transfer *ft) { | |
1581 struct file_header *f = (struct file_header *)ft; | |
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1582 gaim_debug(GAIM_DEBUG_MISC, "toc", "FT HEADER:\n" |
2086 | 1583 "\t%s %d 0x%04x\n" |
1584 "\t%s %d %d\n" | |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4115
diff
changeset
|
1585 "\t%d %d %d %d %d %d\n" |
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4115
diff
changeset
|
1586 "\t%d %d %d %d %d %d %d %d\n" |
2086 | 1587 "\t%s\n" |
1588 "\t0x%02x, 0x%02x, 0x%02x\n" | |
1589 "\t%s %s\n" | |
1590 "\t%d %d\n" | |
1591 "\t%s\n", | |
1592 f->magic, ntohs(f->hdrlen), f->hdrtype, | |
1593 f->bcookie, ntohs(f->encrypt), ntohs(f->compress), | |
1594 ntohs(f->totfiles), ntohs(f->filesleft), ntohs(f->totparts), | |
1595 ntohs(f->partsleft), ntohl(f->totsize), ntohl(f->size), | |
1596 ntohl(f->modtime), ntohl(f->checksum), ntohl(f->rfrcsum), ntohl(f->rfsize), | |
1597 ntohl(f->cretime), ntohl(f->rfcsum), ntohl(f->nrecvd), | |
1598 ntohl(f->recvcsum), | |
1599 f->idstring, | |
1600 f->flags, f->lnameoffset, f->lsizeoffset, | |
1601 f->dummy, f->macfileinfo, | |
1602 ntohs(f->nencode), ntohs(f->nlanguage), | |
1603 f->name); | |
1604 } | |
1605 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1606 static void toc_send_file_callback(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1607 { |
1608 char buf[BUF_LONG]; | |
1609 int rt, i; | |
1610 | |
1611 struct file_transfer *ft = data; | |
1612 | |
1613 if (ft->hdr.hdrtype != 0x202) { | |
1614 char *buf; | |
1615 frombase64(ft->cookie, &buf, NULL); | |
1616 | |
3630 | 1617 toc_read(source, ft, 8); |
1618 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); | |
2086 | 1619 debug_header(ft); |
1620 | |
1621 ft->hdr.hdrtype = 0x202; | |
1622 memcpy(ft->hdr.bcookie, buf, 8); | |
1623 g_free(buf); | |
1624 ft->hdr.encrypt = 0; ft->hdr.compress = 0; | |
1625 debug_header(ft); | |
3630 | 1626 toc_write(source, ft, 256); |
2086 | 1627 |
1628 if (ft->files == 1) { | |
1629 ft->file = fopen(ft->filename, "w"); | |
1630 if (!ft->file) { | |
4115 | 1631 buf = g_strdup_printf(_("Could not open %s for writing!"), ft->filename); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1632 gaim_notify_error(ft->gc, NULL, buf, strerror(errno)); |
2086 | 1633 g_free(buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1634 gaim_input_remove(ft->inpa); |
3630 | 1635 toc_soc_close(source); |
2086 | 1636 g_free(ft->filename); |
1637 g_free(ft->user); | |
1638 g_free(ft->ip); | |
1639 g_free(ft->cookie); | |
1640 g_free(ft); | |
1641 } | |
1642 } else { | |
1643 buf = g_strdup_printf("%s/%s", ft->filename, ft->hdr.name); | |
1644 ft->file = fopen(buf, "w"); | |
1645 g_free(buf); | |
1646 if (!ft->file) { | |
1647 buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename, | |
1648 ft->hdr.name); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1649 gaim_notify_error(ft->gc, NULL, buf, strerror(errno)); |
2086 | 1650 g_free(buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1651 gaim_input_remove(ft->inpa); |
3630 | 1652 toc_soc_close(source); |
2086 | 1653 g_free(ft->filename); |
1654 g_free(ft->user); | |
1655 g_free(ft->ip); | |
1656 g_free(ft->cookie); | |
1657 g_free(ft); | |
1658 } | |
1659 } | |
1660 | |
1661 return; | |
1662 } | |
1663 | |
3630 | 1664 rt = toc_read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); |
2086 | 1665 if (rt < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1666 gaim_notify_error(ft->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1667 _("File transfer failed; other side probably " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1668 "canceled."), NULL); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1669 gaim_input_remove(ft->inpa); |
3630 | 1670 toc_soc_close(source); |
2086 | 1671 g_free(ft->user); |
1672 g_free(ft->ip); | |
1673 g_free(ft->cookie); | |
1674 if (ft->file) | |
1675 fclose(ft->file); | |
1676 g_free(ft); | |
1677 return; | |
1678 } | |
1679 ft->recvsize += rt; | |
1680 for (i = 0; i < rt; i++) | |
1681 fprintf(ft->file, "%c", buf[i]); | |
1682 | |
1683 if (ft->recvsize == ntohl(ft->hdr.size)) { | |
1684 ft->hdr.hdrtype = htons(0x0204); | |
1685 ft->hdr.filesleft = htons(ntohs(ft->hdr.filesleft) - 1); | |
1686 ft->hdr.partsleft = htons(ntohs(ft->hdr.partsleft) - 1); | |
1687 ft->hdr.recvcsum = ft->hdr.checksum; /* uh... */ | |
1688 ft->hdr.nrecvd = htons(ntohs(ft->hdr.nrecvd) + 1); | |
1689 ft->hdr.flags = 0; | |
3630 | 1690 toc_write(source, ft, 256); |
2086 | 1691 debug_header(ft); |
1692 ft->recvsize = 0; | |
1693 fclose(ft->file); | |
1694 if (ft->hdr.filesleft == 0) { | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1695 gaim_input_remove(ft->inpa); |
3630 | 1696 toc_soc_close(source); |
2086 | 1697 g_free(ft->filename); |
1698 g_free(ft->user); | |
1699 g_free(ft->ip); | |
1700 g_free(ft->cookie); | |
1701 g_free(ft); | |
1702 } | |
1703 } | |
1704 } | |
1705 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1706 static void toc_send_file_connect(gpointer data, gint src, GaimInputCondition cond) |
2086 | 1707 { |
1708 struct file_transfer *ft = data; | |
1709 | |
1710 if (src == -1) { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1711 gaim_notify_error(ft->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1712 _("Could not connect for transfer."), NULL); |
2086 | 1713 g_free(ft->filename); |
1714 g_free(ft->cookie); | |
1715 g_free(ft->user); | |
1716 g_free(ft->ip); | |
1717 g_free(ft); | |
1718 return; | |
1719 } | |
1720 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1721 ft->inpa = gaim_input_add(src, GAIM_INPUT_READ, toc_send_file_callback, ft); |
2086 | 1722 } |
1723 | |
1724 static void toc_send_file(gpointer a, struct file_transfer *old_ft) | |
1725 { | |
1726 struct file_transfer *ft; | |
1727 const char *dirname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(old_ft->window)); | |
5605 | 1728 GaimAccount *account; |
2086 | 1729 char buf[BUF_LEN * 2]; |
1730 | |
5966 | 1731 if (gaim_gtk_check_if_dir(dirname, GTK_FILE_SELECTION(old_ft->window))) |
2086 | 1732 return; |
1733 ft = g_new0(struct file_transfer, 1); | |
1734 if (old_ft->files == 1) | |
1735 ft->filename = g_strdup(dirname); | |
1736 else | |
4793 | 1737 ft->filename = g_path_get_dirname(dirname); |
2086 | 1738 ft->cookie = g_strdup(old_ft->cookie); |
1739 ft->user = g_strdup(old_ft->user); | |
1740 ft->ip = g_strdup(old_ft->ip); | |
1741 ft->files = old_ft->files; | |
1742 ft->port = old_ft->port; | |
1743 ft->gc = old_ft->gc; | |
4491 | 1744 account = ft->gc->account; |
2086 | 1745 gtk_widget_destroy(old_ft->window); |
1746 | |
1747 g_snprintf(buf, sizeof(buf), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_SEND_UID); | |
1748 sflap_send(ft->gc, buf, -1, TYPE_DATA); | |
1749 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1750 if (gaim_proxy_connect(account, ft->ip, ft->port, toc_send_file_connect, ft) != 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1751 gaim_notify_error(ft->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1752 _("Could not connect for transfer."), NULL); |
2086 | 1753 g_free(ft->filename); |
1754 g_free(ft->cookie); | |
1755 g_free(ft->user); | |
1756 g_free(ft->ip); | |
1757 g_free(ft); | |
1758 return; | |
1759 } | |
1760 } | |
1761 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1762 static void toc_get_file_callback(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1763 { |
1764 char buf[BUF_LONG]; | |
1765 | |
1766 struct file_transfer *ft = data; | |
1767 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1768 if (cond & GAIM_INPUT_WRITE) { |
2086 | 1769 int remain = MIN(ntohl(ft->hdr.totsize) - ft->recvsize, 1024); |
1770 int i; | |
1771 for (i = 0; i < remain; i++) | |
1772 fscanf(ft->file, "%c", &buf[i]); | |
3630 | 1773 toc_write(source, buf, remain); |
2086 | 1774 ft->recvsize += remain; |
1775 if (ft->recvsize == ntohl(ft->hdr.totsize)) { | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1776 gaim_input_remove(ft->inpa); |
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1777 ft->inpa = gaim_input_add(source, GAIM_INPUT_READ, |
2086 | 1778 toc_get_file_callback, ft); |
1779 } | |
1780 return; | |
1781 } | |
1782 | |
1783 if (ft->hdr.hdrtype == htons(0x1108)) { | |
1784 struct tm *fortime; | |
1785 struct stat st; | |
4793 | 1786 char *basename; |
2086 | 1787 |
3630 | 1788 toc_read(source, ft, 8); |
1789 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); | |
2086 | 1790 debug_header(ft); |
1791 | |
1792 stat(ft->filename, &st); | |
1793 fortime = localtime(&st.st_mtime); | |
4793 | 1794 basename = g_path_get_basename(ft->filename); |
2086 | 1795 g_snprintf(buf, sizeof(buf), "%2d/%2d/%4d %2d:%2d %8ld %s\r\n", |
1796 fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900, | |
1797 fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size, | |
4793 | 1798 basename); |
3630 | 1799 toc_write(source, buf, ntohl(ft->hdr.size)); |
4793 | 1800 g_free(basename); |
2086 | 1801 return; |
1802 } | |
1803 | |
1804 if (ft->hdr.hdrtype == htons(0x1209)) { | |
3630 | 1805 toc_read(source, ft, 8); |
1806 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); | |
2086 | 1807 debug_header(ft); |
1808 return; | |
1809 } | |
1810 | |
1811 if (ft->hdr.hdrtype == htons(0x120b)) { | |
3630 | 1812 toc_read(source, ft, 8); |
1813 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); | |
2086 | 1814 debug_header(ft); |
1815 | |
1816 if (ft->hdr.hdrtype != htons(0x120c)) { | |
1817 g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1818 gaim_notify_error(ft->gc, NULL, buf, NULL); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1819 gaim_input_remove(ft->inpa); |
3630 | 1820 toc_soc_close(source); |
2086 | 1821 g_free(ft->filename); |
1822 g_free(ft->user); | |
1823 g_free(ft->ip); | |
1824 g_free(ft->cookie); | |
1825 if (ft->file) | |
1826 fclose(ft->file); | |
1827 g_free(ft); | |
1828 return; | |
1829 } | |
1830 | |
1831 ft->hdr.hdrtype = 0x0101; | |
1832 ft->hdr.totfiles = htons(1); ft->hdr.filesleft = htons(1); | |
1833 ft->hdr.flags = 0x20; | |
3630 | 1834 toc_write(source, ft, 256); |
2086 | 1835 return; |
1836 } | |
1837 | |
1838 if (ft->hdr.hdrtype == 0x0101) { | |
3630 | 1839 toc_read(source, ft, 8); |
1840 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); | |
2086 | 1841 debug_header(ft); |
1842 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1843 gaim_input_remove(ft->inpa); |
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1844 ft->inpa = gaim_input_add(source, GAIM_INPUT_WRITE, |
2086 | 1845 toc_get_file_callback, ft); |
1846 return; | |
1847 } | |
1848 | |
1849 if (ft->hdr.hdrtype == 0x0202) { | |
3630 | 1850 toc_read(source, ft, 8); |
1851 toc_read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); | |
2086 | 1852 debug_header(ft); |
1853 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1854 gaim_input_remove(ft->inpa); |
3630 | 1855 toc_soc_close(source); |
2086 | 1856 g_free(ft->filename); |
1857 g_free(ft->user); | |
1858 g_free(ft->ip); | |
1859 g_free(ft->cookie); | |
1860 if (ft->file) | |
1861 fclose(ft->file); | |
1862 g_free(ft); | |
1863 return; | |
1864 } | |
1865 } | |
1866 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1867 static void toc_get_file_connect(gpointer data, gint src, GaimInputCondition cond) |
2086 | 1868 { |
1869 struct file_transfer *ft = data; | |
1870 struct file_header *hdr; | |
1871 char *buf; | |
4793 | 1872 char *basename; |
2086 | 1873 |
1874 if (src == -1) { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1875 gaim_notify_error(ft->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1876 _("Could not connect for transfer!"), NULL); |
2086 | 1877 fclose(ft->file); |
1878 g_free(ft->filename); | |
1879 g_free(ft->cookie); | |
1880 g_free(ft->user); | |
1881 g_free(ft->ip); | |
1882 g_free(ft); | |
1883 return; | |
1884 } | |
1885 | |
1886 hdr = (struct file_header *)ft; | |
1887 hdr->magic[0] = 'O'; hdr->magic[1] = 'F'; hdr->magic[2] = 'T'; hdr->magic[3] = '2'; | |
1888 hdr->hdrlen = htons(256); | |
1889 hdr->hdrtype = htons(0x1108); | |
1890 frombase64(ft->cookie, &buf, NULL); | |
1891 g_snprintf(hdr->bcookie, 8, "%s", buf); | |
1892 g_free(buf); | |
1893 hdr->totfiles = htons(1); hdr->filesleft = htons(1); | |
1894 hdr->totparts = htons(1); hdr->partsleft = htons(1); | |
1895 hdr->totsize = htonl((long)ft->st.st_size); /* combined size of all files */ | |
1896 /* size = strlen("mm/dd/yyyy hh:mm sizesize 'name'\r\n") */ | |
4793 | 1897 basename = g_path_get_basename(ft->filename); |
1898 hdr->size = htonl(28 + strlen(basename)); /* size of listing.txt */ | |
1899 g_free(basename); | |
2086 | 1900 hdr->modtime = htonl(ft->st.st_mtime); |
1901 hdr->checksum = htonl(0x89f70000); /* uh... */ | |
1902 g_snprintf(hdr->idstring, 32, "OFT_Windows ICBMFT V1.1 32"); | |
1903 hdr->flags = 0x02; | |
1904 hdr->lnameoffset = 0x1A; | |
1905 hdr->lsizeoffset = 0x10; | |
1906 g_snprintf(hdr->name, 64, "listing.txt"); | |
3630 | 1907 if (toc_write(src, hdr, 256) < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1908 gaim_notify_error(ft->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1909 _("Could not write file header. The file will " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1910 "not be transferred."), NULL); |
2086 | 1911 fclose(ft->file); |
1912 g_free(ft->filename); | |
1913 g_free(ft->cookie); | |
1914 g_free(ft->user); | |
1915 g_free(ft->ip); | |
1916 g_free(ft); | |
1917 return; | |
1918 } | |
1919 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1920 ft->inpa = gaim_input_add(src, GAIM_INPUT_READ, toc_get_file_callback, ft); |
2086 | 1921 } |
1922 | |
1923 static void toc_get_file(gpointer a, struct file_transfer *old_ft) | |
1924 { | |
1925 struct file_transfer *ft; | |
1926 const char *dirname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(old_ft->window)); | |
5605 | 1927 GaimAccount *account; |
2086 | 1928 char *buf, buf2[BUF_LEN * 2]; |
1929 | |
5966 | 1930 if (gaim_gtk_check_if_dir(dirname, GTK_FILE_SELECTION(old_ft->window))) |
2086 | 1931 return; |
1932 ft = g_new0(struct file_transfer, 1); | |
1933 ft->filename = g_strdup(dirname); | |
1934 ft->file = fopen(ft->filename, "r"); | |
1935 if (!ft->file) { | |
3427 | 1936 buf = g_strdup_printf("Unable to open %s for transfer.", ft->filename); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1937 gaim_notify_error(ft->gc, NULL, buf, NULL); |
2086 | 1938 g_free(buf); |
1939 g_free(ft->filename); | |
1940 g_free(ft); | |
1941 return; | |
1942 } | |
1943 if (stat(dirname, &ft->st)) { | |
3427 | 1944 buf = g_strdup_printf("Unable to examine %s.", dirname); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1945 gaim_notify_error(ft->gc, NULL, buf, NULL); |
2086 | 1946 g_free(buf); |
1947 g_free(ft->filename); | |
1948 g_free(ft); | |
1949 return; | |
1950 } | |
1951 ft->cookie = g_strdup(old_ft->cookie); | |
1952 ft->user = g_strdup(old_ft->user); | |
1953 ft->ip = g_strdup(old_ft->ip); | |
1954 ft->port = old_ft->port; | |
1955 ft->gc = old_ft->gc; | |
4491 | 1956 account = ft->gc->account; |
2086 | 1957 gtk_widget_destroy(old_ft->window); |
1958 | |
1959 g_snprintf(buf2, sizeof(buf2), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_GET_UID); | |
1960 sflap_send(ft->gc, buf2, -1, TYPE_DATA); | |
1961 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1962 if (gaim_proxy_connect(account, ft->ip, ft->port, toc_get_file_connect, ft) < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1963 gaim_notify_error(ft->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
1964 _("Could not connect for transfer."), NULL); |
2086 | 1965 fclose(ft->file); |
1966 g_free(ft->filename); | |
1967 g_free(ft->cookie); | |
1968 g_free(ft->user); | |
1969 g_free(ft->ip); | |
1970 g_free(ft); | |
1971 return; | |
1972 } | |
1973 } | |
1974 | |
1975 static void cancel_callback(gpointer a, struct file_transfer *ft) { | |
1976 gtk_widget_destroy(ft->window); | |
1977 if (a == ft->window) { | |
1978 g_free(ft->cookie); | |
1979 g_free(ft->user); | |
1980 g_free(ft->ip); | |
1981 g_free(ft); | |
1982 } | |
1983 } | |
1984 | |
3867 | 1985 static void toc_reject_ft(struct ft_request *ft) { |
1986 g_free(ft->user); | |
1987 g_free(ft->filename); | |
1988 g_free(ft->ip); | |
1989 g_free(ft->cookie); | |
1990 if (ft->message) | |
1991 g_free(ft->message); | |
1992 g_free(ft); | |
1993 } | |
1994 | |
1995 | |
3730 | 1996 static void toc_accept_ft(struct ft_request *fr) { |
5605 | 1997 if(g_list_find(gaim_connections_get_all(), fr->gc)) { |
4249 | 1998 GtkWidget *window; |
1999 char buf[BUF_LEN]; | |
2086 | 2000 |
4249 | 2001 struct file_transfer *ft = g_new0(struct file_transfer, 1); |
2002 ft->gc = fr->gc; | |
2003 ft->user = g_strdup(fr->user); | |
2004 ft->cookie = g_strdup(fr->cookie); | |
2005 ft->ip = g_strdup(fr->ip); | |
2006 ft->port = fr->port; | |
2007 ft->files = fr->files; | |
2086 | 2008 |
4249 | 2009 ft->window = window = gtk_file_selection_new(_("Gaim - Save As...")); |
2010 g_snprintf(buf, sizeof(buf), "%s/%s", gaim_home_dir(), fr->filename ? fr->filename : ""); | |
2011 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
4635 | 2012 g_signal_connect(G_OBJECT(window), "destroy", |
2013 G_CALLBACK(cancel_callback), ft); | |
2014 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), | |
2015 "clicked", G_CALLBACK(cancel_callback), ft); | |
2086 | 2016 |
4249 | 2017 if (!strcmp(fr->UID, FILE_SEND_UID)) |
4635 | 2018 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
2019 "clicked", G_CALLBACK(toc_send_file), ft); | |
4249 | 2020 else |
4635 | 2021 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
2022 "clicked", G_CALLBACK(toc_get_file), ft); | |
2086 | 2023 |
4249 | 2024 gtk_widget_show(window); |
2025 } | |
2026 | |
3867 | 2027 toc_reject_ft(fr); |
2086 | 2028 } |
2029 | |
2030 static void accept_file_dialog(struct ft_request *ft) { | |
2031 char buf[BUF_LONG]; | |
2032 if (!strcmp(ft->UID, FILE_SEND_UID)) { | |
2033 /* holy crap. who the fuck would transfer gigabytes through AIM?! */ | |
2034 static char *sizes[4] = { "bytes", "KB", "MB", "GB" }; | |
2035 float size = ft->size; | |
2036 int index = 0; | |
2037 while ((index < 4) && (size > 1024)) { | |
2038 size /= 1024; | |
2039 index++; | |
2040 } | |
6500 | 2041 g_snprintf(buf, sizeof(buf), |
4276 | 2042 ngettext( |
2043 "%s requests %s to accept %d file: %s (%.2f %s)%s%s", | |
2044 "%s requests %s to accept %d files: %s (%.2f %s)%s%s", | |
2045 ft->files), | |
5605 | 2046 ft->user, gaim_account_get_username(ft->gc->account), ft->files, |
2086 | 2047 ft->filename, size, sizes[index], (ft->message) ? "\n" : "", |
2048 (ft->message) ? ft->message : ""); | |
2049 } else { | |
2050 g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user); | |
2051 } | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2052 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2053 gaim_request_accept_cancel(ft->gc, NULL, buf, NULL, 0, ft, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2054 G_CALLBACK(toc_accept_ft), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2055 G_CALLBACK(toc_reject_ft)); |
2086 | 2056 } |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2057 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2058 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2059 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2060 GAIM_PROTO_TOC, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2061 OPT_PROTO_CORRECT_TIME, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2062 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2063 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2064 toc_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2065 toc_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2066 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2067 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2068 toc_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2069 toc_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2070 toc_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2071 toc_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2072 toc_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2073 toc_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2074 toc_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2075 toc_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2076 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2077 toc_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2078 toc_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2079 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2080 toc_set_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2081 toc_get_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2082 toc_dir_search, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2083 toc_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2084 toc_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2085 toc_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2086 toc_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2087 toc_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2088 toc_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2089 toc_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2090 toc_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2091 toc_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2092 toc_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2093 toc_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2094 toc_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2095 toc_join_chat, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2096 toc_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2097 toc_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2098 toc_chat_whisper, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2099 toc_chat_send, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2100 toc_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2101 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2102 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2103 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2104 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2105 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2106 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2107 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2108 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2109 NULL |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2110 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2111 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2112 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2113 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2114 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2115 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2116 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2117 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2118 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2119 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2120 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2121 "prpl-toc", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2122 "TOC", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2123 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2124 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2125 N_("TOC Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2126 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2127 N_("TOC Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2128 NULL, /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
2129 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2130 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2131 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2132 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2133 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2134 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2135 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2136 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2137 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2138 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2139 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2140 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2141 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5605
diff
changeset
|
2142 GaimAccountOption *option; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2143 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
2144 option = gaim_account_option_string_new(_("TOC host"), "server", TOC_HOST); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5605
diff
changeset
|
2145 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5605
diff
changeset
|
2146 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2147 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
2148 option = gaim_account_option_int_new(_("TOC port"), "port", TOC_PORT); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5605
diff
changeset
|
2149 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5605
diff
changeset
|
2150 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2151 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2152 my_protocol = plugin; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2153 } |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2154 |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2155 GAIM_INIT_PLUGIN(toc, init_plugin, info); |