Mercurial > pidgin.yaz
changeset 25213:be762644486f
Actually close the assoiciated jsx when closing an IBB session.
This also ensures the file we're writing to is actually closes (this might
be what caused a truncated received file on Windows.).
Change g_fopen/g_fclose to fopen/fclose (these are glib 2.6+).
Some additional debug output
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Sat, 27 Sep 2008 19:39:17 +0000 |
parents | 87a206ca018f |
children | cd4a5275ba06 |
files | libpurple/protocols/jabber/ibb.c libpurple/protocols/jabber/si.c |
diffstat | 2 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/ibb.c Tue Sep 23 17:55:53 2008 +0000 +++ b/libpurple/protocols/jabber/ibb.c Sat Sep 27 19:39:17 2008 +0000 @@ -328,6 +328,9 @@ { JabberIBBSessionState state = jabber_ibb_session_get_state(sess); + purple_debug_info("jabber", "sending data block of %d bytes on IBB stream\n", + size); + if (state != JABBER_IBB_SESSION_OPENED) { purple_debug_error("jabber", "trying to send data on a non-open IBB session\n"); @@ -408,10 +411,14 @@ g_free(base64); if (rawdata) { + purple_debug_info("jabber", + "got %d bytes of data on IBB stream\n", size); if (size > jabber_ibb_session_get_block_size(sess)) { purple_debug_error("jabber", "IBB: received a too large packet\n"); } else { + purple_debug_info("jabber", + "calling IBB callback for received data\n"); sess->data_received_cb(sess, rawdata, size); } g_free(rawdata);
--- a/libpurple/protocols/jabber/si.c Tue Sep 23 17:55:53 2008 +0000 +++ b/libpurple/protocols/jabber/si.c Sat Sep 27 19:39:17 2008 +0000 @@ -959,6 +959,7 @@ purple_xfer_end(xfer); } else { purple_xfer_set_completed(xfer, TRUE); + jabber_si_xfer_free(xfer); } } @@ -970,6 +971,7 @@ JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; if (size <= purple_xfer_get_bytes_remaining(xfer)) { + purple_debug_info("jabber", "about to write %d bytes from IBB stream\n"); fwrite(data, size, 1, jsx->fp); purple_xfer_set_bytes_sent(xfer, purple_xfer_get_bytes_sent(xfer) + size); purple_xfer_update_progress(xfer); @@ -1008,7 +1010,7 @@ jabber_si_xfer_ibb_error_cb); /* open the file to write to */ - jsx->fp = g_fopen(purple_xfer_get_local_filename(xfer), "w"); + jsx->fp = fopen(purple_xfer_get_local_filename(xfer), "w"); jsx->ibb_session = sess; @@ -1060,6 +1062,7 @@ /* close the session */ jabber_ibb_session_close(sess); purple_xfer_set_completed(xfer, TRUE); + jabber_si_xfer_free(xfer); } else { /* send more... */ jabber_si_xfer_ibb_send_data(sess); @@ -1075,7 +1078,7 @@ purple_xfer_start(xfer, 0, NULL, 0); purple_xfer_set_bytes_sent(xfer, 0); purple_xfer_update_progress(xfer); - jsx->fp = g_fopen(purple_xfer_get_local_filename(xfer), "r"); + jsx->fp = fopen(purple_xfer_get_local_filename(xfer), "r"); jabber_si_xfer_ibb_send_data(sess); } @@ -1255,7 +1258,7 @@ g_free(jsx); xfer->data = NULL; - purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p", jsx); + purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p\n", jsx); } static void jabber_si_xfer_cancel_send(PurpleXfer *xfer)