changeset 4832:edfe778868e2

[gaim-migrate @ 5157] This is mainly a fix for a crash when signing off within maybe half a second that of when a user in your buddy list signed on. I just had neglected to remove a timer. It also includes some shuffling around of some file transfer #defines. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 19 Mar 2003 22:09:24 +0000
parents cd60c41e6e4a
children a6960b4b0c9b
files src/protocols/oscar/aim.h src/protocols/oscar/aim_cbtypes.h src/protocols/oscar/ft.c src/protocols/oscar/oscar.c
diffstat 4 files changed, 49 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Wed Mar 19 05:20:02 2003 +0000
+++ b/src/protocols/oscar/aim.h	Wed Mar 19 22:09:24 2003 +0000
@@ -996,7 +996,7 @@
 struct aim_oft_info {
 	char cookie[8];
 	char ip[30];
-	struct aim_fileheader_t *fh;
+	struct aim_fileheader_t fh;
 	struct aim_oft_info *next;
 };
 
@@ -1009,6 +1009,7 @@
 faim_export aim_conn_t *aim_odc_getconn(aim_session_t *sess, const char *sn);
 faim_export aim_conn_t *aim_odc_initiate(aim_session_t *sess, const char *sn);
 faim_export aim_conn_t *aim_odc_connect(aim_session_t *sess, const char *sn, const char *addr, const fu8_t *cookie);
+faim_export struct aim_oft_info *aim_oft_createnewheader(fu8_t *cookie, char *ip, fu32_t size, fu32_t modtime, char *filename);
 faim_export aim_conn_t *aim_sendfile_listen(aim_session_t *sess, const fu8_t *cookie, const fu8_t *ip, fu16_t port);
 faim_export int aim_oft_sendheader(aim_session_t *sess, aim_conn_t *conn, fu16_t type, const fu8_t *cookie, const char *filename, fu16_t filesdone, fu16_t numfiles, fu32_t size, fu32_t totsize, fu32_t modtime, fu32_t checksum, fu8_t flags, fu32_t bytesreceived, fu32_t recvcsum);
 
--- a/src/protocols/oscar/aim_cbtypes.h	Wed Mar 19 05:20:02 2003 +0000
+++ b/src/protocols/oscar/aim_cbtypes.h	Wed Mar 19 22:09:24 2003 +0000
@@ -254,47 +254,32 @@
 /*
  * OFT Services
  *
- * See non-SNAC note below.
+ * For all of the above #defines, the number is the subtype 
+ * of the SNAC.  For OFT #defines, the number is the 
+ * "hdrtype" which comes after the magic string and OFT 
+ * packet length.
+ *
+ * I'm pretty sure the ODC ones are arbitrary right now, 
+ * that should be changed.
  */
-#define AIM_CB_OFT_DIRECTIMCONNECTREQ 0x0001/* connect request -- actually an OSCAR CAP */
+#define AIM_CB_OFT_DIRECTIMCONNECTREQ 0x0001	/* connect request -- actually an OSCAR CAP */
 #define AIM_CB_OFT_DIRECTIMINCOMING 0x0002
 #define AIM_CB_OFT_DIRECTIMDISCONNECT 0x0003
 #define AIM_CB_OFT_DIRECTIMTYPING 0x0004
 #define AIM_CB_OFT_DIRECTIM_ESTABLISHED 0x0005
 
-#if 0
-/* Are this arbitrary?! */
-#define AIM_CB_OFT_GETFILECONNECTREQ 0x0006	/* connect request -- actually an OSCAR CAP */
-#define AIM_CB_OFT_GETFILELISTINGREQ 0x0007	/* OFT listing.txt request */
-#define AIM_CB_OFT_GETFILEFILEREQ 0x0008	/* received file request */
-#define AIM_CB_OFT_GETFILEFILESEND 0x0009	/* received file request confirm -- send data */
-#define AIM_CB_OFT_GETFILECOMPLETE 0x000a	/* received file send complete*/
-#define AIM_CB_OFT_GETFILE_ESTABLISHED 0x000b	/* request for file get acknowledge */
-#define AIM_CB_OFT_GETFILEDISCONNECT 0x000c	/* OFT connection disconnected.*/
-#define AIM_CB_OFT_GETFILELISTING 0x000d	/* OFT listing.txt received.*/
-#define AIM_CB_OFT_GETFILERECEIVE 0x000e	/* OFT file incoming.*/
-#define AIM_CB_OFT_GETFILELISTINGRXCONFIRM 0x000f
-#define AIM_CB_OFT_GETFILESTATE4 0x0010
-#endif
-
-#define AIM_CB_OFT_SENDFILE_REQUEST 0x0011	/* started receiving file */
-#define AIM_CB_OFT_SENDFILE_SEND 0x0012		/* buddy ready to for us to send */
-#define AIM_CB_OFT_SENDFILE_COMPLETE 0x0013	/* send to buddy complete */
-#define AIM_CB_OFT_SENDFILE_RESUME 0x0015	/* somethin' */
-
-#define AIM_CB_OFT_PROMPT 0x0101		/* Just connected to another buddy, receiver sends this */
+#define AIM_CB_OFT_PROMPT 0x0101		/* "I am going to send you this file, is that ok?" */
 #define AIM_CB_OFT_RESUMESOMETHING 0x0106	/* I really don't know */
