Mercurial > pidgin
comparison libpurple/protocols/msn/slpcall.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 867104ed576a |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
111 slpcall->end_cb(slpcall, slpcall->slplink->session); | 111 slpcall->end_cb(slpcall, slpcall->slplink->session); |
112 | 112 |
113 if (slpcall->xfer != NULL) { | 113 if (slpcall->xfer != NULL) { |
114 if (purple_xfer_get_type(slpcall->xfer) == PURPLE_XFER_RECEIVE) | 114 if (purple_xfer_get_type(slpcall->xfer) == PURPLE_XFER_RECEIVE) |
115 g_byte_array_free(slpcall->u.incoming_data, TRUE); | 115 g_byte_array_free(slpcall->u.incoming_data, TRUE); |
116 slpcall->xfer->data = NULL; | 116 purple_xfer_set_protocol_data(slpcall->xfer, NULL); |
117 purple_xfer_unref(slpcall->xfer); | 117 purple_xfer_unref(slpcall->xfer); |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 msn_slplink_remove_slpcall(slpcall->slplink, slpcall); | 121 msn_slplink_remove_slpcall(slpcall->slplink, slpcall); |
483 } else if (type == MSN_OBJECT_USERTILE) { | 483 } else if (type == MSN_OBJECT_USERTILE) { |
484 img = msn_object_get_image(obj); | 484 img = msn_object_get_image(obj); |
485 if (img) | 485 if (img) |
486 purple_imgstore_ref(img); | 486 purple_imgstore_ref(img); |
487 } | 487 } |
488 msn_object_destroy(obj); | 488 msn_object_destroy(obj, FALSE); |
489 | 489 |
490 if (img != NULL) { | 490 if (img != NULL) { |
491 /* DATA PREP */ | 491 /* DATA PREP */ |
492 slpmsg = msn_slpmsg_dataprep_new(slpcall); | 492 slpmsg = msn_slpmsg_dataprep_new(slpcall); |
493 msn_slplink_queue_slpmsg(slplink, slpmsg); | 493 msn_slplink_queue_slpmsg(slplink, slpmsg); |
510 PurpleAccount *account; | 510 PurpleAccount *account; |
511 PurpleXfer *xfer; | 511 PurpleXfer *xfer; |
512 MsnFileContext *file_context; | 512 MsnFileContext *file_context; |
513 char *buf; | 513 char *buf; |
514 gsize bin_len; | 514 gsize bin_len; |
515 guint32 file_size; | |
516 char *file_name; | 515 char *file_name; |
517 | 516 |
518 account = slpcall->slplink->session->account; | 517 account = slpcall->slplink->session->account; |
519 | 518 |
520 slpcall->end_cb = msn_xfer_end_cb; | 519 slpcall->end_cb = msn_xfer_end_cb; |
527 | 526 |
528 buf = (char *)purple_base64_decode(context, &bin_len); | 527 buf = (char *)purple_base64_decode(context, &bin_len); |
529 file_context = msn_file_context_from_wire(buf, bin_len); | 528 file_context = msn_file_context_from_wire(buf, bin_len); |
530 | 529 |
531 if (file_context != NULL) { | 530 if (file_context != NULL) { |
532 file_size = file_context->file_size; | |
533 | |
534 file_name = g_convert((const gchar *)&file_context->file_name, | 531 file_name = g_convert((const gchar *)&file_context->file_name, |
535 MAX_FILE_NAME_LEN * 2, | 532 MAX_FILE_NAME_LEN * 2, |
536 "UTF-8", "UTF-16LE", | 533 "UTF-8", "UTF-16LE", |
537 NULL, NULL, NULL); | 534 NULL, NULL, NULL); |
538 | 535 |
539 purple_xfer_set_filename(xfer, file_name ? file_name : ""); | 536 purple_xfer_set_filename(xfer, file_name ? file_name : ""); |
540 g_free(file_name); | 537 g_free(file_name); |
541 purple_xfer_set_size(xfer, file_size); | 538 purple_xfer_set_size(xfer, file_context->file_size); |
542 purple_xfer_set_init_fnc(xfer, msn_xfer_init); | 539 purple_xfer_set_init_fnc(xfer, msn_xfer_init); |
543 purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); | 540 purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); |
544 purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); | 541 purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); |
545 purple_xfer_set_read_fnc(xfer, msn_xfer_read); | 542 purple_xfer_set_read_fnc(xfer, msn_xfer_read); |
546 purple_xfer_set_write_fnc(xfer, msn_xfer_write); | 543 purple_xfer_set_write_fnc(xfer, msn_xfer_write); |
548 slpcall->u.incoming_data = g_byte_array_new(); | 545 slpcall->u.incoming_data = g_byte_array_new(); |
549 | 546 |
550 slpcall->xfer = xfer; | 547 slpcall->xfer = xfer; |
551 purple_xfer_ref(slpcall->xfer); | 548 purple_xfer_ref(slpcall->xfer); |
552 | 549 |
553 xfer->data = slpcall; | 550 purple_xfer_set_protocol_data(xfer, slpcall); |
554 | 551 |
555 if (file_context->preview) { | 552 if (file_context->preview) { |
556 purple_xfer_set_thumbnail(xfer, file_context->preview, | 553 purple_xfer_set_thumbnail(xfer, file_context->preview, |
557 file_context->preview_len, | 554 file_context->preview_len, |
558 "image/png"); | 555 "image/png"); |
729 dc->remote_nonce[36] = '\0'; | 726 dc->remote_nonce[36] = '\0'; |
730 } | 727 } |
731 | 728 |
732 dc->listen_data = purple_network_listen_range( | 729 dc->listen_data = purple_network_listen_range( |
733 0, 0, | 730 0, 0, |
731 AF_UNSPEC, | |
734 SOCK_STREAM, | 732 SOCK_STREAM, |
733 TRUE, | |
735 msn_dc_listen_socket_created_cb, | 734 msn_dc_listen_socket_created_cb, |
736 dc | 735 dc |
737 ); | 736 ); |
738 | 737 |
739 if (dc->listen_data == NULL) { | 738 if (dc->listen_data == NULL) { |
830 g_free(slpcall->branch); | 829 g_free(slpcall->branch); |
831 slpcall->branch = rand_guid(); | 830 slpcall->branch = rand_guid(); |
832 | 831 |
833 dc->listen_data = purple_network_listen_range( | 832 dc->listen_data = purple_network_listen_range( |
834 0, 0, | 833 0, 0, |
834 AF_UNSPEC, | |
835 SOCK_STREAM, | 835 SOCK_STREAM, |
836 TRUE, | |
836 msn_dc_listen_socket_created_cb, | 837 msn_dc_listen_socket_created_cb, |
837 dc | 838 dc |
838 ); | 839 ); |
839 | 840 |
840 header = g_strdup_printf( | 841 header = g_strdup_printf( |
1139 slpcall->timer = 0; | 1140 slpcall->timer = 0; |
1140 } | 1141 } |
1141 | 1142 |
1142 if (slpcall->cb) | 1143 if (slpcall->cb) |
1143 slpcall->cb(slpcall, body, body_len); | 1144 slpcall->cb(slpcall, body, body_len); |
1144 | |
1145 slpcall->wasted = TRUE; | |
1146 } | 1145 } |
1147 } | 1146 } |
1148 else if (msn_p2p_info_is_ack(slpmsg->p2p_info)) | 1147 else if (msn_p2p_info_is_ack(slpmsg->p2p_info)) |
1149 { | 1148 { |
1150 /* Acknowledgement of previous message. Don't do anything currently. */ | 1149 /* Acknowledgement of previous message. Don't do anything currently. */ |