aboutsummaryrefslogtreecommitdiffstats
path: root/root_commands.c
diff options
context:
space:
mode:
authorSven Moritz Hallberg <pesco@khjk.org>2010-06-03 13:00:45 +0200
committerSven Moritz Hallberg <pesco@khjk.org>2010-06-03 13:00:45 +0200
commit814aa52228c7cad1d036c1a6dc5ea03cce61c048 (patch)
tree7db06b9191f00b086f25789a0a040d15cef580cf /root_commands.c
parent5f8ab6a9adf09ea7c07f728227bdb6d3953588f1 (diff)
parentf4bcc223fea70de8555bbc4d2caf48e0476c0e13 (diff)
merge in bitlbee 1.2.6
Diffstat (limited to 'root_commands.c')
-rw-r--r--root_commands.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/root_commands.c b/root_commands.c
index 5ce5060a..0f39239a 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -1,7 +1,7 @@
/********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
- * Copyright 2002-2004 Wilmer van der Gaast and others *
+ * Copyright 2002-2010 Wilmer van der Gaast and others *
\********************************************************************/
/* User manager (root) commands */
@@ -658,6 +658,21 @@ static void cmd_rename( irc_t *irc, char **cmd )
{
irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] );
}
+ else if( g_strcasecmp( cmd[1], irc->channel ) == 0 )
+ {
+ if( strchr( CTYPES, cmd[2][0] ) && nick_ok( cmd[2] + 1 ) )
+ {
+ u = user_find( irc, irc->nick );
+
+ irc_part( irc, u, irc->channel );
+ g_free( irc->channel );
+ irc->channel = g_strdup( cmd[2] );
+ irc_join( irc, u, irc->channel );
+
+ if( strcmp( cmd[0], "set_rename" ) != 0 )
+ set_setstr( &irc->set, "control_channel", cmd[2] );
+ }
+ }
else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) )
{
irc_usermsg( irc, "Nick `%s' already exists", cmd[2] );
@@ -707,6 +722,20 @@ char *set_eval_root_nick( set_t *set, char *new_nick )
return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : SET_INVALID;
}
+char *set_eval_control_channel( set_t *set, char *new_name )
+{
+ irc_t *irc = set->data;
+
+ if( strcmp( irc->channel, new_name ) != 0 )
+ {
+ char *cmd[] = { "set_rename", irc->channel, new_name, NULL };
+
+ cmd_rename( irc, cmd );
+ }
+
+ return strcmp( irc->channel, new_name ) == 0 ? new_name : SET_INVALID;
+}
+
static void cmd_remove( irc_t *irc, char **cmd )
{
user_t *u;