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
{
struct aim_tlv_t *block1;
struct aim_tlvlist_t *list2;
- struct aim_tlv_t *tmptlv;
unsigned short reqclass = 0;
unsigned short status = 0;
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;
break;
/*
- * Type = 0x0001: Member Class.
+ * Type = 0x0001: User flags
*
* Specified as any of the following bitwise ORed together:
* 0x0001 Trial (user less than 60days)
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;
/* 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);
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;
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;
}
*/
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;
}
/*
#else
#include <sys/time.h>
#include <unistd.h>
+#include <netinet/in.h>
#endif
#ifdef FAIM_USEPTHREADS
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
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;
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;
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);
* 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
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);
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);
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);
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;
}