]> andersk Git - libfaim.git/commitdiff
- Fri Aug 3 14:19:37 EDT 2001
authormid <mid>
Sat, 4 Aug 2001 01:25:22 +0000 (01:25 +0000)
committermid <mid>
Sat, 4 Aug 2001 01:25:22 +0000 (01:25 +0000)
  - Naje aun_sebd_un retyrn sabe vakyes

CHANGES
include/aim.h
src/im.c

diff --git a/CHANGES b/CHANGES
index ac1054c0d600ebc1572fde46bbc9b163969223b6..2931c903c4e155e971b046a5b668b964724460be 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
 
 No release numbers
 ------------------
+ - Fri Aug  3 14:19:37 EDT 2001
+  - Naje aun_sebd_un retyrn sabe vakyes
+
  - Thu Aug  2 13:28:37 EDT 2001
   - Uhm. Why does arcanejill think its in EDT?
   - Cache the username on warnings so errors work right.
index b29cf65ffd26fd005db9de039a59b54cd1409273..d850c1f3e7ee16a322ca6f59ba637b2b5f5b4ab0 100644 (file)
@@ -704,8 +704,8 @@ struct aim_incomingim_ch2_args {
   } info;
 };
 
-faim_export unsigned long aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args);
-faim_export unsigned long aim_send_im(struct aim_session_t *, struct aim_conn_t *, const char *destsn, unsigned short flags, const char *msg);
+faim_export int aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args);
+faim_export int aim_send_im(struct aim_session_t *, struct aim_conn_t *, const char *destsn, unsigned short flags, const char *msg);
 faim_export int aim_send_icon(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn, const unsigned char *icon, int iconlen, time_t stamp, unsigned short iconsum);
 faim_export unsigned short aim_iconsum(const unsigned char *buf, int buflen);
 faim_export int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *);
index d44e46efefceef04d429a13a4a245fb122b40daa..d78ddd88a1617290b714be19e3713c9a143cf55d 100644 (file)
--- a/src/im.c
+++ b/src/im.c
@@ -115,145 +115,149 @@ faim_export unsigned short aim_iconsum(const unsigned char *buf, int buflen)
  * "Horizontal Ellipsis", or 133 in in ASCII8).
  *
  */
-faim_export unsigned long aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args)
+faim_export int aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args)
 {
-  int curbyte,i;
-  struct command_tx_struct *newpacket;
-
-  if (!sess || !conn || !args)
-    return -1;
-
-  if (!args->msg || (args->msglen <= 0))
-    return -1;
-
-  if (args->msglen >= MAXMSGLEN)
-    return -1;
-
-  if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, args->msglen+512)))
-    return -1;
-
-  newpacket->lock = 1; /* lock struct */
-
-  curbyte  = 0;
-  curbyte += aim_putsnac(newpacket->data+curbyte, 
-                        0x0004, 0x0006, 0x0000, sess->snac_nextid);
-
-  /* 
-   * Generate a random message cookie 
-   *
-   * We could cache these like we do SNAC IDs.  (In fact, it 
-   * might be a good idea.)  In the message error functions, 
-   * the 8byte message cookie is returned as well as the 
-   * SNAC ID.
-   *
-   */
-  for (i = 0; i < 8; i++)
-    curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) rand());
-
-  /*
-   * Channel ID
-   */
-  curbyte += aimutil_put16(newpacket->data+curbyte,0x0001);
-
-  /* 
-   * Destination SN (prepended with byte length)
-   */
-  curbyte += aimutil_put8(newpacket->data+curbyte, strlen(args->destsn));
-  curbyte += aimutil_putstr(newpacket->data+curbyte, args->destsn, strlen(args->destsn));
-
-  /*
-   * metaTLV start.
-   */
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
-  curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x10);
-
-  /*
-   * Flag data / ICBM Parameters?
-   *
-   * I don't know what these are...
-   *
-   */
-  curbyte += aimutil_put8(newpacket->data+curbyte, 0x05);
-  curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
-
-  /* number of bytes to follow */
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0004);
-  curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
-  curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
-  curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
-  curbyte += aimutil_put8(newpacket->data+curbyte, 0x02);
-
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0101);
-
-  /* 
-   * Message block length.
-   */
-  curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x04);
-
-  /*
-   * Character set.
-   */
-  if (args->flags & AIM_IMFLAGS_UNICODE)
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
-  else if (args->flags & AIM_IMFLAGS_ISO_8859_1)
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003);
-  else
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
-
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
-
-  /*
-   * Message.  Not terminated.
-   */
-  curbyte += aimutil_putstr(newpacket->data+curbyte, args->msg, args->msglen);
+       int curbyte,i;
+       struct command_tx_struct *newpacket;
+
+       if (!sess || !conn || !args)
+               return -EINVAL;
+
+       if (!args->msg || (args->msglen <= 0))
+               return -EINVAL;
+
+       if (args->msglen >= MAXMSGLEN)
+               return -E2BIG;
+
+       if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, args->msglen+512)))
+               return -ENOMEM;
+
+       newpacket->lock = 1; /* lock struct */
+
+       curbyte  = 0;
+       curbyte += aim_putsnac(newpacket->data+curbyte, 
+                               0x0004, 0x0006, 0x0000, sess->snac_nextid);
+
+       /* 
+        * Generate a random message cookie 
+        *
+        * We could cache these like we do SNAC IDs.  (In fact, it 
+        * might be a good idea.)  In the message error functions, 
+        * the 8byte message cookie is returned as well as the 
+        * SNAC ID.
+        *
+        */
+       for (i = 0; i < 8; i++) {
+               curbyte += aimutil_put8(newpacket->data+curbyte, 
+                                       (unsigned char) rand());
+       }
 
