cpw.malu.xmpp.ibb_ft: b14d9102: disapproval of revision '3de5eea95915177...

malu at pidgin.im malu at pidgin.im
Wed Jan 14 13:56:51 EST 2009


-----------------------------------------------------------------
Revision: b14d9102960332bef86e0e45b9e3e977ea509a72
Ancestor: 3de5eea959151773885ba601f681aec2431dd47d
Author: malu at pidgin.im
Date: 2009-01-14T18:53:28
Branch: im.pidgin.cpw.malu.xmpp.ibb_ft
URL: http://d.pidgin.im/viewmtn/revision/info/b14d9102960332bef86e0e45b9e3e977ea509a72

Modified files:
        libpurple/protocols/jabber/si.c

ChangeLog: 

disapproval of revision '3de5eea959151773885ba601f681aec2431dd47d'
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c	bd2e04fbe3b1b1f7fb82c66991ebb90340f91c4b
+++ libpurple/protocols/jabber/si.c	dbb250a80fdf7f556d7ba080ffa2ded30cd1605f
@@ -1029,14 +1029,21 @@ jabber_si_xfer_ibb_open_cb(JabberStream 
 		JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
 		JabberIBBSession *sess = 
 			jabber_ibb_session_create_from_xmlnode(js, packet, xfer);
+		const char *filename;
 
 		jabber_si_bytestreams_ibb_timeout_remove(jsx);
 
 		if (sess) {
-			jsx->fp = xfer->dest_fp;
-			xfer->dest_fp = NULL;
-			/* the FD we get from xfer should never be NULL (see ft.c) */
-			
+			/* open the file to write to */
+			filename = purple_xfer_get_local_filename(xfer);
+			jsx->fp = g_fopen(filename, "wb");
+			if (jsx->fp == NULL) {
+				purple_debug_error("jabber", "failed to open file %s for writing: %s\n",
+					filename, g_strerror(errno));
+				purple_xfer_cancel_remote(xfer);
+				return FALSE;
+			}
+
 			/* setup callbacks here...*/
 			jabber_ibb_session_set_data_received_callback(sess,
 				jabber_si_xfer_ibb_recv_data_cb);
@@ -1118,10 +1125,18 @@ jabber_si_xfer_ibb_opened_cb(JabberIBBSe
 	PurpleAccount *account = purple_connection_get_account(gc);
 
 	if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_OPENED) {
-		jsx->fp = xfer->dest_fp;
-		xfer->dest_fp = NULL; /* disable double fclose */
-		/* the FD we get from xfer should never be NULL (see ft.c) */
-		
+		const char *filename = purple_xfer_get_local_filename(xfer);
+		jsx->fp = g_fopen(filename, "rb");
+		if (jsx->fp == NULL) {
+			purple_debug_error("jabber", "Failed to open file %s for reading: %s\n",
+				filename, g_strerror(errno));
+			purple_xfer_error(purple_xfer_get_type(xfer), account,
+				jabber_ibb_session_get_who(sess),
+				_("Failed to open the file"));
+			purple_xfer_cancel_local(xfer);
+			return;
+		}
+
 		purple_xfer_start(xfer, 0, NULL, 0);
 		purple_xfer_set_bytes_sent(xfer, 0);
 		purple_xfer_update_progress(xfer);


More information about the Commits mailing list