No release numbers
------------------
+ - Fri Sep 7 21:18:51 PDT 2001
+ - Make icon field names uniform
+ - Add AIM_IMFLAGS_CUSTOMFEATURES. This allows the client to send/recieve
+ the field in IMs that show client information.
+ - This can be used to identify other open source OSCAR clients, if any
+ one is interested.
+ - Increase the size of args->icbmflags to 32bits
+ - Make sure that extended-only flags are not set for aim_send_im()
+
- Fri Sep 7 19:59:43 PDT 2001
- Fix buddyicons. Yay! (checksums are 32bits all the time. duh.)
unsigned short instance;
};
-#define AIM_IMFLAGS_AWAY 0x01 /* mark as an autoreply */
-#define AIM_IMFLAGS_ACK 0x02 /* request a receipt notice */
-#define AIM_IMFLAGS_UNICODE 0x04
-#define AIM_IMFLAGS_ISO_8859_1 0x08
-#define AIM_IMFLAGS_BUDDYREQ 0x10 /* buddy icon requested */
-#define AIM_IMFLAGS_HASICON 0x20 /* already has icon (timestamp included) */
-#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x40 /* damn that Steve Jobs! */
+#define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */
+#define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */
+#define AIM_IMFLAGS_UNICODE 0x0004
+#define AIM_IMFLAGS_ISO_8859_1 0x0008
+#define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */
+#define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */
+#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */
+#define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */
+#define AIM_IMFLAGS_EXTDATA 0x0100
struct aim_sendimext_args {
+
+ /* These are _required_ */
const char *destsn;
- unsigned short flags;
+ fu32_t flags;
const char *msg;
int msglen;
- int iconlen;
+
+ /* Only used if AIM_IMFLAGS_HASICON is set */
+ fu32_t iconlen;
time_t iconstamp;
- unsigned short iconsum;
+ fu32_t iconsum;
+
+ /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */
+ fu8_t *features;
+ fu8_t featureslen;
};
struct aim_incomingim_ch1_args {
+
+ /* Always provided */
char *msg;
int msglen;
- unsigned long icbmflags;
- unsigned short flag1;
- unsigned short flag2;
- int finlen;
- unsigned char fingerprint[10];
+ fu32_t icbmflags;
+ fu16_t flag1;
+ fu16_t flag2;
+
+ /* Only provided if AIM_IMFLAGS_HASICON is set */
time_t iconstamp;
- unsigned long iconlength;
- unsigned long iconchecksum;
- int extdatalen;
- unsigned char *extdata;
+ fu32_t iconlen;
+ fu32_t iconsum;
+
+ /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */
+ fu8_t *features;
+ fu8_t featureslen;
+
+ /* Only provided if AIM_IMFLAGS_EXTDATA is set */
+ fu8_t extdatalen;
+ fu8_t *extdata;
};
struct aim_incomingim_ch2_args {
*/
faim_export int aim_send_im_ext(aim_session_t *sess, aim_conn_t *conn, struct aim_sendimext_args *args)
{
- int i;
+ static const fu8_t deffeatures[] = {
+ 0x01, 0x01, 0x01, 0x02, 0x42,
+ };
+ int i, msgtlvlen;
aim_frame_t *fr;
aim_snacid_t snacid;
if (args->msglen >= MAXMSGLEN)
return -E2BIG;
+ msgtlvlen = 12 + args->msglen;
+ if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES)
+ msgtlvlen += args->featureslen;
+ else
+ msgtlvlen += sizeof(deffeatures);
+
if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, args->msglen+512)))
return -ENOMEM;
* metaTLV start.
*/
aimbs_put16(&fr->data, 0x0002);
- aimbs_put16(&fr->data, args->msglen + 0x10);
+ aimbs_put16(&fr->data, msgtlvlen);
/*
- * Flag data / ICBM Parameters?
- *
- * I don't know what these are...
+ * Features
*
*/
aimbs_put8(&fr->data, 0x05);
aimbs_put8(&fr->data, 0x01);
- /* number of bytes to follow */
- aimbs_put16(&fr->data, 0x0004);
- aimbs_put8(&fr->data, 0x01);
- aimbs_put8(&fr->data, 0x01);
- aimbs_put8(&fr->data, 0x01);
- aimbs_put8(&fr->data, 0x02);
+ if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) {
+ aimbs_put16(&fr->data, args->featureslen);
+ aimbs_putraw(&fr->data, args->features, args->featureslen);
+ } else {
+ aimbs_put16(&fr->data, sizeof(deffeatures));
+ aimbs_putraw(&fr->data, deffeatures, sizeof(deffeatures));
+ }
aimbs_put16(&fr->data, 0x0101);
args.msg = msg;
args.msglen = strlen(msg);
+ /* Make these don't get set by accident -- they need aim_send_im_ext */
+ args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON);
+
return aim_send_im_ext(sess, conn, &args);
}
endpos = aim_bstream_curpos(bs) + length;
if (type == 0x0002) { /* Message Block */
- fu16_t featureslen;
- int z;
/*
* This TLV consists of the following:
aimbs_get8(bs); /* 05 */
aimbs_get8(bs); /* 01 */
- featureslen = aimbs_get16(bs);
- for (z = 0, args.finlen = 0; z < featureslen; z++) {
- fu8_t tmp;
-
- tmp = aimbs_get8(bs);
- if (z < sizeof(args.fingerprint)) {
- args.fingerprint[z] = tmp;
- args.finlen++;
- }
- }
+
+ args.featureslen = aimbs_get16(bs);
+ /* XXX XXX this is all evil! */
+ args.features = bs->data + bs->offset;
+ aim_bstream_advance(bs, args.featureslen);
+ args.icbmflags |= AIM_IMFLAGS_CUSTOMFEATURES;
+
aimbs_get8(bs); /* 01 */
aimbs_get8(bs); /* 01 */
} else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */
- args.iconchecksum = aimbs_get32(bs);
- args.iconlength = aimbs_get32(bs);
+ args.iconsum = aimbs_get32(bs);
+ args.iconlen = aimbs_get32(bs);
args.iconstamp = aimbs_get32(bs);
args.icbmflags |= AIM_IMFLAGS_HASICON;
aim_send_im_ext(sess, conn, &args);
+ } else if (strstr(tmpstr, "havefeat")) {
+ struct aim_sendimext_args args;
+ static const char featmsg[] = {"I have nifty features."};
+ fu8_t features[] = {0x01, 0x01, 0x01, 0x02, 0x42, 0x43, 0x44, 0x45};
+
+ args.destsn = userinfo->sn;
+ args.flags = AIM_IMFLAGS_CUSTOMFEATURES;
+ args.msg = featmsg;
+ args.msglen = strlen(featmsg);
+ args.features = features;
+ args.featureslen = sizeof(features);
+
+ aim_send_im_ext(sess, conn, &args);
+
} else if (strstr(tmpstr, "sendicon") && priv->buddyicon) {
aim_send_icon(sess, conn, userinfo->sn, priv->buddyicon, priv->buddyiconlen, priv->buddyiconstamp, priv->buddyiconsum);
args = va_arg(ap, struct aim_incomingim_ch1_args *);
va_end(ap);
- clienttype = aim_fingerprintclient(args->fingerprint, args->finlen);
+ clienttype = aim_fingerprintclient(args->features, args->featureslen);
dvprintf("faimtest: icbm: sn = \"%s\"\n", userinfo->sn);
dvprintf("faimtest: icbm: probable client type: %d\n", clienttype);