]> andersk Git - libfaim.git/commitdiff
- Fri Mar 2 02:17:22 UTC 2001
authormid <mid>
Fri, 2 Mar 2001 02:23:56 +0000 (02:23 +0000)
committermid <mid>
Fri, 2 Mar 2001 02:23:56 +0000 (02:23 +0000)
  - Add aim_fingerprintclient(). (AB will, but you shouldn't.)
  - Add some EXTRA_DIST to Makefile.am

CHANGES
Makefile.am
include/aim.h
src/chat.c
src/im.c
utils/faimtest/faimtest.c

diff --git a/CHANGES b/CHANGES
index 72835a97520a65cce7e7cdb4e6febf7da3dddd60..023ee3307cba43804bc1b703c0c6270c4c0ad538 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
 
 No release numbers
 ------------------
+ - Fri Mar  2 02:17:22 UTC 2001
+  - Add aim_fingerprintclient(). (AB will, but you shouldn't.)
+  - Add some EXTRA_DIST to Makefile.am
+
  - Mon Feb 26 01:46:34 UTC 2001
   - Fix swapped bytes in aim_caps[]. Thanks to 
       Bruce Miller <bmiller@ics.uci.edu> for pointing this out.
index 891708d3af2ded25d097b5987fe5f77fc2f033fd..53259cd99787d4e9bd192b5c851dd3e442490cda 100644 (file)
@@ -1,3 +1,5 @@
 
+EXTRA_DIST = AUTHORS BUGS CHANGES COPYING INSTALL README
+
 SUBDIRS = include src utils
 
index e31566d27146557dbbc77a8b2acb1c692d03320f..11977bb9e50fd58d22083264b9cc02535dc9a06b 100644 (file)
@@ -625,6 +625,13 @@ struct aim_tool_version {
 
 #endif /* FAIM_INTERNAL */
 
+#define AIM_CLIENTTYPE_UNKNOWN  0x0000
+#define AIM_CLIENTTYPE_MC       0x0001
+#define AIM_CLIENTTYPE_WINAIM   0x0002
+#define AIM_CLIENTTYPE_WINAIM41 0x0003
+#define AIM_CLIENTTYPE_AOL_TOC  0x0004
+faim_export unsigned short aim_fingerprintclient(unsigned char *msghdr, int len);
+
 #define AIM_RATE_CODE_CHANGE     0x0001
 #define AIM_RATE_CODE_WARNING    0x0002
 #define AIM_RATE_CODE_LIMIT      0x0003
index 47f39d796caec81045d17b2fa5788468b06c78a5..5c3f45525fbdab7c72649ea15f086bf7dddd98ee 100644 (file)
@@ -51,6 +51,7 @@ faim_export int aim_chat_attachname(struct aim_conn_t *conn, char *roomname)
   return 0;
 }
 
+/* XXX convert this to use tlvchains */
 faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess,
                                           struct aim_conn_t *conn, 
                                           char *msg)
@@ -84,8 +85,7 @@ faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess,
   aim_cachecookie(sess, cookie);
 
   /*
-   * metaTLV start.  -- i assume this is a metaTLV.  it could be the
-   *                    channel ID though.
+   * Channel ID. 
    */
   curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003);
 
