changeset 1258:385c1a1d96aa

[gaim-migrate @ 1268] more libfaim changes. yay. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 14 Dec 2000 07:17:34 +0000
parents 0f7b837d88d2
children 7db9121aac80
files libfaim/CHANGES libfaim/aim_misc.c libfaim/aim_rxhandlers.c libfaim/faim/aim.h
diffstat 4 files changed, 90 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Thu Dec 14 06:54:26 2000 +0000
+++ b/libfaim/CHANGES	Thu Dec 14 07:17:34 2000 +0000
@@ -1,6 +1,12 @@
 
 No release numbers
 ------------------
+ - Thu Dec 14 03:39:34 UTC 2000
+  - Change the 0x01 to a 0x00 in auth request to make buddy lists work again
+  - Rearrange bytes in setversions() to match winaim
+  - Add several cachesnac() calls
+  - Add hostonline and hostversions parsers (superfluous)
+
  - Wed Dec 13 02:26:39 UTC 2000
   - Create aim_cachesnac()
   - Some long overdue cleanups
--- a/libfaim/aim_misc.c	Thu Dec 14 06:54:26 2000 +0000
+++ b/libfaim/aim_misc.c	Thu Dec 14 07:17:34 2000 +0000
@@ -457,10 +457,14 @@
   newpacket->lock = 1;
 
   i = aim_putsnac(newpacket->data, 0x0001, 0x0017, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, 0x0001, 0x0017, 0x0000, NULL, 0);
 
   i += aimutil_put16(newpacket->data+i, 0x0001);
   i += aimutil_put16(newpacket->data+i, 0x0003);
 
+  i += aimutil_put16(newpacket->data+i, 0x0013);
+  i += aimutil_put16(newpacket->data+i, 0x0001);
+
   i += aimutil_put16(newpacket->data+i, 0x0002);
   i += aimutil_put16(newpacket->data+i, 0x0001);
 
@@ -483,29 +487,16 @@
   i += aimutil_put16(newpacket->data+i, 0x0001);
 
   i += aimutil_put16(newpacket->data+i, 0x000b);
-  i += aimutil_put16(newpacket->data+i, 0x0002);
+  i += aimutil_put16(newpacket->data+i, 0x0001);
 
   i += aimutil_put16(newpacket->data+i, 0x000c);
   i += aimutil_put16(newpacket->data+i, 0x0001);
 
-  i += aimutil_put16(newpacket->data+i, 0x0013);
-  i += aimutil_put16(newpacket->data+i, 0x0001);
-
-  i += aimutil_put16(newpacket->data+i, 0x0015);
-  i += aimutil_put16(newpacket->data+i, 0x0001);
-
-#if 0
-  for (j = 0; j < 0x10; j++) {
-    i += aimutil_put16(newpacket->data+i, j); /* family */
-    i += aimutil_put16(newpacket->data+i, 0x0003); /* version */
-  }
-#endif
-
   newpacket->commandlen = i;
   newpacket->lock = 0;
   aim_tx_enqueue(sess, newpacket);
 
-  return (sess->snac_nextid++);
+  return sess->snac_nextid;
 }
 
 
@@ -655,9 +646,11 @@
   newpacket->lock = 1;
 
   aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
- 
+
+  aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
+
   aim_tx_enqueue(sess, newpacket);
-  return (sess->snac_nextid++);
+  return sess->snac_nextid;
 }
 
 /*
@@ -682,13 +675,14 @@
   newpacket->lock = 1;
 
   aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
 
   /* copy in data */
   newlong = htonl(*longdata);
   memcpy(&(newpacket->data[10]), &newlong, sizeof(u_long));
 
   aim_tx_enqueue(sess, newpacket);
-  return (sess->snac_nextid++);
+  return sess->snac_nextid;
 }
 
 faim_internal unsigned long aim_genericreq_s(struct aim_session_t *sess,
@@ -709,13 +703,14 @@
   newpacket->lock = 1;
 
   aim_putsnac(newpacket->data, family, subtype, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
 
   /* copy in data */
   newshort = htons(*shortdata);
   memcpy(&(newpacket->data[10]), &newshort, sizeof(u_short));
 
   aim_tx_enqueue(sess, newpacket);
-  return (sess->snac_nextid++);
+  return sess->snac_nextid;
 }
 
 /*
@@ -757,6 +752,8 @@
   newpacket->lock = 1;
 
   i = aim_putsnac(newpacket->data, 0x0004, 0x0002, 0x0000, sess->snac_nextid);
+  aim_cachesnac(sess, 0x0004, 0x0002, 0x0000, NULL, 0);
+
   i += aimutil_put16(newpacket->data+i, 0x0000); 
   i += aimutil_put16(newpacket->data+i, 0x0000);
   i += aimutil_put16(newpacket->data+i, 0x0003);
@@ -768,7 +765,7 @@
   
   aim_tx_enqueue(sess, newpacket);
 
-  return (sess->snac_nextid);
+  return sess->snac_nextid;
 }
 
 /* 
--- a/libfaim/aim_rxhandlers.c	Thu Dec 14 06:54:26 2000 +0000
+++ b/libfaim/aim_rxhandlers.c	Thu Dec 14 07:17:34 2000 +0000
@@ -370,21 +370,24 @@
 	    else
 	      workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
 	    break;
-         case 0x0007:
-           if (subtype == 0x0005)
-             workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_ADM, AIM_CB_ADM_INFOCHANGE_REPLY, workingPtr);
-           break;
-         case AIM_CB_FAM_SPECIAL:
-           if (subtype == AIM_CB_SPECIAL_DEBUGCONN_CONNECT) {
-             workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
-             break;
-           } /* others fall through */
-         default:
-#if 0
-           /* Old login protocol */
-           /* any user callbacks will be called from here */
-           workingPtr->handled = aim_authparse(sess, workingPtr);
-#endif
+	  case 0x0001:
+	    if (subtype == 0x0003)
+	      workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
+	    else
+	      workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
+	    break;
+	  case 0x0007:
+	    if (subtype == 0x0005)
+	      workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_ADM, AIM_CB_ADM_INFOCHANGE_REPLY, workingPtr);
+	    break;
+	  case AIM_CB_FAM_SPECIAL:
+	    if (subtype == AIM_CB_SPECIAL_DEBUGCONN_CONNECT) {
+	      workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, family, subtype, workingPtr);
+	      break;
+	    } else
+	      workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0017, 0xffff, workingPtr);
+	    break;
+	  default:
 	    break;
 	  }
 	}
