comparison libgaim/protocols/msn/slp.c @ 20390:d634f88e25d8

msn.tgz from SF Patch #1621854 from Ka-Hing Cheung "This tarball brings soc-2006-msnp13 up to head. In addition to that it also fixes a crash with sending offline messages. I wasn't able to generate a diff against that branch, svn seems to insist on diff'ing against HEAD after I run the merge command. After running `svn merge -r 16309:HEAD https://gaim.svn.sourceforge.net/svnroot/gaim/trunk` on the soc-2006-msnp13 you can replace the msn directory with the attached tarball. The fix for offline messaging is on msn.c:901: if (!session->oim) session->oim = msn_oim_new(session)" committer: Richard Laager <rlaager@wiktel.com>
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 15 Apr 2007 02:18:17 +0000
parents e354528c4163
children 9ba7dee775e1
comparison
equal deleted inserted replaced
20389:e354528c4163 20390:d634f88e25d8
339 339
340 slpcall->pending = TRUE; 340 slpcall->pending = TRUE;
341 341
342 xfer = gaim_xfer_new(account, GAIM_XFER_RECEIVE, 342 xfer = gaim_xfer_new(account, GAIM_XFER_RECEIVE,
343 slpcall->slplink->remote_user); 343 slpcall->slplink->remote_user);
344 if (xfer) 344
345 { 345 bin = (char *)gaim_base64_decode(context, &bin_len);
346 bin = (char *)gaim_base64_decode(context, &bin_len); 346 file_size = GUINT32_FROM_LE(*((gsize *)bin + 2));
347 file_size = GUINT32_FROM_LE(*((gsize *)bin + 2)); 347
348 348 uni_name = (gunichar2 *)(bin + 20);
349 uni_name = (gunichar2 *)(bin + 20); 349 while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) {
350 while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) { 350 *uni_name = GUINT16_FROM_LE(*uni_name);
351 *uni_name = GUINT16_FROM_LE(*uni_name); 351 uni_name++;
352 uni_name++; 352 }
353 } 353
354 354 file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1,
355 file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1, 355 NULL, NULL, NULL);
356 NULL, NULL, NULL); 356
357 357 g_free(bin);
358 g_free(bin); 358
359 359 gaim_xfer_set_filename(xfer, file_name);
360 gaim_xfer_set_filename(xfer, file_name); 360 gaim_xfer_set_size(xfer, file_size);
361 gaim_xfer_set_size(xfer, file_size); 361 gaim_xfer_set_init_fnc(xfer, msn_xfer_init);
362 gaim_xfer_set_init_fnc(xfer, msn_xfer_init); 362 gaim_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);
363 gaim_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); 363 gaim_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel);
364 gaim_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); 364
365 365 slpcall->xfer = xfer;
366 slpcall->xfer = xfer; 366 xfer->data = slpcall;
367 xfer->data = slpcall; 367
368 368 gaim_xfer_request(xfer);
369 gaim_xfer_request(xfer);
370 }
371 } 369 }
372 } 370 }
373 371
374 void 372 void
375 send_bye(MsnSlpCall *slpcall, const char *type) 373 send_bye(MsnSlpCall *slpcall, const char *type)
751 * I didn't want to do this, but MSN 7 is somehow causing us to crash 749 * I didn't want to do this, but MSN 7 is somehow causing us to crash
752 * here, I couldn't reproduce it to debug more, and people are 750 * here, I couldn't reproduce it to debug more, and people are
753 * reporting bugs. Hopefully this doesn't cause more crashes. Stu. 751 * reporting bugs. Hopefully this doesn't cause more crashes. Stu.
754 */ 752 */
755 if (slplink->swboard != NULL) 753 if (slplink->swboard != NULL)
756 slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); 754 slplink->swboard->slplink = slplink;
757 else 755 else
758 gaim_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n"); 756 gaim_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n");
759 } 757 }
760 758
761 msn_slplink_process_msg(slplink, msg); 759 msn_slplink_process_msg(slplink, msg);
771 const char *who; 769 const char *who;
772 770
773 gc = slpcall->slplink->session->account->gc; 771 gc = slpcall->slplink->session->account->gc;
774 who = slpcall->slplink->remote_user; 772 who = slpcall->slplink->remote_user;
775 773
776 if ((conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who, gc->account))) { 774 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who, gc->account);
777 775
778 /* FIXME: it would be better if we wrote the data as we received it 776 /* FIXME: it would be better if we wrote the data as we received it
779 instead of all at once, calling write multiple times and 777 instead of all at once, calling write multiple times and
780 close once at the very end 778 close once at the very end
781 */ 779 */
782 gaim_conv_custom_smiley_write(conv, slpcall->data_info, data, size); 780 gaim_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
783 gaim_conv_custom_smiley_close(conv, slpcall->data_info); 781 gaim_conv_custom_smiley_close(conv, slpcall->data_info );
784 }
785 #ifdef MSN_DEBUG_UD 782 #ifdef MSN_DEBUG_UD
786 gaim_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); 783 gaim_debug_info("msn", "Got smiley: %s\n", slpcall->data_info);
787 #endif 784 #endif
788 } 785 }
789 786