Changeset a1d30c5 for protocols


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

Location:
protocols
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/presence.c

    rec8b369 ra1d30c5  
    181181}
    182182
     183static char *choose_priority(struct im_connection *ic)
     184{
     185        struct jabber_data *jd = ic->proto_data;
     186        char *prio = set_getstr(&ic->acc->set, "priority");
     187
     188        if (jd->away_state->code != NULL) {
     189                int new_prio = (atoi(prio) - 5);
     190                if (new_prio < 0) {
     191                        new_prio = 0;
     192                }
     193                return g_strdup_printf("%d", new_prio);
     194        }
     195
     196        return g_strdup(prio);
     197}
     198
    183199/* Whenever presence information is updated, call this function to inform the
    184200   server. */
     
    189205        GSList *l;
    190206        int st;
     207        char *prio = choose_priority(ic);
    191208
    192209        node = jabber_make_packet("presence", NULL, NULL, NULL);
    193         xt_add_child(node, xt_new_node("priority", set_getstr(&ic->acc->set, "priority"), NULL));
     210        xt_add_child(node, xt_new_node("priority", prio, NULL));
    194211        if (jd->away_state) {
    195212                xt_add_child(node, xt_new_node("show", jd->away_state->code, NULL));
     
    222239
    223240        xt_free_node(node);
     241        g_free(prio);
    224242        return st;
    225243}
  • protocols/msn/msn.c

    rec8b369 ra1d30c5  
    144144{
    145145        struct bee_user *bu = bee_user_by_handle(ic->bee, ic, who);
    146 
    147 #ifdef DEBUG
    148         if (strcmp(who, "raw") == 0) {
    149                 msn_ns_write(ic, -1, "%s\r\n", message);
    150                 return 0;
    151         }
    152 #endif
    153 
    154         msn_ns_sendmessage(ic, bu, message);
    155         return(0);
     146        msn_ns_send_message(ic, bu, message);
     147        return 0;
    156148}
    157149
     
    277269                return 0;
    278270        } else if (typing & OPT_TYPING) {
    279                 return(msn_buddy_msg(ic, who, TYPING_NOTIFICATION_MESSAGE, 0));
     271                return msn_ns_send_typing(ic, bu);
    280272        } else {
    281273                return 1;
     
    338330
    339331        g_tree_remove(md->domaintree, bu->handle);
    340 }
    341 
    342 GList *msn_buddy_action_list(bee_user_t *bu)
    343 {
    344         static GList *ret = NULL;
    345 
    346         if (ret == NULL) {
    347                 static const struct buddy_action ba[2] = {
    348                         { "NUDGE", "Draw attention" },
    349                 };
    350 
    351                 ret = g_list_prepend(ret, (void *) ba + 0);
    352         }
    353 
    354         return ret;
    355 }
    356 
    357 void *msn_buddy_action(struct bee_user *bu, const char *action, char * const args[], void *data)
    358 {
    359         if (g_strcasecmp(action, "NUDGE") == 0) {
    360                 msn_buddy_msg(bu->ic, bu->handle, NUDGE_MESSAGE, 0);
    361         }
    362 
    363         return NULL;
    364332}
    365333
     
    392360        ret->buddy_data_add = msn_buddy_data_add;
    393361        ret->buddy_data_free = msn_buddy_data_free;
    394         ret->buddy_action_list = msn_buddy_action_list;
    395         ret->buddy_action = msn_buddy_action;
    396362
    397363        register_protocol(ret);
  • protocols/msn/msn.h

    rec8b369 ra1d30c5  
    2626#ifndef _MSN_H
    2727#define _MSN_H
    28 
    29 /* Some hackish magicstrings to make special-purpose messages/switchboards.
    30  */
    31 #define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r"
    32 #define NUDGE_MESSAGE "\r\r\rSHAKE THAT THING\r\r\r"
    33 #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r"
    34 
    35 #ifdef DEBUG_MSN
    36 #define debug(text ...) imcb_log(ic, text);
    37 #else
    38 #define debug(text ...)
    39 #endif
    4028
    4129/* This should be MSN Messenger 7.0.0813
     
    7765#define MSN_MESSAGE_HEADERS MSN_BASE_HEADERS \
    7866        "Messaging: 2.0\r\n" \
    79         "Message-Type: Text\r\n" \
     67        "Message-Type: %s\r\n" \
    8068        "Content-Length: %zd\r\n" \
    8169        "Content-Type: text/plain; charset=UTF-8\r\n" \
     
    10391        "</user>"
    10492
    105 #define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \
    106         "Content-Type: text/x-msmsgscontrol\r\n" \
    107         "TypingUser: %s\r\n" \
    108         "\r\n\r\n"
    109 
    110 #define MSN_NUDGE_HEADERS "MIME-Version: 1.0\r\n" \
    111         "Content-Type: text/x-msnmsgr-datacast\r\n" \
    112         "\r\n" \
    113         "ID: 1\r\n" \
    114         "\r\n"
    115 
    11693#define PROFILE_URL "http://members.msn.com/"
    11794
     
    242219void msn_auth_got_contact_list(struct im_connection *ic);
    243220int msn_ns_finish_login(struct im_connection *ic);
    244 int msn_ns_sendmessage(struct im_connection *ic, struct bee_user *bu, const char *text);
     221int msn_ns_send_typing(struct im_connection *ic, struct bee_user *bu);
     222int msn_ns_send_message(struct im_connection *ic, struct bee_user *bu, const char *text);
    245223int msn_ns_command(struct msn_data *md, char **cmd, int num_parts);
    246224int msn_ns_message(struct msn_data *md, char *msg, int msglen, char **cmd, int num_parts);
  • 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
  • protocols/skype/Makefile

    rec8b369 ra1d30c5  
    77INSTALL = install
    88
    9 
    10 ifdef ASCIIDOC
    11 MANPAGES = skyped.1
    12 else
    13 MANPAGES =
    14 endif
    15 
    16 all: $(MANPAGES)
    17 
     9all:
    1810clean:
    19         rm -f $(MANPAGES)
    2011
    2112# take this from the kernel
     
    2920
    3021install-doc: doc
    31 ifdef ASCIIDOC
    3222        $(INSTALL) -d $(DESTDIR)$(MANDIR)/man1
    3323        $(INSTALL) -m644 $(MANPAGES) $(DESTDIR)$(MANDIR)/man1
    34 endif
    3524
    3625uninstall-doc:
     
    3827
    3928%.1: $(_SRCDIR_)%.txt $(_SRCDIR_)asciidoc.conf
    40         a2x --asciidoc-opts="-f $(_SRCDIR_)asciidoc.conf" -a bee_date=$(DATE) -f manpage -D . $<
     29        a2x --asciidoc-opts="-f $(_SRCDIR_)asciidoc.conf" -a bee_date=$(DATE) -f manpage $<
Note: See TracChangeset for help on using the changeset viewer.