Changes in / [f00e3ad:d419073]
- Files:
-
- 1 deleted
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
rf00e3ad rd419073 17 17 *.gcno 18 18 *.o 19 coverage 20 bitlbee.info -
account.c
rf00e3ad rd419073 182 182 account_t *a, *l = NULL; 183 183 184 if( acc->ic ) 185 /* Caller should have checked, accounts still in use can't be deleted. */ 186 return; 187 184 188 for( a = irc->accounts; a; a = (l=a)->next ) 185 189 if( a == acc ) 186 190 { 187 if( a->ic ) return; /* Caller should have checked, accounts still in use can't be deleted. */188 189 191 if( l ) 190 {191 192 l->next = a->next; 192 }193 193 else 194 {195 194 irc->accounts = a->next; 196 }197 195 198 196 while( a->set ) … … 203 201 g_free( a->user ); 204 202 g_free( a->pass ); 205 if( a->server )g_free( a->server );203 g_free( a->server ); 206 204 if( a->reconnect ) /* This prevents any reconnect still queued to happen */ 207 205 cancel_auto_reconnect( a ); -
bitlbee.c
rf00e3ad rd419073 54 54 ; 55 55 56 i = getaddrinfo( global.conf->iface , global.conf->port, &hints, &addrinfo_bind );56 i = getaddrinfo( global.conf->iface_in, global.conf->port, &hints, &addrinfo_bind ); 57 57 if( i ) 58 58 { 59 59 log_message( LOGLVL_ERROR, "Couldn't parse address `%s': %s", 60 global.conf->iface , gai_strerror(i) );60 global.conf->iface_in, gai_strerror(i) ); 61 61 return -1; 62 62 } … … 226 226 if( st == size ) 227 227 { 228 g_free( irc->sendbuffer );229 irc->sendbuffer = NULL;230 irc->w_watch_source_id = 0;231 232 228 if( irc->status & USTATUS_SHUTDOWN ) 229 { 233 230 irc_free( irc ); 231 } 232 else 233 { 234 g_free( irc->sendbuffer ); 235 irc->sendbuffer = NULL; 236 irc->w_watch_source_id = 0; 237 } 234 238 235 239 return FALSE; -
bitlbee.conf
rf00e3ad rd419073 10 10 ## 11 11 ## Inetd -- Run from inetd (default) 12 ## Daemon -- Run as a stand-alone daemon -- EXPERIMENTAL! BitlBee is not yet 13 ## stable enough to serve lots of users from one process. Because of this 14 ## and other reasons, the use of daemon-mode is *STRONGLY* discouraged, 15 ## don't even *think* of reporting bugs when you use this. 12 ## Daemon -- Run as a stand-alone daemon, serving all users from one process. 13 ## This saves memory if there are more users, the downside is that when one 14 ## user hits a crash-bug, all other users will also lose their connection. 16 15 ## ForkDaemon -- Run as a stand-alone daemon, but keep all clients in separate 17 16 ## child processes. This should be pretty safe and reliable to use instead … … 34 33 # DaemonInterface = 0.0.0.0 35 34 # DaemonPort = 6667 35 36 ## ClientInterface: 37 ## 38 ## If for any reason, you want BitlBee to use a specific address/interface 39 ## for outgoing traffic (IM connections, HTTP(S), etc.), set it here. 40 ## 41 # ClientInterface = 0.0.0.0 36 42 37 43 ## AuthMode -
bitlbee.h
rf00e3ad rd419073 95 95 #define g_main_quit __PLEASE_USE_B_MAIN_QUIT__ 96 96 97 #ifndef F_OK98 #define F_OK 099 #endif100 101 97 #ifndef G_GNUC_MALLOC 102 98 /* Doesn't exist in GLib <=2.4 while everything else in BitlBee should … … 160 156 gboolean bitlbee_shutdown( gpointer data, gint fd, b_input_condition cond ); 161 157 158 char *set_eval_root_nick( set_t *set, char *new_nick ); 159 162 160 extern global_t global; 163 161 -
conf.c
rf00e3ad rd419073 45 45 conf = g_new0( conf_t, 1 ); 46 46 47 conf->iface = NULL; 47 conf->iface_in = NULL; 48 conf->iface_out = NULL; 48 49 conf->port = g_strdup( "6667" ); 49 50 conf->nofork = 0; … … 82 83 if( opt == 'i' ) 83 84 { 84 conf->iface = g_strdup( optarg );85 conf->iface_in = g_strdup( optarg ); 85 86 } 86 87 else if( opt == 'p' ) … … 131 132 "\n" 132 133 " -I Classic/InetD mode. (Default)\n" 133 " -D Daemon mode. ( Still EXPERIMENTAL!)\n"134 " -D Daemon mode. (one process serves all)\n" 134 135 " -F Forking daemon. (one process per client)\n" 135 136 " -u Run daemon as specified user.\n" … … 202 203 else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 ) 203 204 { 204 g_free( conf->iface );205 conf->iface = g_strdup( ini->value );205 g_free( conf->iface_in ); 206 conf->iface_in = g_strdup( ini->value ); 206 207 } 207 208 else if( g_strcasecmp( ini->key, "daemonport" ) == 0 ) … … 209 210 g_free( conf->port ); 210 211 conf->port = g_strdup( ini->value ); 212 } 213 else if( g_strcasecmp( ini->key, "clientinterface" ) == 0 ) 214 { 215 g_free( conf->iface_out ); 216 conf->iface_out = g_strdup( ini->value ); 211 217 } 212 218 else if( g_strcasecmp( ini->key, "authmode" ) == 0 ) -
conf.h
rf00e3ad rd419073 32 32 typedef struct conf 33 33 { 34 char *iface ;34 char *iface_in, *iface_out; 35 35 char *port; 36 36 int nofork; -
configure
rf00e3ad rd419073 74 74 --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto) 75 75 $ssl 76 77 --target=... Cross compilation target same as host 76 78 EOF 77 79 exit; … … 132 134 EOF 133 135 136 if [ -n "$target" ]; then 137 PKG_CONFIG_PATH=/usr/$target/lib/pkgconfig 138 PATH=/usr/$target/bin:$PATH 139 CC=$target-cc 140 LD=$target-ld 141 fi 142 134 143 if [ "$debug" = "1" ]; then 135 144 [ -z "$CFLAGS" ] && CFLAGS=-g … … 158 167 echo "CC=$CC" >> Makefile.settings; 159 168 160 if [ -n "$LD" ]; then 161 echo "LD=$LD" >> Makefile.settings; 162 elif type ld > /dev/null 2> /dev/null; then 163 echo "LD=ld" >> Makefile.settings; 164 else 165 echo 'Cannot find ld, aborting.' 166 exit 1; 167 fi 169 if [ -z "$LD" ]; then 170 if type ld > /dev/null 2> /dev/null; then 171 LD=ld 172 else 173 echo 'Cannot find ld, aborting.' 174 exit 1; 175 fi 176 fi 177 178 echo "LD=$LD" >> Makefile.settings 168 179 169 180 if [ -z "$PKG_CONFIG" ]; then … … 213 224 detect_gnutls() 214 225 { 215 if libgnutls-config --version > /dev/null 2> /dev/null; then 226 if $PKG_CONFIG --exists gnutls; then 227 cat <<EOF>>Makefile.settings 228 EFLAGS+=`$PKG_CONFIG --libs gnutls` 229 CFLAGS+=`$PKG_CONFIG --cflags gnutls` 230 EOF 231 ssl=gnutls 232 ret=1 233 elif libgnutls-config --version > /dev/null 2> /dev/null; then 216 234 cat <<EOF>>Makefile.settings 217 235 EFLAGS+=`libgnutls-config --libs` … … 375 393 376 394 if [ "$gcov" = "1" ]; then 377 echo "CFLAGS+=- ftest-coverage -fprofile-arcs" >> Makefile.settings378 echo "EFLAGS+=- lgcov" >> Makefile.settings395 echo "CFLAGS+=--coverage" >> Makefile.settings 396 echo "EFLAGS+=--coverage" >> Makefile.settings 379 397 fi 380 398 … … 489 507 esac 490 508 509 if [ -n "$target" ]; then 510 echo "Cross-compiling for: $target" 511 fi 512 491 513 echo 492 514 echo 'Configuration done:' -
debian/changelog
rf00e3ad rd419073 1 bitlbee (1.2-6) UNRELEASED; urgency=low 2 3 * Add Homepage and Vcs-Bzr fields. 4 5 -- Jelmer Vernooij <jelmer@samba.org> Sun, 11 May 2008 14:18:16 +0200 6 1 7 bitlbee (1.2-5) unstable; urgency=low 2 8 -
debian/control
rf00e3ad rd419073 6 6 Standards-Version: 3.8.0 7 7 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf 8 Homepage: http://www.bitlbee.org/ 9 Vcs-Bzr: http://code.bitlbee.org/bitlbee/ 8 10 DM-Upload-Allowed: yes 9 11 -
doc/CHANGES
rf00e3ad rd419073 1 Version 1.2.1: 2 - Fixed proxy support. 3 - Fixed stalling issues while connecting to Jabber when using the OpenSSL 4 module. 5 - Fixed problem with GLib and ForkDaemon where processes didn't die when 6 the client disconnects. 7 - Fixed handling of "set charset none". (Which pretty much breaks the account 8 completely in 1.2.) 9 - You can now automatically identify yourself to BitlBee by setting a server 10 password in your IRC client. 11 - Compatible with all crazy kinds of line endings that clients can send. 12 13 Finished ... 14 1 15 Version 1.2: 2 16 - Added ForkDaemon mode next to the existing Daemon- and inetd modes. With -
doc/README
rf00e3ad rd419073 56 56 a package from your distro would've been a better idea. :-P) 57 57 58 Note that the BitlBee code is getting stable enough for daemon mode to be 59 useful. Some public servers use it, and it saves a lot of memory by serving 60 tens of users from a single process. One crash affects all users, but these 61 are becoming quite rare. 62 58 63 59 64 DEPENDENCIES … … 98 103 versions of make, we'd love to hear it, but it seems this just isn't 99 104 possible. 100 101 102 RUNNING ON SERVERS WITH MANY USERS103 ==================================104 105 BitlBee is not yet bug-free. Sometimes a bug causes the program to get into106 an infinite loop. Something you really don't want on a public server,107 especially when that machine is also used for other (mission-critical) things.108 For now we can't do much about it. We haven't seen that happen for a long109 time already on our own machines, but some people still manage to get110 themselves in nasty situations we haven't seen before.111 112 For now the best we can offer against this problem is bitlbeed, which allows113 you to setrlimit() the child processes to use no more than a specified114 number of CPU seconds. Not the best solution (not really a solution anyway),115 but certainly trashing one busy daemon process is better than trashing your116 whole machine.117 118 We don't believe adding a limit for bitlbee to /etc/security/limits.conf will119 work, because that file is only read by PAM (ie just for real login users,120 not daemons).121 122 See utils/bitlbeed.c for more information about the program.123 124 Just a little note: Now that we reach version 1.0, this shouldn't be that125 much of an issue anymore. However, on a public server, especially if you126 also use it for other things, it can't hurt to protect yourself against127 possible problems.128 105 129 106 -
doc/bitlbee.8
rf00e3ad rd419073 44 44 45 45 \fBbitlbee\fP should be called by 46 .BR inetd (8). 47 (Or \fBbitlbeed\fP, 48 if you can't run and/or configure \fBinetd\fP.) There is an experimental 49 daemon mode too, in which BitlBee will serve all clients in one process 50 (and does not require inetd), but this mode is still experimental. 51 There are still some bugs left in BitlBee, and if they cause a crash, 52 that would terminate the BitlBee connection for all clients. 46 .BR inetd (8), 47 or you can run it as a stand-alone daemon. 53 48 .PP 54 49 .SH OPTIONS … … 62 57 Run in daemon mode. In this mode, BitlBee forks to the background and 63 58 waits for new connections. All clients will be served from one process. 64 This is still experimental. See the note above for more information.65 59 .IP "-F" 66 60 Run in ForkDaemon mode. This is similar to ordinary daemon mode, but every 67 client gets its own process. Easier to set up than inetd mode, butwithout61 client gets its own process. Easier to set up than inetd mode, and without 68 62 the possible stability issues. 69 63 .IP "-i \fIaddress\fP" -
doc/user-guide/commands.xml
rf00e3ad rd419073 589 589 </bitlbee-setting> 590 590 591 <bitlbee-setting name="root_nick" type="string" scope="global"> 592 <default>root</default> 593 594 <description> 595 <para> 596 Normally the "bot" that takes all your BitlBee commands is called "root". If you don't like this name, you can rename it to anything else using the <emphasis>rename</emphasis> command, or by changing this setting. 597 </para> 598 </description> 599 </bitlbee-setting> 600 591 601 <bitlbee-setting name="save_on_quit" type="boolean" scope="global"> 592 602 <default>true</default> -
irc.c
rf00e3ad rd419073 42 42 } 43 43 44 static char *set_eval_charset( set_t *set, char *value ) 45 { 46 irc_t *irc = set->data; 47 GIConv ic, oc; 48 49 if( g_strcasecmp( value, "none" ) == 0 ) 50 value = g_strdup( "utf-8" ); 51 52 if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 ) 53 { 54 return NULL; 55 } 56 if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 ) 57 { 58 g_iconv_close( ic ); 59 return NULL; 60 } 61 62 if( irc->iconv != (GIConv) -1 ) 63 g_iconv_close( irc->iconv ); 64 if( irc->oconv != (GIConv) -1 ) 65 g_iconv_close( irc->oconv ); 66 67 irc->iconv = ic; 68 irc->oconv = oc; 69 70 return value; 71 } 72 44 73 irc_t *irc_new( int fd ) 45 74 { … … 64 93 irc->mynick = g_strdup( ROOT_NICK ); 65 94 irc->channel = g_strdup( ROOT_CHAN ); 95 96 irc->iconv = (GIConv) -1; 97 irc->oconv = (GIConv) -1; 66 98 67 99 if( global.conf->hostname ) … … 119 151 set_add( &irc->set, "private", "true", set_eval_bool, irc ); 120 152 set_add( &irc->set, "query_order", "lifo", NULL, irc ); 153 set_add( &irc->set, "root_nick", irc->mynick, set_eval_root_nick, irc ); 121 154 set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc ); 122 155 set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc ); … … 127 160 conf_loaddefaults( irc ); 128 161 162 /* Evaluator sets the iconv/oconv structures. */ 163 set_eval_charset( set_find( &irc->set, "charset" ), set_getstr( &irc->set, "charset" ) ); 164 129 165 return( irc ); 130 166 } … … 164 200 if( irc->sendbuffer && !immed ) 165 201 { 166 /* We won't read from this socket anymore. Instead, we'll connect a timer 167 to it that should shut down the connection in a second, just in case 168 bitlbee_.._write doesn't do it first. */ 202 /* Set up a timeout event that should shut down the connection 203 in a second, just in case ..._write doesn't do it first. */ 169 204 170 205 b_event_remove( irc->r_watch_source_id ); 171 irc->r_watch_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc ); 206 irc->r_watch_source_id = 0; 207 208 b_event_remove( irc->ping_source_id ); 209 irc->ping_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc ); 172 210 } 173 211 else … … 185 223 186 224 /* Because we have no garbage collection, this is quite annoying */ 187 void irc_free(irc_t * irc) 188 { 189 account_t *account; 225 void irc_free( irc_t * irc ) 226 { 190 227 user_t *user, *usertmp; 191 228 … … 196 233 irc_usermsg( irc, "Error while saving settings!" ); 197 234 198 closesocket( irc->fd );199 200 if( irc->ping_source_id > 0 )201 b_event_remove( irc->ping_source_id );202 b_event_remove( irc->r_watch_source_id );203 if( irc->w_watch_source_id > 0 )204 b_event_remove( irc->w_watch_source_id );205 206 235 irc_connection_list = g_slist_remove( irc_connection_list, irc ); 207 236 208 for (account = irc->accounts; account; account = account->next) { 209 if (account->ic) { 210 imc_logout(account->ic, TRUE); 211 } else if (account->reconnect) { 212 cancel_auto_reconnect(account); 213 } 214 } 215 216 g_free(irc->sendbuffer); 217 g_free(irc->readbuffer); 218 219 g_free(irc->nick); 220 g_free(irc->user); 221 g_free(irc->host); 222 g_free(irc->realname); 223 g_free(irc->password); 224 225 g_free(irc->myhost); 226 g_free(irc->mynick); 227 228 g_free(irc->channel); 229 230 while (irc->queries != NULL) 231 query_del(irc, irc->queries); 232 233 while (irc->accounts) 234 if (irc->accounts->ic == NULL) 235 account_del(irc, irc->accounts); 237 while( irc->accounts ) 238 { 239 if( irc->accounts->ic ) 240 imc_logout( irc->accounts->ic, FALSE ); 241 else if( irc->accounts->reconnect ) 242 cancel_auto_reconnect( irc->accounts ); 243 244 if( irc->accounts->ic == NULL ) 245 account_del( irc, irc->accounts ); 236 246 else 237 247 /* Nasty hack, but account_del() doesn't work in this 238 248 case and we don't want infinite loops, do we? ;-) */ 239 249 irc->accounts = irc->accounts->next; 240 241 while (irc->set) 242 set_del(&irc->set, irc->set->key); 243 244 if (irc->users != NULL) { 250 } 251 252 while( irc->queries != NULL ) 253 query_del( irc, irc->queries ); 254 255 while( irc->set ) 256 set_del( &irc->set, irc->set->key ); 257 258 if (irc->users != NULL) 259 { 245 260 user = irc->users; 246 while (user != NULL) { 247 g_free(user->nick); 248 g_free(user->away); 249 g_free(user->handle); 250 if(user->user!=user->nick) g_free(user->user); 251 if(user->host!=user->nick) g_free(user->host); 252 if(user->realname!=user->nick) g_free(user->realname); 253 b_event_remove(user->sendbuf_timer); 261 while( user != NULL ) 262 { 263 g_free( user->nick ); 264 g_free( user->away ); 265 g_free( user->handle ); 266 if( user->user != user->nick ) g_free( user->user ); 267 if( user->host != user->nick ) g_free( user->host ); 268 if( user->realname != user->nick ) g_free( user->realname ); 269 b_event_remove( user->sendbuf_timer ); 254 270 255 271 usertmp = user; 256 272 user = user->next; 257 g_free(usertmp); 258 } 259 } 260 261 g_hash_table_foreach_remove(irc->userhash, irc_free_hashkey, NULL); 262 g_hash_table_destroy(irc->userhash); 263 264 g_hash_table_foreach_remove(irc->watches, irc_free_hashkey, NULL); 265 g_hash_table_destroy(irc->watches); 266 267 g_free(irc); 273 g_free( usertmp ); 274 } 275 } 276 277 if( irc->ping_source_id > 0 ) 278 b_event_remove( irc->ping_source_id ); 279 if( irc->r_watch_source_id > 0 ) 280 b_event_remove( irc->r_watch_source_id ); 281 if( irc->w_watch_source_id > 0 ) 282 b_event_remove( irc->w_watch_source_id ); 283 284 closesocket( irc->fd ); 285 irc->fd = -1; 286 287 g_hash_table_foreach_remove( irc->userhash, irc_free_hashkey, NULL ); 288 g_hash_table_destroy( irc->userhash ); 289 290 g_hash_table_foreach_remove( irc->watches, irc_free_hashkey, NULL ); 291 g_hash_table_destroy( irc->watches ); 292 293 if( irc->iconv != (GIConv) -1 ) 294 g_iconv_close( irc->iconv ); 295 if( irc->oconv != (GIConv) -1 ) 296 g_iconv_close( irc->oconv ); 297 298 g_free( irc->sendbuffer ); 299 g_free( irc->readbuffer ); 300 301 g_free( irc->nick ); 302 g_free( irc->user ); 303 g_free( irc->host ); 304 g_free( irc->realname ); 305 g_free( irc->password ); 306 307 g_free( irc->myhost ); 308 g_free( irc->mynick ); 309 310 g_free( irc->channel ); 311 312 g_free( irc->last_target ); 313 314 g_free( irc ); 268 315 269 316 if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) … … 286 333 void irc_process( irc_t *irc ) 287 334 { 288 char **lines, *temp, **cmd , *cs;335 char **lines, *temp, **cmd; 289 336 int i; 290 337 … … 295 342 for( i = 0; *lines[i] != '\0'; i ++ ) 296 343 { 297 char conv[IRC_MAX_LINE+1];344 char *conv = NULL; 298 345 299 /* [WvG] Because irc_tokenize splits at every newline, the lines[] list 300 should end with an empty string. This is why this actually works. 301 Took me a while to figure out, Maurits. :-P */ 346 /* [WvG] If the last line isn't empty, it's an incomplete line and we 347 should wait for the rest to come in before processing it. */ 302 348 if( lines[i+1] == NULL ) 303 349 { … … 309 355 } 310 356 311 if( ( cs = set_getstr( &irc->set, "charset" ) ) && g_strcasecmp( cs, "none" ) != 0 ) 312 { 313 conv[IRC_MAX_LINE] = 0; 314 if( do_iconv( cs, "UTF-8", lines[i], conv, 0, IRC_MAX_LINE - 2 ) == -1 ) 357 if( irc->iconv != (GIConv) -1 ) 358 { 359 gsize bytes_read, bytes_written; 360 361 conv = g_convert_with_iconv( lines[i], -1, irc->iconv, 362 &bytes_read, &bytes_written, NULL ); 363 364 if( conv == NULL || bytes_read != strlen( lines[i] ) ) 315 365 { 316 366 /* GLib can do strange things if things are not in the expected charset, … … 324 374 "expect by changing the charset setting. See " 325 375 "`help set charset' for more information. Your " 326 "message was ignored.", cs ); 327 *conv = 0; 376 "message was ignored.", 377 set_getstr( &irc->set, "charset" ) ); 378 379 g_free( conv ); 380 conv = NULL; 328 381 } 329 382 else … … 332 385 "Warning: invalid characters received at login time." ); 333 386 334 strncpy( conv, lines[i], IRC_MAX_LINE);387 conv = g_strdup( lines[i] ); 335 388 for( temp = conv; *temp; temp ++ ) 336 389 if( *temp & 0x80 ) … … 341 394 } 342 395 343 if( ( cmd = irc_parse_line( lines[i] ) ) == NULL ) 344 continue; 345 irc_exec( irc, cmd ); 396 if( lines[i] ) 397 { 398 if( ( cmd = irc_parse_line( lines[i] ) ) == NULL ) 399 continue; 400 irc_exec( irc, cmd ); 401 g_free( cmd ); 402 } 346 403 347 g_free( c md);404 g_free( conv ); 348 405 349 406 /* Shouldn't really happen, but just in case... */ … … 369 426 char **irc_tokenize( char *buffer ) 370 427 { 371 int i, j ;428 int i, j, n = 3; 372 429 char **lines; 373 430 374 /* Count the number of elements we're gonna need. */ 375 for( i = 0, j = 1; buffer[i] != '\0'; i ++ ) 376 { 377 if( buffer[i] == '\n' ) 378 if( buffer[i+1] != '\r' && buffer[i+1] != '\n' ) 379 j ++; 380 } 381 382 /* Allocate j+1 elements. */ 383 lines = g_new( char *, j + 1 ); 431 /* Allocate n+1 elements. */ 432 lines = g_new( char *, n + 1 ); 433 434 lines[0] = buffer; 435 436 /* Split the buffer in several strings, and accept any kind of line endings, 437 * knowing that ERC on Windows may send something interesting like \r\r\n, 438 * and surely there must be clients that think just \n is enough... */ 439 for( i = 0, j = 0; buffer[i] != '\0'; i ++ ) 440 { 441 if( buffer[i] == '\r' || buffer[i] == '\n' ) 442 { 443 while( buffer[i] == '\r' || buffer[i] == '\n' ) 444 buffer[i++] = '\0'; 445 446 lines[++j] = buffer + i; 447 448 if( j >= n ) 449 { 450 n *= 2; 451 lines = g_renew( char *, lines, n + 1 ); 452 } 453 454 if( buffer[i] == '\0' ) 455 break; 456 } 457 } 384 458 385 459 /* NULL terminate our list. */ 386 lines[j] = NULL; 387 388 lines[0] = buffer; 389 390 /* Split the buffer in several strings, using \r\n as our seperator, where \r is optional. 391 * Although this is not in the RFC, some braindead ircds (newnet's) use this, so some clients might too. 392 */ 393 for( i = 0, j = 0; buffer[i] != '\0'; i ++) 394 { 395 if( buffer[i] == '\n' ) 396 { 397 buffer[i] = '\0'; 398 399 if( i > 0 && buffer[i-1] == '\r' ) 400 buffer[i-1] = '\0'; 401 if( buffer[i+1] != '\r' && buffer[i+1] != '\n' ) 402 lines[++j] = buffer + i + 1; 403 } 404 } 405 406 return( lines ); 460 lines[++j] = NULL; 461 462 return lines; 407 463 } 408 464 … … 538 594 539 595 return; 540 541 596 } 542 597 … … 544 599 { 545 600 int size; 546 char line[IRC_MAX_LINE+1] , *cs;601 char line[IRC_MAX_LINE+1]; 547 602 548 603 /* Don't try to write anything new anymore when shutting down. */ … … 550 605 return; 551 606 552 line[IRC_MAX_LINE] = 0;607 memset( line, 0, sizeof( line ) ); 553 608 g_vsnprintf( line, IRC_MAX_LINE - 2, format, params ); 554 555 609 strip_newlines( line ); 556 if( ( cs = set_getstr( &irc->set, "charset" ) ) && 557 g_strcasecmp( cs, "none" ) != 0 && g_strcasecmp( cs, "utf-8" ) != 0 ) 558 { 559 char conv[IRC_MAX_LINE+1]; 560 561 conv[IRC_MAX_LINE] = 0; 562 if( do_iconv( "UTF-8", cs, line, conv, 0, IRC_MAX_LINE - 2 ) != -1 ) 563 strcpy( line, conv ); 564 } 565 strcat( line, "\r\n" ); 610 611 if( irc->oconv != (GIConv) -1 ) 612 { 613 gsize bytes_read, bytes_written; 614 char *conv; 615 616 conv = g_convert_with_iconv( line, -1, irc->oconv, 617 &bytes_read, &bytes_written, NULL ); 618 619 if( bytes_read == strlen( line ) ) 620 strncpy( line, conv, IRC_MAX_LINE - 2 ); 621 622 g_free( conv ); 623 } 624 g_strlcat( line, "\r\n", IRC_MAX_LINE + 1 ); 566 625 567 626 if( irc->sendbuffer != NULL ) … … 736 795 irc_spawn( irc, u ); 737 796 738 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQs are answered there." ); 797 irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n" 798 "If you've never used BitlBee before, please do read the help " 799 "information using the \x02help\x02 command. Lots of FAQs are " 800 "answered there.\n" 801 "If you already have an account on this server, just use the " 802 "\x02identify\x02 command to identify yourself." ); 739 803 740 804 if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON ) … … 742 806 743 807 irc->status |= USTATUS_LOGGED_IN; 808 809 /* This is for bug #209 (use PASS to identify to NickServ). */ 810 if( irc->password != NULL ) 811 { 812 char *send_cmd[] = { "identify", g_strdup( irc->password ), NULL }; 813 814 irc_setpass( irc, NULL ); 815 root_command( irc, send_cmd ); 816 g_free( send_cmd[1] ); 817 } 744 818 } 745 819 -
irc.h
rf00e3ad rd419073 61 61 char *sendbuffer; 62 62 char *readbuffer; 63 GIConv iconv, oconv; 63 64 64 65 int sentbytes; … … 69 70 char *host; 70 71 char *realname; 71 char *password; 72 char *password; /* HACK: Used to save the user's password, but before 73 logging in, this may contain a password we should 74 send to identify after USER/NICK are received. */ 72 75 73 76 char umode[8]; -
irc_commands.c
rf00e3ad rd419073 30 30 static void irc_cmd_pass( irc_t *irc, char **cmd ) 31 31 { 32 if( global.conf->auth_pass && 32 if( irc->status & USTATUS_LOGGED_IN ) 33 { 34 char *send_cmd[] = { "identify", cmd[1], NULL }; 35 36 /* We're already logged in, this client seems to send the PASS 37 command last. (Possibly it won't send it at all if it turns 38 out we don't require it, which will break this feature.) 39 Try to identify using the given password. */ 40 return root_command( irc, send_cmd ); 41 } 42 /* Handling in pre-logged-in state, first see if this server is 43 password-protected: */ 44 else if( global.conf->auth_pass && 33 45 ( strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ? 34 46 md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 : … … 38 50 irc_check_login( irc ); 39 51 } 40 else 52 else if( global.conf->auth_pass ) 41 53 { 42 54 irc_reply( irc, 464, ":Incorrect password" ); 55 } 56 else 57 { 58 /* Remember the password and try to identify after USER/NICK. */ 59 irc_setpass( irc, cmd[1] ); 60 irc_check_login( irc ); 43 61 } 44 62 } … … 260 278 if( cmd[1] != irc->last_target ) 261 279 { 262 if( irc->last_target ) 263 g_free( irc->last_target ); 280 g_free( irc->last_target ); 264 281 irc->last_target = g_strdup( cmd[1] ); 265 282 } … … 581 598 582 599 static const command_t irc_commands[] = { 583 { "pass", 1, irc_cmd_pass, IRC_CMD_PRE_LOGIN},600 { "pass", 1, irc_cmd_pass, 0 }, 584 601 { "user", 4, irc_cmd_user, IRC_CMD_PRE_LOGIN }, 585 602 { "nick", 1, irc_cmd_nick, 0 }, -
lib/arc.h
rf00e3ad rd419073 31 31 }; 32 32 33 #ifndef G_GNUC_MALLOC 34 #define G_GNUC_MALLOC 35 #endif 36 33 37 G_GNUC_MALLOC struct arc_state *arc_keymaker( unsigned char *key, int kl, int cycles ); 34 38 unsigned char arc_getbyte( struct arc_state *st ); -
lib/proxy.c
rf00e3ad rd419073 114 114 { 115 115 struct sockaddr_in *sin; 116 struct sockaddr_in me; 116 117 int fd = -1; 117 118 … … 127 128 128 129 sock_make_nonblocking(fd); 130 131 if( global.conf->iface_out ) 132 { 133 me.sin_family = AF_INET; 134 me.sin_port = 0; 135 me.sin_addr.s_addr = inet_addr( global.conf->iface_out ); 136 137 if( bind( fd, (struct sockaddr *) &me, sizeof( me ) ) != 0 ) 138 event_debug( "bind( %d, \"%s\" ) failure\n", fd, global.conf->iface_out ); 139 } 129 140 130 141 event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd); -
protocols/jabber/jabber.c
rf00e3ad rd419073 37 37 GSList *jabber_connections; 38 38 39 /* First enty is the default */ 40 static const int jabber_port_list[] = { 41 5222, 42 5223, 43 5220, 44 5221, 45 5224, 46 5225, 47 5226, 48 5227, 49 5228, 50 5229, 51 80, 52 443, 53 0 54 }; 55 39 56 static void jabber_init( account_t *acc ) 40 57 { 41 58 set_t *s; 42 43 s = set_add( &acc->set, "port", JABBER_PORT_DEFAULT, set_eval_int, acc ); 59 char str[16]; 60 61 g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] ); 62 s = set_add( &acc->set, "port", str, set_eval_int, acc ); 44 63 s->flags |= ACC_SET_OFFLINE_ONLY; 45 64 … … 72 91 struct ns_srv_reply *srv = NULL; 73 92 char *connect_to, *s; 93 int i; 74 94 75 95 /* For now this is needed in the _connected() handlers if using … … 177 197 imcb_log( ic, "Connecting" ); 178 198 179 if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN || 180 set_getint( &acc->set, "port" ) > JABBER_PORT_MAX ) 181 { 182 imcb_log( ic, "Incorrect port number, must be in the %d-%d range", 183 JABBER_PORT_MIN, JABBER_PORT_MAX ); 199 for( i = 0; jabber_port_list[i] > 0; i ++ ) 200 if( set_getint( &acc->set, "port" ) == jabber_port_list[i] ) 201 break; 202 203 if( jabber_port_list[i] == 0 ) 204 { 205 imcb_log( ic, "Illegal port number" ); 184 206 imc_logout( ic, FALSE ); 185 207 return; -
protocols/jabber/jabber.h
rf00e3ad rd419073 134 134 135 135 #define JABBER_XMLCONSOLE_HANDLE "xmlconsole" 136 137 #define JABBER_PORT_DEFAULT "5222"138 #define JABBER_PORT_MIN 5220139 #define JABBER_PORT_MAX 5229140 136 141 137 /* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the -
protocols/jabber/jabber_util.c
rf00e3ad rd419073 246 246 }; 247 247 248 static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla ) 249 { 248 static void jabber_buddy_ask_yes( void *data ) 249 { 250 struct jabber_buddy_ask_data *bla = data; 251 250 252 presence_send_request( bla->ic, bla->handle, "subscribed" ); 251 253 … … 257 259 } 258 260 259 static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla ) 260 { 261 static void jabber_buddy_ask_no( void *data ) 262 { 263 struct jabber_buddy_ask_data *bla = data; 264 261 265 presence_send_request( bla->ic, bla->handle, "subscribed" ); 262 266 -
protocols/jabber/message.c
rf00e3ad rd419073 49 49 { 50 50 GString *fullmsg = g_string_new( "" ); 51 52 for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) 53 { 54 char *ns = xt_find_attr( c, "xmlns" ), *room; 55 struct xt_node *inv, *reason; 56 57 if( strcmp( ns, XMLNS_MUC_USER ) == 0 && 58 ( inv = xt_find_node( c->children, "invite" ) ) ) 59 { 60 room = from; 61 from = xt_find_attr( inv, "from" ) ? : from; 62 63 g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); 64 if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) 65 g_string_append( fullmsg, reason->text ); 66 } 67 } 51 68 52 69 if( ( s = strchr( from, '/' ) ) ) -
protocols/msn/msn.h
rf00e3ad rd419073 29 29 #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r" 30 30 31 #ifdef DEBUG 31 #ifdef DEBUG_MSN 32 32 #define debug( text... ) imcb_log( ic, text ); 33 33 #else -
protocols/msn/msn_util.c
rf00e3ad rd419073 90 90 }; 91 91 92 static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla ) 93 { 92 static void msn_buddy_ask_yes( void *data ) 93 { 94 struct msn_buddy_ask_data *bla = data; 95 94 96 msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname ); 95 97 … … 102 104 } 103 105 104 static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla ) 105 { 106 static void msn_buddy_ask_no( void *data ) 107 { 108 struct msn_buddy_ask_data *bla = data; 109 106 110 msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname ); 107 111 -
protocols/msn/ns.c
rf00e3ad rd419073 178 178 179 179 debug( "Connecting to a new switchboard with key %s", cmd[5] ); 180 sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ); 180 181 if( ( sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ) ) == NULL ) 182 { 183 /* Although this isn't strictly fatal for the NS connection, it's 184 definitely something serious (we ran out of file descriptors?). */ 185 imcb_error( ic, "Could not create new switchboard" ); 186 imc_logout( ic, TRUE ); 187 return( 0 ); 188 } 181 189 182 190 if( md->msgq ) … … 468 476 debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] ); 469 477 470 sb = msn_sb_create( ic, server, port, cmd[4], session ); 471 sb->who = g_strdup( cmd[5] ); 478 if( ( sb = msn_sb_create( ic, server, port, cmd[4], session ) ) == NULL ) 479 { 480 /* Although this isn't strictly fatal for the NS connection, it's 481 definitely something serious (we ran out of file descriptors?). */ 482 imcb_error( ic, "Could not create new switchboard" ); 483 imc_logout( ic, TRUE ); 484 return( 0 ); 485 } 486 else 487 { 488 sb->who = g_strdup( cmd[5] ); 489 } 472 490 } 473 491 else if( strcmp( cmd[0], "ADD" ) == 0 ) -
protocols/nogaim.c
rf00e3ad rd419073 343 343 /* dialogs.c */ 344 344 345 void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ) 345 void imcb_ask( struct im_connection *ic, char *msg, void *data, 346 query_callback doit, query_callback dont ) 346 347 { 347 348 query_add( ic->irc, ic, msg, doit, dont, data ); … … 495 496 }; 496 497 497 void show_got_added_no( gpointer w, struct show_got_added_data*data )498 { 499 g_free( data->handle );498 void show_got_added_no( void *data ) 499 { 500 g_free( ((struct show_got_added_data*)data)->handle ); 500 501 g_free( data ); 501 502 } 502 503 503 void show_got_added_yes( gpointer w, struct show_got_added_data *data ) 504 { 505 data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL ); 506 /* imcb_add_buddy( data->ic, NULL, data->handle, data->handle ); */ 507 508 return show_got_added_no( w, data ); 504 void show_got_added_yes( void *data ) 505 { 506 struct show_got_added_data *sga = data; 507 508 sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); 509 /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ 510 511 return show_got_added_no( data ); 509 512 } 510 513 -
protocols/nogaim.h
rf00e3ad rd419073 42 42 #include "account.h" 43 43 #include "proxy.h" 44 #include "query.h" 44 45 #include "md5.h" 45 46 … … 261 262 * - 'doit' or 'dont' will be called depending of the answer of the user. 262 263 */ 263 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );264 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ); 264 265 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); 265 266 -
protocols/oscar/oscar.c
rf00e3ad rd419073 1084 1084 } 1085 1085 1086 void oscar_accept_chat( gpointer w, struct aim_chat_invitation * inv);1087 void oscar_reject_chat( gpointer w, struct aim_chat_invitation * inv);1086 void oscar_accept_chat(void *data); 1087 void oscar_reject_chat(void *data); 1088 1088 1089 1089 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { … … 1119 1119 } 1120 1120 1121 static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { 1121 static void gaim_icq_authgrant(void *data_) { 1122 struct icq_auth *data = data_; 1122 1123 char *uin, message; 1123 1124 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; … … 1134 1135 } 1135 1136 1136 static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) { 1137 static void gaim_icq_authdeny(void *data_) { 1138 struct icq_auth *data = data_; 1137 1139 char *uin, *message; 1138 1140 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; … … 2588 2590 } 2589 2591 2590 void oscar_accept_chat( gpointer w, struct aim_chat_invitation * inv)2592 void oscar_accept_chat(void *data) 2591 2593 { 2594 struct aim_chat_invitation * inv = data; 2595 2592 2596 oscar_chat_join(inv->ic, inv->name, NULL, NULL); 2593 2597 g_free(inv->name); … … 2595 2599 } 2596 2600 2597 void oscar_reject_chat( gpointer w, struct aim_chat_invitation * inv)2601 void oscar_reject_chat(void *data) 2598 2602 { 2603 struct aim_chat_invitation * inv = data; 2604 2599 2605 g_free(inv->name); 2600 2606 g_free(inv); -
protocols/yahoo/libyahoo2.c
rf00e3ad rd419073 381 381 382 382 /* call repeatedly to get the next one */ 383 /*384 383 static struct yahoo_input_data * find_input_by_id(int id) 385 384 { … … 392 391 return NULL; 393 392 } 394 */395 393 396 394 static struct yahoo_input_data * find_input_by_id_and_webcam_user(int id, const char * who) … … 797 795 { 798 796 struct yahoo_data *yd = find_conn_by_id(id); 797 799 798 if(!yd) 800 799 return; … … 3166 3165 3167 3166 LOG(("write callback: id=%d fd=%d data=%p", id, fd, data)); 3168 if(!yid || !yid->txqueues )3167 if(!yid || !yid->txqueues || !find_conn_by_id(id)) 3169 3168 return -2; 3170 3169 … … 3842 3841 } 3843 3842 3844 3845 /* do { 3843 do { 3846 3844 yahoo_input_close(yid); 3847 } while((yid = find_input_by_id(id)));*/ 3848 3845 } while((yid = find_input_by_id(id))); 3849 3846 } 3850 3847 -
protocols/yahoo/yahoo.c
rf00e3ad rd419073 454 454 struct byahoo_write_ready_data *d = data; 455 455 456 if( !byahoo_get_ic_by_id( d->id ) )457 /* WTF doesn't libyahoo clean this up? */458 return FALSE;459 460 456 yahoo_write_ready( d->id, d->fd, d->data ); 461 457 … … 797 793 } 798 794 799 static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv ) 800 { 795 static void byahoo_accept_conf( void *data ) 796 { 797 struct byahoo_conf_invitation *inv = data; 798 801 799 yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name ); 802 800 imcb_chat_add_buddy( inv->c, inv->ic->acc->user ); … … 805 803 } 806 804 807 static void byahoo_reject_conf( gpointer w, struct byahoo_conf_invitation *inv ) 808 { 805 static void byahoo_reject_conf( void *data ) 806 { 807 struct byahoo_conf_invitation *inv = data; 808 809 809 yahoo_conference_decline( inv->yid, NULL, inv->members, inv->name, "User rejected groupchat" ); 810 810 imcb_chat_free( inv->c ); -
query.c
rf00e3ad rd419073 30 30 static query_t *query_default( irc_t *irc ); 31 31 32 query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data ) 32 query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, 33 query_callback yes, query_callback no, void *data ) 33 34 { 34 35 query_t *q = g_new0( query_t, 1 ); … … 144 145 else 145 146 irc_usermsg( irc, "Accepted: %s", q->question ); 146 q->yes( NULL,q->data );147 q->yes( q->data ); 147 148 } 148 149 else … … 152 153 else 153 154 irc_usermsg( irc, "Rejected: %s", q->question ); 154 q->no( NULL,q->data );155 q->no( q->data ); 155 156 } 156 157 q->data = NULL; -
query.h
rf00e3ad rd419073 27 27 #define _QUERY_H 28 28 29 typedef void (*query_callback) ( void *data ); 30 29 31 typedef struct query 30 32 { 31 33 struct im_connection *ic; 32 34 char *question; 33 void (* yes) ( gpointer w, void *data ); 34 void (* no) ( gpointer w, void *data ); 35 query_callback yes, no; 35 36 void *data; 36 37 struct query *next; 37 38 } query_t; 38 39 39 query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data ); 40 query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, 41 query_callback yes, query_callback no, void *data ); 40 42 void query_del( irc_t *irc, query_t *q ); 41 43 void query_del_by_conn( irc_t *irc, struct im_connection *ic ); -
root_commands.c
rf00e3ad rd419073 204 204 } 205 205 206 void cmd_account_del_yes( gpointer w, void *data ) 207 { 208 account_t *a = data; 209 irc_t *irc = a->irc; 210 211 if( a->ic ) 212 { 213 irc_usermsg( irc, "Account is still logged in, can't delete" ); 214 } 215 else 216 { 217 account_del( irc, a ); 218 irc_usermsg( irc, "Account deleted" ); 219 } 220 } 221 222 void cmd_account_del_no( gpointer w, void *data ) 223 { 206 struct cmd_account_del_data 207 { 208 account_t *a; 209 irc_t *irc; 210 }; 211 212 void cmd_account_del_yes( void *data ) 213 { 214 struct cmd_account_del_data *cad = data; 215 account_t *a; 216 217 for( a = cad->irc->accounts; a && a != cad->a; a = a->next ); 218 219 if( a == NULL ) 220 { 221 irc_usermsg( cad->irc, "Account already deleted" ); 222 } 223 else if( a->ic ) 224 { 225 irc_usermsg( cad->irc, "Account is still logged in, can't delete" ); 226 } 227 else 228 { 229 account_del( cad->irc, a ); 230 irc_usermsg( cad->irc, "Account deleted" ); 231 } 232 g_free( data ); 233 } 234 235 void cmd_account_del_no( void *data ) 236 { 237 g_free( data ); 224 238 } 225 239 … … 278 292 else 279 293 { 294 struct cmd_account_del_data *cad; 280 295 char *msg; 296 297 cad = g_malloc( sizeof( struct cmd_account_del_data ) ); 298 cad->a = a; 299 cad->irc = irc; 281 300 282 301 msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will " … … 285 304 "set' command. Are you sure you want to delete this " 286 305 "account?", a->prpl->name, a->user ); 287 query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, a);306 query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad ); 288 307 g_free( msg ); 289 308 } … … 404 423 acc_handle = g_strdup( cmd[2] ); 405 424 425 if( !acc_handle ) 426 { 427 irc_usermsg( irc, "Not enough parameters given (need %d)", 3 ); 428 return; 429 } 430 406 431 if( ( tmp = strchr( acc_handle, '/' ) ) ) 407 432 { … … 584 609 g_free( irc->mynick ); 585 610 irc->mynick = g_strdup( cmd[2] ); 611 612 if( strcmp( cmd[0], "set_rename" ) != 0 ) 613 set_setstr( &irc->set, "root_nick", cmd[2] ); 586 614 } 587 615 else if( u->send_handler == buddy_send_handler ) … … 592 620 irc_usermsg( irc, "Nick successfully changed" ); 593 621 } 622 } 623 624 char *set_eval_root_nick( set_t *set, char *new_nick ) 625 { 626 irc_t *irc = set->data; 627 628 if( strcmp( irc->mynick, new_nick ) != 0 ) 629 { 630 char *cmd[] = { "set_rename", irc->mynick, new_nick, NULL }; 631 632 cmd_rename( irc, cmd ); 633 } 634 635 return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : NULL; 594 636 } 595 637 -
set.c
rf00e3ad rd419073 230 230 return value; 231 231 } 232 233 char *set_eval_charset( set_t *set, char *value )234 {235 GIConv cd;236 237 if( g_strcasecmp( value, "none" ) == 0 )238 return value;239 240 cd = g_iconv_open( "UTF-8", value );241 if( cd == (GIConv) -1 )242 return NULL;243 244 g_iconv_close( cd );245 return value;246 } -
set.h
rf00e3ad rd419073 97 97 char *set_eval_to_char( set_t *set, char *value ); 98 98 char *set_eval_ops( set_t *set, char *value ); 99 char *set_eval_charset( set_t *set, char *value );100 99 101 100 #endif /* __SET_H__ */ -
storage_xml.c
rf00e3ad rd419073 29 29 #include "arc.h" 30 30 #include "md5.h" 31 #include <glib/gstdio.h> 31 32 32 33 typedef enum … … 243 244 static void xml_init( void ) 244 245 { 245 if( access( global.conf->configdir, F_OK ) != 0)246 if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) ) 246 247 log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir ); 247 else if( access( global.conf->configdir, R_OK ) != 0 ||access( global.conf->configdir, W_OK ) != 0 )248 else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || g_access( global.conf->configdir, W_OK ) != 0 ) 248 249 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); 249 250 } … … 372 373 g_free( path2 ); 373 374 374 if( !overwrite && access( path, F_OK ) != -1)375 if( !overwrite && g_file_test( path, G_FILE_TEST_EXISTS ) ) 375 376 return STORAGE_ALREADY_EXISTS; 376 377 -
tests/check_irc.c
rf00e3ad rd419073 37 37 irc = irc_new(g_io_channel_unix_get_fd(ch1)); 38 38 39 fail_unless(g_io_channel_write_chars(ch2, "NICK bla\r\ n"40 "USER a a a a\ r\n", -1, NULL, NULL) == G_IO_STATUS_NORMAL);39 fail_unless(g_io_channel_write_chars(ch2, "NICK bla\r\r\n" 40 "USER a a a a\n", -1, NULL, NULL) == G_IO_STATUS_NORMAL); 41 41 fail_unless(g_io_channel_flush(ch2, NULL) == G_IO_STATUS_NORMAL); 42 42
Note: See TracChangeset
for help on using the changeset viewer.