]> andersk Git - libfaim.git/blobdiff - aim_chatnav.c
- Sun Feb 11 01:07:36 UTC 2001
[libfaim.git] / aim_chatnav.c
index 0967d0db1c76e0d19114cdb0f49d9458ba8e05d6..92f9db8da3b6874c6d3aea53cb3ed1baba110e67 100644 (file)
@@ -1,31 +1,24 @@
 /*
+ * Handle ChatNav.
  *
- *
- *
+ * [The ChatNav(igation) service does various things to keep chat
+ *  alive.  It provides room information, room searching and creating, 
+ *  as well as giving users the right ("permission") to use chat.]
  *
  */
 
+#define FAIM_INTERNAL
 #include <faim/aim.h>
 
-
 /*
  * conn must be a chatnav connection!
  */
 faim_export unsigned long aim_chatnav_reqrights(struct aim_session_t *sess,
                                                struct aim_conn_t *conn)
 {
-  struct aim_snac_t snac;
-
-  snac.id = aim_genericreq_n(sess, conn, 0x000d, 0x0002);
-
-  snac.family = 0x000d;
-  snac.type = 0x0002;
-  snac.flags = 0x0000;
-  snac.data = NULL;
-  
-  aim_newsnac(sess, &snac);
+  aim_genericreq_n(sess, conn, 0x000d, 0x0002);
 
-  return (sess->snac_nextid); /* already incremented */
+  return sess->snac_nextid;
 }
 
 faim_export unsigned long aim_chatnav_clientready(struct aim_session_t *sess,
@@ -105,11 +98,7 @@ faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct comm
           * Type 0x0002: Maximum concurrent rooms.
           */ 
          if (aim_gettlv(tlvlist, 0x0002, 1))
-           {
-             struct aim_tlv_t *maxroomstlv;
-             maxroomstlv = aim_gettlv(tlvlist, 0x0002, 1);
-             maxrooms = aimutil_get8(maxroomstlv->value);
-           }
+           maxrooms = aim_gettlv8(tlvlist, 0x0002, 1);
 
          /* 
           * Type 0x0003: Exchange information
@@ -145,11 +134,9 @@ faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct comm
               * Type 0x0002: Unknown
               */
              if (aim_gettlv(innerlist, 0x0002, 1)) {
-               struct aim_tlv_t *tmptlv;
-               unsigned short classperms = 0;
+               unsigned short classperms;
 
-               tmptlv = aim_gettlv(innerlist, 0x0002, 1);
-               classperms = aimutil_get16(tmptlv->value);
+               classperms = aim_gettlv16(innerlist, 0x0002, 1);
                
                printf("faim: class permissions %x\n", classperms);
              }
@@ -201,13 +188,9 @@ faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct comm
               * 
               */
              if (aim_gettlv(innerlist, 0x00d5, 1)) {
-               struct aim_tlv_t *tmptlv;
-               unsigned char createperms = 0;
+               unsigned char createperms;
 
-               tmptlv = aim_gettlv(innerlist, 0x00d5, 1);
-               createperms = aimutil_get8(tmptlv->value);
-               
-               printf("faim: creation permissions %x\n", createperms);
+               createperms = aim_gettlv8(innerlist, 0x00d5, 1);
              }
 
              /*
@@ -316,7 +299,7 @@ faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct comm
       unsigned long createtime = 0;
       unsigned char createperms;
       int i, cklen;
-      struct aim_tlv_t *bigblock, *tmp;
+      struct aim_tlv_t *bigblock;
 
       i = 10;
       if (!(tlvlist = aim_readtlvchain(command->data+i, command->commandlen-i))) {
@@ -366,26 +349,26 @@ faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct comm
       if (aim_gettlv(innerlist, 0x006a, 1))
        fqcn = aim_gettlv_str(innerlist, 0x006a, 1);
 
-      if ((tmp = aim_gettlv(innerlist, 0x00c9, 1)))
-       flags = aimutil_get16(tmp->value);
+      if (aim_gettlv(innerlist, 0x00c9, 1))
+       flags = aim_gettlv16(innerlist, 0x00c9, 1);
 
-      if ((tmp = aim_gettlv(innerlist, 0x00ca, 1)))
-       createtime = aimutil_get32(tmp->value);
+      if (aim_gettlv(innerlist, 0x00ca, 1))
+       createtime = aim_gettlv32(innerlist, 0x00ca, 1);
 
-      if ((tmp = aim_gettlv(innerlist, 0x00d1, 1)))
-       maxmsglen = aimutil_get16(tmp->value);
+      if (aim_gettlv(innerlist, 0x00d1, 1))
+       maxmsglen = aim_gettlv16(innerlist, 0x00d1, 1);
 
-      if ((tmp = aim_gettlv(innerlist, 0x00d2, 1)))
-       maxoccupancy = aimutil_get16(tmp->value);
+      if (aim_gettlv(innerlist, 0x00d2, 1))
+       maxoccupancy = aim_gettlv16(innerlist, 0x00d2, 1);
 
       if (aim_gettlv(innerlist, 0x00d3, 1))
        name = aim_gettlv_str(innerlist, 0x00d3, 1);
 
-      if ((tmp = aim_gettlv(innerlist, 0x00d5, 1)))
-       createperms = aimutil_get8(tmp->value);
+      if (aim_gettlv(innerlist, 0x00d5, 1))
+       createperms = aim_gettlv8(innerlist, 0x00d5, 1);
 
       if ((userfunc = aim_callhandler(command->conn, 0x000d, 0x0009))) {
-       ret = userfunc(sess, command, snac->type, fqcn, instance, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
+       ret = userfunc(sess, command, snac->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
       }
      
       if (ck)
@@ -418,7 +401,6 @@ faim_export unsigned long aim_chatnav_createroom(struct aim_session_t *sess,
 {
   struct command_tx_struct *newpacket; 
   int i;
-  struct aim_snac_t snac;
 
   if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+12+strlen("invite")+strlen(name))))
     return -1;
@@ -446,15 +428,9 @@ faim_export unsigned long aim_chatnav_createroom(struct aim_session_t *sess,
   /* room name */
   i+= aim_puttlv_str(newpacket->data+i, 0x00d3, strlen(name), name);
 
-  snac.id = sess->snac_nextid;
-  snac.family = 0x000d;
-  snac.type = 0x0008;
-  snac.flags = 0x0000;
-  snac.data = NULL;
-  
-  aim_newsnac(sess, &snac);
+  aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0);
 
   aim_tx_enqueue(sess, newpacket);
 
-  return (sess->snac_nextid++);
+  return sess->snac_nextid;
 }
This page took 0.041857 seconds and 4 git commands to generate.