]> andersk Git - libfaim.git/commitdiff
- Wed Sep 13 22:01:35 UTC 2000
authormid <mid>
Wed, 13 Sep 2000 22:15:17 +0000 (22:15 +0000)
committermid <mid>
Wed, 13 Sep 2000 22:15:17 +0000 (22:15 +0000)
   - Remove references to "new" and "class" for dumb C++ compilers
   - Renamed userinfo->class to userinfo->flags both for clarity and C++
   - Remove some extraneous variables

CHANGES
aim_im.c
aim_info.c
aim_rxhandlers.c
aim_tlv.c
aim_txqueue.c
faim/aim.h
utils/faimtest/faimtest.c

diff --git a/CHANGES b/CHANGES
index 494edff34c6ed5c1391f4f470234d1474630d8a8..e38f569881dc879a91224bd63906bec6d00790a3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
 
 No release numbers
 ------------------
+ - Wed Sep 13 22:01:35 UTC 2000
+   - Remove references to "new" and "class" for dumb C++ compilers
+   - Renamed userinfo->class to userinfo->flags both for clarity and C++
+   - Remove some extraneous variables
+
  - Tue Sep 12 20:16:51 UTC 2000
    - Add aim_flap_nop() from my work tree 
 
index 82ce16cbfe4437217382bfe243434d66524ff18a..55610a2b176fa237422d049ab7a754fabfbd14fc 100644 (file)
--- a/aim_im.c
+++ b/aim_im.c
@@ -397,7 +397,6 @@ faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *sess,
     {  
       struct aim_tlv_t *block1;
       struct aim_tlvlist_t *list2;
-      struct aim_tlv_t *tmptlv;
       unsigned short reqclass = 0;
       unsigned short status = 0;
       
@@ -618,11 +617,8 @@ faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *sess,
          free(lang);
       } else if (reqclass & AIM_CAPS_GETFILE) {
        char ip[30];
-       char *desc = NULL;
        struct aim_msgcookie_t *cachedcook;
-       struct aim_filetransfer_priv *ft;
        struct aim_tlv_t *miscinfo;
-       struct aim_conn_t *newconn;
 
        if (!(cachedcook = calloc(1, sizeof(struct aim_msgcookie_t))))
          return 0;
index 4f53747954a400de1db7ad711775f34999bbd3cd..8b23757da68f72492948a189014c5689704148ab 100644 (file)
@@ -259,7 +259,7 @@ faim_internal int aim_extractuserinfo(u_char *buf, struct aim_userinfo_s *outinf
       break;
 
       /*
-       * Type = 0x0001: Member Class.   
+       * Type = 0x0001: User flags
        * 
        * Specified as any of the following bitwise ORed together:
        *      0x0001  Trial (user less than 60days)
@@ -277,7 +277,7 @@ faim_internal int aim_extractuserinfo(u_char *buf, struct aim_userinfo_s *outinf
     case 0x0001:
       if (tlv1) /* use only the first */
        break;
-      outinfo->class = aimutil_get16(&buf[i+4]);
+      outinfo->flags = aimutil_get16(&buf[i+4]);
       tlv1++;
       break;
       
@@ -563,12 +563,12 @@ faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s
 
   /* XXX: we only put down five */
   i += aimutil_put16(buf+i, 5);
-  aim_addtlvtochain16(&tlvlist, 0x0001, info->class);
+  aim_addtlvtochain16(&tlvlist, 0x0001, info->flags);
   aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);
   aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
   aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
   /* XXX: should put caps here */
-  aim_addtlvtochain32(&tlvlist, (unsigned short)((info->class)&AIM_CLASS_AOL?0x0010:0x000f), info->sessionlen);
+  aim_addtlvtochain32(&tlvlist, (unsigned short)((info->flags)&AIM_FLAG_AOL?0x0010:0x000f), info->sessionlen);
   
   i += aim_writetlvchain(buf+i, buflen-i, &tlvlist);
   aim_freetlvchain(&tlvlist);
index 91db4a0057f6afb8a9df87f43924c61a00bec11c..fa2429e3454b0f82fa80ee847a284de3ab880779 100644 (file)
@@ -188,31 +188,31 @@ faim_export int aim_conn_addhandler(struct aim_session_t *sess,
                        rxcallback_t newhandler,
                        u_short flags)
 {
-  struct aim_rxcblist_t *new,*cur;
+  struct aim_rxcblist_t *newcb,*cur;
 
   if (!conn)
     return -1;
 
   faimdprintf(1, "aim_conn_addhandler: adding for %04x/%04x\n", family, type);
 
-  new = (struct aim_rxcblist_t *)calloc(1, sizeof(struct aim_rxcblist_t));
-  new->family = family;
-  new->type = type;
-  new->flags = flags;
+  newcb = (struct aim_rxcblist_t *)calloc(1, sizeof(struct aim_rxcblist_t));
+  newcb->family = family;
+  newcb->type = type;
+  newcb->flags = flags;
   if (!newhandler)
-    new->handler = &bleck;
+    newcb->handler = &bleck;
   else
-    new->handler = newhandler;
-  new->next = NULL;
+    newcb->handler = newhandler;
+  newcb->next = NULL;
   
   cur = conn->handlerlist;
   if (!cur)
-    conn->handlerlist = new;
+    conn->handlerlist = newcb;
   else 
     {
       while (cur->next)
        cur = cur->next;
-      cur->next = new;
+      cur->next = newcb;
     }
 
   return 0;
index 838259daf7dee4679f68058f044053e4f83a9931..ba5b1cbb509cbc5f3124673af519add1a19c3a05 100644 (file)
--- a/aim_tlv.c
+++ b/aim_tlv.c
@@ -97,93 +97,93 @@ faim_internal int aim_counttlvchain(struct aim_tlvlist_t **list)
 
 faim_internal int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len)
 {
-  struct aim_tlvlist_t *new;
+  struct aim_tlvlist_t *newtlv;
   struct aim_tlvlist_t *cur;
 
   if (!list)
     return 0;
 
-  new = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
-  memset(new, 0x00, sizeof(struct aim_tlvlist_t));
+  newtlv = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
+  memset(newtlv, 0x00, sizeof(struct aim_tlvlist_t));
 
-  new->tlv = aim_createtlv();  
-  new->tlv->type = type;
-  new->tlv->length = len;
-  new->tlv->value = (u_char *)malloc(new->tlv->length*sizeof(u_char));
-  memcpy(new->tlv->value, str, new->tlv->length);
+  newtlv->tlv = aim_createtlv();       
+  newtlv->tlv->type = type;
+  newtlv->tlv->length = len;
+  newtlv->tlv->value = (unsigned char *)malloc(newtlv->tlv->length*sizeof(unsigned char));
+  memcpy(newtlv->tlv->value, str, newtlv->tlv->length);
 
-  new->next = NULL;
+  newtlv->next = NULL;
 
   if (*list == NULL) {
-    *list = new;
+    *list = newtlv;
   } else if ((*list)->next == NULL) {
-    (*list)->next = new;
+    (*list)->next = newtlv;
   } else {
     for(cur = *list; cur->next; cur = cur->next)
       ;
-    cur->next = new;
+    cur->next = newtlv;
   }
-  return new->tlv->length;
+  return newtlv->tlv->length;
 }
 
 faim_internal int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val)
 {
-  struct aim_tlvlist_t *new;
+  struct aim_tlvlist_t *newtl;
   struct aim_tlvlist_t *cur;
 
   if (!list)
     return 0;
 
-  new = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
-  memset(new, 0x00, sizeof(struct aim_tlvlist_t));
+  newtl = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
+  memset(newtl, 0x00, sizeof(struct aim_tlvlist_t));
 
-  new->tlv = aim_createtlv();  
-  new->tlv->type = type;
-  new->tlv->length = 2;
-  new->tlv->value = (u_char *)malloc(new->tlv->length*sizeof(u_char));
-  aimutil_put16(new->tlv->value, val);
+  newtl->tlv = aim_createtlv();        
+  newtl->tlv->type = type;
+  newtl->tlv->length = 2;
+  newtl->tlv->value = (unsigned char *)malloc(newtl->tlv->length*sizeof(unsigned char));
+  aimutil_put16(newtl->tlv->value, val);
 
-  new->next = NULL;
+  newtl->next = NULL;
 
   if (*list == NULL) {
-    *list = new;
+    *list = newtl;
   } else if ((*list)->next == NULL) {
-    (*list)->next = new;
+    (*list)->next = newtl;
   } else {
     for(cur = *list; cur->next; cur = cur->next)
       ;
-    cur->next = new;
+    cur->next = newtl;
   }
   return 2;
 }
 
 faim_internal int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val)
 {
-  struct aim_tlvlist_t *new;
+  struct aim_tlvlist_t *newtl;
   struct aim_tlvlist_t *cur;
 
   if (!list)
     return 0;
 
-  new = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
-  memset(new, 0x00, sizeof(struct aim_tlvlist_t));
+  newtl = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
+  memset(newtl, 0x00, sizeof(struct aim_tlvlist_t));
 
-  new->tlv = aim_createtlv();  
-  new->tlv->type = type;
-  new->tlv->length = 4;
-  new->tlv->value = (u_char *)malloc(new->tlv->length*sizeof(u_char));
-  aimutil_put32(new->tlv->value, val);
+  newtl->tlv = aim_createtlv();        
+  newtl->tlv->type = type;
+  newtl->tlv->length = 4;
+  newtl->tlv->value = (unsigned char *)malloc(newtl->tlv->length*sizeof(unsigned char));
+  aimutil_put32(newtl->tlv->value, val);
 
-  new->next = NULL;
+  newtl->next = NULL;
 
   if (*list == NULL) {
-    *list = new;
+    *list = newtl;
   } else if ((*list)->next == NULL) {
-    (*list)->next = new;
+    (*list)->next = newtl;
   } else {
     for(cur = *list; cur->next; cur = cur->next)
       ;
-    cur->next = new;
+    cur->next = newtl;
   }
   return 4;
 }
