]> andersk Git - libfaim.git/commitdiff
- Fri Sep 7 21:18:51 PDT 2001
authormid <mid>
Sat, 8 Sep 2001 04:33:13 +0000 (04:33 +0000)
committermid <mid>
Sat, 8 Sep 2001 04:33:13 +0000 (04:33 +0000)
  - 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()

CHANGES
include/aim.h
src/im.c
utils/faimtest/faimtest.c

diff --git a/CHANGES b/CHANGES
index 10bfd15cf6feff5abce322ad753c63bdd0f8da7d..8f21d2f3864b60c6d1f568fd9bebcc47f95e168f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,15 @@
 
 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.)
 
index fc125fa58ca1cc2068d5add9effae74d3eac2305..cb0b8d429a40ef37a105a85eb8d3ae50290a7480 100644 (file)
@@ -664,37 +664,55 @@ struct aim_chat_roominfo {
        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 {
index c656557bc2a00f94cc3c148a81731338f2d80a3e..e2070bc062c512422ac2ad7c0adacd8dd4585eb3 100644 (file)
--- a/src/im.c
+++ b/src/im.c
@@ -143,7 +143,10 @@ faim_export fu32_t aim_iconsum(const fu8_t *buf, int buflen)
  */
 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;
 
@@ -156,6 +159,12 @@ faim_export int aim_send_im_ext(aim_session_t *sess, aim_conn_t *conn, struct ai
        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;
 
@@ -190,23 +199,22 @@ faim_export int aim_send_im_ext(aim_session_t *sess, aim_conn_t *conn, struct ai
         * 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);
 
@@ -295,6 +303,9 @@ faim_export int aim_send_im(aim_session_t *sess, aim_conn_t *conn, const char *d
        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);
 }
 
@@ -492,8 +503,6 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r
                endpos = aim_bstream_curpos(bs) + length;
 
                if (type == 0x0002) { /* Message Block */
-                       fu16_t featureslen;
-                       int z;
 
                        /*
                         * This TLV consists of the following:
@@ -506,16 +515,13 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r
 
                        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 */
 
@@ -579,8 +585,8 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r
 
                } 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;
 
index e339f30072185319b3fc49b573180195dd1fead7..377295c597c60950c770edad7a5c90920aabbc34 100644 (file)
@@ -980,6 +980,20 @@ static int faimtest_handlecmd(aim_session_t *sess, aim_conn_t *conn, struct aim_
 
                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);
@@ -1114,7 +1128,7 @@ static int faimtest_parse_incoming_im_chan1(aim_session_t *sess, aim_conn_t *con
        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);
This page took 0.071448 seconds and 5 git commands to generate.