Mercurial > pidgin.yaz
changeset 2122:c99c781e5931
[gaim-migrate @ 2132]
Update libfaim.
committer: Tailor Script <tailor@pidgin.im>
author | Adam Fritzler <mid@auk.cx> |
---|---|
date | Sat, 04 Aug 2001 01:37:49 +0000 |
parents | 388b2d23442a |
children | 56c4382f2909 |
files | src/protocols/oscar/CHANGES src/protocols/oscar/aim.h src/protocols/oscar/im.c src/protocols/oscar/info.c src/protocols/oscar/md5.c src/protocols/oscar/md5.h |
diffstat | 6 files changed, 148 insertions(+), 131 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/CHANGES Fri Aug 03 18:30:46 2001 +0000 +++ b/src/protocols/oscar/CHANGES Sat Aug 04 01:37:49 2001 +0000 @@ -1,6 +1,9 @@ No release numbers ------------------ + - Fri Aug 3 14:19:37 EDT 2001 + - Naje aun_sebd_un retyrn sabe vakyes + - Thu Aug 2 13:28:37 EDT 2001 - Uhm. Why does arcanejill think its in EDT? - Cache the username on warnings so errors work right.
--- a/src/protocols/oscar/aim.h Fri Aug 03 18:30:46 2001 +0000 +++ b/src/protocols/oscar/aim.h Sat Aug 04 01:37:49 2001 +0000 @@ -704,8 +704,8 @@ } info; }; -faim_export unsigned long aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args); -faim_export unsigned long aim_send_im(struct aim_session_t *, struct aim_conn_t *, const char *destsn, unsigned short flags, const char *msg); +faim_export int aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args); +faim_export int aim_send_im(struct aim_session_t *, struct aim_conn_t *, const char *destsn, unsigned short flags, const char *msg); faim_export int aim_send_icon(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn, const unsigned char *icon, int iconlen, time_t stamp, unsigned short iconsum); faim_export unsigned short aim_iconsum(const unsigned char *buf, int buflen); faim_export int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *);
--- a/src/protocols/oscar/im.c Fri Aug 03 18:30:46 2001 +0000 +++ b/src/protocols/oscar/im.c Sat Aug 04 01:37:49 2001 +0000 @@ -115,145 +115,149 @@ * "Horizontal Ellipsis", or 133 in in ASCII8). * */ -faim_export unsigned long aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args) +faim_export int aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args) { - int curbyte,i; - struct command_tx_struct *newpacket; + int curbyte,i; + struct command_tx_struct *newpacket; - if (!sess || !conn || !args) - return -1; + if (!sess || !conn || !args) + return -EINVAL; - if (!args->msg || (args->msglen <= 0)) - return -1; + if (!args->msg || (args->msglen <= 0)) + return -EINVAL; - if (args->msglen >= MAXMSGLEN) - return -1; + if (args->msglen >= MAXMSGLEN) + return -E2BIG; - if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, args->msglen+512))) - return -1; + if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, args->msglen+512))) + return -ENOMEM; - newpacket->lock = 1; /* lock struct */ + newpacket->lock = 1; /* lock struct */ - curbyte = 0; - curbyte += aim_putsnac(newpacket->data+curbyte, - 0x0004, 0x0006, 0x0000, sess->snac_nextid); + curbyte = 0; + curbyte += aim_putsnac(newpacket->data+curbyte, + 0x0004, 0x0006, 0x0000, sess->snac_nextid); - /* - * Generate a random message cookie - * - * We could cache these like we do SNAC IDs. (In fact, it - * might be a good idea.) In the message error functions, - * the 8byte message cookie is returned as well as the - * SNAC ID. - * - */ - for (i = 0; i < 8; i++) - curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) rand()); + /* + * Generate a random message cookie + * + * We could cache these like we do SNAC IDs. (In fact, it + * might be a good idea.) In the message error functions, + * the 8byte message cookie is returned as well as the + * SNAC ID. + * + */ + for (i = 0; i < 8; i++) { + curbyte += aimutil_put8(newpacket->data+curbyte, + (unsigned char) rand()); + } - /* - * Channel ID - */ - curbyte += aimutil_put16(newpacket->data+curbyte,0x0001); + /* + * Channel ID + */ + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); - /* - * Destination SN (prepended with byte length) - */ - curbyte += aimutil_put8(newpacket->data+curbyte, strlen(args->destsn)); - curbyte += aimutil_putstr(newpacket->data+curbyte, args->destsn, strlen(args->destsn)); + /* + * Destination SN (prepended with byte length) + */ + curbyte += aimutil_put8(newpacket->data+curbyte, strlen(args->destsn)); + curbyte += aimutil_putstr(newpacket->data+curbyte, + args->destsn, strlen(args->destsn)); - /* - * metaTLV start. - */ - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002); - curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x10); + /* + * metaTLV start. + */ + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002); + curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x10); - /* - * Flag data / ICBM Parameters? - * - * I don't know what these are... - * - */ - curbyte += aimutil_put8(newpacket->data+curbyte, 0x05); - curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); + /* + * Flag data / ICBM Parameters? + * + * I don't know what these are... + * + */ + curbyte += aimutil_put8(newpacket->data+curbyte, 0x05); + curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); - /* number of bytes to follow */ - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0004); - curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); - curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); - curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); - curbyte += aimutil_put8(newpacket->data+curbyte, 0x02); + /* number of bytes to follow */ + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0004); + curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); + curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); + curbyte += aimutil_put8(newpacket->data+curbyte, 0x01); + curbyte += aimutil_put8(newpacket->data+curbyte, 0x02); - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0101); + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0101); - /* - * Message block length. - */ - curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x04); + /* + * Message block length. + */ + curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x04); - /* - * Character set. - */ - if (args->flags & AIM_IMFLAGS_UNICODE) - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002); - else if (args->flags & AIM_IMFLAGS_ISO_8859_1) - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003); - else - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); + /* + * Character set. + */ + if (args->flags & AIM_IMFLAGS_UNICODE) + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002); + else if (args->flags & AIM_IMFLAGS_ISO_8859_1) + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003); + else + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); - /* - * Message. Not terminated. - */ - curbyte += aimutil_putstr(newpacket->data+curbyte, args->msg, args->msglen); + /* + * Message. Not terminated. + */ + curbyte += aimutil_putstr(newpacket->data+curbyte, + args->msg, args->msglen); - /* - * Set the Request Acknowledge flag. - */ - if (args->flags & AIM_IMFLAGS_ACK) { - curbyte += aimutil_put16(newpacket->data+curbyte,0x0003); - curbyte += aimutil_put16(newpacket->data+curbyte,0x0000); - } - - /* - * Set the Autoresponse flag. - */ - if (args->flags & AIM_IMFLAGS_AWAY) { - curbyte += aimutil_put16(newpacket->data+curbyte,0x0004); - curbyte += aimutil_put16(newpacket->data+curbyte,0x0000); - } + /* + * Set the Request Acknowledge flag. + */ + if (args->flags & AIM_IMFLAGS_ACK) { + curbyte += aimutil_put16(newpacket->data+curbyte,0x0003); + curbyte += aimutil_put16(newpacket->data+curbyte,0x0000); + } - /* - * Set the Buddy Icon Requested flag. - */ - if (args->flags & AIM_IMFLAGS_BUDDYREQ) { - curbyte += aimutil_put16(newpacket->data+curbyte,0x0009); - curbyte += aimutil_put16(newpacket->data+curbyte,0x0000); - } + /* + * Set the Autoresponse flag. + */ + if (args->flags & AIM_IMFLAGS_AWAY) { + curbyte += aimutil_put16(newpacket->data+curbyte,0x0004); + curbyte += aimutil_put16(newpacket->data+curbyte,0x0000); + } + + /* + * Set the Buddy Icon Requested flag. + */ + if (args->flags & AIM_IMFLAGS_BUDDYREQ) { + curbyte += aimutil_put16(newpacket->data+curbyte,0x0009); + curbyte += aimutil_put16(newpacket->data+curbyte,0x0000); + } - /* - * Set the I HAVE A REALLY PURTY ICON flag (with timestamp). - */ - if (args->flags & AIM_IMFLAGS_HASICON) { - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0008); - curbyte += aimutil_put16(newpacket->data+curbyte, 0x000c); - curbyte += aimutil_put32(newpacket->data+curbyte, args->iconlen); - curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); - curbyte += aimutil_put16(newpacket->data+curbyte, args->iconsum); - curbyte += aimutil_put32(newpacket->data+curbyte, args->iconstamp); - } + /* + * Set the I HAVE A REALLY PURTY ICON flag (with timestamp). + */ + if (args->flags & AIM_IMFLAGS_HASICON) { + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0008); + curbyte += aimutil_put16(newpacket->data+curbyte, 0x000c); + curbyte += aimutil_put32(newpacket->data+curbyte, args->iconlen); + curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); + curbyte += aimutil_put16(newpacket->data+curbyte, args->iconsum); + curbyte += aimutil_put32(newpacket->data+curbyte, args->iconstamp); + } - newpacket->commandlen = curbyte; - newpacket->lock = 0; + newpacket->commandlen = curbyte; + newpacket->lock = 0; - aim_tx_enqueue(sess, newpacket); + aim_tx_enqueue(sess, newpacket); #if 1 /* XXX do this with autoconf or something... */ - aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, args->destsn, strlen(args->destsn)+1); - aim_cleansnacs(sess, 60); /* clean out all SNACs over 60sec old */ + aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, args->destsn, strlen(args->destsn)+1); + aim_cleansnacs(sess, 60); /* clean out all SNACs over 60sec old */ #endif - return sess->snac_nextid; + return 0; } /* @@ -266,16 +270,16 @@ * that requires an explicit message length. Use aim_send_im_ext(). * */ -faim_export unsigned long aim_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, const char *destsn, unsigned short flags, const char *msg) +faim_export int aim_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, const char *destsn, unsigned short flags, const char *msg) { - struct aim_sendimext_args args; + struct aim_sendimext_args args; - args.destsn = destsn; - args.flags = flags; - args.msg = msg; - args.msglen = strlen(msg); + args.destsn = destsn; + args.flags = flags; + args.msg = msg; + args.msglen = strlen(msg); - return aim_send_im_ext(sess, conn, &args); + return aim_send_im_ext(sess, conn, &args); } faim_export int aim_send_icon(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn, const unsigned char *icon, int iconlen, time_t stamp, unsigned short iconsum)
--- a/src/protocols/oscar/info.c Fri Aug 03 18:30:46 2001 +0000 +++ b/src/protocols/oscar/info.c Sat Aug 04 01:37:49 2001 +0000 @@ -539,20 +539,30 @@ return 0; } +/* + * Normally contains: + * t(0001) - short containing max profile length (value = 1024) + * t(0002) - short - unknown (value = 16) [max MIME type length?] + * t(0003) - short - unknown (value = 7) + */ static int rights(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen) { - struct aim_tlvlist_t *tlvlist; - aim_rxcallback_t userfunc; - int ret = 0; + struct aim_tlvlist_t *tlvlist; + aim_rxcallback_t userfunc; + int ret = 0; + unsigned short maxsiglen = 0; - tlvlist = aim_readtlvchain(data, datalen); + tlvlist = aim_readtlvchain(data, datalen); - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx); + if (aim_gettlv(tlvlist, 0x0001, 1)) + maxsiglen = aim_gettlv16(tlvlist, 0x0001, 1); - aim_freetlvchain(&tlvlist); + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) + ret = userfunc(sess, rx, maxsiglen); - return ret; + aim_freetlvchain(&tlvlist); + + return ret; } static int userinfo(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
--- a/src/protocols/oscar/md5.c Fri Aug 03 18:30:46 2001 +0000 +++ b/src/protocols/oscar/md5.c Sat Aug 04 01:37:49 2001 +0000 @@ -21,7 +21,7 @@ ghost@aladdin.com */ -/*$Id: md5.c 2096 2001-07-31 01:00:39Z warmenhoven $ */ +/*$Id: md5.c 2132 2001-08-04 01:37:49Z mid $ */ /* Independent implementation of MD5 (RFC 1321).
--- a/src/protocols/oscar/md5.h Fri Aug 03 18:30:46 2001 +0000 +++ b/src/protocols/oscar/md5.h Sat Aug 04 01:37:49 2001 +0000 @@ -21,7 +21,7 @@ ghost@aladdin.com */ -/*$Id: md5.h 2096 2001-07-31 01:00:39Z warmenhoven $ */ +/*$Id: md5.h 2132 2001-08-04 01:37:49Z mid $ */ /* Independent implementation of MD5 (RFC 1321).