Changeset a429907


Ignore:
Timestamp:
2010-12-05T12:28:07Z (13 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d88c92a
Parents:
fd65edb
Message:

rename -del

Files:
4 edited

Legend:

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

    rfd65edb ra429907  
    15401540                <short-description>Rename (renick) a buddy</short-description>
    15411541                <syntax>rename &lt;oldnick&gt; &lt;newnick&gt;</syntax>
     1542                <syntax>rename -del &lt;oldnick&gt;</syntax>
    15421543
    15431544                <description>
    15441545                        <para>
    15451546                                Renick a user in your buddy list. Very useful, in fact just very important, if you got a lot of people with stupid account names (or hard ICQ numbers).
     1547                        </para>
     1548                       
     1549                        <para>
     1550                                <emphasis>rename -del</emphasis> can be used to erase your manually set nickname for a contact and reset it to what was automatically generated.
    15461551                        </para>
    15471552                </description>
  • irc.h

    rfd65edb ra429907  
    339339/* irc_im.c */
    340340void bee_irc_channel_update( irc_t *irc, irc_channel_t *ic, irc_user_t *iu );
     341void bee_irc_user_nick_reset( irc_user_t *iu );
    341342
    342343#endif
  • irc_im.c

    rfd65edb ra429907  
    361361       
    362362        return TRUE;
     363}
     364
     365void bee_irc_user_nick_reset( irc_user_t *iu )
     366{
     367        bee_user_t *bu = iu->bu;
     368        bee_user_flags_t online;
     369       
     370        if( bu == FALSE )
     371                return;
     372       
     373        /* In this case, pretend the user is offline. */
     374        if( ( online = bu->flags & BEE_USER_ONLINE ) )
     375                bu->flags &= ~BEE_USER_ONLINE;
     376       
     377        nick_del( bu );
     378        bee_irc_user_nick_update( iu );
     379       
     380        bu->flags |= online;
    363381}
    364382
  • root_commands.c

    rfd65edb ra429907  
    774774{
    775775        irc_user_t *iu, *old;
    776        
    777         iu = irc_user_by_name( irc, cmd[1] );
     776        gboolean del = g_strcasecmp( cmd[1], "-del" ) == 0;
     777       
     778        iu = irc_user_by_name( irc, cmd[del ? 2 : 1] );
    778779       
    779780        if( iu == NULL )
    780781        {
    781782                irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
     783        }
     784        else if( del )
     785        {
     786                if( iu->bu )
     787                        bee_irc_user_nick_reset( iu );
     788                irc_usermsg( irc, "Nickname reset to `%s'", iu->nick );
    782789        }
    783790        else if( iu == irc->user )
Note: See TracChangeset for help on using the changeset viewer.