diff src/protocols/oscar/ft.c @ 3033:1143524a2eaf

[gaim-migrate @ 3046] Laying the ground work for image send. Also an IRC fix. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 12 Mar 2002 17:21:46 +0000
parents 08327a2f25aa
children 9682c0e022c6
line wrap: on
line diff
--- a/src/protocols/oscar/ft.c	Tue Mar 12 02:44:22 2002 +0000
+++ b/src/protocols/oscar/ft.c	Tue Mar 12 17:21:46 2002 +0000
@@ -181,12 +181,13 @@
  * aim_send_im_direct - send IM client-to-client over established connection
  * @sess: session to conn
  * @conn: directim connection
- * @msg: null-terminated string to send. 
+ * @msg:  null-terminated string to send. 
+ * len:   The length of the message to send, including binary data.
  * 
  * Call this just like you would aim_send_im, to send a directim. You
  * _must_ have previously established the directim connection.
  */
-faim_export int aim_send_im_direct(aim_session_t *sess, aim_conn_t *conn, const char *msg)
+faim_export int aim_send_im_direct(aim_session_t *sess, aim_conn_t *conn, const char *msg, int len)
 {
 	struct aim_directim_intdata *intdata = (struct aim_directim_intdata *)conn->internal;
 	aim_frame_t *fr;
@@ -195,7 +196,7 @@
 	if (!sess || !conn || !msg || (conn->type != AIM_CONN_TYPE_RENDEZVOUS)) 
 		return -EINVAL; 
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_OFT, 0x01, strlen(msg))))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_OFT, 0x01, len)))
 		return -ENOMEM;	
 
 	memcpy(fr->hdr.oft.magic, "ODC2", 4);
@@ -216,7 +217,7 @@
 	aimbs_put16(&hdrbs, 0x0000);
 	aimbs_put16(&hdrbs, 0x0000);
 	aimbs_put16(&hdrbs, 0x0000);
-	aimbs_put32(&hdrbs, strlen(msg));
+	aimbs_put32(&hdrbs, len);
 	aimbs_put16(&hdrbs, 0x0000);
 	aimbs_put16(&hdrbs, 0x0000);
 	aimbs_put16(&hdrbs, 0x0000);
@@ -251,7 +252,7 @@
 	i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x393e);
 	i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0xcac8);
 #endif
-	aimbs_putraw(&fr->data, msg, strlen(msg));
+	aimbs_putraw(&fr->data, msg, len);
 	
 	aim_tx_enqueue(sess, fr);
 	
@@ -1121,7 +1122,7 @@
 			}
 			recvd = recvd + i;
 			msg2 = msg2 + i;
-			if ((userfunc=aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DOWNLOADIMAGE)))
+			if ((userfunc=aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER)))
 				userfunc(sess, &fr, snptr, (double)recvd / payloadlength);
 		}