diff options
author | dequis <dx@dxzone.com.ar> | 2016-03-10 02:20:31 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2016-03-20 00:58:05 -0300 |
commit | 3320d6d9868729ce1d7b5a90866554bc898a1fa3 (patch) | |
tree | ede2c0d459956c4345e0c48a9deb169c1b35e721 /protocols/jabber/conference.c | |
parent | 63825d6c4c22c15c48db35ce6d23e1b8ced8c79c (diff) |
jabber: Add "always_use_nicks" setting, for non-anonymous MUCs
Basically the same thing as github PR #55, which fixes trac bug 415,
but this one conditionalized that behavior and uses the API introduced a
few commits ago.
I didn't think too much about the setting name and i'm open to changing
it to anything else
Diffstat (limited to 'protocols/jabber/conference.c')
-rw-r--r-- | protocols/jabber/conference.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index cc832659..3a6cff7c 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -27,7 +27,8 @@ static xt_status jabber_chat_join_failed(struct im_connection *ic, struct xt_node *node, struct xt_node *orig); static xt_status jabber_chat_self_message(struct im_connection *ic, struct xt_node *node, struct xt_node *orig); -struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password) +struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password, + gboolean always_use_nicks) { struct jabber_chat *jc; struct xt_node *node; @@ -58,6 +59,10 @@ struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, c return NULL; } + if (always_use_nicks) { + jc->flags = JCFLAG_ALWAYS_USE_NICKS; + } + /* roomjid isn't normalized yet, and we need an original version of the nick to send a proper presence update. */ jc->my_full_jid = roomjid; @@ -94,7 +99,7 @@ struct groupchat *jabber_chat_with(struct im_connection *ic, char *who) g_free(uuid); g_free(cserv); - c = jabber_chat_join(ic, rjid, jd->username, NULL); + c = jabber_chat_join(ic, rjid, jd->username, NULL, FALSE); g_free(rjid); if (c == NULL) { return NULL; @@ -340,6 +345,11 @@ void jabber_chat_pkt_presence(struct im_connection *ic, struct jabber_buddy *bud if (s) { *s = 0; /* Should NEVER be NULL, but who knows... */ } + + if (bud != jc->me && (jc->flags & JCFLAG_ALWAYS_USE_NICKS) && !(bud->flags & JBFLAG_IS_ANONYMOUS)) { + imcb_buddy_nick_change(ic, bud->ext_jid, bud->resource); + } + imcb_chat_add_buddy(chat, bud->ext_jid); if (s) { *s = '/'; |