Changeset 0b5cc72 for irc_user.c


Ignore:
Timestamp:
2010-04-05T00:39:04Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
57c96f7
Parents:
1d39159
Message:

Send nickname change notifications when necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_user.c

    r1d39159 r0b5cc72  
    8383}
    8484
    85 int irc_user_rename( irc_t *irc, const char *old, const char *new )
     85int irc_user_set_nick( irc_t *irc, const char *old, const char *new )
    8686{
    8787        irc_user_t *iu = irc_user_by_name( irc, old );
    8888        char key[strlen(new)+1];
     89        GSList *cl;
    8990       
    9091        strcpy( key, new );
    9192        if( iu == NULL || !nick_lc( key ) || irc_user_by_name( irc, new ) )
    9293                return 0;
     94       
     95        for( cl = irc->channels; cl; cl = cl->next )
     96        {
     97                irc_channel_t *ic = cl->data;
     98               
     99                /* Send a NICK update if we're renaming our user, or someone
     100                   who's in the same channel like our user. */
     101                if( iu == irc->user ||
     102                    ( irc_channel_has_user( ic, irc->user ) &&
     103                      irc_channel_has_user( ic, iu ) ) )
     104                {
     105                        irc_send_nick( iu, new );
     106                        break;
     107                }
     108        }
    93109       
    94110        irc->users = g_slist_remove( irc->users, iu );
Note: See TracChangeset for help on using the changeset viewer.