]> andersk Git - libfaim.git/commitdiff
- Thu Mar 29 14:45:22 CST 2001 (jbm)
authorjbm <jbm>
Thu, 29 Mar 2001 20:48:37 +0000 (20:48 +0000)
committerjbm <jbm>
Thu, 29 Mar 2001 20:48:37 +0000 (20:48 +0000)
  - Add module capability to the 0001/001f stuff (jbm)

CHANGES
src/login.c
utils/faimtest/faimtest.c

diff --git a/CHANGES b/CHANGES
index 93073e3d3e0bcd79a5ec1c144a94e1545a8b9dec..a5e69faced17b9b36730100d5ec1bd9ac4041983 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
 
 No release numbers
 ------------------
+ - Thu Mar 29 14:45:22 CST 2001 (jbm)
+  - Add module capability to the 0001/001f stuff (jbm)
+
  - Wed Mar 28 21:20:08 PST 2001
   - Add flags arg to aim_chat_send_im()
   - Add msglen arg to aim_send_im and aim_chat_send_im
index 1fd031ab1c9ad2213c9d6f9fee1753f1a81b4de3..bb26feddbd876f9ef59405fb303b42ee4286a9aa 100644 (file)
@@ -715,14 +715,31 @@ static int memrequest(struct aim_session_t *sess, aim_module_t *mod, struct comm
 {
   rxcallback_t userfunc;
   unsigned long offset, len;
+  struct aim_tlvlist_t *tlvlist;
+  struct aim_tlv_t *tlv;
+  char *modname;
 
   offset = aimutil_get32(data);
   len = aimutil_get32(data+4);
 
-  faimdprintf(sess, 1, "data at 0x%08lx (%d bytes) requested\n", offset, len);
+  if(rx->commandlen > 0x12) { /* XXX right len? */
+    tlvlist = aim_readtlvchain(data+8, datalen-8);
+
+    if((tlv = aim_gettlv(tlvlist, 0x0001, 1))) {
+      modname = malloc(tlv->length + 5);
+      memset(modname, 0, tlv->length + 5);
+      memcpy(modname, tlv->value, tlv->length);
+      strncat(modname, ".ocm", tlv->length + 5 - strlen(modname));
+    } else {
+      modname = "aim.exe";
+    }
+  }  else
+    modname = "aim.exe";
+    
+  faimdprintf(sess, 1, "data at 0x%08lx (%d bytes) of %s requested\n", offset, len, modname);
 
   if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-    return userfunc(sess, rx, offset, len);
+    return userfunc(sess, rx, offset, len, modname);
 
   return 0;
 }
index ec10485303d857a72d91ade469c0d594deafc346..bc6656abda29e729d329095e8c2fe69f99caa4ef 100644 (file)
@@ -797,11 +797,26 @@ int faimtest_handleredirect(struct aim_session_t *sess, struct command_rx_struct
   return 1;
 }
 
-static int getaimdata(unsigned char *buf, int buflen, unsigned long offset)
+static int getaimdata(unsigned char *buf, int buflen, unsigned long offset, char *modname)
 {
   FILE *f;
 
-  if (!(f = fopen(aimbinarypath, "r"))) {
+  char *filename;
+  int len;
+
+  len = strlen(aimbinarypath)+1+strlen(modname)+1;
+
+  if(!(filename = malloc(len))) {
+    dperror("memrequest: malloc");
+    return -1;
+  }
+
+  memset(filename,0, len);
+  memcpy(filename, aimbinarypath, strlen(aimbinarypath));
+  filename[strlen(filename)] = '/';
+  strncat(filename, modname, len - strlen(filename));
+
+  if (!(f = fopen(filename, "r"))) {
     dperror("memrequest: fopen");
     return -1;
   }
@@ -835,10 +850,12 @@ static int faimtest_memrequest(struct aim_session_t *sess, struct command_rx_str
   va_list ap;
   unsigned long offset, len;
   unsigned char *buf;
+  char *modname;
   
   va_start(ap, command);
   offset = va_arg(ap, unsigned long);
   len = va_arg(ap, unsigned long);
+  modname = va_arg(ap, char *);
   va_end(ap);
 
   if (!(buf = malloc(len))) {
@@ -846,15 +863,15 @@ static int faimtest_memrequest(struct aim_session_t *sess, struct command_rx_str
     return 0;
   }
 
-  if (aimbinarypath && (getaimdata(buf, len, offset) == len)) {
+  if (aimbinarypath && (getaimdata(buf, len, offset, modname) == len)) {
 
-    dvprintf("memrequest: sending %ld bytes from 0x%08lx in %s...\n", len, offset, aimbinarypath);
+    dvprintf("memrequest: sending %ld bytes from 0x%08lx in \"%s/%s\"...\n", len, offset, aimbinarypath, modname);
 
     aim_sendmemblock(sess, command->conn, offset, len, buf);
 
   } else {
 
-    dprintf("memrequest: unable to use AIM binary, sending defaults...\n");
+    dvprintf("memrequest: unable to use AIM binary (\"%s/%s\"), sending defaults...\n", aimbinarypath, modname);
 
     aim_sendmemblock(sess, command->conn, offset, len, NULL);
 
This page took 0.07271 seconds and 5 git commands to generate.