-#define AIM_CB_OFT_ACK 0x0202			/* Just after receiving the prompt, sender sends this */
-#define AIM_CB_OFT_DONE 0x0204			/* After a transfer is complete, sender sends this */
-#define AIM_CB_OFT_RESUME 0x0205		/* Resume transferring, send by whoever paused? */
+#define AIM_CB_OFT_ACK 0x0202			/* "Yes, it is ok for you to send me that file" */
+#define AIM_CB_OFT_DONE 0x0204			/* "I received that file with no problems, thanks a bunch" */
+#define AIM_CB_OFT_RESUME 0x0205		/* Resume transferring, sent by whoever paused? */
 #define AIM_CB_OFT_RESUMEACK 0x0207		/* Not really sure */
 
-#define AIM_CB_OFT_GETFILE_REQUESTLISTING 0x1108 /* request a listing.txt file from the remote user */
-#define AIM_CB_OFT_GETFILE_SENDLISTING 0x1208	/* we're going to send a listing.txt file */
-#define AIM_CB_OFT_GETFILE_RECEIVELISTING 0x1209 /* the other dude sent us a listing.txt file */
-#define AIM_CB_OFT_GETFILE_RECEIVEDLISTING 0x120a /* we received a listing.txt file, thanks */ /* I'm just guessing about this one... */
-#define AIM_CB_OFT_GETFILE_ACKLISTING 0x120b	/* other user received the listing.txt file, yay */
-#define AIM_CB_OFT_GETFILE_REQUESTFILE 0x120c	/* request a specific file from the remote user */
+#define AIM_CB_OFT_GETFILE_REQUESTLISTING 0x1108 /* "I have a listing.txt file, do you want it?" */
+#define AIM_CB_OFT_GETFILE_RECEIVELISTING 0x1209 /* "Yes, please send me your listing.txt file" */
+#define AIM_CB_OFT_GETFILE_RECEIVEDLISTING 0x120a /* received corrupt listing.txt file? */ /* I'm just guessing about this one... */
+#define AIM_CB_OFT_GETFILE_ACKLISTING 0x120b	/* "I received the listing.txt file successfully" */
+#define AIM_CB_OFT_GETFILE_REQUESTFILE 0x120c	/* "Please send me this file" */
 
 #define AIM_CB_OFT_ESTABLISHED 0xFFFF		/* connection to buddy initiated */
 
--- a/src/protocols/oscar/ft.c	Wed Mar 19 05:20:02 2003 +0000
+++ b/src/protocols/oscar/ft.c	Wed Mar 19 22:09:24 2003 +0000
@@ -824,6 +824,32 @@
 	return 0;
 }
 
+faim_export struct aim_oft_info *aim_oft_createnewheader(fu8_t *cookie, char *ip, fu32_t size, fu32_t modtime, char *filename)
+{
+	struct aim_oft_info *new;
+
+	if (!(new = (struct aim_oft_info *)calloc(1, sizeof(struct aim_oft_info))))
+		return NULL;
+
+	if (cookie && (sizeof(cookie) == 8)) {
+		memcpy(new->cookie, cookie, 8);
+		memcpy(new->fh.bcookie, cookie, 8);
+	}
+	if (ip)
+		strncpy(new->ip, ip, 30);
+	new->fh.filesleft = 0;
+	new->fh.totparts = 1;
+	new->fh.partsleft = 1;
+	new->fh.totsize = size;
+	new->fh.size = size;
+	new->fh.modtime = modtime;
+	strcpy(new->fh.idstring, "OFT_Windows ICBMFT V1.1 32");
+	if (filename)
+		strncpy(new->fh.name, filename, 64);
+
+	return new;
+}
+
 /**
  * Create an OFT packet based on the given information, and send it on its merry way.
  *
--- a/src/protocols/oscar/oscar.c	Wed Mar 19 05:20:02 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Mar 19 22:09:24 2003 +0000
@@ -669,6 +669,10 @@
 		gaim_input_remove(od->emlpa);
 	if (od->icopa > 0)
 		gaim_input_remove(od->icopa);
+	if (od->icopa > 0)
+		gaim_input_remove(od->icopa);
+	if (od->icontimer)
+		g_source_remove(od->icontimer);
 	aim_session_kill(od->sess);
 	g_free(od->sess);
 	od->sess = NULL;