aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-01-18 13:15:40 -0300
committerdequis <dx@dxzone.com.ar>2015-01-25 23:43:34 -0300
commitfcb2c2eee4526bb58dccf17f8702d670dda62644 (patch)
tree661cdba9d9fd16e92198670606db1e7d32e1bfe8
parentbe1efa31e01a96be922c7addba2d9207bfbdf5fc (diff)
jabber: Account-wide display_name setting, for groupchats
This sets the default value of 'nick' for newly created groupchats. There is no way to set an account-wide nick.
-rw-r--r--doc/user-guide/commands.xml8
-rw-r--r--protocols/jabber/jabber.c12
2 files changed, 18 insertions, 2 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml
index e7d56ba1..682c5dc1 100644
--- a/doc/user-guide/commands.xml
+++ b/doc/user-guide/commands.xml
@@ -887,7 +887,13 @@
<bitlbee-setting name="display_name" type="string" scope="account">
<description>
<para>
- Currently only available for MSN connections. This setting allows you to read and change your "friendly name" for this connection. Since this is a server-side setting, it can't be changed when the account is off-line.
+ Currently only available for MSN connections, and for jabber groupchats.
+ </para>
+ <para>
+ For MSN: This setting allows you to read and change your "friendly name" for this connection. Since this is a server-side setting, it can't be changed when the account is off-line.
+ </para>
+ <para>
+ For jabber groupchats: this sets the default value of 'nick' for newly created groupchats. There is no way to set an account-wide nick like MSN.
</para>
</description>
</bitlbee-setting>
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index ccc13f47..30e55159 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -62,6 +62,8 @@ static void jabber_init( account_t *acc )
s = set_add( &acc->set, "oauth", "false", set_eval_oauth, acc );
+ s = set_add( &acc->set, "display_name", NULL, NULL, acc );
+
g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] );
s = set_add( &acc->set, "port", str, set_eval_int, acc );
s->flags |= ACC_SET_OFFLINE_ONLY;
@@ -473,14 +475,22 @@ static void jabber_remove_buddy( struct im_connection *ic, char *who, char *grou
static struct groupchat *jabber_chat_join_( struct im_connection *ic, const char *room, const char *nick, const char *password, set_t **sets )
{
struct jabber_data *jd = ic->proto_data;
+ char *final_nick;
+ /* Ignore the passed nick parameter if we have our own default */
+ if ( !( final_nick = set_getstr( sets, "nick" ) ) &&
+ !( final_nick = set_getstr( &ic->acc->set, "display_name" ) ) ) {
+ /* Well, whatever, actually use the provided default, then */
+ final_nick = (char *) nick;
+ }
+
if( strchr( room, '@' ) == NULL )
imcb_error( ic, "%s is not a valid Jabber room name. Maybe you mean %s@conference.%s?",
room, room, jd->server );
else if( jabber_chat_by_jid( ic, room ) )
imcb_error( ic, "Already present in chat `%s'", room );
else
- return jabber_chat_join( ic, room, nick, set_getstr( sets, "password" ) );
+ return jabber_chat_join( ic, room, final_nick, set_getstr( sets, "password" ) );
return NULL;
}