diff options
author | dequis <dx@dxzone.com.ar> | 2015-05-13 05:05:01 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-05-13 05:05:01 -0300 |
commit | 99fe03055377745e7d549f63379ff99e65b04018 (patch) | |
tree | 80faf282387fdc8dcb27eff6af7bc2e45c612982 /protocols/msn/ns.c | |
parent | a7336698d6fa7b561ac56166eef3ec07adcbee41 (diff) |
msn: Implement sending typing notifications
Also remove some old unused debug stuff
Diffstat (limited to 'protocols/msn/ns.c')
-rw-r--r-- | protocols/msn/ns.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 906208a7..d3fde5d1 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -723,21 +723,25 @@ int msn_ns_finish_login(struct im_connection *ic) return 1; } -// TODO: typing notifications, nudges lol, etc -int msn_ns_sendmessage(struct im_connection *ic, bee_user_t *bu, const char *text) +static int msn_ns_send_sdg(struct im_connection *ic, bee_user_t *bu, const char *message_type, const char *text) { struct msn_data *md = ic->proto_data; int retval = 0; char *buf; - if (strncmp(text, "\r\r\r", 3) == 0) { - /* Err. Shouldn't happen but I guess it can. Don't send others - any of the "SHAKE THAT THING" messages. :-D */ - return 1; - } - - buf = g_strdup_printf(MSN_MESSAGE_HEADERS, bu->handle, ic->acc->user, md->uuid, strlen(text), text); + buf = g_strdup_printf(MSN_MESSAGE_HEADERS, bu->handle, ic->acc->user, md->uuid, message_type, strlen(text), text); retval = msn_ns_write(ic, -1, "SDG %d %zd\r\n%s", ++md->trId, strlen(buf), buf); g_free(buf); return retval; } + +int msn_ns_send_typing(struct im_connection *ic, bee_user_t *bu) +{ + return msn_ns_send_sdg(ic, bu, "Control/Typing", ""); +} + +int msn_ns_send_message(struct im_connection *ic, bee_user_t *bu, const char *text) +{ + return msn_ns_send_sdg(ic, bu, "Text", text); +} + |