changeset 900:e18815f5a4e9

[gaim-migrate @ 910] libfaim changes la la la committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 13 Sep 2000 23:48:43 +0000
parents 88d1edcd7cd6
children f168f2c7b357
files libfaim/CHANGES libfaim/aim_im.c libfaim/aim_info.c libfaim/aim_rxhandlers.c libfaim/aim_tlv.c libfaim/aim_txqueue.c libfaim/faim/aim.h src/oscar.c
diffstat 8 files changed, 88 insertions(+), 86 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Wed Sep 13 23:33:11 2000 +0000
+++ b/libfaim/CHANGES	Wed Sep 13 23:48:43 2000 +0000
@@ -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 
 
--- a/libfaim/aim_im.c	Wed Sep 13 23:33:11 2000 +0000
+++ b/libfaim/aim_im.c	Wed Sep 13 23:48:43 2000 +0000
@@ -397,7 +397,6 @@
     {	
       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 @@
 	  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;
--- a/libfaim/aim_info.c	Wed Sep 13 23:33:11 2000 +0000
+++ b/libfaim/aim_info.c	Wed Sep 13 23:48:43 2000 +0000
@@ -259,7 +259,7 @@
       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 @@
     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 @@
 
   /* 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);
--- a/libfaim/aim_rxhandlers.c	Wed Sep 13 23:33:11 2000 +0000
+++ b/libfaim/aim_rxhandlers.c	Wed Sep 13 23:48:43 2000 +0000
@@ -188,31 +188,31 @@
 			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;
--- a/libfaim/aim_tlv.c	Wed Sep 13 23:33:11 2000 +0000
+++ b/libfaim/aim_tlv.c	Wed Sep 13 23:48:43 2000 +0000
@@ -97,93 +97,93 @@
 
 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;
 }
--- a/libfaim/aim_txqueue.c	Wed Sep 13 23:33:11 2000 +0000
+++ b/libfaim/aim_txqueue.c	Wed Sep 13 23:48:43 2000 +0000
@@ -25,37 +25,37 @@
  */
 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;
+    newtx->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->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;
 }
 
 /*
--- a/libfaim/faim/aim.h	Wed Sep 13 23:33:11 2000 +0000
+++ b/libfaim/faim/aim.h	Wed Sep 13 23:48:43 2000 +0000
@@ -32,6 +32,7 @@
 #else
 #include <sys/time.h>
 #include <unistd.h>
+#include <netinet/in.h>
 #endif
 
 #ifdef FAIM_USEPTHREADS
@@ -341,23 +342,23 @@
   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
--- a/src/oscar.c	Wed Sep 13 23:33:11 2000 +0000
+++ b/src/oscar.c	Wed Sep 13 23:48:43 2000 +0000
@@ -542,15 +542,15 @@
 	info = va_arg(ap, struct aim_userinfo_s *);
 	va_end(ap);
 
-	if (info->class & AIM_CLASS_TRIAL)
+	if (info->flags & AIM_FLAG_UNCONFIRMED)
 		type |= UC_UNCONFIRMED;
-	else if (info->class & AIM_CLASS_ADMINISTRATOR)
+	else if (info->flags & AIM_FLAG_ADMINISTRATOR)
 		type |= UC_ADMIN;
-	else if (info->class & AIM_CLASS_AOL)
+	else if (info->flags & AIM_FLAG_AOL)
 		type |= UC_AOL;
-	else if (info->class & AIM_CLASS_FREE)
+	else if (info->flags & AIM_FLAG_FREE)
 		type |= UC_NORMAL;
-	if (info->class & AIM_CLASS_AWAY)
+	if (info->flags & AIM_FLAG_AWAY)
 		type |= UC_UNAVAILABLE;
 
 	if (info->idletime) {
@@ -1093,7 +1093,7 @@
 		aim_bos_reqicbmparaminfo(sess, command->conn);
 
 		aim_bos_reqrights(sess, command->conn);
-		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);