Changeset a1d30c5 for protocols/msn/ns.c


Ignore:
Timestamp:
2015-05-28T04:12:23Z (9 years ago)
Author:
dequis <dx@…>
Children:
d2d2b80
Parents:
ec8b369 (diff), 3d31618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'develop' into feat/hip-cat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/ns.c

    rec8b369 ra1d30c5  
    417417                        } else if (g_strncasecmp(ct, "text/x-msmsgsactivemailnotification", 35) == 0) {
    418418                                /* Notification that a message has been read... Ignore it */
    419                         } else {
    420                                 debug("Can't handle %s packet from notification server", ct);
    421419                        }
    422420
     
    623621        char l[4];
    624622
    625         if ((bd->flags & 7) == 0 || (bd->flags & MSN_BUDDY_ADL_SYNCED)) {
     623        if ((bd->flags & (MSN_BUDDY_FL | MSN_BUDDY_AL)) == 0 || (bd->flags & MSN_BUDDY_ADL_SYNCED)) {
    626624                return FALSE;
    627625        }
     
    641639        }
    642640
    643         g_snprintf(l, sizeof(l), "%d", bd->flags & 7);
     641        g_snprintf(l, sizeof(l), "%d", bd->flags & (MSN_BUDDY_FL | MSN_BUDDY_AL));
    644642        c = xt_new_node("c", NULL, NULL);
    645643        xt_add_attr(c, "n", handle);
     
    694692                struct msn_buddy_data *bd = bu->data;
    695693
    696                 if (bu->ic != ic || (bd->flags & 7) == 0) {
     694                if (bu->ic != ic || (bd->flags & (MSN_BUDDY_FL | MSN_BUDDY_AL)) == 0) {
    697695                        continue;
    698696                }
     
    724722}
    725723
    726 // TODO: typing notifications, nudges lol, etc
    727 int msn_ns_sendmessage(struct im_connection *ic, bee_user_t *bu, const char *text)
     724static int msn_ns_send_sdg(struct im_connection *ic, bee_user_t *bu, const char *message_type, const char *text)
    728725{
    729726        struct msn_data *md = ic->proto_data;
     
    731728        char *buf;
    732729
    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);
     730        buf = g_strdup_printf(MSN_MESSAGE_HEADERS, bu->handle, ic->acc->user, md->uuid, message_type, strlen(text), text);
    740731        retval = msn_ns_write(ic, -1, "SDG %d %zd\r\n%s", ++md->trId, strlen(buf), buf);
    741732        g_free(buf);
    742733        return retval;
    743734}
     735
     736int msn_ns_send_typing(struct im_connection *ic, bee_user_t *bu)
     737{
     738        return msn_ns_send_sdg(ic, bu, "Control/Typing", "");
     739}
     740
     741int msn_ns_send_message(struct im_connection *ic, bee_user_t *bu, const char *text)
     742{
     743        return msn_ns_send_sdg(ic, bu, "Text", text);
     744}
     745
Note: See TracChangeset for help on using the changeset viewer.