Mercurial > pidgin.yaz
annotate src/protocols/msn/slp.c @ 11057:e9eeacd1a8d0
[gaim-migrate @ 13009]
Patch #1223021 from Jason Roth (jroth2)
Fixes Bug #1222552
"As described in bug report #1222552, gaim will disconnect the current msn session and corrupt blist.xml when you try to add an msn screenname with a space in it" -- jroth2
I reworked this quite a bit. Stu suggested using gaim_email_valid() rather than just checking for a space. I took this advice. I also made it display an error message instead of silently dropping the add request.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 05 Jul 2005 00:03:42 +0000 |
parents | 407e47f580e4 |
children | 719779387f96 |
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 |
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
155 msn_xfer_completed_cb(MsnSlpCall *slpcall, const char *body, |
f5f7482678d2
[gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents:
9231
diff
changeset
|
156 long long size) |
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; | |
10112 | 256 int 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 | |
270 gaim_base64_decode(context, &msnobj_data, &len); | |
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; | |
10112 | 325 int 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 | |
342 gaim_base64_decode(context, &bin, &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 * | |
614 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body, gsize len) | |
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 | |
758 void | |
759 got_emoticon(MsnSlpCall *slpcall, | |
760 const char *data, long long size) | |
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 |
10526 | 770 conv = gaim_find_conversation_with_account(GAIM_CONV_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; | |
790 char *smile; | |
10527 | 791 const char *who, *sha1c; |
9193 | 792 |
10526 | 793 GaimConversation *conversation; |
794 GaimConnection *gc; | |
795 | |
9193 | 796 session = cmdproc->servconn->session; |
797 | |
798 tokens = g_strsplit(msg->body, "\t", 2); | |
799 | |
800 smile = tokens[0]; | |
801 obj = msn_object_new_from_string(gaim_url_decode(tokens[1])); | |
802 | |
803 who = msn_object_get_creator(obj); | |
10527 | 804 sha1c = msn_object_get_sha1c(obj); |
9193 | 805 |
806 slplink = msn_session_get_slplink(session, who); | |
807 | |
10526 | 808 gc = slplink->session->account->gc; |
809 | |
810 conversation = gaim_find_conversation_with_account(GAIM_CONV_ANY, who, gc->account); | |
811 | |
10527 | 812 if (gaim_conv_custom_smiley_add(conversation, smile, "sha1", sha1c)) { |
10526 | 813 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); |
814 } | |
9193 | 815 |
816 g_strfreev(tokens); | |
817 } | |
818 | |
819 static gboolean | |
820 buddy_icon_cached(GaimConnection *gc, MsnObject *obj) | |
821 { | |
822 GaimAccount *account; | |
823 GaimBuddy *buddy; | |
824 GSList *sl; | |
825 const char *old; | |
826 const char *new; | |
827 | |
828 g_return_val_if_fail(obj != NULL, FALSE); | |
829 | |
830 account = gaim_connection_get_account(gc); | |
831 | |
832 sl = gaim_find_buddies(account, msn_object_get_creator(obj)); | |
833 | |
834 if (sl == NULL) | |
835 return FALSE; | |
836 | |
837 buddy = (GaimBuddy *)sl->data; | |
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
838 |
9193 | 839 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum"); |
840 new = msn_object_get_sha1c(obj); | |
841 | |
842 if (new == NULL) | |
843 return FALSE; | |
844 | |
11020 | 845 /* If the old and new checksums are the same, and the file actually exists, |
846 * then return TRUE */ | |
847 if (old != NULL && !strcmp(old, new) && (gaim_buddy_icons_find(account, gaim_buddy_get_name(buddy)) != NULL)) | |
9193 | 848 return TRUE; |
849 | |
850 return FALSE; | |
851 } | |
852 | |
853 void | |
9860 | 854 msn_release_buddy_icon_request(MsnUserList *userlist) |
9193 | 855 { |
856 MsnUser *user; | |
9860 | 857 |
10225 | 858 g_return_if_fail(userlist != NULL); |
859 | |
10773 | 860 #ifdef MSN_DEBUG_UD |
10225 | 861 gaim_debug_info("msn", "Releasing buddy icon request\n"); |
10773 | 862 #endif |
10225 | 863 |
9860 | 864 while (userlist->buddy_icon_window > 0) |
865 { | |
866 GQueue *queue; | |
867 GaimAccount *account; | |
868 const char *username; | |
869 | |
870 queue = userlist->buddy_icon_requests; | |
871 | |
872 if (g_queue_is_empty(userlist->buddy_icon_requests)) | |
873 break; | |
874 | |
875 user = g_queue_pop_head(queue); | |
9193 | 876 |
9860 | 877 account = userlist->session->account; |
878 username = user->passport; | |
9193 | 879 |
9860 | 880 msn_request_user_display(user); |
881 userlist->buddy_icon_window--; | |
10225 | 882 |
10773 | 883 #ifdef MSN_DEBUG_UD |
10225 | 884 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
885 userlist->buddy_icon_window); | |
10773 | 886 #endif |
9860 | 887 } |
888 } | |
9193 | 889 |
9860 | 890 void |
891 msn_queue_buddy_icon_request(MsnUser *user) | |
892 { | |
893 GaimAccount *account; | |
894 MsnObject *obj; | |
895 GQueue *queue; | |
9193 | 896 |
10225 | 897 g_return_if_fail(user != NULL); |
898 | |
9860 | 899 account = user->userlist->session->account; |
9193 | 900 |
901 obj = msn_user_get_object(user); | |
902 | |
903 if (obj == NULL) | |
9860 | 904 { |
9193 | 905 /* It seems the user has not set a msnobject */ |
9860 | 906 GSList *sl; |
907 | |
908 /* TODO: I think we need better buddy icon core functions. */ | |
909 gaim_buddy_icons_set_for_user(account, user->passport, NULL, -1); | |
910 | |
911 sl = gaim_find_buddies(account, user->passport); | |
912 | |
913 for (; sl != NULL; sl = sl->next) | |
914 { | |
915 GaimBuddy *buddy = (GaimBuddy *)sl->data; | |
916 gaim_blist_node_remove_setting((GaimBlistNode*)buddy, "icon_checksum"); | |
917 } | |
918 | |
9193 | 919 return; |
9860 | 920 } |
921 | |
922 if (!buddy_icon_cached(account->gc, obj)) | |
923 { | |
924 MsnUserList *userlist; | |
925 | |
926 userlist = user->userlist; | |
927 queue = userlist->buddy_icon_requests; | |
928 | |
10773 | 929 #ifdef MSN_DEBUG_UD |
10225 | 930 gaim_debug_info("msn", "Queueing buddy icon request: %s\n", |
931 user->passport); | |
10773 | 932 #endif |
10225 | 933 |
9860 | 934 g_queue_push_tail(queue, user); |
935 | |
10773 | 936 #ifdef MSN_DEBUG_UD |
10225 | 937 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
938 userlist->buddy_icon_window); | |
10773 | 939 #endif |
10225 | 940 |
9860 | 941 if (userlist->buddy_icon_window > 0) |
942 msn_release_buddy_icon_request(userlist); | |
943 } | |
944 } | |
945 | |
946 void | |
947 got_user_display(MsnSlpCall *slpcall, | |
948 const char *data, long long size) | |
949 { | |
10225 | 950 MsnUserList *userlist; |
9860 | 951 const char *info; |
952 GaimAccount *account; | |
953 GSList *sl; | |
954 | |
10225 | 955 g_return_if_fail(slpcall != NULL); |
956 | |
9860 | 957 info = slpcall->data_info; |
10773 | 958 #ifdef MSN_DEBUG_UD |
9860 | 959 gaim_debug_info("msn", "Got User Display: %s\n", info); |
10773 | 960 #endif |
9860 | 961 |
10225 | 962 userlist = slpcall->slplink->session->userlist; |
9860 | 963 account = slpcall->slplink->session->account; |
964 | |
965 /* TODO: I think we need better buddy icon core functions. */ | |
966 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, | |
967 (void *)data, size); | |
968 | |
969 sl = gaim_find_buddies(account, slpcall->slplink->remote_user); | |
970 | |
971 for (; sl != NULL; sl = sl->next) | |
972 { | |
973 GaimBuddy *buddy = (GaimBuddy *)sl->data; | |
974 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); | |
975 } | |
976 | |
10225 | 977 #if 0 |
978 /* Free one window slot */ | |
979 userlist->buddy_icon_window++; | |
980 | |
981 gaim_debug_info("msn", "buddy_icon_window=%d\n", | |
982 userlist->buddy_icon_window); | |
983 | |
984 msn_release_buddy_icon_request(userlist); | |
985 #endif | |
986 } | |
987 | |
988 void | |
989 end_user_display(MsnSlpCall *slpcall) | |
990 { | |
991 MsnUserList *userlist; | |
992 | |
993 g_return_if_fail(slpcall != NULL); | |
994 | |
10773 | 995 #ifdef MSN_DEBUG_UD |
10225 | 996 gaim_debug_info("msn", "End User Display\n"); |
10773 | 997 #endif |
998 | |
999 /* Maybe the slplink was destroyed. */ | |
1000 if (slpcall->slplink == NULL) | |
1001 return; | |
10225 | 1002 |
1003 userlist = slpcall->slplink->session->userlist; | |
1004 | |
10296 | 1005 /* If the session is being destroyed we better stop doing anything. */ |
1006 if (slpcall->slplink->session->destroying) | |
1007 return; | |
1008 | |
10225 | 1009 /* Free one window slot */ |
1010 userlist->buddy_icon_window++; | |
1011 | |
10773 | 1012 #ifdef MSN_DEBUG_UD |
10225 | 1013 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
1014 userlist->buddy_icon_window); | |
10773 | 1015 #endif |
10225 | 1016 |
1017 msn_release_buddy_icon_request(userlist); | |
9860 | 1018 } |
1019 | |
1020 void | |
1021 msn_request_user_display(MsnUser *user) | |
1022 { | |
1023 GaimAccount *account; | |
1024 MsnSession *session; | |
1025 MsnSlpLink *slplink; | |
1026 MsnObject *obj; | |
1027 const char *info; | |
1028 | |
1029 session = user->userlist->session; | |
1030 account = session->account; | |
1031 | |
1032 slplink = msn_session_get_slplink(session, user->passport); | |
1033 | |
1034 obj = msn_user_get_object(user); | |
9193 | 1035 |
1036 info = msn_object_get_sha1c(obj); | |
1037 | |
9860 | 1038 if (g_ascii_strcasecmp(user->passport, |
1039 gaim_account_get_username(account))) | |
1040 { | |
10225 | 1041 msn_slplink_request_object(slplink, info, got_user_display, |
1042 end_user_display, obj); | |
9860 | 1043 } |
1044 else | |
1045 { | |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1046 MsnObject *my_obj = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1047 const char *filename = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1048 gchar *data = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1049 gsize len = 0; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1050 const char *my_info = NULL; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1051 GSList *sl; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1052 |
10773 | 1053 #ifdef MSN_DEBUG_UD |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1054 gaim_debug_info("msn", "Requesting our own user display\n"); |
10773 | 1055 #endif |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1056 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1057 my_obj = msn_user_get_object(session->user); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1058 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1059 if (my_obj != NULL) |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1060 { |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1061 filename = msn_object_get_real_location(my_obj); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1062 my_info = msn_object_get_sha1c(my_obj); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1063 } |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1064 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1065 if (filename != NULL) |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1066 g_file_get_contents(filename, &data, &len, NULL); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1067 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1068 /* TODO: I think we need better buddy icon core functions. */ |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1069 gaim_buddy_icons_set_for_user(account, user->passport, (void *)data, len); |
10519 | 1070 g_free(data); |
10225 | 1071 |
10072
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1072 sl = gaim_find_buddies(account, user->passport); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1073 |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1074 for (; sl != NULL; sl = sl->next) |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1075 { |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1076 GaimBuddy *buddy = (GaimBuddy *)sl->data; |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1077 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1078 } |
cf3454eadc22
[gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents:
10047
diff
changeset
|
1079 |
10225 | 1080 /* Free one window slot */ |
9860 | 1081 session->userlist->buddy_icon_window++; |
10225 | 1082 |
10773 | 1083 #ifdef MSN_DEBUG_UD |
10225 | 1084 gaim_debug_info("msn", "buddy_icon_window=%d\n", |
1085 session->userlist->buddy_icon_window); | |
10773 | 1086 #endif |
10225 | 1087 |
9860 | 1088 msn_release_buddy_icon_request(session->userlist); |
1089 } | |
9193 | 1090 } |