]> andersk Git - libfaim.git/commitdiff
- Thu May 3 15:47:23 PDT 2001
authormid <mid>
Thu, 3 May 2001 22:57:17 +0000 (22:57 +0000)
committermid <mid>
Thu, 3 May 2001 22:57:17 +0000 (22:57 +0000)
  - Clean up getcap/putcaps
  - Add GAMES2 and SENDBUDDYLIST caps (the latter is new in winaim 4.7beta)
  - Update hash to latest value

CHANGES
include/aim.h
include/aim_internal.h
src/info.c
src/login.c

diff --git a/CHANGES b/CHANGES
index 54f1194ff378493d8d750471bcc78697758d2855..e408a1c5f0b1d25dbabde21f24998a6b1d90747c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
 
 No release numbers
 ------------------
+ - Thu May  3 15:47:23 PDT 2001
+  - Clean up getcap/putcaps
+  - Add GAMES2 and SENDBUDDYLIST caps (the latter is new in winaim 4.7beta)
+  - Update hash to latest value
+
  - Wed Apr 25 11:51:39 PDT 2001
   - I think this was a bug.
 
index 5fd09ed560a20770b7b2a1bc18e3cc333db005f5..bd5443cfe1b99603ef68607f0f540c558d962dac 100644 (file)
@@ -649,14 +649,17 @@ faim_export int aim_oft_getfile_ack(struct aim_session_t *sess, struct aim_conn_
 faim_export int aim_oft_getfile_end(struct aim_session_t *sess, struct aim_conn_t *conn);
 
 /* aim_info.c */
-#define AIM_CAPS_BUDDYICON 0x01
-#define AIM_CAPS_VOICE 0x02
-#define AIM_CAPS_IMIMAGE 0x04
-#define AIM_CAPS_CHAT 0x08
-#define AIM_CAPS_GETFILE 0x10
-#define AIM_CAPS_SENDFILE 0x20
-#define AIM_CAPS_GAMES 0x40
-#define AIM_CAPS_SAVESTOCKS 0x80
+#define AIM_CAPS_BUDDYICON      0x0001
+#define AIM_CAPS_VOICE          0x0002
+#define AIM_CAPS_IMIMAGE        0x0004
+#define AIM_CAPS_CHAT           0x0008
+#define AIM_CAPS_GETFILE        0x0010
+#define AIM_CAPS_SENDFILE       0x0020
+#define AIM_CAPS_GAMES          0x0040
+#define AIM_CAPS_SAVESTOCKS     0x0080
+#define AIM_CAPS_SENDBUDDYLIST  0x0100
+#define AIM_CAPS_GAMES2         0x0200
+#define AIM_CAPS_LAST           0x8000
 
 faim_export int aim_0002_000b(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn);
 
index 98c2dd7da34882c48305373a5225e9a46e60013c..1c58e304a7bb83d21b4398ae9fbd640e2e303328 100644 (file)
@@ -108,9 +108,8 @@ struct aim_tool_version {
 
 faim_internal int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command);
 
-extern u_char aim_caps[8][16];
 faim_internal unsigned short aim_getcap(struct aim_session_t *sess, unsigned char *capblock, int buflen);
-faim_internal int aim_putcap(unsigned char *capblock, int buflen, u_short caps);
+faim_internal int aim_putcap(unsigned char *capblock, int buflen, unsigned short caps);
 
 faim_internal int aim_cachecookie(struct aim_session_t *sess, struct aim_msgcookie_t *cookie);
 faim_internal struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, unsigned char *cookie, int type);
