diff src/protocols/oscar/oscar.c @ 7621:bfe3a796b2c2

[gaim-migrate @ 8245] Reverting the previous patch. Sorry, Juan. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 24 Nov 2003 03:05:16 +0000
parents 3e0404393761
children ea2d07ad05a9
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Mon Nov 24 02:45:53 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Nov 24 03:05:16 2003 +0000
@@ -1025,6 +1025,51 @@
 	gaim_xfer_request(xfer);
 }
 
+static void oscar_sendfile(GaimConnection *gc, const char *destsn, const char *file) {
+	OscarData *od = (OscarData *)gc->proto_data;
+	GaimXfer *xfer;
+	struct aim_oft_info *oft_info;
+
+	/* You want to send a file to someone else, you're so generous */
+
+	/* Build the file transfer handle */
+	xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn);
+	xfer->local_port = 5190;
+
+	/* Create the oscar-specific data */
+	oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL);
+	xfer->data = oft_info;
+
+	 /* Setup our I/O op functions */
+	gaim_xfer_set_init_fnc(xfer, oscar_xfer_init);
+	gaim_xfer_set_start_fnc(xfer, oscar_xfer_start);
+	gaim_xfer_set_end_fnc(xfer, oscar_xfer_end);
+	gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send);
+	gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv);
+	gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack);
+
+	/* Keep track of this transfer for later */
+	od->file_transfers = g_slist_append(od->file_transfers, xfer);
+
+	/* We don't need to request, since it has already been accepted */
+	gaim_xfer_request_accepted (xfer, g_strdup(file));
+}
+
+static gboolean oscar_has_sendfile (GaimConnection *gc, const char *who)
+{
+	GaimBuddy *b = gaim_find_buddy(gc->account, who);
+	aim_userinfo_t *userinfo;
+        OscarData *od = gc->proto_data;
+	
+	if (b)
+		userinfo = aim_locate_finduserinfo(od->sess, b->name);
+	else
+		return FALSE;
+
+	/* True if we can send files to this dude, false if we can't */
+	return userinfo->capabilities & AIM_CAPS_SENDFILE;
+}
+
 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
 	GaimConnection *gc = sess->aux_data;
 	OscarData *od = gc->proto_data;
@@ -6227,14 +6272,6 @@
 				pbm->gc = gc;
 				m = g_list_append(m, pbm);
 			}
-
-			if (userinfo->capabilities & AIM_CAPS_SENDFILE) {
-				pbm = g_new0(struct proto_buddy_menu, 1);
-				pbm->label = _("Send File");
-				pbm->callback = oscar_ask_sendfile;
-				pbm->gc = gc;
-				m = g_list_append(m, pbm);
-			}
 #if 0
 			if (userinfo->capabilities & AIM_CAPS_GETFILE) {
 				pbm = g_new0(struct proto_buddy_menu, 1);
@@ -6661,7 +6698,12 @@
 	NULL,
 	oscar_convo_closed,
 	NULL,
-	oscar_set_icon
+	oscar_set_icon,
+	NULL,
+	NULL,
+	oscar_ask_sendfile,
+	oscar_sendfile,
+	oscar_has_sendfile
 };
 
 static GaimPluginInfo info =