]> andersk Git - libfaim.git/commitdiff
- Fri Jun 2 15:57:27 UTC 2000
authormid <mid>
Fri, 2 Jun 2000 16:01:26 +0000 (16:01 +0000)
committermid <mid>
Fri, 2 Jun 2000 16:01:26 +0000 (16:01 +0000)
   - Add creation time, maxmsglen, and various unknowns to chat info
     update callback.
   - Remove 'nothing works yet' comment from top of aim_chat.c (it works!)

CHANGES
aim_chat.c
utils/faimtest/faimtest.c

diff --git a/CHANGES b/CHANGES
index f49d5b6c73ca7ece7c556a753f9ddbf4c7ac9d6b..f84c1d4e9d66568567b26649bf668b3ed3eb1c1f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
 
 No release numbers
 ------------------
+ - Fri Jun  2 15:57:27 UTC 2000
+   - Add creation time, maxmsglen, and various unknowns to chat info
+     update callback.
+   - Remove 'nothing works yet' comment from top of aim_chat.c (it works!)
+
  - Wed May 31 01:17:24 UTC 2000
    - Added constants for message sizes (MAXMSGLEN, MAXCHATMSGLEN)
      - Note that the new max message size is defined as 7988bytes,
index 03650aca716cdd221ea5d93b1d6e193bcf1daebc..85cf21564f70b0af8e636ca4be5f92eadf27188c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * aim_chat.c
  *
- * Routines for the Chat service.  Nothing works (yet).
+ * Routines for the Chat service.
  *
  */
 
@@ -221,6 +221,7 @@ int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo)
  * them to any of the 'Unknown's:
  *     - Language (English)
  *
+ * SNAC 000e/0002
  */
 int aim_chat_parse_infoupdate(struct aim_session_t *sess,
                              struct command_rx_struct *command)
