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)))
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.
static int infoupdate(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
{
struct aim_userinfo_s *userinfo = NULL;
- rxcallback_t userfunc=NULL;
+ aim_rxcallback_t userfunc=NULL;
int ret = 0, i = 0;
int usercount = 0;
unsigned char detaillevel = 0;
static int userlistchange(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
{
struct aim_userinfo_s *userinfo = NULL;
- rxcallback_t userfunc;
+ aim_rxcallback_t userfunc;
int i = 0, curcount = 0, ret = 0;
while (i < datalen) {
static int incomingmsg(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
{
struct aim_userinfo_s userinfo;
- rxcallback_t userfunc=NULL;
+ aim_rxcallback_t userfunc=NULL;
int ret = 0, i = 0;
unsigned char cookie[8];
int channel;