@@ -402,6 +402,24 @@ faim_internal int aim_chat_parse_leave(struct aim_session_t *sess,
  * We could probably include this in the normal ICBM parsing 
  * code as channel 0x0003, however, since only the start
  * would be the same, we might as well do it here.
+ *
+ * General outline of this SNAC:
+ *   snac
+ *   cookie
+ *   channel id
+ *   tlvlist
+ *     unknown
+ *     source user info
+ *       name
+ *       evility
+ *       userinfo tlvs
+ *         online time
+ *         etc
+ *     message metatlv
+ *       message tlv
+ *         message string
+ *       possibly others
+ *  
  */
 faim_internal int aim_chat_parse_incoming(struct aim_session_t *sess,
                                          struct command_rx_struct *command)
index 5f42b5bb99a6da2fc789e786d432952366ad64f5..ce4886afed67a003047031aa8530d19e9c09c1f7 100644 (file)
--- a/src/im.c
+++ b/src/im.c
@@ -8,6 +8,63 @@
 #define FAIM_INTERNAL
 #include <aim.h>
 
+/*
+ * Takes a msghdr (and a length) and returns a client type
+ * code.  Note that this is *only a guess* and has a low likelihood
+ * of actually being accurate.
+ *
+ * Its based on experimental data, with the help of Eric Warmenhoven
+ * who seems to have collected a wide variety of different AIM clients.
+ *
+ *
+ * Heres the current collection:
+ *  0501 0003 0101 0101 01       AOL Mobile Communicator, WinAIM 1.0.414
+ *  0501 0003 0101 0201 01       WinAIM 2.0.847, 2.1.1187, 3.0.1464, 
+ *                                      4.3.2229, 4.4.2286
+ *  0501 0004 0101 0102 0101     WinAIM 4.1.2010, libfaim (right here)
+ *  0501 0001 0101 01            AOL v6.0, CompuServe 2000 v6.0, any
+ *                                      TOC client
+ */
+faim_export unsigned short aim_fingerprintclient(unsigned char *msghdr, int len)
+{
+  static const struct {
+    unsigned short clientid;
+    int len;
+    unsigned char data[10];
+  } fingerprints[] = {
+    /* AOL Mobile Communicator, WinAIM 1.0.414 */
+    { AIM_CLIENTTYPE_MC, 
+      9, {0x05, 0x01, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01}},
+
+    /* WinAIM 2.0.847, 2.1.1187, 3.0.1464, 4.3.2229, 4.4.2286 */
+    { AIM_CLIENTTYPE_WINAIM, 
+      9, {0x05, 0x01, 0x00, 0x03, 0x01, 0x01, 0x02, 0x01, 0x01}},
+
+    /* WinAIM 4.1.2010, libfaim */
+    { AIM_CLIENTTYPE_WINAIM41,
+      10, {0x05, 0x01, 0x00, 0x04, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01}},
+
+    /* AOL v6.0, CompuServe 2000 v6.0, any TOC client */
+    { AIM_CLIENTTYPE_AOL_TOC,
+      7, {0x05, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01}},
+
+    { 0, 0}
+  };
+  int i;
+
+  if (!msghdr || (len <= 0))
+    return 0;
+
+  for (i = 0; fingerprints[i].len; i++) {
+    if (fingerprints[i].len != len)
+      continue;
+    if (memcmp(fingerprints[i].data, msghdr, fingerprints[i].len) == 0)
+      return fingerprints[i].clientid;
+  }
+
+  return AIM_CLIENTTYPE_UNKNOWN;
+}
+
 /*
  * Send an ICBM (instant message).  
  *
@@ -69,6 +126,9 @@ faim_export unsigned long aim_send_im(struct aim_session_t *sess,
 
   /*
    * 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);
@@ -217,7 +277,6 @@ faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *sess,
   int channel;
   struct aim_tlvlist_t *tlvlist;
   struct aim_userinfo_s userinfo;
-  u_short wastebits;
 
   memset(&userinfo, 0x00, sizeof(struct aim_userinfo_s));
  
@@ -289,6 +348,9 @@ faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *sess,
       struct aim_tlv_t *msgblocktlv;
       u_char *msgblock;
       u_short flag1,flag2;
+      int finlen = 0;
+      unsigned char fingerprint[10];
+      u_short wastebits;
            
       /*
        * Check Autoresponse status.  If it is an autoresponse,
@@ -335,7 +397,12 @@ faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *sess,
        wastebits = aimutil_get8(msgblock+j++);
       wastebits = aimutil_get8(msgblock+j++);
       wastebits = aimutil_get8(msgblock+j++);
-      
+
+      finlen = j;
+      if (finlen > sizeof(fingerprint))
+       finlen = sizeof(fingerprint);
+      memcpy(fingerprint, msgblocktlv->value, finlen);
+
       /* 
        * Message string length, including flag words.
        */
@@ -373,7 +440,7 @@ faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *sess,
        */
       userfunc = aim_callhandler(command->conn, 0x0004, 0x0007);
       if (userfunc)
-       i = userfunc(sess, command, channel, &userinfo, msg, icbmflags, flag1, flag2);
+       i = userfunc(sess, command, channel, &userinfo, msg, icbmflags, flag1, flag2, finlen, fingerprint);
       else 
        i = 0;
       
index 491e6197c3e27542ae2ddd1689d73c6f0d8a6b8b..57593b6447de9c82e39b36889159443d2b6ad0c7 100644 (file)
@@ -914,15 +914,23 @@ int faimtest_parse_incoming_im(struct aim_session_t *sess, struct command_rx_str
     u_int icbmflags = 0;
     char *tmpstr = NULL;
     unsigned short flag1, flag2;
+    int finlen = 0;
+    unsigned char *fingerprint = NULL;
+    int clienttype = AIM_CLIENTTYPE_UNKNOWN;
     
     userinfo = va_arg(ap, struct aim_userinfo_s *);
     msg = va_arg(ap, char *);
     icbmflags = va_arg(ap, u_int);
     flag1 = va_arg(ap, int);
     flag2 = va_arg(ap, int);
+    finlen = va_arg(ap, int);
+    fingerprint = va_arg(ap, unsigned char *);
     va_end(ap);
     
+    clienttype = aim_fingerprintclient(fingerprint, finlen);
+
     dvprintf("faimtest: icbm: sn = \"%s\"\n", userinfo->sn);
+    dvprintf("faimtest: icbm: probable client type: %d\n", clienttype);
     dvprintf("faimtest: icbm: warnlevel = 0x%04x\n", userinfo->warnlevel);
     dvprintf("faimtest: icbm: flags = 0x%04x = ", userinfo->flags);
     printuserflags(userinfo->flags);
This page took 0.060912 seconds and 5 git commands to generate.