cpw.malu.xmpp.jingle_ft: 518b31c1: Move some duplicate code to its own func...

malu at pidgin.im malu at pidgin.im
Mon Mar 16 18:07:24 EDT 2009


-----------------------------------------------------------------
Revision: 518b31c1c113e4cfda3ac52a6df8d781339512b3
Ancestor: 5127ab1efe46614323d5d7cb66c156744add680a
Author: malu at pidgin.im
Date: 2009-03-16T22:02:00
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/518b31c1c113e4cfda3ac52a6df8d781339512b3

Modified files:
        libpurple/protocols/jabber/jingle/file-transfer.c

ChangeLog: 

Move some duplicate code to its own function

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	7ef67938e0c92232593ab91261651c00a48159b1
+++ libpurple/protocols/jabber/jingle/file-transfer.c	74f5099cff4a9d6a86d493f1433fb5cf7ee73101
@@ -166,61 +166,63 @@ static void
 }
 
 static void
+jingle_file_transfer_close_ibb_fp(JingleContent *content)
+{
+	FILE *ibb_fp = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->ibb_fp;
+
+	if (ibb_fp)
+		fclose(ibb_fp);
+}
+
+static void
 jingle_file_transfer_cancel_remote(JingleContent *content)
 {
 	PurpleXfer *xfer = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer;
-	FILE *ibb_fp = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->ibb_fp;
-	
+
 	purple_debug_info("jingle-ft", "cancel remote transfer\n");
 	if (xfer) {
 		jabber_iq_send(jingle_session_to_packet(
 			jingle_content_get_session(content), JINGLE_SESSION_TERMINATE));
 		purple_xfer_cancel_remote(xfer);
 	}
-	if (ibb_fp) {
-		fclose(ibb_fp);
-	}
+
+	jingle_file_transfer_close_ibb_fp(content);
 }
 
 static void
 jingle_file_transfer_cancel_local(JingleContent *content)
 {
 	PurpleXfer *xfer = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer;
-	FILE *ibb_fp = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->ibb_fp;
-	
+
 	purple_debug_info("jingle-ft", "cancel local trasfer\n");
 	if (xfer) {
 		jabber_iq_send(jingle_session_to_packet(
 			jingle_content_get_session(content), JINGLE_SESSION_TERMINATE));
 		purple_xfer_cancel_local(xfer);
 	}
-	if (ibb_fp) {
-		fclose(ibb_fp);
-	}
+
+	jingle_file_transfer_close_ibb_fp(content);
 }
 
 static void
 jingle_file_transfer_success(JingleContent *content)
 {
 	PurpleXfer *xfer = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer;
-	FILE *ibb_fp = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->ibb_fp;
-	
+
 	purple_debug_info("jingle-ft", "transfer received successful!\n");
 	if (xfer) {
 		purple_xfer_set_completed(xfer, TRUE);
 		purple_xfer_end(xfer);
 	}
-	if (ibb_fp) {
-		fclose(ibb_fp);
-	}
+
+	jingle_file_transfer_close_ibb_fp(content);
 }
 
 static void
 jingle_file_transfer_end(JingleContent *content)
 {
 	PurpleXfer *xfer = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer;
-	FILE *ibb_fp = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->ibb_fp;
-	
+
 	purple_debug_info("jingle-ft", "ending transfer\n");
 	if (xfer) {
 		jabber_iq_send(jingle_session_to_packet(jingle_content_get_session(content), 
@@ -228,9 +230,8 @@ jingle_file_transfer_end(JingleContent *
 		purple_xfer_set_completed(xfer, TRUE);
 		purple_xfer_end(xfer);
 	}
-	if (ibb_fp) {
-		fclose(ibb_fp);
-	}
+
+	jingle_file_transfer_close_ibb_fp(content);
 }
 
 static void


More information about the Commits mailing list