diff libfaim/chat.c @ 1746:bacb77b0eb06

[gaim-migrate @ 1756] this won't help. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 25 Apr 2001 01:53:56 +0000
parents 3fe5799b7823
children 109cacf1ff97
line wrap: on
line diff
--- a/libfaim/chat.c	Tue Apr 24 23:23:40 2001 +0000
+++ b/libfaim/chat.c	Wed Apr 25 01:53:56 2001 +0000
@@ -51,17 +51,30 @@
   return 0;
 }
 
-/* XXX convert this to use tlvchains */
+/*
+ * Send a Chat Message.
+ *
+ * Possible flags:
+ *   AIM_CHATFLAGS_NOREFLECT   --  Unset the flag that requests messages
+ *                                 should be sent to their sender.
+ *   AIM_CHATFLAGS_AWAY        --  Mark the message as an autoresponse
+ *                                 (Note that WinAIM does not honor this,
+ *                                 and displays the message as normal.)
+ *
+ * XXX convert this to use tlvchains 
+ */
 faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess,
 					   struct aim_conn_t *conn, 
-					   char *msg)
+					   unsigned short flags,
+					   const char *msg,
+					   int msglen)
 {   
 
   int curbyte,i;
   struct command_tx_struct *newpacket;
   struct aim_msgcookie_t *cookie;
 
-  if (!sess || !conn || !msg)
+  if (!sess || !conn || !msg || (msglen <= 0))
     return 0;
   
   if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152)))
@@ -90,16 +103,26 @@
   curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003);
 
   /*
-   * Type 1: Unknown.  Blank.
+   * Type 1: Flag meaning this message is destined to the room.
    */
   curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
   curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
   
   /*
-   * Type 6: Unknown.  Blank.
+   * Type 6: Reflect
    */
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0006);
-  curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
+  if (!(flags & AIM_CHATFLAGS_NOREFLECT)) {
+    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0006);
+    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
+  }
+
+  /*
+   * Type 7: Autoresponse
+   */
+  if (flags & AIM_CHATFLAGS_AWAY) {
+    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0007);
+    curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
+  }
 
   /*
    * Type 5: Message block.  Contains more TLVs.