]> andersk Git - libfaim.git/blobdiff - utils/faimtest/faimtest.c
- Sat Dec 16 01:34:19 UTC 2000
[libfaim.git] / utils / faimtest / faimtest.c
index 5370a492bae241026641664858685f28ecb4b24b..d0c0453a3ead9750f8bc0cfd247e3d202ac1208e 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;
@@ -1611,7 +1631,7 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru
                           "limit cleared"};
   va_list ap;
   int code;
-  unsigned long parmid, windowsize, clear, alert, limit, disconnect;
+  unsigned long rateclass, windowsize, clear, alert, limit, disconnect;
   unsigned long currentavg, maxavg;
 
   va_start(ap, command); 
@@ -1620,11 +1640,9 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru
   code = va_arg(ap, int);
 
   /*
-   * Known parameter ID's...
-   *   0x0003  BOS (normal ICBMs, userinfo requests, etc)
-   *   0x0005  Chat messages
+   * See comments above aim_parse_ratechange_middle() in aim_rxhandlers.c.
    */
-  parmid = va_arg(ap, unsigned long);
+  rateclass = va_arg(ap, unsigned long);
 
   /*
    * Not sure what this is exactly.  I think its the temporal 
@@ -1644,9 +1662,9 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru
   va_end(ap);
 
 
-  printf("faimtest: rate %s (paramid 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n",
+  printf("faimtest: rate %s (rate class 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n",
         (code < 5)?codes[code]:"invalid",
-        parmid,
+        rateclass,
         currentavg, maxavg,
         alert, clear,
         limit, disconnect,
@@ -1690,13 +1708,23 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru
 int faimtest_parse_evilnotify(struct aim_session_t *sess, struct command_rx_struct *command, ...)
 {
   va_list ap;
-  char *sn;
+  int newevil;
+  struct aim_userinfo_s *userinfo;
 
   va_start(ap, command);
-  sn = va_arg(ap, char *);
+  newevil = va_arg(ap, int);
+  userinfo = va_arg(ap, struct aim_userinfo_s *);
   va_end(ap);
 
-  printf("faimtest: warning from: %s\n", sn);
+  /*
+   * Evil Notifications that are lacking userinfo->sn are anon-warns
+   * if they are an evil increases, but are not warnings at all if its
+   * a decrease (its the natural backoff happening).
+   *
+   * newevil is passed as an int representing the new evil value times
+   * ten.
+   */
+  printf("faimtest: evil level change: new value = %2.1f%% (caused by %s)\n", ((float)newevil)/10, (userinfo && strlen(userinfo->sn))?userinfo->sn:"anonymous");
 
   return 1;
 }
This page took 0.037836 seconds and 4 git commands to generate.