]> andersk Git - libfaim.git/commitdiff
- Fri Dec 15 23:35:01 UTC 2000
authormid <mid>
Fri, 15 Dec 2000 23:38:51 +0000 (23:38 +0000)
committermid <mid>
Fri, 15 Dec 2000 23:38:51 +0000 (23:38 +0000)
  - Add genericerr callback/middle.
   - This is for catching the errors that come back, for instance, from
     sending a SNAC that isn't supported by the host (such as the
     Watcher Request SNAC).

CHANGES
aim_rxhandlers.c
utils/faimtest/faimtest.c

diff --git a/CHANGES b/CHANGES
index bda46f4c9301aad506ab33dbdcc8f962fd89b45a..0ed63f5cf57fd780c0c7f8997e3d91caf7d7ce8d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,12 @@
 
 No release numbers
 ------------------
+ - Fri Dec 15 23:35:01 UTC 2000
+  - Add genericerr callback/middle. 
+   - This is for catching the errors that come back, for instance, from
+     sending a SNAC that isn't supported by the host (such as the
+     Watcher Request SNAC).
+
  - Fri Dec 15 21:51:32 UTC 2000
   - Add more info to evilnotify callback
   - Add a few values to aim_cbtypes.h
index 076f99bb0b1ad4778baa7f1e58f843aacf7dc073..16b77443df251edc771dcc40b37549c58390b1aa 100644 (file)
@@ -907,20 +907,22 @@ faim_internal int aim_negchan_middle(struct aim_session_t *sess,
 faim_internal int aim_parse_generalerrs(struct aim_session_t *sess,
                                        struct command_rx_struct *command, ...)
 {
-  u_short family;
-  u_short subtype;
+  unsigned short family;
+  unsigned short subtype;
+  int ret = 1;
+  int error = 0;
+  rxcallback_t userfunc = NULL;
   
   family = aimutil_get16(command->data+0);
   subtype= aimutil_get16(command->data+2);
   
-  switch(family)
-    {
-    default:
-      /* Unknown family */
-      return aim_callhandler_noparam(sess, command->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_UNKNOWN, command);
-    }
+  if (command->commandlen > 10)
+    error = aimutil_get16(command->data+10);
 
-  return 1;
+  if ((userfunc = aim_callhandler(command->conn, family, subtype))) 
+    ret = userfunc(sess, command, error);
+
+  return ret;
 }
 
 
index fc0acaf2109350794986bd3f75250d6db45d99e2..3afbc7de6ae4913580f0120e5389569e1e130a54 100644 (file)
@@ -88,6 +88,7 @@ int faimtest_parse_evilnotify(struct aim_session_t *sess, struct command_rx_stru
 int faimtest_parse_msgerr(struct aim_session_t *sess, struct command_rx_struct *command, ...);
 int faimtest_parse_buddyrights(struct aim_session_t *sess, struct command_rx_struct *command, ...);
 int faimtest_parse_locerr(struct aim_session_t *sess, struct command_rx_struct *command, ...);
+int faimtest_parse_genericerr(struct aim_session_t *sess, struct command_rx_struct *command, ...);
 
 static char *msgerrreasons[] = {
   "Invalid error",
@@ -674,8 +675,13 @@ int faimtest_parse_authresp(struct aim_session_t *sess, struct command_rx_struct
   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEFAULT, aim_parse_unknown, 0);
   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, faimtest_parse_motd, 0);
     
+  aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, faimtest_parse_genericerr, 0);
+  aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, faimtest_parse_genericerr, 0);
+  aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, faimtest_parse_genericerr, 0);
+
   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, faimtest_parse_connerr, 0);
-    
+
+
   aim_auth_sendcookie(sess, bosconn, cookie);
 
   return 1;
@@ -1209,6 +1215,20 @@ int faimtest_parse_motd(struct aim_session_t *sess, struct command_rx_struct *co
   return 1;
 }
 
+int faimtest_parse_genericerr(struct aim_session_t *sess, struct command_rx_struct *command, ...)
+{
+  va_list ap;
+  unsigned short reason;
+
+  va_start(ap, command);
+  reason = va_arg(ap, int);
+  va_end(ap);
+
+  printf("faimtest: snac threw error (reason 0x%04x: %s)\n", reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown");
+  
+  return 1;
+}
+
 int faimtest_parse_msgerr(struct aim_session_t *sess, struct command_rx_struct *command, ...)
 {
   va_list ap;
This page took 2.200273 seconds and 5 git commands to generate.