Index: doc/user-guide/commands.xml
===================================================================
--- doc/user-guide/commands.xml (revision 63825d6c4c22c15c48db35ce6d23e1b8ced8c79c)
+++ doc/user-guide/commands.xml (revision 3320d6d9868729ce1d7b5a90866554bc898a1fa3)
@@ -649,4 +649,22 @@
+
+ false
+
+
+
+ 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)
+
+
+
+ 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.
+
+
+
+ Note that manual nick changes done through the rename command always take priority
+
+
+
+
true
Index: protocols/jabber/conference.c
===================================================================
--- protocols/jabber/conference.c (revision 63825d6c4c22c15c48db35ce6d23e1b8ced8c79c)
+++ protocols/jabber/conference.c (revision 3320d6d9868729ce1d7b5a90866554bc898a1fa3)
@@ -28,5 +28,6 @@
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;
@@ -57,4 +58,8 @@
g_free(jc);
return NULL;
+ }
+
+ if (always_use_nicks) {
+ jc->flags = JCFLAG_ALWAYS_USE_NICKS;
}
@@ -95,5 +100,5 @@
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) {
@@ -341,4 +346,9 @@
*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) {
Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c (revision 63825d6c4c22c15c48db35ce6d23e1b8ced8c79c)
+++ protocols/jabber/jabber.c (revision 3320d6d9868729ce1d7b5a90866554bc898a1fa3)
@@ -577,5 +577,6 @@
} else {
/* jabber_chat_join without the underscore is the conference.c one */
- return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password"));
+ return jabber_chat_join(ic, room, final_nick, set_getstr(sets, "password"),
+ set_getbool(sets, "always_use_nicks"));
}
@@ -686,4 +687,6 @@
void jabber_chat_add_settings(account_t *acc, set_t **head)
{
+ set_add(head, "always_use_nicks", "false", set_eval_bool, NULL);
+
/* Meh. Stupid room passwords. Not trying to obfuscate/hide
them from the user for now. */
@@ -693,4 +696,6 @@
void jabber_chat_free_settings(account_t *acc, set_t **head)
{
+ set_del(head, "always_use_nicks");
+
set_del(head, "password");
}
Index: protocols/jabber/jabber.h
===================================================================
--- protocols/jabber/jabber.h (revision 63825d6c4c22c15c48db35ce6d23e1b8ced8c79c)
+++ protocols/jabber/jabber.h (revision 3320d6d9868729ce1d7b5a90866554bc898a1fa3)
@@ -75,4 +75,5 @@
JCFLAG_MESSAGE_SENT = 1, /* Set this after sending the first message, so
we can detect echoes/backlogs. */
+ JCFLAG_ALWAYS_USE_NICKS = 2,
} jabber_chat_flags_t;
@@ -343,5 +344,6 @@
/* conference.c */
-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 groupchat *jabber_chat_with(struct im_connection *ic, char *who);
struct groupchat *jabber_chat_by_jid(struct im_connection *ic, const char *name);