Ignore:
Timestamp:
2016-11-20T08:40:36Z (8 years ago)
Author:
dequis <dx@…>
Children:
3f44e43
Parents:
ba52ac5 (diff), 9f03c47 (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 master up to commit '9f03c47' into parson

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/conference.c

    rba52ac5 r537d9b9  
    2828static xt_status jabber_chat_self_message(struct im_connection *ic, struct xt_node *node, struct xt_node *orig);
    2929
    30 struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password)
     30struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password,
     31                                   gboolean always_use_nicks)
    3132{
    3233        struct jabber_chat *jc;
     
    5758                g_free(jc);
    5859                return NULL;
     60        }
     61
     62        if (always_use_nicks) {
     63                jc->flags = JCFLAG_ALWAYS_USE_NICKS;
    5964        }
    6065
     
    95100        g_free(cserv);
    96101
    97         c = jabber_chat_join(ic, rjid, jd->username, NULL);
     102        c = jabber_chat_join(ic, rjid, jd->username, NULL, FALSE);
    98103        g_free(rjid);
    99104        if (c == NULL) {
     
    244249}
    245250
     251static int jabber_chat_has_other_resources(struct im_connection *ic, struct jabber_buddy *bud)
     252{
     253        struct jabber_buddy *cur;
     254
     255        for (cur = jabber_buddy_by_jid(ic, bud->bare_jid, GET_BUDDY_FIRST); cur; cur = cur->next) {
     256                if (cur != bud && jabber_compare_jid(cur->ext_jid, bud->ext_jid)) {
     257                        return TRUE;
     258                }
     259        }
     260       
     261        return FALSE;
     262}
     263
    246264/* Not really the same syntax as the normal pkt_ functions, but this isn't
    247265   called by the xmltree parser directly and this way I can add some extra
     
    328346                        *s = 0; /* Should NEVER be NULL, but who knows... */
    329347                }
     348
     349                if (bud != jc->me && (jc->flags & JCFLAG_ALWAYS_USE_NICKS) && !(bud->flags & JBFLAG_IS_ANONYMOUS)) {
     350                        imcb_buddy_nick_change(ic, bud->ext_jid, bud->resource);
     351                }
     352
    330353                imcb_chat_add_buddy(chat, bud->ext_jid);
    331354                if (s) {
     
    333356                }
    334357        } else if (type) { /* type can only be NULL or "unavailable" in this function */
    335                 if ((bud->flags & JBFLAG_IS_CHATROOM) && bud->ext_jid) {
     358                if ((bud->flags & JBFLAG_IS_CHATROOM) && bud->ext_jid && !jabber_chat_has_other_resources(ic, bud)) {
    336359                        char *reason = NULL;
    337360                        char *status = NULL;
     
    443466
    444467        if (subject && chat) {
    445                 char *subject_text = subject->text_len > 0 ? subject->text : "";
     468                char empty[1] = "";
     469                char *subject_text = subject->text_len > 0 ? subject->text : empty;
    446470                if (g_strcmp0(chat->topic, subject_text) != 0) {
    447471                        bare_jid = (bud) ? jabber_get_bare_jid(bud->ext_jid) : NULL;
     
    479503                bare_jid = jabber_get_bare_jid(bud->ext_jid ? bud->ext_jid : bud->full_jid);
    480504                final_from = bare_jid;
    481                 flags = (bud == jc->me) ? OPT_SELFMESSAGE : 0;
     505                if (bud == jc->me || (g_strcasecmp(final_from, ic->acc->user) == 0)) {
     506                        flags = OPT_SELFMESSAGE;
     507                }
    482508        } else {
    483509                final_from = nick;
Note: See TracChangeset for help on using the changeset viewer.