-  /*
-   * Set the Request Acknowledge flag.  
-   */
-  if (args->flags & AIM_IMFLAGS_ACK) {
-    curbyte += aimutil_put16(newpacket->data+curbyte,0x0003);
-    curbyte += aimutil_put16(newpacket->data+curbyte,0x0000);
-  }
-  
-  /*
-   * Set the Autoresponse flag.
-   */
-  if (args->flags & AIM_IMFLAGS_AWAY) {
-    curbyte += aimutil_put16(newpacket->data+curbyte,0x0004);
-    curbyte += aimutil_put16(newpacket->data+curbyte,0x0000);
-  }
+       /*
+        * Channel ID
+        */
+       curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
+
+       /*
+        * Destination SN (prepended with byte length)
+        */
+       curbyte += aimutil_put8(newpacket->data+curbyte, strlen(args->destsn));
+       curbyte += aimutil_putstr(newpacket->data+curbyte, 
+                                       args->destsn, strlen(args->destsn));
+
+       /*
+        * metaTLV start.
+        */
+       curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
+       curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x10);
+
+       /*
+        * Flag data / ICBM Parameters?
+        *
+        * I don't know what these are...
+        *
+        */
+       curbyte += aimutil_put8(newpacket->data+curbyte, 0x05);
+       curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
+
+       /* number of bytes to follow */
+       curbyte += aimutil_put16(newpacket->data+curbyte, 0x0004);
+       curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
+       curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
+       curbyte += aimutil_put8(newpacket->data+curbyte, 0x01);
+       curbyte += aimutil_put8(newpacket->data+curbyte, 0x02);
+
+       curbyte += aimutil_put16(newpacket->data+curbyte, 0x0101);
+
+       /* 
+        * Message block length.
+        */
+       curbyte += aimutil_put16(newpacket->data+curbyte, args->msglen + 0x04);
+
+       /*
+        * Character set.
+        */
+       if (args->flags & AIM_IMFLAGS_UNICODE)
+               curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
+       else if (args->flags & AIM_IMFLAGS_ISO_8859_1)
+               curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003);
+       else
+               curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
+
+       curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
+
+       /*
+        * Message.  Not terminated.
+        */
+       curbyte += aimutil_putstr(newpacket->data+curbyte, 
+                                       args->msg, args->msglen);
+
+       /*
+        * Set the Request Acknowledge flag.  
+        */
+       if (args->flags & AIM_IMFLAGS_ACK) {
+               curbyte += aimutil_put16(newpacket->data+curbyte,0x0003);
+               curbyte += aimutil_put16(newpacket->data+curbyte,0x0000);
+       }
   
