Mercurial > pidgin.yaz
annotate src/protocols/msn/slp.c @ 11548:30ad548e8537
[gaim-migrate @ 13803]
Ellipsize the title column in the gtksavedstatus window and set a minimum
width
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 15 Sep 2005 03:43:18 +0000 |
parents | 922782381027 |
children | e3e21a3b2975 |
rev | line source |
---|---|
9193 | 1 /** |
2 * @file msnslp.c MSNSLP support | |
3 * | |
4 * gaim | |
5 * | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
6 * Gaim is the legal property of its developers, whose names are too numerous |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 * source distribution. |
9193 | 9 * |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
24 #include "msn.h" | |
25 #include "slp.h" | |
26 #include "slpcall.h" | |
27 #include "slpmsg.h" | |
28 #include "slpsession.h" | |
29 | |
30 #include "object.h" | |
31 #include "user.h" | |
32 #include "switchboard.h" | |
33 | |
34 static void send_ok(MsnSlpCall *slpcall, const char *branch, | |
35 const char *type, const char *content); | |
36 | |
37 static void send_decline(MsnSlpCall *slpcall, const char *branch, | |
38 const char *type, const char *content); | |
39 | |
9860 | 40 void msn_request_user_display(MsnUser *user); |
41 | |
9193 | 42 /************************************************************************** |
43 * Util | |
44 **************************************************************************/ | |
45 | |
46 char * | |
47 get_token(const char *str, const char *start, const char *end) | |
48 { | |
49 const char *c, *c2; | |
50 | |
51 if ((c = strstr(str, start)) == NULL) | |
52 return NULL; | |
53 | |
54 c += strlen(start); | |
55 | |
56 if (end != NULL) | |
57 { | |
58 if ((c2 = strstr(c, end)) == NULL) | |
59 return NULL; | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
60 |
9193 | 61 return g_strndup(c, c2 - c); |
62 } | |
63 else | |
64 { | |
65 /* This has to be changed */ | |
66 return g_strdup(c); | |
67 } | |
68 | |
69 } | |
70 | |
71 /************************************************************************** | |
72 * Xfer | |
73 **************************************************************************/ | |
74 | |
75 static void | |
76 msn_xfer_init(GaimXfer *xfer) | |
77 { | |
78 MsnSlpCall *slpcall; | |
79 /* MsnSlpLink *slplink; */ | |
80 char *content; | |
81 | |
82 gaim_debug_info("msn", "xfer_init\n"); | |
83 | |
84 slpcall = xfer->data; | |
85 | |
86 /* Send Ok */ | |
87 content = g_strdup_printf("SessionID: %lu\r\n\r\n", | |
88 slpcall->session_id); | |
89 | |
90 send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", | |
91 content); | |
92 | |
93 g_free(content); | |
94 msn_slplink_unleash(slpcall->slplink); | |
95 } | |
96 | |
97 void | |
98 msn_xfer_cancel(GaimXfer *xfer) | |
99 { | |
100 MsnSlpCall *slpcall; | |
101 char *content; | |
102 | |
9788 | 103 g_return_if_fail(xfer != NULL); |
104 g_return_if_fail(xfer->data != NULL); | |
105 | |
9193 | 106 slpcall = xfer->data; |
107 | |
108 if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) | |
109 { | |
110 if (slpcall->started) | |
111 { | |
112 msn_slp_call_close(slpcall); | |
113 } | |
114 else | |
115 { | |
116 content = g_strdup_printf("SessionID: %lu\r\n\r\n", | |
117 slpcall->session_id); | |
118 | |
119 send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", | |
120 content); | |
121 | |
122 g_free(content); | |
123 msn_slplink_unleash(slpcall->slplink); | |
10773 | 124 |
125 msn_slp_call_destroy(slpcall); | |
9193 | 126 } |
127 } | |
128 } | |
129 | |
130 void | |
131 msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset) | |
132 { | |
133 GaimXfer *xfer; | |
134 | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
135 xfer = slpcall->xfer; |
9193 | 136 |
9226
7a00289f2ef1
[gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents:
9198
diff
changeset
|
137 xfer->bytes_sent = (offset + len); |
7a00289f2ef1
[gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents:
9198
diff
changeset
|
138 xfer->bytes_remaining = total_length - (offset + len); |
9193 | 139 |
140 gaim_xfer_update_progress(xfer); | |
141 } | |
142 | |
143 void | |
9259
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
144 msn_xfer_end_cb(MsnSlpCall *slpcall) |
9193 | 145 { |
10225 | 146 if ((gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_DONE) && |
147 (gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_CANCEL_REMOTE) && | |
148 (gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_CANCEL_LOCAL)) | |
9226
7a00289f2ef1
[gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents:
9198
diff
changeset
|
149 { |
10226 | 150 gaim_xfer_cancel_remote(slpcall->xfer); |
9226
7a00289f2ef1
[gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents:
9198
diff
changeset
|
151 } |
9193 | 152 } |
153 | |
9259
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
154 void |
11138 | 155 msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body, |
11137 | 156 gsize size) |
9259
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
157 { |
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
158 gaim_xfer_set_completed(slpcall->xfer, TRUE); |
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
159 } |
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
160 |
9193 | 161 /************************************************************************** |
162 * SLP Control | |
163 **************************************************************************/ | |
164 | |
165 #if 0 | |
166 static void | |
167 got_transresp(MsnSlpCall *slpcall, const char *nonce, | |
168 const char *ips_str, int port) | |
169 { | |
170 MsnDirectConn *directconn; | |
171 char **ip_addrs, **c; | |
172 | |
173 directconn = msn_directconn_new(slpcall->slplink); | |
174 | |
175 directconn->initial_call = slpcall; | |
176 | |
177 /* msn_directconn_parse_nonce(directconn, nonce); */ | |
178 directconn->nonce = g_strdup(nonce); | |
179 | |
180 ip_addrs = g_strsplit(ips_str, " ", -1); | |
181 | |
182 for (c = ip_addrs; *c != NULL; c++) | |
183 { | |
184 gaim_debug_info("msn", "ip_addr = %s\n", *c); | |
185 if (msn_directconn_connect(directconn, *c, port)) | |
186 break; | |
187 } | |
188 | |
189 g_strfreev(ip_addrs); | |
190 } | |
191 #endif | |
192 | |
193 static void | |
194 send_ok(MsnSlpCall *slpcall, const char *branch, | |
195 const char *type, const char *content) | |
196 { | |
197 MsnSlpLink *slplink; | |
198 MsnSlpMessage *slpmsg; | |
199 | |
200 slplink = slpcall->slplink; | |
201 | |
202 /* 200 OK */ | |
203 slpmsg = msn_slpmsg_sip_new(slpcall, 1, | |
204 "MSNSLP/1.0 200 OK", | |
205 branch, type, content); | |
206 | |
10345 | 207 #ifdef MSN_DEBUG_SLP |
9193 | 208 slpmsg->info = "SLP 200 OK"; |
209 slpmsg->text_body = TRUE; | |
210 #endif | |
211 | |
212 msn_slplink_queue_slpmsg(slplink, slpmsg); | |
213 | |
214 msn_slp_call_session_init(slpcall); | |
215 } | |
216 | |
217 static void | |
218 send_decline(MsnSlpCall *slpcall, const char *branch, | |
219 const char *type, const char *content) | |
220 { | |
221 MsnSlpLink *slplink; | |
222 MsnSlpMessage *slpmsg; | |
223 | |
224 slplink = slpcall->slplink; | |
225 | |
226 /* 603 Decline */ | |
227 slpmsg = msn_slpmsg_sip_new(slpcall, 1, | |
228 "MSNSLP/1.0 603 Decline", | |
229 branch, type, content); | |
230 | |
10345 | 231 #ifdef MSN_DEBUG_SLP |
9193 | 232 slpmsg->info = "SLP 603 Decline"; |
233 slpmsg->text_body = TRUE; | |
234 #endif | |
235 | |
236 msn_slplink_queue_slpmsg(slplink, slpmsg); | |
237 } | |
238 | |
10047 | 239 #define MAX_FILE_NAME_LEN 0x226 |
240 | |
9193 | 241 static void |
242 got_sessionreq(MsnSlpCall *slpcall, const char *branch, | |
243 const char *euf_guid, const char *context) | |
244 { | |
245 if (!strcmp(euf_guid, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6")) | |
246 { | |
247 /* Emoticon or UserDisplay */ | |
248 MsnSlpSession *slpsession; | |
249 MsnSlpLink *slplink; | |
250 MsnSlpMessage *slpmsg; | |
251 MsnObject *obj; | |
252 char *msnobj_data; | |
253 const char *sha1c; | |
254 const char *file_name; | |
255 char *content; | |
11127 | 256 gsize len; |
9193 | 257 int type; |
258 | |
259 /* Send Ok */ | |
260 content = g_strdup_printf("SessionID: %lu\r\n\r\n", | |
261 slpcall->session_id); | |
262 | |
263 send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody", | |
264 content); | |
265 | |
266 g_free(content); | |
267 | |
268 slplink = slpcall->slplink; | |
269 | |
11127 | 270 msnobj_data = (char *)gaim_base64_decode(context, &len); |
9193 | 271 obj = msn_object_new_from_string(msnobj_data); |
272 type = msn_object_get_type(obj); | |
273 sha1c = msn_object_get_sha1c(obj); | |
274 g_free(msnobj_data); | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
275 |
9193 | 276 if (!(type == MSN_OBJECT_USERTILE)) |
277 { | |
278 gaim_debug_error("msn", "Wrong object?\n"); | |
279 msn_object_destroy(obj); | |
280 g_return_if_reached(); | |
281 } | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
282 |
9193 | 283 file_name = msn_object_get_real_location(obj); |
284 | |
9858 | 285 if (file_name == NULL) |
286 { | |
287 gaim_debug_error("msn", "Wrong object.\n"); | |
288 msn_object_destroy(obj); | |
289 g_return_if_reached(); | |
290 } | |
291 | |
10519 | 292 msn_object_destroy(obj); |
293 | |
9193 | 294 slpsession = msn_slplink_find_slp_session(slplink, |
9861 | 295 slpcall->session_id); |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
296 |
9193 | 297 /* DATA PREP */ |
298 slpmsg = msn_slpmsg_new(slplink); | |
10345 | 299 slpmsg->slpcall = slpcall; |
9193 | 300 slpmsg->slpsession = slpsession; |
301 slpmsg->session_id = slpsession->id; | |
302 msn_slpmsg_set_body(slpmsg, NULL, 4); | |
10345 | 303 #ifdef MSN_DEBUG_SLP |
9193 | 304 slpmsg->info = "SLP DATA PREP"; |
305 #endif | |
306 msn_slplink_queue_slpmsg(slplink, slpmsg); | |
307 | |
308 /* DATA */ | |
309 slpmsg = msn_slpmsg_new(slplink); | |
10345 | 310 slpmsg->slpcall = slpcall; |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
311 slpmsg->slpsession = slpsession; |
9193 | 312 slpmsg->flags = 0x20; |
10345 | 313 #ifdef MSN_DEBUG_SLP |
9193 | 314 slpmsg->info = "SLP DATA"; |
315 #endif | |
316 msn_slpmsg_open_file(slpmsg, file_name); | |
317 msn_slplink_queue_slpmsg(slplink, slpmsg); | |
318 } | |
319 else if (!strcmp(euf_guid, "5D3E02AB-6190-11D3-BBBB-00C04F795683")) | |
320 { | |
321 /* File Transfer */ | |
322 GaimAccount *account; | |
323 GaimXfer *xfer; | |
324 char *bin; | |
11127 | 325 gsize bin_len; |
9193 | 326 guint32 file_size; |
327 char *file_name; | |
10047 | 328 gunichar2 *uni_name; |
9193 | 329 |
330 account = slpcall->slplink->session->account; | |
331 | |
9259
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
332 slpcall->cb = msn_xfer_completed_cb; |
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
333 slpcall->end_cb = msn_xfer_end_cb; |
9193 | 334 slpcall->progress_cb = msn_xfer_progress_cb; |
335 slpcall->branch = g_strdup(branch); | |
336 | |
10296 | 337 slpcall->pending = TRUE; |
338 | |
9193 | 339 xfer = gaim_xfer_new(account, GAIM_XFER_RECEIVE, |
340 slpcall->slplink->remote_user); | |
341 | |
11127 | 342 bin = (char *)gaim_base64_decode(context, &bin_len); |
9263
70153c759016
[gaim-migrate @ 10062]
Christian Hammond <chipx86@chipx86.com>
parents:
9259
diff
changeset
|
343 file_size = GUINT32_FROM_LE(*((gsize *)bin + 2)); |
10225 | 344 |
10047 | 345 uni_name = (gunichar2 *)(bin + 20); |
346 while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) { | |
347 *uni_name = GUINT16_FROM_LE(*uni_name); | |
348 uni_name++; | |
349 } | |
10225 | 350 |
9193 | 351 file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1, |
352 NULL, NULL, NULL); | |
353 | |
354 g_free(bin); | |
355 | |
356 gaim_xfer_set_filename(xfer, file_name); | |
357 gaim_xfer_set_size(xfer, file_size); | |
358 gaim_xfer_set_init_fnc(xfer, msn_xfer_init); | |
359 gaim_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); | |
360 gaim_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); | |
361 | |
362 slpcall->xfer = xfer; | |
363 xfer->data = slpcall; | |
364 | |
365 gaim_xfer_request(xfer); | |
366 } | |
367 } | |
368 | |
369 void | |
370 send_bye(MsnSlpCall *slpcall, const char *type) | |
371 { | |
372 MsnSlpLink *slplink; | |
373 MsnSlpMessage *slpmsg; | |
374 char *header; | |
375 | |
376 slplink = slpcall->slplink; | |
377 | |
378 g_return_if_fail(slplink != NULL); | |
379 | |
380 header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0", | |
381 slplink->local_user); | |
382 | |
383 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, | |
384 "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32", | |
385 type, | |
386 "\r\n"); | |
387 g_free(header); | |
388 | |
10345 | 389 #ifdef MSN_DEBUG_SLP |
9193 | 390 slpmsg->info = "SLP BYE"; |
391 slpmsg->text_body = TRUE; | |
392 #endif | |
393 | |
394 msn_slplink_queue_slpmsg(slplink, slpmsg); | |
395 } | |
396 | |
397 static void | |
398 got_invite(MsnSlpCall *slpcall, | |
399 const char *branch, const char *type, const char *content) | |
400 { | |
401 MsnSlpLink *slplink; | |
402 | |
403 slplink = slpcall->slplink; | |
404 | |
405 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) | |
406 { | |
407 char *euf_guid, *context; | |
408 char *temp; | |
409 | |
410 euf_guid = get_token(content, "EUF-GUID: {", "}\r\n"); | |
411 | |
412 temp = get_token(content, "SessionID: ", "\r\n"); | |
413 if (temp != NULL) | |
414 slpcall->session_id = atoi(temp); | |
415 g_free(temp); | |
416 | |
417 temp = get_token(content, "AppID: ", "\r\n"); | |
418 if (temp != NULL) | |
419 slpcall->app_id = atoi(temp); | |
420 g_free(temp); | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
421 |
9193 | 422 context = get_token(content, "Context: ", "\r\n"); |
423 | |
424 got_sessionreq(slpcall, branch, euf_guid, context); | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
425 |
9193 | 426 g_free(context); |
427 g_free(euf_guid); | |
428 } | |
429 else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) | |
430 { | |
431 /* A direct connection? */ | |
432 | |
433 char *listening, *nonce; | |
434 char *content; | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
435 |
9193 | 436 if (FALSE) |
437 { | |
438 #if 0 | |
439 MsnDirectConn *directconn; | |
440 /* const char *ip_addr; */ | |
441 char *ip_port; | |
442 int port; | |
443 | |
444 /* ip_addr = gaim_prefs_get_string("/core/ft/public_ip"); */ | |
445 ip_port = "5190"; | |
446 listening = "true"; | |
447 nonce = rand_guid(); | |
448 | |
449 directconn = msn_directconn_new(slplink); | |
450 | |
451 /* msn_directconn_parse_nonce(directconn, nonce); */ | |
452 directconn->nonce = g_strdup(nonce); | |
453 | |
454 msn_directconn_listen(directconn); | |
455 | |
456 port = directconn->port; | |
457 | |
458 content = g_strdup_printf( | |
459 "Bridge: TCPv1\r\n" | |
460 "Listening: %s\r\n" | |
461 "Nonce: {%s}\r\n" | |
462 "Ipv4Internal-Addrs: 192.168.0.82\r\n" | |
463 "Ipv4Internal-Port: %d\r\n" | |
464 "\r\n", | |
465 listening, | |
466 nonce, | |
467 port); | |
468 #endif | |
469 } | |
470 else | |
471 { | |
472 listening = "false"; | |
473 nonce = g_strdup("00000000-0000-0000-0000-000000000000"); | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
474 |
9193 | 475 content = g_strdup_printf( |
476 "Bridge: TCPv1\r\n" | |
477 "Listening: %s\r\n" | |
478 "Nonce: {%s}\r\n" | |
479 "\r\n", | |
480 listening, | |
481 nonce); | |
482 } | |
483 | |
484 send_ok(slpcall, branch, | |
485 "application/x-msnmsgr-transrespbody", content); | |
486 | |
487 g_free(content); | |
488 g_free(nonce); | |
489 } | |
490 else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) | |
491 { | |
492 #if 0 | |
493 char *ip_addrs; | |
494 char *temp; | |
495 char *nonce; | |
496 int port; | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
497 |
9193 | 498 nonce = get_token(content, "Nonce: {", "}\r\n"); |
499 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); | |
500 | |
501 temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); | |
502 if (temp != NULL) | |
503 port = atoi(temp); | |
504 else | |
505 port = -1; | |
506 g_free(temp); | |
507 | |
508 if (ip_addrs == NULL) | |
509 return; | |
510 | |
511 if (port > 0) | |
512 got_transresp(slpcall, nonce, ip_addrs, port); | |
513 | |
514 g_free(nonce); | |
515 g_free(ip_addrs); | |
516 #endif | |
517 } | |
518 } | |
519 | |
520 static void | |
521 got_ok(MsnSlpCall *slpcall, | |
522 const char *type, const char *content) | |
523 { | |
524 g_return_if_fail(slpcall != NULL); | |
525 g_return_if_fail(type != NULL); | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
526 |
9193 | 527 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) |
528 { | |
529 #if 0 | |
530 if (slpcall->type == MSN_SLPCALL_DC) | |
531 { | |
532 /* First let's try a DirectConnection. */ | |
533 | |
534 MsnSlpLink *slplink; | |
535 MsnSlpMessage *slpmsg; | |
536 char *header; | |
537 char *content; | |
538 char *branch; | |
539 | |
540 slplink = slpcall->slplink; | |
541 | |
542 branch = rand_guid(); | |
543 | |
544 content = g_strdup_printf( | |
545 "Bridges: TRUDPv1 TCPv1\r\n" | |
546 "NetID: 0\r\n" | |
547 "Conn-Type: Direct-Connect\r\n" | |
548 "UPnPNat: false\r\n" | |
549 "ICF: false\r\n" | |
550 ); | |
551 | |
552 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", | |
553 slplink->remote_user); | |
554 | |
555 slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch, | |
556 "application/x-msnmsgr-transreqbody", | |
557 content); | |
558 | |
10345 | 559 #ifdef MSN_DEBUG_SLP |
9193 | 560 slpmsg->info = "SLP INVITE"; |
561 slpmsg->text_body = TRUE; | |
562 #endif | |
563 msn_slplink_send_slpmsg(slplink, slpmsg); | |
564 | |
565 g_free(header); | |
566 g_free(content); | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
567 |
9193 | 568 g_free(branch); |
569 } | |
570 else | |
571 { | |
572 msn_slp_call_session_init(slpcall); | |
573 } | |
574 #else | |
575 msn_slp_call_session_init(slpcall); | |
576 #endif | |
577 } | |
578 else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) | |
579 { | |
580 /* Do we get this? */ | |
581 gaim_debug_info("msn", "OK with transreqbody\n"); | |
582 } | |
583 else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) | |
584 { | |
585 #if 0 | |
586 char *ip_addrs; | |
587 char *temp; | |
588 char *nonce; | |
589 int port; | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
590 |
9193 | 591 nonce = get_token(content, "Nonce: {", "}\r\n"); |
592 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); | |
593 | |
594 temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); | |
595 if (temp != NULL) | |
596 port = atoi(temp); | |
597 else | |
598 port = -1; | |
599 g_free(temp); | |
600 | |
601 if (ip_addrs == NULL) | |
602 return; | |
603 | |
604 if (port > 0) | |
605 got_transresp(slpcall, nonce, ip_addrs, port); | |
606 | |
607 g_free(nonce); | |
608 g_free(ip_addrs); | |
609 #endif | |
610 } | |
611 } | |
612 | |
613 MsnSlpCall * | |
11236 | 614 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body) |
9193 | 615 { |
616 MsnSlpCall *slpcall; | |
617 | |
10907 | 618 if (body == NULL) |
619 { | |
620 gaim_debug_warning("msn", "received bogus message\n"); | |
621 return NULL; | |
622 } | |
623 | |
9193 | 624 if (!strncmp(body, "INVITE", strlen("INVITE"))) |
625 { | |
626 char *branch; | |
627 char *content; | |
628 char *content_type; | |
629 | |
630 slpcall = msn_slp_call_new(slplink); | |
631 | |
632 /* From: <msnmsgr:buddy@hotmail.com> */ | |
633 #if 0 | |
634 slpcall->remote_user = get_token(body, "From: <msnmsgr:", ">\r\n"); | |
635 #endif | |
636 | |
637 branch = get_token(body, ";branch={", "}"); | |
638 | |
639 slpcall->id = get_token(body, "Call-ID: {", "}"); | |
640 | |
641 #if 0 | |
642 long content_len = -1; | |
643 | |
644 temp = get_token(body, "Content-Length: ", "\r\n"); | |
645 if (temp != NULL) | |
646 content_len = atoi(temp); | |
647 g_free(temp); | |
648 #endif | |
649 content_type = get_token(body, "Content-Type: ", "\r\n"); | |
650 | |
651 content = get_token(body, "\r\n\r\n", NULL); | |
652 | |
653 got_invite(slpcall, branch, content_type, content); | |
654 | |
10519 | 655 g_free(branch); |
9193 | 656 g_free(content_type); |
657 g_free(content); | |
658 } | |
659 else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 "))) | |
660 { | |
661 char *content; | |
662 char *content_type; | |
663 /* Make sure this is "OK" */ | |
664 const char *status = body + strlen("MSNSLP/1.0 "); | |
665 char *call_id; | |
666 | |
667 call_id = get_token(body, "Call-ID: {", "}"); | |
668 slpcall = msn_slplink_find_slp_call(slplink, call_id); | |
669 g_free(call_id); | |
670 | |
9231
ac8790437abe
[gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents:
9226
diff
changeset
|
671 g_return_val_if_fail(slpcall != NULL, NULL); |
ac8790437abe
[gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents:
9226
diff
changeset
|
672 |
9193 | 673 if (strncmp(status, "200 OK", 6)) |
674 { | |
675 /* It's not valid. Kill this off. */ | |
676 char temp[32]; | |
677 const char *c; | |
678 | |
679 /* Eww */ | |
680 if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) || | |
681 (c = strchr(status, '\0'))) | |
682 { | |
9739 | 683 size_t offset = c - status; |
684 if (offset >= sizeof(temp)) | |
685 offset = sizeof(temp) - 1; | |
10225 | 686 |
9739 | 687 strncpy(temp, status, offset); |
688 temp[offset] = '\0'; | |
9193 | 689 } |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
690 |
9193 | 691 gaim_debug_error("msn", "Received non-OK result: %s\n", temp); |
692 | |
693 slpcall->wasted = TRUE; | |
694 | |
695 /* msn_slp_call_destroy(slpcall); */ | |
696 return slpcall; | |
697 } | |
698 | |
699 content_type = get_token(body, "Content-Type: ", "\r\n"); | |
700 | |
701 content = get_token(body, "\r\n\r\n", NULL); | |
702 | |
703 got_ok(slpcall, content_type, content); | |
704 | |
705 g_free(content_type); | |
706 g_free(content); | |
707 } | |
708 else if (!strncmp(body, "BYE", strlen("BYE"))) | |
709 { | |
710 char *call_id; | |
711 | |
712 call_id = get_token(body, "Call-ID: {", "}"); | |
713 slpcall = msn_slplink_find_slp_call(slplink, call_id); | |
714 g_free(call_id); | |
715 | |
716 if (slpcall != NULL) | |
717 slpcall->wasted = TRUE; | |
718 | |
719 /* msn_slp_call_destroy(slpcall); */ | |
720 } | |
721 else | |
722 slpcall = NULL; | |
723 | |
724 return slpcall; | |
725 } | |
726 | |
727 /************************************************************************** | |
728 * Msg Callbacks | |
729 **************************************************************************/ | |
730 | |
731 void | |
732 msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg) | |
733 { | |
734 MsnSession *session; | |
735 MsnSlpLink *slplink; | |
736 | |
737 session = cmdproc->servconn->session; | |
738 slplink = msn_session_get_slplink(session, msg->remote_user); | |
739 | |
10602 | 740 if (slplink->swboard == NULL) |
741 { | |
10887 | 742 /* We will need this in order to change its flags. */ |
10602 | 743 slplink->swboard = (MsnSwitchBoard *)cmdproc->data; |
10887 | 744 /* If swboard is NULL, something has probably gone wrong earlier on |
745 * I didn't want to do this, but MSN 7 is somehow causing us to crash | |
746 * here, I couldn't reproduce it to debug more, and people are | |
747 * reporting bugs. Hopefully this doesn't cause more crashes. Stu. | |
748 */ | |
749 if (slplink->swboard != NULL) | |
750 slplink->swboard->slplink = slplink; | |
751 else | |
752 gaim_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n"); | |
10602 | 753 } |
754 | |
9193 | 755 msn_slplink_process_msg(slplink, msg); |
756 } | |
757 | |
11137 | 758 static void |
9193 | 759 got_emoticon(MsnSlpCall *slpcall, |
11137 | 760 const guchar *data, gsize size) |
9193 | 761 { |
10526 | 762 |
763 GaimConversation *conv; | |
764 GaimConnection *gc; | |
765 const char *who; | |
9193 | 766 |
10526 | 767 gc = slpcall->slplink->session->account->gc; |
768 who = slpcall->slplink->remote_user; | |
10773 | 769 |
11338 | 770 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who, gc->account); |
10403 | 771 |
10526 | 772 /* FIXME: it would be better if we wrote the data as we received it |
773 instead of all at once, calling write multiple times and | |
774 close once at the very end | |
775 */ | |
776 gaim_conv_custom_smiley_write(conv, slpcall->data_info, data, size); | |
777 gaim_conv_custom_smiley_close(conv, slpcall->data_info ); | |
10773 | 778 #ifdef MSN_DEBUG_UD |
10526 | 779 gaim_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); |
10773 | 780 #endif |
9193 | 781 } |
782 | |
783 void | |
784 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) | |
785 { | |
786 MsnSession *session; | |
787 MsnSlpLink *slplink; | |
788 MsnObject *obj; | |
789 char **tokens; | |
11235 | 790 char *smile, *body_str; |
791 const char *body, *who, *sha1c; | |
11518 | 792 guint tok; |
11235 | 793 size_t body_len; |
9193 | 794 |
11518 | 795 GaimConversation *conv; |
10526 | 796 |
9193 | 797 session = cmdproc->servconn->session; |
798 | |
11235 | 799 body = msn_message_get_bin_data(msg, &body_len); |
800 body_str = g_strndup(body, body_len); | |
801 | |
11518 | 802 /* MSN Messenger 7 may send more than one MSNObject in a single message... |
803 * Maybe 10 tokens is a reasonable max value. */ | |
804 tokens = g_strsplit(body_str, "\t", 10); | |
11235 | 805 |
806 g_free(body_str); | |
9193 | 807 |
11518 | 808 for (tok = 0; tok < 9; tok += 2) { |
809 if (tokens[tok] == NULL || tokens[tok + 1] == NULL) { | |
810 break; | |
811 } | |
812 | |
813 smile = tokens[tok]; | |
814 obj = msn_object_new_from_string(gaim_url_decode(tokens[tok + 1])); | |
9193 | 815 |
11518 | 816 who = msn_object_get_creator(obj); |
817 sha1c = msn_object_get_sha1c(obj); | |
9193 | 818 |
11518 | 819 slplink = msn_session_get_slplink(session, who); |
820 | |
821 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who, | |
822 session->account); | |
9193 | 823 |
11518 | 824 /* If the conversation doesn't exist then this is a custom smiley |
825 * used in the first message in a MSN conversation: we need to create | |
826 * the conversation now, otherwise the custom smiley won't be shown. | |
827 * This happens because every GtkIMHtml has its own smiley tree: if | |
828 * the conversation doesn't exist then we cannot associate the new | |
829 * smiley with its GtkIMHtml widget. */ | |
830 if (!conv) { | |
831 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, session->account, who); | |
832 } | |
10526 | 833 |
11518 | 834 if (gaim_conv_custom_smiley_add(conv, smile, "sha1", sha1c)) { |
835 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); | |
836 } | |
837 | |
838 msn_object_destroy(obj); | |
839 obj = NULL; | |
840 who = NULL; | |
841 sha1c = NULL; | |
10526 | 842 } |
9193 | 843 g_strfreev(tokens); |
844 } | |
845 | |
846 static gboolean | |
847 buddy_icon_cached(GaimConnection *gc, MsnObject *obj) | |
848 { | |
849 GaimAccount *account; | |
850 GaimBuddy *buddy; | |
851 GSList *sl; | |
852 const char *old; | |
853 const char *new; | |
854 | |
855 g_return_val_if_fail(obj != NULL, FALSE); | |
856 | |
857 account = gaim_connection_get_account(gc); | |
858 | |
859 sl = gaim_find_buddies(account, msn_object_get_creator(obj)); | |
860 | |
861 if (sl == NULL) | |
862 return FALSE; | |
863 | |
864 buddy = (GaimBuddy *)sl->data; | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
865 |
9193 | 866 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum"); |
867 new = msn_object_get_sha1c(obj); | |
868 | |
869 if (new == NULL) | |
870 return FALSE; | |
871 | |
11020 | 872 /* If the old and new checksums are the same, and the file actually exists, |
873 * then return TRUE */ | |
874 if (old != NULL && !strcmp(old, new) && (gaim_buddy_icons_find(account, gaim_buddy_get_name(buddy)) != NULL)) | |
9193 | 875 return TRUE; |
876 | |
877 return FALSE; | |
878 } | |
879 | |
880 void | |
9860 | 881 msn_release_buddy_icon_request(MsnUserList *userlist) |
9193 | 882 { |
883 MsnUser *user; | |
9860 | 884 |
10225 | 885 g_return_if_fail(userlist != NULL); |
886 | |
10773 | 887 #ifdef MSN_DEBUG_UD |
10225 | 888 gaim_debug_info("msn", "Releasing buddy icon request\n"); |
10773 | 889 #endif |
10225 | 890 |
9860 | 891 while (userlist->buddy_icon_window > 0) |
892 { | |
893 GQueue *queue; | |
894 GaimAccount *account; | |
895 const char *username; | |
896 | |
897 queue = userlist->buddy_icon_requests; | |
898 | |
899 if (g_queue_is_empty(userlist->buddy_icon_requests)) | |
900 break; | |
901 | |
902 user = g_queue_pop_head(queue); | |
9193 | 903 |
9860 | 904 account = userlist->session->account; |
905 username = user->passport; | |
9193 | 906 |
9860 | 907 msn_request_user_display(user); |
908 userlist->buddy_icon_window--; | |
10225 | 909 |
10773 | 910 #ifdef MSN_DEBUG_UD |
10225 | 911 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
912 userlist->buddy_icon_window); | |
10773 | 913 #endif |
9860 | 914 } |
915 } | |
9193 | 916 |
9860 | 917 void |
918 msn_queue_buddy_icon_request(MsnUser *user) | |
919 { | |
920 GaimAccount *account; | |
921 MsnObject *obj; | |
922 GQueue *queue; | |
9193 | 923 |
10225 | 924 g_return_if_fail(user != NULL); |
925 | |
9860 | 926 account = user->userlist->session->account; |
9193 | 927 |
928 obj = msn_user_get_object(user); | |
929 | |
930 if (obj == NULL) | |
9860 | 931 { |
9193 | 932 /* It seems the user has not set a msnobject */ |
9860 | 933 GSList *sl; |
934 | |
935 /* TODO: I think we need better buddy icon core functions. */ | |
936 gaim_buddy_icons_set_for_user(account, user->passport, NULL, -1); | |
937 | |
938 sl = gaim_find_buddies(account, user->passport); | |
939 | |
940 for (; sl != NULL; sl = sl->next) | |
941 { | |
942 GaimBuddy *buddy = (GaimBuddy *)sl->data; | |
943 gaim_blist_node_remove_setting((GaimBlistNode*)buddy, "icon_checksum"); | |
944 } | |
945 | |
9193 | 946 return; |
9860 | 947 } |
948 | |
949 if (!buddy_icon_cached(account->gc, obj)) | |
950 { | |
951 MsnUserList *userlist; | |
952 | |
953 userlist = user->userlist; | |
954 queue = userlist->buddy_icon_requests; | |
955 | |
10773 | 956 #ifdef MSN_DEBUG_UD |
10225 | 957 gaim_debug_info("msn", "Queueing buddy icon request: %s\n", |
958 user->passport); | |
10773 | 959 #endif |
10225 | 960 |
9860 | 961 g_queue_push_tail(queue, user); |
962 | |
10773 | 963 #ifdef MSN_DEBUG_UD |
10225 | 964 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
965 userlist->buddy_icon_window); | |
10773 | 966 #endif |
10225 | 967 |
9860 | 968 if (userlist->buddy_icon_window > 0) |
969 msn_release_buddy_icon_request(userlist); | |
970 } | |
971 } | |
972 | |
973 void | |
974 got_user_display(MsnSlpCall *slpcall, | |
11137 | 975 const guchar *data, gsize size) |
9860 | 976 { |
10225 | 977 MsnUserList *userlist; |
9860 | 978 const char *info; |
979 GaimAccount *account; | |
980 GSList *sl; | |
981 | |
10225 | 982 g_return_if_fail(slpcall != NULL); |
983 | |
9860 | 984 info = slpcall->data_info; |
10773 | 985 #ifdef MSN_DEBUG_UD |
9860 | 986 gaim_debug_info("msn", "Got User Display: %s\n", info); |
10773 | 987 #endif |
9860 | 988 |
10225 | 989 userlist = slpcall->slplink->session->userlist; |
9860 | 990 account = slpcall->slplink->session->account; |
991 | |
992 /* TODO: I think we need better buddy icon core functions. */ | |
993 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, | |
994 (void *)data, size); | |
995 | |
996 sl = gaim_find_buddies(account, slpcall->slplink->remote_user); | |
997 | |
998 for (; sl != NULL; sl = sl->next) | |
999 { | |
1000 GaimBuddy *buddy = (GaimBuddy *)sl->data; | |
1001 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); | |
1002 } | |
1003 | |
10225 | 1004 #if 0 |
1005 /* Free one window slot */ | |
1006 userlist->buddy_icon_window++; | |
1007 | |
1008 gaim_debug_info("msn", "buddy_icon_window=%d\n", | |
1009 userlist->buddy_icon_window); | |
1010 | |
1011 msn_release_buddy_icon_request(userlist); | |
1012 #endif | |
1013 } | |
1014 | |
1015 void | |
1016 end_user_display(MsnSlpCall *slpcall) | |
1017 { | |
1018 MsnUserList *userlist; | |
1019 | |
1020 g_return_if_fail(slpcall != NULL); | |
1021 | |
10773 | 1022 #ifdef MSN_DEBUG_UD |
10225 | 1023 gaim_debug_info("msn", "End User Display\n"); |
10773 | 1024 #endif |
1025 | |
1026 /* Maybe the slplink was destroyed. */ | |
1027 if (slpcall->slplink == NULL) | |
1028 return; | |
10225 | 1029 |
1030 userlist = slpcall->slplink->session->userlist; | |
1031 | |
10296 | 1032 /* If the session is being destroyed we better stop doing anything. */ |
1033 if (slpcall->slplink->session->destroying) | |
1034 return; | |
1035 | |
10225 | 1036 /* Free one window slot */ |
1037 userlist->buddy_icon_window++; | |
1038 | |
10773 | 1039 #ifdef MSN_DEBUG_UD |
10225 | 1040 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
1041 userlist->buddy_icon_window); | |
10773 | 1042 #endif |
10225 | 1043 |
1044 msn_release_buddy_icon_request(userlist); | |
9860 | 1045 } |
1046 | |
1047 void | |
1048 msn_request_user_display(MsnUser *user) | |
1049 { | |
1050 GaimAccount *account; | |
1051 MsnSession *session; | |
1052 MsnSlpLink *slplink; | |
1053 MsnObject *obj; | |
1054 const char *info; | |
1055 | |
1056 session = user->userlist->session; | |
1057 account = session->account; | |
1058 | |
1059 slplink = msn_session_get_slplink(session, user->passport); | |
1060 | |
1061 obj = msn_user_get_object(user); | |
9193 | 1062 |
1063 info = msn_object_get_sha1c(obj); | |
1064 | |
9860 | 1065 if (g_ascii_strcasecmp(user->passport, |
1066 gaim_account_get_username(account))) | |
1067 { | |
10225 | 1068 msn_slplink_request_object(slplink, info, got_user_display, |
1069 end_user_display, obj); | |
9860 | 1070 } |
1071 else | |
1072 { | |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1073 MsnObject *my_obj = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1074 const char *filename = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1075 gchar *data = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1076 gsize len = 0; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1077 const char *my_info = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1078 GSList *sl; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1079 |
10773 | 1080 #ifdef MSN_DEBUG_UD |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1081 gaim_debug_info("msn", "Requesting our own user display\n"); |
10773 | 1082 #endif |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1083 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1084 my_obj = msn_user_get_object(session->user); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1085 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1086 if (my_obj != NULL) |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1087 { |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1088 filename = msn_object_get_real_location(my_obj); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1089 my_info = msn_object_get_sha1c(my_obj); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1090 } |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1091 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1092 if (filename != NULL) |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1093 g_file_get_contents(filename, &data, &len, NULL); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1094 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1095 /* TODO: I think we need better buddy icon core functions. */ |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1096 gaim_buddy_icons_set_for_user(account, user->passport, (void *)data, len); |
10519 | 1097 g_free(data); |
10225 | 1098 |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1099 sl = gaim_find_buddies(account, user->passport); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1100 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1101 for (; sl != NULL; sl = sl->next) |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1102 { |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1103 GaimBuddy *buddy = (GaimBuddy *)sl->data; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1104 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1105 } |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1106 |
10225 | 1107 /* Free one window slot */ |
9860 | 1108 session->userlist->buddy_icon_window++; |
10225 | 1109 |
10773 | 1110 #ifdef MSN_DEBUG_UD |
10225 | 1111 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
1112 session->userlist->buddy_icon_window); | |
10773 | 1113 #endif |
10225 | 1114 |
9860 | 1115 msn_release_buddy_icon_request(session->userlist); |
1116 } | |
9193 | 1117 } |