index 11c16605d27f7d8421b917d2b38392140a7c4022..2344073a287db48715cd274d859934f8391cceb2 100644 (file)
  */
 faim_internal struct command_tx_struct *aim_tx_new(unsigned char framing, int chan, struct aim_conn_t *conn, int datalen)
 {
-  struct command_tx_struct *new;
+  struct command_tx_struct *newtx;
 
   if (!conn) {
     printf("aim_tx_new: ERROR: no connection specified\n");
     return NULL;
   }
 
-  new = (struct command_tx_struct *)malloc(sizeof(struct command_tx_struct));
-  if (!new)
+  newtx = (struct command_tx_struct *)malloc(sizeof(struct command_tx_struct));
+  if (!newtx)
     return NULL;
-  memset(new, 0, sizeof(struct command_tx_struct));
+  memset(newtx, 0, sizeof(struct command_tx_struct));
 
-  new->conn = conn; 
+  newtx->conn = conn; 
 
   if(datalen) {
-    new->data = (u_char *)malloc(datalen);
-    new->commandlen = datalen;
+    newtx->data = (unsigned char *)malloc(datalen);
+    newtx->commandlen = datalen;
   } else
-    new->data = NULL;
-
-  new->hdrtype = framing;
-  if (new->hdrtype == AIM_FRAMETYPE_OSCAR) {
-    new->hdr.oscar.type = chan;
-  } else if (new->hdrtype == AIM_FRAMETYPE_OFT) {
-    new->hdr.oft.type = chan;
-    new->hdr.oft.hdr2len = 0; /* this will get setup by caller */
+    newtx->data = NULL;
+
+  newtx->hdrtype = framing;
+  if (newtx->hdrtype == AIM_FRAMETYPE_OSCAR) {
+    newtx->hdr.oscar.type = chan;
+  } else if (newtx->hdrtype == AIM_FRAMETYPE_OFT) {
+    newtx->hdr.oft.type = chan;
+    newtx->hdr.oft.hdr2len = 0; /* this will get setup by caller */
   } else { 
     printf("tx_new: unknown framing\n");
   }
 
-  return new;
+  return newtx;
 }
 
 /*
index ea78693603552d474f4569d11567183e2ba41215..85b57026a42b76f2fa0140275ffbd2d4ff18794d 100644 (file)
@@ -32,6 +32,7 @@
 #else
 #include <sys/time.h>
 #include <unistd.h>
+#include <netinet/in.h>
 #endif
 
 #ifdef FAIM_USEPTHREADS
@@ -341,23 +342,23 @@ struct aim_userinfo_s {
   char sn[MAXSNLEN+1];
   u_short warnlevel;
   u_short idletime;
-  u_short class;
+  u_short flags;
   u_long membersince;
   u_long onlinesince;
   u_long sessionlen;  
   u_short capabilities;
 };
 
-#define AIM_CLASS_TRIAL        0x0001 /* "damned transients" */
-#define AIM_CLASS_ADMINISTRATOR        0x0002
-#define AIM_CLASS_AOL          0x0004
-#define AIM_CLASS_OSCAR_PAY    0x0008
-#define AIM_CLASS_FREE                 0x0010
-#define AIM_CLASS_AWAY         0x0020
-#define AIM_CLASS_UNKNOWN40    0x0040
-#define AIM_CLASS_UNKNOWN80    0x0080
+#define AIM_FLAG_UNCONFIRMED   0x0001 /* "damned transients" */
+#define AIM_FLAG_ADMINISTRATOR 0x0002
+#define AIM_FLAG_AOL           0x0004
+#define AIM_FLAG_OSCAR_PAY     0x0008
+#define AIM_FLAG_FREE          0x0010
+#define AIM_FLAG_AWAY          0x0020
+#define AIM_FLAG_UNKNOWN40     0x0040
+#define AIM_FLAG_UNKNOWN80     0x0080
 
-#define AIM_CLASS_ALLUSERS      0x001f
+#define AIM_FLAG_ALLUSERS      0x001f
 
 /*
  * TLV handling
index d38e7275fe8fcbf6312eb6e9a9f6c64d33b725b2..72e813dda7fcf0576c8d918298e81f2e05be1be6 100644 (file)
@@ -260,7 +260,7 @@ int faimtest_rateresp(struct aim_session_t *sess, struct command_rx_struct *comm
   
     aim_bos_reqrights(sess, command->conn);  
     /* set group permissions -- all user classes */
-    aim_bos_setgroupperm(sess, command->conn, AIM_CLASS_ALLUSERS);
+    aim_bos_setgroupperm(sess, command->conn, AIM_FLAG_ALLUSERS);
     aim_bos_setprivacyflags(sess, command->conn, AIM_PRIVFLAGS_ALLOWIDLE|AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
 
     break;  
@@ -506,6 +506,27 @@ int faimtest_parse_authresp(struct aim_session_t *sess, struct command_rx_struct
   return 1;
 }
 
+static void printuserflags(unsigned short flags)
+{
+  if (flags & AIM_FLAG_UNCONFIRMED)
+    printf("UNCONFIRMED ");
+  if (flags & AIM_FLAG_ADMINISTRATOR)
+    printf("ADMINISTRATOR ");
+  if (flags & AIM_FLAG_AOL)
+    printf("AOL ");
+  if (flags & AIM_FLAG_OSCAR_PAY)
+      printf("OSCAR_PAY ");
+  if (flags & AIM_FLAG_FREE)
+    printf("FREE ");
+  if (flags & AIM_FLAG_AWAY)
+    printf("AWAY ");
+  if (flags & AIM_FLAG_UNKNOWN40)
+    printf("ICQ? ");
+  if (flags & AIM_FLAG_UNKNOWN80)
+    printf("UNKNOWN80 ");
+  return;
+}
+
 int faimtest_parse_userinfo(struct aim_session_t *sess, struct command_rx_struct *command, ...)
 {
   struct aim_userinfo_s *userinfo;
@@ -523,32 +544,8 @@ int faimtest_parse_userinfo(struct aim_session_t *sess, struct command_rx_struct
   
   printf("faimtest: userinfo: sn: %s\n", userinfo->sn);
   printf("faimtest: userinfo: warnlevel: 0x%04x\n", userinfo->warnlevel);
-  printf("faimtest: userinfo: class: 0x%04x = ", userinfo->class);
-
-  /*
-   *  00000000  (binary)
-   *         1  Trial  
-   *        2   Unknown
-   *       3    AOL
-   *      4     Unknown
-   *     5      Free
-   * 
-   * ORed together.
-   *
-   */
-
-  if (userinfo->class & 0x0001)
-    printf("TRIAL ");
-  if (userinfo->class & 0x0002)
-    printf("ADMINISTRATOR ");
-  if (userinfo->class & 0x0004)
-    printf("AOL ");
-  if (userinfo->class & 0x0008)
-    printf("OSCAR_PAY ");
-  if (userinfo->class & 0x0010)
-    printf("FREE ");
-  if (userinfo->class & 0x0040)
-    printf("ICQ? ");
+  printf("faimtest: userinfo: flags: 0x%04x = ", userinfo->flags);
+  printuserflags(userinfo->flags);
   printf("\n");
   
   printf("faimtest: userinfo: membersince: %lu\n", userinfo->membersince);
@@ -575,7 +572,7 @@ int faimtest_parse_userinfo(struct aim_session_t *sess, struct command_rx_struct
  *  char *                      srcsn       the source name
  *  char *                      msg         message
  *  int                         warnlevel   warning/evil level
- *  int                         class       user class
+ *  int                         flags       flags
  *  ulong                       membersince time_t of date of signup
  *  ulong                       onsince     time_t of date of singon
  *  int                         idletime    min (sec?) idle
@@ -609,14 +606,10 @@ int faimtest_parse_incoming_im(struct aim_session_t *sess, struct command_rx_str
     
     printf("faimtest: icbm: sn = \"%s\"\n", userinfo->sn);
     printf("faimtest: icbm: warnlevel = 0x%04x\n", userinfo->warnlevel);
-    printf("faimtest: icbm: class = 0x%04x ", userinfo->class);
-    if (userinfo->class & 0x0010)
-      printf("(FREE) ");
-    if (userinfo->class & 0x0001)
-      printf("(TRIAL) ");
-    if (userinfo->class & 0x0004)
-      printf("(AOL) ");
+    printf("faimtest: icbm: flags = 0x%04x = ", userinfo->flags);
+    printuserflags(userinfo->flags);
     printf("\n");
+
     printf("faimtest: icbm: membersince = %lu\n", userinfo->membersince);
     printf("faimtest: icbm: onlinesince = %lu\n", userinfo->onlinesince);
     printf("faimtest: icbm: idletime = 0x%04x\n", userinfo->idletime);
@@ -719,14 +712,10 @@ int faimtest_parse_incoming_im(struct aim_session_t *sess, struct command_rx_str
       
       printf("faimtest: voice invitation: source sn = %s\n", userinfo->sn);
       printf("faimtest: voice invitation: \twarnlevel = 0x%04x\n", userinfo->warnlevel);
-      printf("faimtest: voice invitation: \tclass = 0x%04x ", userinfo->class);
-      if (userinfo->class & 0x0010)
-       printf("(FREE) ");
-      if (userinfo->class & 0x0001)
-       printf("(TRIAL) ");
-      if (userinfo->class & 0x0004)
-       printf("(AOL) ");
+      printf("faimtest: voice invitation: \tclass = 0x%04x = ", userinfo->flags);
+      printuserflags(userinfo->flags);
       printf("\n");
+
       /* we dont get membersince on chat invites! */
       printf("faimtest: voice invitation: \tonlinesince = %lu\n", userinfo->onlinesince);
       printf("faimtest: voice invitation: \tidletime = 0x%04x\n", userinfo->idletime);
@@ -754,14 +743,10 @@ int faimtest_parse_incoming_im(struct aim_session_t *sess, struct command_rx_str
       
       printf("faimtest: chat invitation: source sn = %s\n", userinfo->sn);
       printf("faimtest: chat invitation: \twarnlevel = 0x%04x\n", userinfo->warnlevel);
-      printf("faimtest: chat invitation: \tclass = 0x%04x ", userinfo->class);
-      if (userinfo->class & 0x0010)
-       printf("(FREE) ");
-      if (userinfo->class & 0x0001)
-       printf("(TRIAL) ");
-      if (userinfo->class & 0x0004)
-       printf("(AOL) ");
+      printf("faimtest: chat invitation: \tclass = 0x%04x = ", userinfo->flags);
+      printuserflags(userinfo->flags);
       printf("\n");
+
       /* we dont get membersince on chat invites! */
       printf("faimtest: chat invitation: \tonlinesince = %lu\n", userinfo->onlinesince);
       printf("faimtest: chat invitation: \tidletime = 0x%04x\n", userinfo->idletime);
@@ -949,16 +934,16 @@ int faimtest_parse_oncoming(struct aim_session_t *sess, struct command_rx_struct
   userinfo = va_arg(ap, struct aim_userinfo_s *);
   va_end(ap);
 
-  printf("\n%s is now online (class: %04x = %s%s%s%s%s%s%s%s) (caps = 0x%04x)\n",
-        userinfo->sn, userinfo->class,
-        (userinfo->class&AIM_CLASS_TRIAL)?" TRIAL":"",
-        (userinfo->class&AIM_CLASS_ADMINISTRATOR)?" ADMINISTRATOR":"",
-        (userinfo->class&AIM_CLASS_AOL)?" AOL":"",
-        (userinfo->class&AIM_CLASS_OSCAR_PAY)?" OSCAR_PAY":"",
-        (userinfo->class&AIM_CLASS_FREE)?" FREE":"",
-        (userinfo->class&AIM_CLASS_AWAY)?" AWAY":"",
-        (userinfo->class&AIM_CLASS_UNKNOWN40)?" UNKNOWN40":"",
-        (userinfo->class&AIM_CLASS_UNKNOWN80)?" UNKNOWN80":"",
+  printf("\n%s is now online (flags: %04x = %s%s%s%s%s%s%s%s) (caps = 0x%04x)\n",
+        userinfo->sn, userinfo->flags,
+        (userinfo->flags&AIM_FLAG_UNCONFIRMED)?" UNCONFIRMED":"",
+        (userinfo->flags&AIM_FLAG_ADMINISTRATOR)?" ADMINISTRATOR":"",
+        (userinfo->flags&AIM_FLAG_AOL)?" AOL":"",
+        (userinfo->flags&AIM_FLAG_OSCAR_PAY)?" OSCAR_PAY":"",
+        (userinfo->flags&AIM_FLAG_FREE)?" FREE":"",
+        (userinfo->flags&AIM_FLAG_AWAY)?" AWAY":"",
+        (userinfo->flags&AIM_FLAG_UNKNOWN40)?" UNKNOWN40":"",
+        (userinfo->flags&AIM_FLAG_UNKNOWN80)?" UNKNOWN80":"",
         userinfo->capabilities);
   return 1;
 }
This page took 0.075322 seconds and 5 git commands to generate.