changeset 316:8cdc4ab449ec

[gaim-migrate @ 326] Monkey see monkey do committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 02 Jun 2000 18:16:21 +0000
parents 68637b451377
children a91a898ea22d
files libfaim/CHANGES libfaim/aim_chat.c
diffstat 2 files changed, 98 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Fri Jun 02 18:03:18 2000 +0000
+++ b/libfaim/CHANGES	Fri Jun 02 18:16:21 2000 +0000
@@ -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,
--- a/libfaim/aim_chat.c	Fri Jun 02 18:03:18 2000 +0000
+++ b/libfaim/aim_chat.c	Fri Jun 02 18:16:21 2000 +0000
@@ -1,7 +1,7 @@
 /*
  * aim_chat.c
  *
- * Routines for the Chat service.  Nothing works (yet).
+ * Routines for the Chat service.
  *
  */
 
@@ -221,6 +221,7 @@
  * 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 @@
   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 @@
   /*
    * 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);
+  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));
-
-      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 @@
     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 @@
   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 @@
   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 @@
   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 @@
   /*
    * 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.