Changeset b1f818b
- Timestamp:
- 2010-07-11T12:21:59Z (14 years ago)
- Branches:
- master
- Children:
- 2e0eaac
- Parents:
- 133cdff
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r133cdff rb1f818b 50 50 51 51 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 52 strcpy( nick, nick_get( bu ->ic->acc, bu->handle) );52 strcpy( nick, nick_get( bu ) ); 53 53 54 54 bu->ui_data = iu = irc_user_new( irc, nick ); … … 294 294 return TRUE; 295 295 296 if( nick_saved( bu ->ic->acc, bu->handle) )296 if( nick_saved( bu ) ) 297 297 /* The user already assigned a nickname to this person. */ 298 298 return TRUE; … … 319 319 If rejoining a channel, maybe we got this nick already 320 320 (and dedupe would only add an underscore. */ 321 nick_dedupe( bu ->ic->acc, bu->handle, newnick );321 nick_dedupe( bu, newnick ); 322 322 irc_user_set_nick( iu, newnick ); 323 323 } -
nick.c
r133cdff rb1f818b 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 07Wilmer van der Gaast and others *4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 42 42 } 43 43 44 void nick_set ( account_t *acc, const char *handle, const char *nick )44 void nick_set_raw( account_t *acc, const char *handle, const char *nick ) 45 45 { 46 46 char *store_handle, *store_nick = g_malloc( MAX_NICK_LENGTH + 1 ); 47 47 48 48 store_handle = clean_handle( handle ); 49 store_nick[MAX_NICK_LENGTH] = 0;49 store_nick[MAX_NICK_LENGTH] = '\0'; 50 50 strncpy( store_nick, nick, MAX_NICK_LENGTH ); 51 51 nick_strip( store_nick ); … … 54 54 } 55 55 56 char *nick_get( account_t *acc, const char *handle ) 56 void nick_set( bee_user_t *bu, const char *nick ) 57 { 58 nick_set_raw( bu->ic->acc, bu->handle, nick ); 59 } 60 61 char *nick_get( bee_user_t *bu ) 57 62 { 58 63 static char nick[MAX_NICK_LENGTH+1]; … … 61 66 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 62 67 63 store_handle = clean_handle( handle );68 store_handle = clean_handle( bu->handle ); 64 69 /* Find out if we stored a nick for this person already. If not, try 65 70 to generate a sane nick automatically. */ 66 if( ( found_nick = g_hash_table_lookup( acc->nicks, store_handle ) ) )71 if( ( found_nick = g_hash_table_lookup( bu->ic->acc->nicks, store_handle ) ) ) 67 72 { 68 73 strncpy( nick, found_nick, MAX_NICK_LENGTH ); … … 72 77 char *s; 73 78 74 g_snprintf( nick, MAX_NICK_LENGTH, "%s", handle );79 g_snprintf( nick, MAX_NICK_LENGTH, "%s", bu->handle ); 75 80 if( ( s = strchr( nick, '@' ) ) ) 76 81 while( *s ) … … 78 83 79 84 nick_strip( nick ); 80 if( set_getbool( & acc->bee->set, "lcnicks" ) )85 if( set_getbool( &bu->bee->set, "lcnicks" ) ) 81 86 nick_lc( nick ); 82 87 } … … 85 90 /* Make sure the nick doesn't collide with an existing one by adding 86 91 underscores and that kind of stuff, if necessary. */ 87 nick_dedupe( acc, handle, nick );92 nick_dedupe( bu, nick ); 88 93 89 94 return nick; 90 95 } 91 96 92 void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] ) 93 { 94 irc_t *irc = (irc_t*) acc->bee->ui_data; 97 char *nick_gen( bee_user_t *bu ) 98 { 99 return NULL; 100 } 101 102 void nick_dedupe( bee_user_t *bu, char nick[MAX_NICK_LENGTH+1] ) 103 { 104 irc_t *irc = (irc_t*) bu->bee->ui_data; 95 105 int inf_protection = 256; 96 106 … … 119 129 "Please send all the following lines in your report:" ); 120 130 121 irc_usermsg( irc, "Trying to get a sane nick for handle %s", handle );131 irc_usermsg( irc, "Trying to get a sane nick for handle %s", bu->handle ); 122 132 for( i = 0; i < MAX_NICK_LENGTH; i ++ ) 123 133 irc_usermsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] ); … … 136 146 /* Just check if there is a nickname set for this buddy or if we'd have to 137 147 generate one. */ 138 int nick_saved( account_t *acc, const char *handle)148 int nick_saved( bee_user_t *bu ) 139 149 { 140 150 char *store_handle, *found; 141 151 142 store_handle = clean_handle( handle );143 found = g_hash_table_lookup( acc->nicks, store_handle );152 store_handle = clean_handle( bu->handle ); 153 found = g_hash_table_lookup( bu->ic->acc->nicks, store_handle ); 144 154 g_free( store_handle ); 145 155 … … 147 157 } 148 158 149 void nick_del( account_t *acc, const char *handle)150 { 151 g_hash_table_remove( acc->nicks,handle );159 void nick_del( bee_user_t *bu ) 160 { 161 g_hash_table_remove( bu->ic->acc->nicks, bu->handle ); 152 162 } 153 163 -
nick.h
r133cdff rb1f818b 24 24 */ 25 25 26 void nick_set( account_t *acc, const char *handle, const char *nick ); 27 char *nick_get( account_t *acc, const char *handle ); 28 void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] ); 29 int nick_saved( account_t *acc, const char *handle ); 30 void nick_del( account_t *acc, const char *handle ); 26 void nick_set_raw( account_t *acc, const char *handle, const char *nick ); 27 void nick_set( bee_user_t *bu, const char *nick ); 28 char *nick_get( bee_user_t *bu ); 29 char *nick_gen( bee_user_t *bu ); 30 void nick_dedupe( bee_user_t *bu, char nick[MAX_NICK_LENGTH+1] ); 31 int nick_saved( bee_user_t *bu ); 32 void nick_del( bee_user_t *bu ); 31 33 void nick_strip( char *nick ); 32 34 -
root_commands.c
r133cdff rb1f818b 615 615 else 616 616 { 617 nick_set ( a, cmd[2], cmd[3] );617 nick_set_raw( a, cmd[2], cmd[3] ); 618 618 } 619 619 } … … 643 643 644 644 bu->ic->acc->prpl->remove_buddy( bu->ic, bu->handle, NULL ); 645 nick_del( bu ->ic->acc, bu->handle);645 nick_del( bu ); 646 646 //TODO(wilmer): bee_user_free() and/or let the IM mod do it? irc_user_free( irc, cmd[1] ); 647 647 … … 728 728 else if( iu->bu ) 729 729 { 730 nick_set( iu->bu ->ic->acc, iu->bu->handle, cmd[2] );730 nick_set( iu->bu, cmd[2] ); 731 731 } 732 732 -
storage_xml.c
r133cdff rb1f818b 197 197 if( xd->current_account && handle && nick ) 198 198 { 199 nick_set ( xd->current_account, handle, nick );199 nick_set_raw( xd->current_account, handle, nick ); 200 200 } 201 201 else
Note: See TracChangeset
for help on using the changeset viewer.