Changeset 4f22a68c


Ignore:
Timestamp:
2010-07-18T20:12:55Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
94d5da9c
Parents:
3e59c8d
Message:

Automatically operate on the current channel if just using "channel set".

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/user-guide/commands.xml

    r3e59c8d r4f22a68c  
    211211
    212212                <bitlbee-command name="set">
    213                         <syntax>channel &lt;channel id&gt; set</syntax>
    214                         <syntax>channel &lt;channel id&gt; set &lt;setting&gt;</syntax>
    215                         <syntax>channel &lt;channel id&gt; set &lt;setting&gt; &lt;value&gt;</syntax>
    216                         <syntax>channel &lt;channel id&gt; set -del &lt;setting&gt;</syntax>
     213                        <syntax>channel [&lt;channel id&gt;] set</syntax>
     214                        <syntax>channel [&lt;channel id&gt;] set &lt;setting&gt;</syntax>
     215                        <syntax>channel [&lt;channel id&gt;] set &lt;setting&gt; &lt;value&gt;</syntax>
     216                        <syntax>channel [&lt;channel id&gt;] set -del &lt;setting&gt;</syntax>
    217217
    218218                        <description>
     
    226226                               
    227227                                <para>
    228                                         The channel ID can be a number (see <emphasis>channel list</emphasis>), or (part of) its name, as long as it matches only one channel.
     228                                        The channel ID can be a number (see <emphasis>channel list</emphasis>), or (part of) its name, as long as it matches only one channel. If you want to change settings of the current channel, you can omit the channel ID.
    229229                                </para>
    230230                        </description>
  • root_commands.c

    r3e59c8d r4f22a68c  
    550550        }
    551551       
     552        if( ( ic = irc_channel_get( irc, cmd[1] ) ) == NULL )
     553        {
     554                /* If this doesn't match any channel, maybe this is the short
     555                   syntax (only works when used inside a channel). */
     556                if( ( len = strlen( cmd[1] ) ) &&
     557                    g_strncasecmp( cmd[1], "set", len ) == 0 &&
     558                    ( ic = irc_channel_by_name( irc, irc->last_root_cmd ) ) )
     559                        cmd_set_real( irc, cmd + 1, &ic->set, NULL );
     560                else
     561                        irc_usermsg( irc, "Could not find channel `%s'", cmd[1] );
     562               
     563                return;
     564        }
     565       
    552566        MIN_ARGS( 2 );
    553567        len = strlen( cmd[2] );
    554        
    555         if( ( ic = irc_channel_get( irc, cmd[1] ) ) == NULL )
    556         {
    557                 irc_usermsg( irc, "Could not find channel `%s'", cmd[1] );
    558                 return;
    559         }
    560568       
    561569        if( len >= 1 && g_strncasecmp( cmd[2], "set", len ) == 0 )
Note: See TracChangeset for help on using the changeset viewer.