-  /*
-   * Set the Buddy Icon Requested flag.
-   */
-  if (args->flags & AIM_IMFLAGS_BUDDYREQ) {
-    curbyte += aimutil_put16(newpacket->data+curbyte,0x0009);
-    curbyte += aimutil_put16(newpacket->data+curbyte,0x0000);
-  }
+       /*
+        * Set the Autoresponse flag.
+        */
+       if (args->flags & AIM_IMFLAGS_AWAY) {
+               curbyte += aimutil_put16(newpacket->data+curbyte,0x0004);
+               curbyte += aimutil_put16(newpacket->data+curbyte,0x0000);
+       }
 
-  /*
-   * Set the I HAVE A REALLY PURTY ICON flag (with timestamp).
-   */
-  if (args->flags & AIM_IMFLAGS_HASICON) {
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0008);
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x000c);
-    curbyte += aimutil_put32(newpacket->data+curbyte, args->iconlen);
-    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
-    curbyte += aimutil_put16(newpacket->data+curbyte, args->iconsum);
-    curbyte += aimutil_put32(newpacket->data+curbyte, args->iconstamp);
-  }
+       /*
+        * Set the Buddy Icon Requested flag.
+        */
+       if (args->flags & AIM_IMFLAGS_BUDDYREQ) {
+               curbyte += aimutil_put16(newpacket->data+curbyte,0x0009);
+               curbyte += aimutil_put16(newpacket->data+curbyte,0x0000);
+       }
 
-  newpacket->commandlen = curbyte;
-  newpacket->lock = 0;
+       /*
+        * Set the I HAVE A REALLY PURTY ICON flag (with timestamp).
+        */
+       if (args->flags & AIM_IMFLAGS_HASICON) {
+               curbyte += aimutil_put16(newpacket->data+curbyte, 0x0008);
+               curbyte += aimutil_put16(newpacket->data+curbyte, 0x000c);
+               curbyte += aimutil_put32(newpacket->data+curbyte, args->iconlen);
+               curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
+               curbyte += aimutil_put16(newpacket->data+curbyte, args->iconsum);
+               curbyte += aimutil_put32(newpacket->data+curbyte, args->iconstamp);
+       }
 
-  aim_tx_enqueue(sess, newpacket);
+       newpacket->commandlen = curbyte;
+       newpacket->lock = 0;
+
+       aim_tx_enqueue(sess, newpacket);
 
 #if 1 /* XXX do this with autoconf or something... */
-  aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, args->destsn, strlen(args->destsn)+1);
-  aim_cleansnacs(sess, 60); /* clean out all SNACs over 60sec old */
+       aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, args->destsn, strlen(args->destsn)+1);
+       aim_cleansnacs(sess, 60); /* clean out all SNACs over 60sec old */
 #endif
 
-  return sess->snac_nextid;
+       return 0;
 }
 
 /*
@@ -266,16 +270,16 @@ faim_export unsigned long aim_send_im_ext(struct aim_session_t *sess, struct aim
  * that requires an explicit message length.  Use aim_send_im_ext().
  *
  */
-faim_export unsigned long aim_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, const char *destsn, unsigned short flags, const char *msg)
+faim_export int aim_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, const char *destsn, unsigned short flags, const char *msg)
 {
-  struct aim_sendimext_args args;
+       struct aim_sendimext_args args;
 
-  args.destsn = destsn;
-  args.flags = flags;
-  args.msg = msg;
-  args.msglen = strlen(msg);
+       args.destsn = destsn;
+       args.flags = flags;
+       args.msg = msg;
+       args.msglen = strlen(msg);
 
-  return aim_send_im_ext(sess, conn, &args);
+       return aim_send_im_ext(sess, conn, &args);
 }
 
 faim_export int aim_send_icon(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn, const unsigned char *icon, int iconlen, time_t stamp, unsigned short iconsum)
This page took 0.081732 seconds and 5 git commands to generate.