From 99fe03055377745e7d549f63379ff99e65b04018 Mon Sep 17 00:00:00 2001 From: dequis Date: Wed, 13 May 2015 05:05:01 -0300 Subject: msn: Implement sending typing notifications Also remove some old unused debug stuff --- protocols/msn/ns.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'protocols/msn/ns.c') 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); +} + -- cgit v1.2.3