Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 9466:d27156c9c876
[gaim-migrate @ 10291]
(21:36:44) datallah: anyway... i added "Send File" to the prpl core
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 07 Jul 2004 01:49:39 +0000 |
parents | 9a654ab734fe |
children | 7a65fdba750f |
comparison
equal
deleted
inserted
replaced
9465:8a4797a608ae | 9466:d27156c9c876 |
---|---|
1920 xfer->fd = 0; | 1920 xfer->fd = 0; |
1921 gaim_xfer_set_completed(xfer, TRUE); | 1921 gaim_xfer_set_completed(xfer, TRUE); |
1922 } | 1922 } |
1923 } | 1923 } |
1924 | 1924 |
1925 static void oscar_ask_sendfile(GaimBlistNode *node, gpointer data) { | 1925 static gboolean oscar_can_receive_file(GaimConnection *gc, const char *who) { |
1926 | 1926 gboolean can_receive = FALSE; |
1927 GaimBuddy *buddy; | 1927 OscarData *od = gc->proto_data; |
1928 GaimConnection *gc; | 1928 |
1929 if (!od->icq) { | |
1930 aim_userinfo_t *userinfo; | |
1931 userinfo = aim_locate_finduserinfo(od->sess, who); | |
1932 if (userinfo && userinfo->capabilities & AIM_CAPS_SENDFILE) | |
1933 can_receive = TRUE; | |
1934 } | |
1935 | |
1936 return can_receive; | |
1937 } | |
1938 | |
1939 static void oscar_send_file(GaimConnection *gc, const char *who, const char *file) { | |
1929 | 1940 |
1930 OscarData *od; | 1941 OscarData *od; |
1931 GaimXfer *xfer; | 1942 GaimXfer *xfer; |
1932 struct aim_oft_info *oft_info; | 1943 struct aim_oft_info *oft_info; |
1933 const char *ip; | 1944 const char *ip; |
1934 | 1945 |
1935 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | |
1936 | |
1937 buddy = (GaimBuddy *) node; | |
1938 gc = gaim_account_get_connection(buddy->account); | |
1939 od = (OscarData *)gc->proto_data; | 1946 od = (OscarData *)gc->proto_data; |
1940 | 1947 |
1941 /* You want to send a file to someone else, you're so generous */ | 1948 /* You want to send a file to someone else, you're so generous */ |
1942 | 1949 |
1943 /* Build the file transfer handle */ | 1950 /* Build the file transfer handle */ |
1944 xfer = gaim_xfer_new(buddy->account, GAIM_XFER_SEND, buddy->name); | 1951 xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, who); |
1945 | 1952 |
1946 /* Create the oscar-specific data */ | 1953 /* Create the oscar-specific data */ |
1947 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); | 1954 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); |
1948 oft_info = aim_oft_createinfo(od->sess, NULL, buddy->name, ip, 0, 0, 0, NULL); | 1955 oft_info = aim_oft_createinfo(od->sess, NULL, who, ip, 0, 0, 0, NULL); |
1949 xfer->data = oft_info; | 1956 xfer->data = oft_info; |
1950 | 1957 |
1951 /* Setup our I/O op functions */ | 1958 /* Setup our I/O op functions */ |
1952 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_send); | 1959 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_send); |
1953 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | 1960 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
1957 | 1964 |
1958 /* Keep track of this transfer for later */ | 1965 /* Keep track of this transfer for later */ |
1959 od->file_transfers = g_slist_append(od->file_transfers, xfer); | 1966 od->file_transfers = g_slist_append(od->file_transfers, xfer); |
1960 | 1967 |
1961 /* Now perform the request */ | 1968 /* Now perform the request */ |
1962 gaim_xfer_request(xfer); | 1969 if (file) |
1970 gaim_xfer_request_accepted(xfer, file); | |
1971 else | |
1972 gaim_xfer_request(xfer); | |
1963 } | 1973 } |
1964 | 1974 |
1965 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { | 1975 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
1966 GaimConnection *gc = sess->aux_data; | 1976 GaimConnection *gc = sess->aux_data; |
1967 OscarData *od = gc->proto_data; | 1977 OscarData *od = gc->proto_data; |
6768 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { | 6778 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { |
6769 act = gaim_blist_node_action_new(_("Direct IM"), | 6779 act = gaim_blist_node_action_new(_("Direct IM"), |
6770 oscar_ask_direct_im, NULL); | 6780 oscar_ask_direct_im, NULL); |
6771 m = g_list_append(m, act); | 6781 m = g_list_append(m, act); |
6772 } | 6782 } |
6773 | 6783 #if 0 |
6774 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { | 6784 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { |
6775 act = gaim_blist_node_action_new(_("Send File"), | 6785 act = gaim_blist_node_action_new(_("Send File"), |
6776 oscar_ask_sendfile, NULL); | 6786 oscar_ask_sendfile, NULL); |
6777 m = g_list_append(m, act); | 6787 m = g_list_append(m, act); |
6778 } | 6788 } |
6779 #if 0 | |
6780 if (userinfo->capabilities & AIM_CAPS_GETFILE) { | 6789 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
6781 act = gaim_blist_node_action_new(_("Get File"), | 6790 act = gaim_blist_node_action_new(_("Get File"), |
6782 oscar_ask_getfile, NULL); | 6791 oscar_ask_getfile, NULL); |
6783 m = g_list_append(m, act); | 6792 m = g_list_append(m, act); |
6784 } | 6793 } |
7208 NULL, | 7217 NULL, |
7209 NULL, | 7218 NULL, |
7210 NULL, | 7219 NULL, |
7211 NULL, | 7220 NULL, |
7212 NULL, | 7221 NULL, |
7213 NULL | 7222 NULL, |
7223 oscar_can_receive_file, | |
7224 oscar_send_file | |
7214 }; | 7225 }; |
7215 | 7226 |
7216 static GaimPluginInfo info = | 7227 static GaimPluginInfo info = |
7217 { | 7228 { |
7218 GAIM_PLUGIN_API_VERSION, /**< api_version */ | 7229 GAIM_PLUGIN_API_VERSION, /**< api_version */ |