Ignore:
Timestamp:
2015-06-17T22:47:26Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
b441614
Parents:
d832164 (diff), 2f99f23 (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 remote-tracking branch 'origin/master' into parson

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/presence.c

    rd832164 rb75671d  
    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}
Note: See TracChangeset for help on using the changeset viewer.