Changeset 0bd948e for irc_user.c
- Timestamp:
- 2010-07-03T21:16:41Z (14 years ago)
- Branches:
- master
- Children:
- c8eeadd
- Parents:
- 917a83e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_user.c
r917a83e r0bd948e 52 52 int irc_user_free( irc_t *irc, irc_user_t *iu ) 53 53 { 54 GSList *l;55 gboolean send_quit = FALSE;54 static struct im_connection *last_ic; 55 static char *msg; 56 56 57 57 if( !iu ) 58 58 return 0; 59 59 60 if( iu->bu && 61 ( iu->bu->ic->flags & OPT_LOGGING_OUT ) && 62 iu->bu->ic != last_ic ) 63 { 64 char host_prefix[] = "bitlbee."; 65 char *s; 66 67 /* Irssi recognises netsplits by quitmsgs with two 68 hostnames, where a hostname is a "word" with one 69 of more dots. Mangle no-dot hostnames a bit. */ 70 if( strchr( irc->root->host, '.' ) ) 71 *host_prefix = '\0'; 72 73 last_ic = iu->bu->ic; 74 g_free( msg ); 75 if( !set_getbool( &irc->b->set, "simulate_netsplit" ) ) 76 msg = g_strdup( "Account off-line" ); 77 else if( ( s = strchr( iu->bu->ic->acc->user, '@' ) ) ) 78 msg = g_strdup_printf( "%s%s %s", host_prefix, 79 irc->root->host, s + 1 ); 80 else 81 msg = g_strdup_printf( "%s%s %s.%s", 82 host_prefix, irc->root->host, 83 iu->bu->ic->acc->prpl->name, irc->root->host ); 84 } 85 else if( !iu->bu || !( iu->bu->ic->flags & OPT_LOGGING_OUT ) ) 86 { 87 g_free( msg ); 88 msg = g_strdup( "Removed" ); 89 last_ic = NULL; 90 } 91 irc_user_quit( iu, msg ); 92 60 93 irc->users = g_slist_remove( irc->users, iu ); 61 94 g_hash_table_remove( irc->nick_user_hash, iu->key ); 62 63 for( l = irc->channels; l; l = l->next )64 send_quit |= irc_channel_del_user( (irc_channel_t*) l->data, iu, TRUE, NULL );65 66 if( send_quit )67 {68 static struct im_connection *last_ic;69 static char *msg;70 71 if( iu->bu &&72 ( iu->bu->ic->flags & OPT_LOGGING_OUT ) &&73 iu->bu->ic != last_ic )74 {75 char host_prefix[] = "bitlbee.";76 char *s;77 78 /* Irssi recognises netsplits by quitmsgs with two79 hostnames, where a hostname is a "word" with one80 of more dots. Mangle no-dot hostnames a bit. */81 if( strchr( irc->root->host, '.' ) )82 *host_prefix = '\0';83 84 last_ic = iu->bu->ic;85 g_free( msg );86 if( !set_getbool( &irc->b->set, "simulate_netsplit" ) )87 msg = g_strdup( "Account off-line" );88 else if( ( s = strchr( iu->bu->ic->acc->user, '@' ) ) )89 msg = g_strdup_printf( "%s%s %s", host_prefix,90 irc->root->host, s + 1 );91 else92 msg = g_strdup_printf( "%s%s %s.%s",93 host_prefix, irc->root->host,94 iu->bu->ic->acc->prpl->name, irc->root->host );95 }96 else if( !iu->bu || !( iu->bu->ic->flags & OPT_LOGGING_OUT ) )97 {98 g_free( msg );99 msg = g_strdup( "Removed" );100 last_ic = NULL;101 }102 irc_send_quit( iu, msg );103 }104 95 105 96 g_free( iu->nick ); … … 205 196 } 206 197 198 void irc_user_quit( irc_user_t *iu, const char *msg ) 199 { 200 GSList *l; 201 gboolean send_quit = FALSE; 202 203 if( !iu ) 204 return; 205 206 for( l = iu->irc->channels; l; l = l->next ) 207 send_quit |= irc_channel_del_user( (irc_channel_t*) l->data, iu, TRUE, NULL ); 208 209 if( send_quit ) 210 irc_send_quit( iu, msg ); 211 } 212 207 213 /* User-type dependent functions, for root/NickServ: */ 208 214 static gboolean root_privmsg( irc_user_t *iu, const char *msg )
Note: See TracChangeset
for help on using the changeset viewer.