libfaim/aim_info.c

changeset 835
ae8ae0549dd5
parent 445
f7ef3b61a842
child 840
b80a628d935f
--- a/libfaim/aim_info.c	Sat Sep 02 12:46:05 2000 +0000
+++ b/libfaim/aim_info.c	Sun Sep 03 23:22:05 2000 +0000
@@ -57,6 +57,49 @@
   return (sess->snac_nextid++);
 }
 
+int aim_parse_locateerr(struct aim_session_t *sess,
+			struct command_rx_struct *command)
+{
+  u_long snacid = 0x000000000;
+  struct aim_snac_t *snac = NULL;
+  int ret = 0;
+  rxcallback_t userfunc = NULL;
+  char *dest;
+  unsigned short reason = 0;
+
+  /*
+   * Get SNAC from packet and look it up 
+   * the list of unrepliedto/outstanding
+   * SNACs.
+   *
+   */
+  snacid = aimutil_get32(command->data+6);
+  snac = aim_remsnac(sess, snacid);
+
+  if (!snac) {
+    printf("faim: locerr: got an locate-failed error on an unknown SNAC ID! (%08lx)\n", snacid);
+    dest = NULL;
+  } else
+    dest = snac->data;
+
+  reason = aimutil_get16(command->data+10);
+
+  /*
+   * Call client.
+   */
+  userfunc = aim_callhandler(command->conn, 0x0002, 0x0001);
+  if (userfunc)
+    ret =  userfunc(sess, command, dest, reason);
+  else
+    ret = 0;
+  
+  if (snac) {
+    free(snac->data);
+    free(snac);
+  }
+
+  return ret;
+}
 
 /*
  * Capability blocks.  

mercurial