Changeset 0baed0d


Ignore:
Timestamp:
2010-03-19T00:09:50Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
21029d0, 545d7c0, 81ee561
Parents:
5fbec3d
Message:

Allow changing the name of the control channel at run-time.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.h

    r5fbec3d r0baed0d  
    163163
    164164char *set_eval_root_nick( set_t *set, char *new_nick );
     165char *set_eval_control_channel( set_t *set, char *new_name );
    165166
    166167extern global_t global;
  • doc/user-guide/commands.xml

    r5fbec3d r0baed0d  
    511511        </bitlbee-setting>
    512512
     513        <bitlbee-setting name="control_channel" type="string" scope="global">
     514                <default>&amp;bitlbee</default>
     515
     516                <description>
     517                        <para>
     518                                Normally the control channel where you can see all your contacts is called "&amp;bitlbee". If you don't like this name, you can rename it to anything else using the <emphasis>rename</emphasis> command, or by changing this setting.
     519                        </para>
     520                </description>
     521        </bitlbee-setting>
     522
    513523        <bitlbee-setting name="debug" type="boolean" scope="global">
    514524                <default>false</default>
  • irc.c

    r5fbec3d r0baed0d  
    171171        s = set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc );
    172172        s = set_add( &irc->set, "charset", "utf-8", set_eval_charset, irc );
     173        s = set_add( &irc->set, "control_channel", irc->channel, set_eval_control_channel, irc );
    173174        s = set_add( &irc->set, "debug", "false", set_eval_bool, irc );
    174175        s = set_add( &irc->set, "default_target", "root", NULL, irc );
  • root_commands.c

    r5fbec3d r0baed0d  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2010 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    654654                irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] );
    655655        }
     656        else if( g_strcasecmp( cmd[1], irc->channel ) == 0 )
     657        {
     658                if( strchr( CTYPES, cmd[2][0] ) && nick_ok( cmd[2] + 1 ) )
     659                {
     660                        u = user_find( irc, irc->nick );
     661                       
     662                        irc_part( irc, u, irc->channel );
     663                        g_free( irc->channel );
     664                        irc->channel = g_strdup( cmd[2] );
     665                        irc_join( irc, u, irc->channel );
     666                       
     667                        if( strcmp( cmd[0], "set_rename" ) != 0 )
     668                                set_setstr( &irc->set, "control_channel", cmd[2] );
     669                }
     670        }
    656671        else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) )
    657672        {
     
    701716       
    702717        return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : SET_INVALID;
     718}
     719
     720char *set_eval_control_channel( set_t *set, char *new_name )
     721{
     722        irc_t *irc = set->data;
     723       
     724        if( strcmp( irc->channel, new_name ) != 0 )
     725        {
     726                char *cmd[] = { "set_rename", irc->channel, new_name, NULL };
     727               
     728                cmd_rename( irc, cmd );
     729        }
     730       
     731        return strcmp( irc->channel, new_name ) == 0 ? new_name : SET_INVALID;
    703732}
    704733
Note: See TracChangeset for help on using the changeset viewer.