Changeset 99fe030 for protocols/msn/ns.c


Ignore:
Timestamp:
2015-05-13T08:05:01Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
a6bed1a
Parents:
a733669
Message:

msn: Implement sending typing notifications

Also remove some old unused debug stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/ns.c

    ra733669 r99fe030  
    724724}
    725725
    726 // TODO: typing notifications, nudges lol, etc
    727 int msn_ns_sendmessage(struct im_connection *ic, bee_user_t *bu, const char *text)
     726static int msn_ns_send_sdg(struct im_connection *ic, bee_user_t *bu, const char *message_type, const char *text)
    728727{
    729728        struct msn_data *md = ic->proto_data;
     
    731730        char *buf;
    732731
    733         if (strncmp(text, "\r\r\r", 3) == 0) {
    734                 /* Err. Shouldn't happen but I guess it can. Don't send others
    735                    any of the "SHAKE THAT THING" messages. :-D */
    736                 return 1;
    737         }
    738 
    739         buf = g_strdup_printf(MSN_MESSAGE_HEADERS, bu->handle, ic->acc->user, md->uuid, strlen(text), text);
     732        buf = g_strdup_printf(MSN_MESSAGE_HEADERS, bu->handle, ic->acc->user, md->uuid, message_type, strlen(text), text);
    740733        retval = msn_ns_write(ic, -1, "SDG %d %zd\r\n%s", ++md->trId, strlen(buf), buf);
    741734        g_free(buf);
    742735        return retval;
    743736}
     737
     738int msn_ns_send_typing(struct im_connection *ic, bee_user_t *bu)
     739{
     740        return msn_ns_send_sdg(ic, bu, "Control/Typing", "");
     741}
     742
     743int msn_ns_send_message(struct im_connection *ic, bee_user_t *bu, const char *text)
     744{
     745        return msn_ns_send_sdg(ic, bu, "Text", text);
     746}
     747
Note: See TracChangeset for help on using the changeset viewer.