From: Sean E. <sea...@us...> - 2002-03-12 17:24:49
|
Update of /cvsroot/gaim/gaim/src/protocols/oscar In directory usw-pr-cvs1:/tmp/cvs-serv29919/src/protocols/oscar Modified Files: aim.h aim_cbtypes.h ft.c oscar.c Log Message: Laying the ground work for image send. Also an IRC fix. Index: aim.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/aim.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- aim.h 7 Mar 2002 02:19:36 -0000 1.34 +++ aim.h 12 Mar 2002 17:21:44 -0000 1.35 @@ -249,8 +249,8 @@ */ typedef struct aim_bstream_s { fu8_t *data; - fu16_t len; - fu16_t offset; + fu32_t len; + fu32_t offset; } aim_bstream_t; typedef struct aim_frame_s { @@ -838,7 +838,7 @@ faim_export int aim_send_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum); faim_export fu16_t aim_iconsum(const fu8_t *buf, int buflen); faim_export int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing); -faim_export int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg); +faim_export int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len); faim_export const char *aim_directim_getsn(aim_conn_t *conn); faim_export aim_conn_t *aim_directim_initiate(aim_session_t *, const char *destsn); faim_export aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const fu8_t *cookie); Index: aim_cbtypes.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/aim_cbtypes.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- aim_cbtypes.h 2 Mar 2002 04:52:21 -0000 1.7 +++ aim_cbtypes.h 12 Mar 2002 17:21:44 -0000 1.8 @@ -254,7 +254,7 @@ #define AIM_CB_SPECIAL_CONNCOMPLETE 0x0004 #define AIM_CB_SPECIAL_FLAPVER 0x0005 #define AIM_CB_SPECIAL_CONNINITDONE 0x0006 -#define AIM_CB_SPECIAL_DOWNLOADIMAGE 0x007 +#define AIM_CB_SPECIAL_IMAGETRANSFER 0x007 #define AIM_CB_SPECIAL_UNKNOWN 0xffff #define AIM_CB_SPECIAL_DEFAULT AIM_CB_SPECIAL_UNKNOWN Index: ft.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/ft.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ft.c 6 Mar 2002 00:18:02 -0000 1.15 +++ ft.c 12 Mar 2002 17:21:44 -0000 1.16 @@ -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); } Index: oscar.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/oscar/oscar.c,v retrieving revision 1.112 retrieving revision 1.113 diff -u -d -r1.112 -r1.113 --- oscar.c 11 Mar 2002 23:02:54 -0000 1.112 +++ oscar.c 12 Mar 2002 17:21:44 -0000 1.113 @@ -1273,7 +1273,7 @@ gaim_directim_incoming, 0); aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_directim_typing, 0); - aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DOWNLOADIMAGE, + aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_update_ui, 0); for (i = 0; i < (int)strlen(d->ip); i++) { if (d->ip[i] == ':') { @@ -2424,13 +2424,13 @@ return 0; } -static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int imflags) { +static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) { struct oscar_data *odata = (struct oscar_data *)gc->proto_data; struct direct_im *dim = find_direct_im(odata, name); int ret = 0; if (dim) { if (dim->connected) { /* If we're not connected yet, send through server */ - ret = aim_send_im_direct(odata->sess, dim->conn, message); + ret = aim_send_im_direct(odata->sess, dim->conn, message, len == -1 ? strlen(len) : len); if (ret == 0) return 1; else return ret; @@ -3146,7 +3146,7 @@ gaim_directim_incoming, 0); aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_directim_typing, 0); - aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DOWNLOADIMAGE, + aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_update_ui, 0); return 1; } |