@@ -235,12 +236,25 @@ int aim_chat_parse_infoupdate(struct aim_session_t *sess,
   u_short tlvcount = 0;
   struct aim_tlvlist_t *tlvlist;
   char *roomdesc = NULL;
+  struct aim_tlv_t *tmptlv;
+  unsigned short unknown_c9 = 0;
+  unsigned long creationtime = 0;
+  unsigned short maxmsglen = 0;
+  unsigned short unknown_d2 = 0, unknown_d5 = 0;
 
   i = 10;
   i += aim_chat_readroominfo(command->data+i, &roominfo);
   
   detaillevel = aimutil_get8(command->data+i);
   i++;
+
+  if (detaillevel != 0x02) {
+    if (detaillevel == 0x01)
+      printf("faim: chat_roomupdateinfo: detail level 2 not supported\n");
+    else
+      printf("faim: chat_roomupdateinfo: unknown detail level %d\n", detaillevel);
+    return 1;
+  }
   
   tlvcount = aimutil_get16(command->data+i);
   i += 2;
@@ -259,55 +273,53 @@ int aim_chat_parse_infoupdate(struct aim_session_t *sess,
   /*
    * Type 0x006f: Number of occupants.
    */
-  if (aim_gettlv(tlvlist, 0x006f, 1))
-    {
-      struct aim_tlv_t *tmptlv;
-      tmptlv = aim_gettlv(tlvlist, 0x006f, 1);
-
-      usercount = aimutil_get16(tmptlv->value);
-    }
+  if (aim_gettlv(tlvlist, 0x006f, 1)) {
+    struct aim_tlv_t *tmptlv;
+    tmptlv = aim_gettlv(tlvlist, 0x006f, 1);
+    
+    usercount = aimutil_get16(tmptlv->value);
+  }
 
   /*
    * Type 0x0073:  Occupant list.
    */
-  if (aim_gettlv(tlvlist, 0x0073, 1))
-    {  
-      int curoccupant = 0;
-      struct aim_tlv_t *tmptlv;
-
-      tmptlv = aim_gettlv(tlvlist, 0x0073, 1);
-
-      /* Allocate enough userinfo structs for all occupants */
-      userinfo = calloc(usercount, sizeof(struct aim_userinfo_s));
+  if (aim_gettlv(tlvlist, 0x0073, 1)) {        
+    int curoccupant = 0;
+    struct aim_tlv_t *tmptlv;
+    
+    tmptlv = aim_gettlv(tlvlist, 0x0073, 1);
 
-      i = 0;
-      while (curoccupant < usercount)
-       i += aim_extractuserinfo(tmptlv->value+i, &userinfo[curoccupant++]);
-    }
+    /* Allocate enough userinfo structs for all occupants */
+    userinfo = calloc(usercount, sizeof(struct aim_userinfo_s));
+    
+    i = 0;
+    while (curoccupant < usercount)
+      i += aim_extractuserinfo(tmptlv->value+i, &userinfo[curoccupant++]);
+  }
   
   /* 
-   * Type 0x00c9: Unknown.
+   * Type 0x00c9: Unknown. (2 bytes)
    */
-  if (aim_gettlv(tlvlist, 0x00c9, 1))
-    ;
+  if ((tmptlv = aim_gettlv(tlvlist, 0x00c9, 1)))
+    unknown_c9 = aimutil_get16(tmptlv->value);
   
   /* 
-   * Type 0x00ca: Creation date
+   * Type 0x00ca: Creation time (4 bytes)
    */
-  if (aim_gettlv(tlvlist, 0x00ca, 1))
-    ;
+  if ((tmptlv = aim_gettlv(tlvlist, 0x00ca, 1)))
+    creationtime = aimutil_get32(tmptlv->value);
 
   /* 
    * Type 0x00d1: Maximum Message Length
    */
-  if (aim_gettlv(tlvlist, 0x00d1, 1))
-    ;
+  if ((tmptlv = aim_gettlv(tlvlist, 0x00d1, 1)))
+    maxmsglen = aimutil_get16(tmptlv->value);
 
   /* 
-   * Type 0x00d2: Unknown.
+   * Type 0x00d2: Unknown. (2 bytes)
    */
-  if (aim_gettlv(tlvlist, 0x00d2, 1))
-    ;
+  if ((tmptlv = aim_gettlv(tlvlist, 0x00d2, 1)))
+    unknown_d2 = aimutil_get16(tmptlv->value);;
 
   /* 
    * Type 0x00d3: Room Description
@@ -316,23 +328,27 @@ int aim_chat_parse_infoupdate(struct aim_session_t *sess,
     roomdesc = aim_gettlv_str(tlvlist, 0x00d3, 1);
 
   /* 
-   * Type 0x00d5: Unknown.
+   * Type 0x00d5: Unknown. (1 byte)
    */
-  if (aim_gettlv(tlvlist, 0x00d5, 1))
-    ;
+  if ((tmptlv = aim_gettlv(tlvlist, 0x00d5, 1)))
+    unknown_d5 = aimutil_get8(tmptlv->value);;
 
 
   userfunc = aim_callhandler(command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE);
-  if (userfunc)
-    {
-      ret = userfunc(sess,
-                    command, 
-                    &roominfo,
-                    roomname,
-                    usercount,
-                    userinfo,  
-                    roomdesc);
-    }
+  if (userfunc) {
+    ret = userfunc(sess,
+                  command, 
+                  &roominfo,
+                  roomname,
+                  usercount,
+                  userinfo,    
+                  roomdesc,
+                  unknown_c9,
+                  creationtime,
+                  maxmsglen,
+                  unknown_d2,
+                  unknown_d5);
+  }    
   free(roominfo.name);
   free(userinfo);
   free(roomname);
@@ -349,21 +365,19 @@ int aim_chat_parse_joined(struct aim_session_t *sess,
   rxcallback_t userfunc=NULL;  
   int i = 10, curcount = 0, ret = 1;
 
-  while (i < command->commandlen)
-    {
-      curcount++;
-      userinfo = realloc(userinfo, curcount * sizeof(struct aim_userinfo_s));
-      i += aim_extractuserinfo(command->data+i, &userinfo[curcount-1]);
-    }
+  while (i < command->commandlen) {
+    curcount++;
+    userinfo = realloc(userinfo, curcount * sizeof(struct aim_userinfo_s));
+    i += aim_extractuserinfo(command->data+i, &userinfo[curcount-1]);
+  }
 
   userfunc = aim_callhandler(command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN);
-  if (userfunc)
-    {
-      ret = userfunc(sess,
-                    command, 
-                    curcount,
-                    userinfo);
-    }
+  if (userfunc) {      
+    ret = userfunc(sess,
+                  command, 
+                  curcount,
+                  userinfo);
+  }
 
   free(userinfo);
 
@@ -378,21 +392,19 @@ int aim_chat_parse_leave(struct aim_session_t *sess,
   rxcallback_t userfunc=NULL;  
   int i = 10, curcount = 0, ret = 1;
 
-  while (i < command->commandlen)
-    {
-      curcount++;
-      userinfo = realloc(userinfo, curcount * sizeof(struct aim_userinfo_s));
-      i += aim_extractuserinfo(command->data+i, &userinfo[curcount-1]);
-    }
+  while (i < command->commandlen) {
+    curcount++;
+    userinfo = realloc(userinfo, curcount * sizeof(struct aim_userinfo_s));
+    i += aim_extractuserinfo(command->data+i, &userinfo[curcount-1]);
+  }
 
   userfunc = aim_callhandler(command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE);
-  if (userfunc)
-    {
-      ret = userfunc(sess,
-                    command, 
-                    curcount,
-                    userinfo);
-    }
+  if (userfunc) {
+    ret = userfunc(sess,
+                  command, 
+                  curcount,
+                  userinfo);
+  }
 
   free(userinfo);
 
@@ -437,11 +449,10 @@ int aim_chat_parse_incoming(struct aim_session_t *sess,
   channel = aimutil_get16(command->data+i);
   i += 2;
 
-  if (channel != 0x0003)
-    {
-      printf("faim: chat_incoming: unknown channel! (0x%04x)\n", channel);
-      return 1;
-    }
+  if (channel != 0x0003) {
+    printf("faim: chat_incoming: unknown channel! (0x%04x)\n", channel);
+    return 1;
+  }
 
   /*
    * Start parsing TLVs right away. 
@@ -451,13 +462,12 @@ int aim_chat_parse_incoming(struct aim_session_t *sess,
   /*
    * Type 0x0003: Source User Information
    */
-  if (aim_gettlv(outerlist, 0x0003, 1))
-    {
-      struct aim_tlv_t *userinfotlv;
-      
-      userinfotlv = aim_gettlv(outerlist, 0x0003, 1);
-      aim_extractuserinfo(userinfotlv->value, &userinfo);
-    }
+  if (aim_gettlv(outerlist, 0x0003, 1)) {
+    struct aim_tlv_t *userinfotlv;
+    
+    userinfotlv = aim_gettlv(outerlist, 0x0003, 1);
+    aim_extractuserinfo(userinfotlv->value, &userinfo);
+  }
 
   /*
    * Type 0x0001: Unknown.
index 03313be5ca0160ae58ebe5a60c756bbf888b7eb4..5c0fba7e60b9929fa2f8aa7d0b24fa90d63fda03 100644 (file)
@@ -819,6 +819,8 @@ int faimtest_chat_infoupdate(struct aim_session_t *sess, struct command_rx_struc
   char *roomname;
   int usercount,i;
   char *roomdesc;
+  unsigned short unknown_c9, unknown_d2, unknown_d5, maxmsglen;
+  unsigned long creationtime;
 
   va_start(ap, command);
   roominfo = va_arg(ap, struct aim_chat_roominfo *);
@@ -826,6 +828,11 @@ int faimtest_chat_infoupdate(struct aim_session_t *sess, struct command_rx_struc
   usercount= va_arg(ap, int);
   userinfo = va_arg(ap, struct aim_userinfo_s *);
   roomdesc = va_arg(ap, char *);
+  unknown_c9 = va_arg(ap, unsigned short);
+  creationtime = va_arg(ap, unsigned long);
+  maxmsglen = va_arg(ap, unsigned short);
+  unknown_d2 = va_arg(ap, unsigned short);
+  unknown_d5 = va_arg(ap, unsigned short);
   va_end(ap);
 
   printf("faimtest: chat: %s:  info update:\n", (char *)command->conn->priv);
@@ -842,6 +849,12 @@ int faimtest_chat_infoupdate(struct aim_session_t *sess, struct command_rx_struc
   while (i < usercount)
     printf("faimtest: chat: %s:  \t\t%s\n", (char *)command->conn->priv, userinfo[i++].sn);
 
+  printf("faimtest: chat: %s:  \tUnknown_c9: 0x%04x\n", (char *)command->conn->priv, unknown_c9);
+  printf("faimtest: chat: %s:  \tCreation time: %lu (time_t)\n", (char *)command->conn->priv, creationtime);
+  printf("faimtest: chat: %s:  \tMax message length: %d bytes\n", (char *)command->conn->priv, maxmsglen);
+  printf("faimtest: chat: %s:  \tUnknown_d2: 0x%04x\n", (char *)command->conn->priv, unknown_d2);
+  printf("faimtest: chat: %s:  \tUnknown_d5: 0x%02x\n", (char *)command->conn->priv, unknown_d5);
+
   return 1;
 }
 
This page took 0.053152 seconds and 5 git commands to generate.