diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2013-02-21 14:03:15 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2013-02-21 14:03:15 +0000 |
commit | 06eef808b0ce5d7d7056240be6286aa79ac6a9ec (patch) | |
tree | f2ef90945c7595580ff4aeb33ee78320132c8ab4 /root_commands.c | |
parent | 12f500f085fe715b62e13c9b67b23f952c100a21 (diff) |
For the lazy among us: When adding a Jabber/MSN contact within the same
domain like you, you can omit the domain name.
Diffstat (limited to 'root_commands.c')
-rw-r--r-- | root_commands.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/root_commands.c b/root_commands.c index 6188245d..3e5b90a4 100644 --- a/root_commands.c +++ b/root_commands.c @@ -679,6 +679,7 @@ static void cmd_add( irc_t *irc, char **cmd ) { account_t *a; int add_on_server = 1; + char *handle = NULL, *s; if( g_strcasecmp( cmd[1], "-tmp" ) == 0 ) { @@ -716,6 +717,18 @@ static void cmd_add( irc_t *irc, char **cmd ) } } + if( ( a->flags & ACC_FLAG_HANDLE_DOMAINS ) && cmd[2][0] != '_' && + ( !( s = strchr( cmd[2], '@' ) ) || s[1] == '\0' ) ) + { + /* If there's no @ or it's the last char, append the user's + domain name now. Exclude handles starting with a _ so + adding _xmlconsole will keep working. */ + if( s ) + *s = '\0'; + if( ( s = strchr( a->user, '@' ) ) ) + cmd[2] = handle = g_strconcat( cmd[2], s, NULL ); + } + if( add_on_server ) { irc_channel_t *ic; @@ -745,6 +758,7 @@ static void cmd_add( irc_t *irc, char **cmd ) "to contact `%s'", iu->nick, cmd[2] ); } + g_free( handle ); } static void cmd_remove( irc_t *irc, char **cmd ) |