Changeset 3320d6d


Ignore:
Timestamp:
2016-03-20T03:58:05Z (5 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
4e0e590
Parents:
63825d6
git-author:
dequis <dx@…> (10-03-16 05:20:31)
git-committer:
dequis <dx@…> (20-03-16 03:58:05)
Message:

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

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • doc/user-guide/commands.xml

    r63825d6 r3320d6d  
    649649        </bitlbee-setting>
    650650
     651        <bitlbee-setting name="always_use_nicks" type="boolean" scope="channel">
     652                <default>false</default>
     653
     654                <description>
     655                        <para>
     656                                Jabber groupchat specific. This setting ensures that the nicks defined by the other members of a groupchat are used, instead of the username part of their JID. This only applies to groupchats where their real JID is known (either "non-anonymous" ones, or "semi-anonymous" from the point of view of the channel moderators)
     657                        </para>
     658
     659                        <para>
     660                                Enabling this may have the side effect of changing the nick of existing contacts, either in your buddy list or in other groupchats. If a contact is in multiple groupchats with different nicks, enabling this setting for all those would result in multiple nick changes when joining, and the order of those changes may vary.
     661                        </para>
     662
     663                        <para>
     664                                Note that manual nick changes done through the <emphasis>rename</emphasis> command always take priority
     665                        </para>
     666                </description>
     667        </bitlbee-setting>
     668
    651669        <bitlbee-setting name="auto_connect" type="boolean" scope="account,global">
    652670                <default>true</default>
  • protocols/jabber/conference.c

    r63825d6 r3320d6d  
    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) {
     
    341346                        *s = 0; /* Should NEVER be NULL, but who knows... */
    342347                }
     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
    343353                imcb_chat_add_buddy(chat, bud->ext_jid);
    344354                if (s) {
  • protocols/jabber/jabber.c

    r63825d6 r3320d6d  
    577577        } else {
    578578                /* jabber_chat_join without the underscore is the conference.c one */
    579                 return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password"));
     579                return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password"),
     580                                        set_getbool(sets, "always_use_nicks"));
    580581        }
    581582
     
    686687void jabber_chat_add_settings(account_t *acc, set_t **head)
    687688{
     689        set_add(head, "always_use_nicks", "false", set_eval_bool, NULL);
     690
    688691        /* Meh. Stupid room passwords. Not trying to obfuscate/hide
    689692           them from the user for now. */
     
    693696void jabber_chat_free_settings(account_t *acc, set_t **head)
    694697{
     698        set_del(head, "always_use_nicks");
     699
    695700        set_del(head, "password");
    696701}
  • protocols/jabber/jabber.h

    r63825d6 r3320d6d  
    7575        JCFLAG_MESSAGE_SENT = 1,        /* Set this after sending the first message, so
    7676                                           we can detect echoes/backlogs. */
     77        JCFLAG_ALWAYS_USE_NICKS = 2,
    7778} jabber_chat_flags_t;
    7879
     
    343344
    344345/* conference.c */
    345 struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password);
     346struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password,
     347                                   gboolean always_use_nicks);
    346348struct groupchat *jabber_chat_with(struct im_connection *ic, char *who);
    347349struct groupchat *jabber_chat_by_jid(struct im_connection *ic, const char *name);
Note: See TracChangeset for help on using the changeset viewer.