No release numbers
------------------
+ - 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
+ - This will make more sense when I make the UNICODE commit (tomorrow?)
+
- Wed Mar 28 16:51:25 PST 2001
- I decided it was a good day while I was figuring out that it was a bad day.
- See faimtest and login.c::memrequest().
#define AIM_IMFLAGS_AWAY 0x01 /* mark as an autoreply */
#define AIM_IMFLAGS_ACK 0x02 /* request a receipt notice */
-faim_export unsigned long aim_send_im(struct aim_session_t *, struct aim_conn_t *, char *, u_int, char *);
+faim_export unsigned long aim_send_im(struct aim_session_t *, struct aim_conn_t *, const char *destsn, unsigned short flags, const char *msg, int msglen);
faim_export int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *);
faim_export struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *destsn);
faim_export struct aim_conn_t *aim_directim_connect(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *);
char *lang2;
};
-faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, char *msg);
+#define AIM_CHATFLAGS_NOREFLECT 0x0001
+#define AIM_CHATFLAGS_AWAY 0x0002
+faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned short flags, const char *msg, int msglen);
faim_export unsigned long aim_chat_join(struct aim_session_t *sess, struct aim_conn_t *conn, u_short exchange, const char *roomname);
faim_export unsigned long aim_chat_clientready(struct aim_session_t *sess, struct aim_conn_t *conn);
faim_export int aim_chat_attachname(struct aim_conn_t *conn, char *roomname);
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.
* when the message is received (of type 0x0004/0x000c)
*
*/
-faim_export unsigned long aim_send_im(struct aim_session_t *sess,
- struct aim_conn_t *conn,
- char *destsn, u_int flags, char *msg)
-{
-
+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, int msglen)
+{
int curbyte,i;
struct command_tx_struct *newpacket;
-
- if (strlen(msg) >= MAXMSGLEN)
+
+ if (!msg || (msglen <= 0))
+ return -1;
+
+ if (msglen >= MAXMSGLEN)
return -1;
- if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, strlen(msg)+256)))
+ if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, msglen+256)))
return -1;
newpacket->lock = 1; /* lock struct */
* metaTLV start.
*/
curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
- curbyte += aimutil_put16(newpacket->data+curbyte, strlen(msg) + 0x10);
+ curbyte += aimutil_put16(newpacket->data+curbyte, msglen + 0x10);
/*
* Flag data / ICBM Parameters?
/*
* Message block length.
*/
- curbyte += aimutil_put16(newpacket->data+curbyte, strlen(msg) + 0x04);
+ curbyte += aimutil_put16(newpacket->data+curbyte, msglen + 0x04);
/*
* Character set data?
/*
* Message. Not terminated.
*/
- curbyte += aimutil_putstr(newpacket->data+curbyte,msg, strlen(msg));
+ curbyte += aimutil_putstr(newpacket->data+curbyte,msg, msglen);
/*
* Set the Request Acknowledge flag.
static int cmd_goodday(char *arg)
{
if (arg && strlen(arg) && (strlen(arg) < MAXSNLEN))
- aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, AIM_IMFLAGS_ACK, "Good day to you too.");
+ aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, AIM_IMFLAGS_ACK, "Good day to you too.", strlen("Good day to you too."));
else
printf("no one to say hello to!\n");
newbuf[z] = (z % 10)+0x30;
newbuf[len] = '\0';
- aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), sn, AIM_IMFLAGS_ACK, newbuf);
+ aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), sn, AIM_IMFLAGS_ACK, newbuf, strlen(newbuf));
free(newbuf);
{
if (ohcaptainmycaptain)
- aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), ohcaptainmycaptain, 0, "ta ta...");
+ aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), ohcaptainmycaptain, 0, "ta ta...", strlen("ta ta..."));
aim_session_kill(&aimsess);
} else if (strstr(tmpstr, "goodday")) {
- aim_send_im(sess, command->conn, userinfo->sn, AIM_IMFLAGS_ACK, "Good day to you too.");
+ aim_send_im(sess, command->conn, userinfo->sn, AIM_IMFLAGS_ACK, "Good day to you too.", strlen("Good day to you too."));
} else if (strstr(tmpstr, "warnme")) {
if (!ohcaptainmycaptain) {
- aim_send_im(sess, command->conn, userinfo->sn, AIM_IMFLAGS_ACK, "I have no owner!");
+ aim_send_im(sess, command->conn, userinfo->sn, AIM_IMFLAGS_ACK, "I have no owner!", strlen("I have no owner!"));
} else {
struct aim_conn_t *newconn;
} else if (!strncmp(tmpstr, "reqsendmsg", 10)) {
- aim_send_im(sess, command->conn, ohcaptainmycaptain, 0, "sendmsg 7900");
+ aim_send_im(sess, command->conn, ohcaptainmycaptain, 0, "sendmsg 7900", strlen("sendmsg 7900"));
} else if (!strncmp(tmpstr, "reqauth", 7)) {
newbuf[z] = (z % 10)+0x30;
}
newbuf[i] = '\0';
- aim_send_im(sess, command->conn, userinfo->sn, 0, newbuf);
+ aim_send_im(sess, command->conn, userinfo->sn, 0, newbuf, strlen(newbuf));
free(newbuf);
}
if (strcmp(userinfo->sn, sess->sn) != 0)
{
sprintf(tmpbuf, "(%s said \"%s\")", userinfo->sn, msg);
- aim_chat_send_im(sess, command->conn, tmpbuf);
+ aim_chat_send_im(sess, command->conn, 0, tmpbuf, strlen(tmpbuf));
}
return 1;