comparison src/protocols/oscar/oscar.c @ 12143:cbebda5f019c

[gaim-migrate @ 14444] SF Patch #1360399 from Evan Schoenberg (evands) "I discussed this previously with Mark and he said it'd be fine. This factors out the part of the send_file function which creates a new GaimXfer into a separate prpl function, new_xfer. It's called in each of the existing send_file functions. This is needed so that another client (okay, Adium) can get a new outgoing GaimXfer from a prpl without depending upon the specific ft.c logic of send_file; previously I was adding a duplicate method to each prpl and then calling it directly." I fixed a couple small bugs in this. Otherwise, it looks good, and seems like a reasonable libgaim request. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 19 Nov 2005 00:26:12 +0000
parents 980c877bd238
children 2de8b6772d00
comparison
equal deleted inserted replaced
12142:0c672be21798 12143:cbebda5f019c
2644 } 2644 }
2645 2645
2646 return can_receive; 2646 return can_receive;
2647 } 2647 }
2648 2648
2649 /* 2649 static GaimXfer*
2650 * Called by the Gaim core when the user indicates that a file is to be sent to 2650 oscar_new_xfer(GaimConnection *gc, const char *who) {
2651 * a special someone.
2652 */
2653 static void oscar_send_file(GaimConnection *gc, const char *who, const char *file) {
2654 OscarData *od; 2651 OscarData *od;
2655 GaimXfer *xfer; 2652 GaimXfer *xfer;
2656 struct aim_oft_info *oft_info; 2653 struct aim_oft_info *oft_info;
2657 const char *ip; 2654 const char *ip;
2658 gboolean use_rv_proxy; 2655 gboolean use_rv_proxy;
2675 xfer->remote_port = AIM_RV_PROXY_CONNECT_PORT; 2672 xfer->remote_port = AIM_RV_PROXY_CONNECT_PORT;
2676 oft_info = aim_oft_createinfo(od->sess, NULL /*cookie*/, who, 0 /*ip*/, 0, 0, 0, NULL, 2673 oft_info = aim_oft_createinfo(od->sess, NULL /*cookie*/, who, 0 /*ip*/, 0, 0, 0, NULL,
2677 AIM_XFER_SEND, AIM_XFER_PROXY, AIM_XFER_PROXY_STG1); 2674 AIM_XFER_SEND, AIM_XFER_PROXY, AIM_XFER_PROXY_STG1);
2678 oft_info->proxy_info = aim_rv_proxy_createinfo(oft_info->sess, NULL, 0); 2675 oft_info->proxy_info = aim_rv_proxy_createinfo(oft_info->sess, NULL, 0);
2679 /* We must create a cookie before the request is sent 2676 /* We must create a cookie before the request is sent
2680 * so that it can be sent to the proxy */ 2677 * so that it can be sent to the proxy */
2681 aim_icbm_makecookie(oft_info->cookie); 2678 aim_icbm_makecookie(oft_info->cookie);
2682 } else { 2679 } else {
2683 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); 2680 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1);
2684 oft_info = aim_oft_createinfo(od->sess, NULL, who, ip, 0, 0, 0, NULL, 2681 oft_info = aim_oft_createinfo(od->sess, NULL, who, ip, 0, 0, 0, NULL,
2685 AIM_XFER_SEND, AIM_XFER_DIRECT, AIM_XFER_PROXY_NONE); 2682 AIM_XFER_SEND, AIM_XFER_DIRECT, AIM_XFER_PROXY_NONE);
2696 gaim_xfer_set_request_denied_fnc(xfer, oscar_xfer_cancel_send); 2693 gaim_xfer_set_request_denied_fnc(xfer, oscar_xfer_cancel_send);
2697 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack_send); 2694 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack_send);
2698 2695
2699 /* Keep track of this transfer for later */ 2696 /* Keep track of this transfer for later */
2700 od->file_transfers = g_slist_append(od->file_transfers, xfer); 2697 od->file_transfers = g_slist_append(od->file_transfers, xfer);
2698
2699 return xfer;
2700 }
2701
2702 /*
2703 * Called by the Gaim core when the user indicates that a file is to be sent to
2704 * a special someone.
2705 */
2706 static void oscar_send_file(GaimConnection *gc, const char *who, const char *file) {
2707 GaimXfer *xfer = oscar_new_xfer(gc, who);
2701 2708
2702 /* Now perform the request */ 2709 /* Now perform the request */
2703 if (file) 2710 if (file)
2704 gaim_xfer_request_accepted(xfer, file); 2711 gaim_xfer_request_accepted(xfer, file);
2705 else 2712 else
8420 NULL, /* find_blist_chat */ 8427 NULL, /* find_blist_chat */
8421 NULL, /* roomlist_get_list */ 8428 NULL, /* roomlist_get_list */
8422 NULL, /* roomlist_cancel */ 8429 NULL, /* roomlist_cancel */
8423 NULL, /* roomlist_expand_category */ 8430 NULL, /* roomlist_expand_category */
8424 oscar_can_receive_file, /* can_receive_file */ 8431 oscar_can_receive_file, /* can_receive_file */
8425 oscar_send_file /* send_file */ 8432 oscar_send_file, /* send_file */
8433 oscar_new_xfer, /* new_xfer */
8434 NULL, /* whiteboard ops */
8435 NULL /* media ops */
8426 }; 8436 };
8427 8437
8428 static GaimPluginUiInfo prefs_info = { 8438 static GaimPluginUiInfo prefs_info = {
8429 get_plugin_pref_frame 8439 get_plugin_pref_frame
8430 }; 8440 };