index db84a71889b296b0b7caf615208ac39c3495cb1d..ad2486178f1322311ed44647796b584c0126cac0 100644 (file)
@@ -54,112 +54,101 @@ faim_export int aim_getinfo(struct aim_session_t *sess,
 /*
  * Capability blocks.  
  */
-u_char aim_caps[8][16] = {
+static const struct {
+  unsigned short flag;
+  unsigned char data[16];
+} aim_caps[] = {
   
-  /* Buddy icon */
-  {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
+  {AIM_CAPS_BUDDYICON,
+   {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
   
-  /* Voice */
-  {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
-  
-  /* IM image */
-  {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
-  
-  /* Chat */
-  {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
+  {AIM_CAPS_VOICE,
+   {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+
+  {AIM_CAPS_IMIMAGE,
+   {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
   
-  /* Get file */
-  {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
+  {AIM_CAPS_CHAT,
+   {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
   
-  /* Send file */
-  {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
+  {AIM_CAPS_GETFILE,
+   {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+
+  {AIM_CAPS_SENDFILE,
+   {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
-  /* Saves stock portfolios */
-  {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
+  {AIM_CAPS_SAVESTOCKS,
+   {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
-  /* Games */
-  {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
-   0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
+  /*
+   * Indeed, there are two of these.  The former appears
+   * to be correct, but in some versions of winaim, the
+   * second one is set.  Either they forgot to fix endianness,
+   * or they made a typo. It really doesn't matter which.
+   */
+  {AIM_CAPS_GAMES,
+   {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+  {AIM_CAPS_GAMES2,
+   {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
+    0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+
+  {AIM_CAPS_SENDBUDDYLIST,
+   {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1,
+    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+
+  {AIM_CAPS_LAST}
 };
 
 faim_internal unsigned short aim_getcap(struct aim_session_t *sess, unsigned char *capblock, int buflen)
 {
-  u_short ret = 0;
-  int y;
+  unsigned short flags;
+  int i;
   int offset = 0;
   int identified;
 
-  while (offset < buflen) {
-    identified = 0;
-    for(y=0; y < (sizeof(aim_caps)/0x10); y++) {
-      if (memcmp(&aim_caps[y], capblock+offset, 0x10) == 0) {
-       switch(y) {
-       case 0: ret |= AIM_CAPS_BUDDYICON; identified++; break;
-       case 1: ret |= AIM_CAPS_VOICE; identified++; break;
-       case 2: ret |= AIM_CAPS_IMIMAGE; identified++; break;
-       case 3: ret |= AIM_CAPS_CHAT; identified++; break;
-       case 4: ret |= AIM_CAPS_GETFILE; identified++; break;
-       case 5: ret |= AIM_CAPS_SENDFILE; identified++; break;
-       case 6: ret |= AIM_CAPS_GAMES; identified++; break;
-       case 7: ret |= AIM_CAPS_SAVESTOCKS; identified++; break;
-       }
+  for (offset = 0, flags = 0; offset < buflen; offset += 0x0010) {
+
+    for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) {
+
+      if (memcmp(&aim_caps[i].data, capblock+offset, 0x10) == 0) {
+       flags |= aim_caps[i].flag;
+       identified++;
+       break; /* should only match once... */
       }
+
     }
-    if (!identified) {
+
+    if (!identified)
       faimdprintf(sess, 0, "unknown capability!\n");
-      ret |= 0xff00;
-    }
 
-    offset += 0x10;
-  } 
-  return ret;
+  }
+
+  return flags;
 }
 
-faim_internal int aim_putcap(unsigned char *capblock, int buflen, u_short caps)
+faim_internal int aim_putcap(unsigned char *capblock, int buflen, unsigned short caps)
 {
-  int offset = 0;
+  int offset, i;
 
   if (!capblock)
-    return -1;
+    return 0;
+
+  for (i = 0, offset = 0; 
+       !(aim_caps[i].flag & AIM_CAPS_LAST) && (offset < buflen); i++) {
+
+    if (caps & aim_caps[i].flag) {
+      memcpy(capblock+offset, aim_caps[i].data, 16);
+      offset += 16;
+    }
 
-  if ((caps & AIM_CAPS_BUDDYICON) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[0], sizeof(aim_caps[0]));
-    offset += sizeof(aim_caps[1]);
-  }
-  if ((caps & AIM_CAPS_VOICE) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[1], sizeof(aim_caps[1]));
-    offset += sizeof(aim_caps[1]);
-  }
-  if ((caps & AIM_CAPS_IMIMAGE) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[2], sizeof(aim_caps[2]));
-    offset += sizeof(aim_caps[2]);
-  }
-  if ((caps & AIM_CAPS_CHAT) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[3], sizeof(aim_caps[3]));
-    offset += sizeof(aim_caps[3]);
-  }
-  if ((caps & AIM_CAPS_GETFILE) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[4], sizeof(aim_caps[4]));
-    offset += sizeof(aim_caps[4]);
-  }
-  if ((caps & AIM_CAPS_SENDFILE) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[5], sizeof(aim_caps[5]));
-    offset += sizeof(aim_caps[5]);
-  }
-  if ((caps & AIM_CAPS_GAMES) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[6], sizeof(aim_caps[6]));
-    offset += sizeof(aim_caps[6]);
-  }
-  if ((caps & AIM_CAPS_SAVESTOCKS) && (offset < buflen)) {
-    memcpy(capblock+offset, aim_caps[7], sizeof(aim_caps[7]));
-    offset += sizeof(aim_caps[7]);
   }
 
   return offset;
index 98b81208947cb08a6aaffa99b5e076f9079ff894..e12d97372b8caa54ccceb573657d19d80309e334 100644 (file)
@@ -813,15 +813,19 @@ faim_export int aim_sendmemblock(struct aim_session_t *sess, struct aim_conn_t *
       faimdprintf(sess, 0, "sendmemblock: WARNING: sending bad hash... you will be disconnected soon...\n");
 
     /* 
-     * This data is correct for AIM 3.5.1670, offset 0x1004, length 4 
+     * This data is correct for AIM 3.5.1670, offset 0x1000, length 0 
      *
      * Using this block is as close to "legal" as you can get without
      * using an AIM binary.
+     *
+     * For the moment, this is the MD5 hash of nothing.  Yes, that's
+     * right.  Nothing.  AOL is smart.
+     *
      */
-    i += aimutil_put32(tx->data+i, 0x92bd6757);
-    i += aimutil_put32(tx->data+i, 0x3722cbd3);
-    i += aimutil_put32(tx->data+i, 0x2b048ab9);
-    i += aimutil_put32(tx->data+i, 0xd0b1e4ab);
+    i += aimutil_put32(tx->data+i, 0xd41d8cd9);
+    i += aimutil_put32(tx->data+i, 0x8f00b204);
+    i += aimutil_put32(tx->data+i, 0xe9800998);
+    i += aimutil_put32(tx->data+i, 0xecf8427e);
 
   }
 
This page took 0.079704 seconds and 5 git commands to generate.