Changeset d06eabf for protocols/nogaim.c


Ignore:
Timestamp:
2007-06-04T13:22:05Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e0e2a71
Parents:
54f2f55
Message:

Added imcb_buddy_nick_hint so the Jabber conference module can suggest sane
nicknames for chatroom participants. There'll probably be a lot of
underscores now, but this is by far the cleanest way to implement this, I
think. At least now whispers will work properly. Also using this function
call to set names for ICQ contacts in a slightly saner way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r54f2f55 rd06eabf  
    428428{
    429429        user_t *u = user_findhandle( ic, handle );
    430         char *s, newnick[MAX_NICK_LENGTH+1];
    431430       
    432431        if( !u || !realname ) return;
     
    440439                if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )
    441440                        imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
    442                
    443                 if( !u->online && !nick_saved( ic->acc, handle ) )
    444                 {
    445                         /* Detect numeric handles: */
    446                         for( s = u->user; isdigit( *s ); s++ );
    447                        
    448                         if( *s == 0 )
    449                         {
    450                                 /* If we reached the end of the string, it only contained numbers.
    451                                    Seems to be an ICQ# then, so hopefully realname contains
    452                                    something more useful. */
    453                                 strcpy( newnick, realname );
    454                                
    455                                 /* Some processing to make sure this string is a valid IRC nickname. */
    456                                 nick_strip( newnick );
    457                                 if( set_getbool( &ic->irc->set, "lcnicks" ) )
    458                                         nick_lc( newnick );
    459                                
    460                                 u->nick = g_strdup( newnick );
    461                         }
    462                 }
    463         }
    464 }
    465 
     441        }
     442}
     443
     444/* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM
     445   modules to suggest a nickname for a handle. */
     446void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick )
     447{
     448        user_t *u = user_findhandle( ic, handle );
     449        char newnick[MAX_NICK_LENGTH+1];
     450       
     451        if( !u->online && !nick_saved( ic->acc, handle ) )
     452        {
     453                /* Only do this if the person isn't online yet (which should
     454                   be the case if we just added it) and if the user hasn't
     455                   assigned a nickname to this buddy already. */
     456               
     457                strcpy( newnick, nick );
     458               
     459                /* Some processing to make sure this string is a valid IRC nickname. */
     460                nick_strip( newnick );
     461                if( set_getbool( &ic->irc->set, "lcnicks" ) )
     462                        nick_lc( newnick );
     463               
     464                nick_dedupe( ic->acc, handle, newnick );
     465               
     466                u->nick = g_strdup( newnick );
     467        }
     468}
    466469
    467470/* prpl.c */
Note: See TracChangeset for help on using the changeset viewer.