comparison 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
comparison
equal deleted inserted replaced
1745:c39cc2b44226 1746:bacb77b0eb06
49 conn->priv = strdup(roomname); 49 conn->priv = strdup(roomname);
50 50
51 return 0; 51 return 0;
52 } 52 }
53 53
54 /* XXX convert this to use tlvchains */ 54 /*
55 * Send a Chat Message.
56 *
57 * Possible flags:
58 * AIM_CHATFLAGS_NOREFLECT -- Unset the flag that requests messages
59 * should be sent to their sender.
60 * AIM_CHATFLAGS_AWAY -- Mark the message as an autoresponse
61 * (Note that WinAIM does not honor this,
62 * and displays the message as normal.)
63 *
64 * XXX convert this to use tlvchains
65 */
55 faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, 66 faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess,
56 struct aim_conn_t *conn, 67 struct aim_conn_t *conn,
57 char *msg) 68 unsigned short flags,
69 const char *msg,
70 int msglen)
58 { 71 {
59 72
60 int curbyte,i; 73 int curbyte,i;
61 struct command_tx_struct *newpacket; 74 struct command_tx_struct *newpacket;
62 struct aim_msgcookie_t *cookie; 75 struct aim_msgcookie_t *cookie;
63 76
64 if (!sess || !conn || !msg) 77 if (!sess || !conn || !msg || (msglen <= 0))
65 return 0; 78 return 0;
66 79
67 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152))) 80 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152)))
68 return -1; 81 return -1;
69 82
88 * Channel ID. 101 * Channel ID.
89 */ 102 */
90 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003); 103 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003);
91 104
92 /* 105 /*
93 * Type 1: Unknown. Blank. 106 * Type 1: Flag meaning this message is destined to the room.
94 */ 107 */
95 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); 108 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
96 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); 109 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
97 110
98 /* 111 /*
99 * Type 6: Unknown. Blank. 112 * Type 6: Reflect
100 */ 113 */
101 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0006); 114 if (!(flags & AIM_CHATFLAGS_NOREFLECT)) {
102 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); 115 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0006);
116 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
117 }
118
119 /*
120 * Type 7: Autoresponse
121 */
122 if (flags & AIM_CHATFLAGS_AWAY) {
123 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0007);
124 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
125 }
103 126
104 /* 127 /*
105 * Type 5: Message block. Contains more TLVs. 128 * Type 5: Message block. Contains more TLVs.
106 * 129 *
107 * This could include other information... We just 130 * This could include other information... We just