@@ -415,7 +418,7 @@
 	    workingPtr->handled = aim_parse_generalerrs(sess, workingPtr);
 	    break;
 	  case 0x0003:
-	    workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0003, workingPtr);
+	    workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
 	    break;
 	  case 0x0005:
 	    workingPtr->handled = aim_handleredirect_middle(sess, workingPtr);
@@ -435,6 +438,9 @@
 	  case 0x0013:
 	    workingPtr->handled = aim_parsemotd_middle(sess, workingPtr);
 	    break;
+	  case 0x0018:
+	    workingPtr->handled = aim_parse_hostversions(sess, workingPtr);
+	    break;
 	  default:
 	    workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_GEN, AIM_CB_GEN_DEFAULT, workingPtr);
 	    break;
@@ -544,6 +550,8 @@
 
 	if ((family == 0x0000) && (subtype == 0x00001)) {
 	  workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, workingPtr);
+	} else if ((family == 0x0001) && (subtype == 0x0003)) {
+	  workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
 	} else if ((family == 0x000d) && (subtype == 0x0009)) {
 	  workingPtr->handled = aim_chatnav_parse_info(sess, workingPtr);
 	} else {
@@ -563,7 +571,7 @@
 	  if (subtype == 0x0001)
 	    workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0001, workingPtr);
 	  else if (subtype == 0x0003)
-	    workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0003, workingPtr);
+	    workingPtr->handled = aim_parse_hostonline(sess, workingPtr);
 	  else if (subtype == 0x0007)
 	    workingPtr->handled = aim_callhandler_noparam(sess, workingPtr->conn, 0x0001, 0x0007, workingPtr);
 	  else
@@ -731,8 +739,46 @@
   return ret;  
 }
 
+faim_internal int aim_parse_hostonline(struct aim_session_t *sess,
+				       struct command_rx_struct *command, ...)
+{
+  rxcallback_t userfunc = NULL;
+  int ret = 1;
+  unsigned short *families = NULL;
+  int famcount = 0, i;
+
+  famcount = (command->commandlen-10)/2;
+  if (!(families = malloc(command->commandlen-10)))
+    return ret;
+
+  for (i = 0; i < famcount; i++)
+    families[i] = aimutil_get16(command->data+((i*2)+10));
+
+  if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0003)))
+    ret = userfunc(sess, command, famcount, families);
+
+  free(families);
+
+  return ret;  
+}
+
+faim_internal int aim_parse_hostversions(struct aim_session_t *sess,
+					 struct command_rx_struct *command, ...)
+{
+  rxcallback_t userfunc = NULL;
+  int ret = 1;
+  int vercount;
+
+  vercount = (command->commandlen-10)/4;
+  
+  if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x0018)))
+    ret = userfunc(sess, command, vercount, command->data+10);
+
+  return ret;  
+}
+
 faim_internal int aim_handleredirect_middle(struct aim_session_t *sess,
-			      struct command_rx_struct *command, ...)
+					    struct command_rx_struct *command, ...)
 {
   int serviceid = 0;
   unsigned char *cookie = NULL;
--- a/libfaim/faim/aim.h	Thu Dec 14 06:54:26 2000 +0000
+++ b/libfaim/faim/aim.h	Thu Dec 14 07:17:34 2000 +0000
@@ -476,6 +476,9 @@
 faim_export int aim_tx_flushqueue(struct aim_session_t *);
 faim_internal int aim_tx_printqueue(struct aim_session_t *);
 faim_export void aim_tx_purgequeue(struct aim_session_t *);
+faim_internal int aim_parse_hostonline(struct aim_session_t *sess, struct command_rx_struct *command, ...);
+faim_internal int aim_parse_hostversions(struct aim_session_t *sess, struct command_rx_struct *command, ...);
+
 
 struct aim_rxcblist_t {
   u_short family;