Changes in / [d301872:934dddf3]
- Files:
-
- 3 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
rd301872 r934dddf3 19 19 coverage 20 20 bitlbee.info 21 bitlbee.exe -
Makefile
rd301872 r934dddf3 10 10 11 11 # Program variables 12 objects = account.o bitlbee.o c onf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.ouser.o12 objects = account.o bitlbee.o crypting.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o 13 13 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/nogaim.h 14 14 subdirs = lib protocols 15 16 ifeq ($(TARGET),i586-mingw32msvc) 17 objects += win32.o 18 LFLAGS+=-lws2_32 19 EFLAGS+=-lsecur32 20 OUTFILE=bitlbee.exe 21 else 22 objects += unix.o conf.o log.o 23 OUTFILE=bitlbee 24 endif 15 25 16 26 # Expansion of variables -
account.c
rd301872 r934dddf3 79 79 return NULL; 80 80 81 if( strcmp( set->key, "username" ) == 0 ) 81 if( strcmp( set->key, "server" ) == 0 ) 82 { 83 g_free( acc->server ); 84 if( value && *value ) 85 { 86 acc->server = g_strdup( value ); 87 return value; 88 } 89 else 90 { 91 acc->server = NULL; 92 return g_strdup( set->def ); 93 } 94 } 95 else if( value == NULL ) 96 { 97 /* Noop, the other three can't be NULL. */ 98 } 99 else if( strcmp( set->key, "username" ) == 0 ) 82 100 { 83 101 g_free( acc->user ); … … 90 108 acc->pass = g_strdup( value ); 91 109 return NULL; /* password shouldn't be visible in plaintext! */ 92 }93 else if( strcmp( set->key, "server" ) == 0 )94 {95 g_free( acc->server );96 if( *value )97 {98 acc->server = g_strdup( value );99 return value;100 }101 else102 {103 acc->server = NULL;104 return g_strdup( set->def );105 }106 110 } 107 111 else if( strcmp( set->key, "auto_connect" ) == 0 ) … … 234 238 } 235 239 } 240 241 struct account_reconnect_delay 242 { 243 int start; 244 char op; 245 int step; 246 int max; 247 }; 248 249 int account_reconnect_delay_parse( char *value, struct account_reconnect_delay *p ) 250 { 251 memset( p, 0, sizeof( *p ) ); 252 /* A whole day seems like a sane "maximum maximum". */ 253 p->max = 86400; 254 255 /* Format: /[0-9]+([*+][0-9]+(<[0-9+]))/ */ 256 while( *value && isdigit( *value ) ) 257 p->start = p->start * 10 + *value++ - '0'; 258 259 /* Sure, call me evil for implementing my own fscanf here, but it's 260 dead simple and I'm immediately at the next part to parse. */ 261 262 if( *value == 0 ) 263 /* If the string ends now, the delay is constant. */ 264 return 1; 265 else if( *value != '+' && *value != '*' ) 266 /* Otherwise allow either a + or a * */ 267 return 0; 268 269 p->op = *value++; 270 271 /* + or * the delay by this number every time. */ 272 while( *value && isdigit( *value ) ) 273 p->step = p->step * 10 + *value++ - '0'; 274 275 if( *value == 0 ) 276 /* Use the default maximum (one day). */ 277 return 1; 278 else if( *value != '<' ) 279 return 0; 280 281 p->max = 0; 282 value ++; 283 while( *value && isdigit( *value ) ) 284 p->max = p->max * 10 + *value++ - '0'; 285 286 return p->max > 0; 287 } 288 289 char *set_eval_account_reconnect_delay( set_t *set, char *value ) 290 { 291 struct account_reconnect_delay p; 292 293 return account_reconnect_delay_parse( value, &p ) ? value : NULL; 294 } 295 296 int account_reconnect_delay( account_t *a ) 297 { 298 char *setting = set_getstr( &a->irc->set, "auto_reconnect_delay" ); 299 struct account_reconnect_delay p; 300 301 if( account_reconnect_delay_parse( setting, &p ) ) 302 { 303 if( a->auto_reconnect_delay == 0 ) 304 a->auto_reconnect_delay = p.start; 305 else if( p.op == '+' ) 306 a->auto_reconnect_delay += p.step; 307 else if( p.op == '*' ) 308 a->auto_reconnect_delay *= p.step; 309 310 if( a->auto_reconnect_delay > p.max ) 311 a->auto_reconnect_delay = p.max; 312 } 313 else 314 { 315 a->auto_reconnect_delay = 0; 316 } 317 318 return a->auto_reconnect_delay; 319 } -
account.h
rd301872 r934dddf3 35 35 36 36 int auto_connect; 37 int auto_reconnect_delay; 37 38 int reconnect; 38 39 … … 52 53 53 54 char *set_eval_account( set_t *set, char *value ); 55 char *set_eval_account_reconnect_delay( set_t *set, char *value ); 56 int account_reconnect_delay( account_t *a ); 54 57 55 58 #define ACC_SET_NOSAVE 1 -
bitlbee.c
rd301872 r934dddf3 118 118 119 119 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 120 ipc_master_load_state( );120 ipc_master_load_state( getenv( "_BITLBEE_RESTART_STATE" ) ); 121 121 122 122 if( global.conf->runmode == RUNMODE_DAEMON || global.conf->runmode == RUNMODE_FORKDAEMON ) 123 123 ipc_master_listen_socket(); 124 124 125 #ifndef _WIN32 125 126 if( ( fp = fopen( global.conf->pidfile, "w" ) ) ) 126 127 { … … 132 133 log_message( LOGLVL_WARNING, "Warning: Couldn't write PID to `%s'", global.conf->pidfile ); 133 134 } 135 #endif 134 136 135 137 return( 0 ); … … 140 142 if( !irc_new( 0 ) ) 141 143 return( 1 ); 142 143 log_link( LOGLVL_ERROR, LOGOUTPUT_IRC );144 log_link( LOGLVL_WARNING, LOGOUTPUT_IRC );145 144 146 145 return( 0 ); … … 254 253 struct sockaddr_in conn_info; 255 254 int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, &size ); 256 pid_t client_pid = 0;257 255 258 256 if( new_socket == -1 ) … … 262 260 } 263 261 262 #ifndef _WIN32 264 263 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 265 264 { 265 pid_t client_pid = 0; 266 266 int fds[2]; 267 267 … … 320 320 } 321 321 else 322 #endif 322 323 { 323 324 log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket ); -
bitlbee.h
rd301872 r934dddf3 29 29 #define _GNU_SOURCE /* Stupid GNU :-P */ 30 30 31 /* Depend on Windows 2000 for now since we need getaddrinfo() */ 32 #define _WIN32_WINNT 0x0501 33 31 34 #define PACKAGE "BitlBee" 32 35 #define BITLBEE_VERSION "1.2.1" … … 48 51 #include <stdio.h> 49 52 #include <ctype.h> 53 #include <errno.h> 54 50 55 #ifndef _WIN32 51 56 #include <syslog.h> 52 #include <errno.h>53 57 #endif 54 58 -
conf.c
rd301872 r934dddf3 148 148 else if( opt == 'R' ) 149 149 { 150 /* We can't load the statefile yet (and should make very sure we do this 151 only once), so set the filename here and load the state information 152 when initializing ForkDaemon. (This option only makes sense in that 153 mode anyway!) */ 154 ipc_master_set_statefile( optarg ); 150 /* Backward compatibility; older BitlBees passed this 151 info using a command-line flag. Allow people to 152 upgrade from such a version for now. */ 153 setenv( "_BITLBEE_RESTART_STATE", optarg, 0 ); 155 154 } 156 155 else if( opt == 'u' ) -
configure
rd301872 r934dddf3 20 20 ipcsocket='/var/run/bitlbee.sock' 21 21 pcdir='$prefix/lib/pkgconfig' 22 systemlibdirs="/lib /usr/lib /usr/local/lib" 22 23 23 24 msn=1 … … 109 110 PCDIR=$pcdir 110 111 112 TARGET=$target 111 113 ARCH=$arch 112 114 CPU=$cpu 113 OUTFILE=bitlbee114 115 115 116 DESTDIR= … … 134 135 EOF 135 136 137 138 136 139 if [ -n "$target" ]; then 137 PKG_CONFIG_PATH=/usr/$target/lib/pkgconfig 140 PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig 141 export PKG_CONFIG_LIBDIR 138 142 PATH=/usr/$target/bin:$PATH 139 143 CC=$target-cc 140 144 LD=$target-ld 141 fi 145 systemlibdirs="/usr/$target/lib" 146 fi 147 142 148 143 149 if [ "$debug" = "1" ]; then … … 285 291 elif [ "$ssl" = "nss" ]; then 286 292 detect_nss 293 elif [ "$ssl" = "sspi" ]; then 294 echo 287 295 elif [ "$ssl" = "openssl" ]; then 288 296 echo … … 341 349 echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings 342 350 343 for i in /lib /usr/lib /usr/local/lib; do351 for i in $systemlibdirs; do 344 352 if [ -f $i/libresolv.a ]; then 345 353 echo '#define HAVE_RESOLV_A' >> config.h … … 501 509 echo 'Cygwin is not officially supported.' 502 510 ;; 511 Windows ) 512 ;; 503 513 * ) 504 514 echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' -
doc/user-guide/commands.xml
rd301872 r934dddf3 321 321 </bitlbee-setting> 322 322 323 <bitlbee-setting name="auto_reconnect_delay" type="integer" scope="global"> 324 <default>300</default> 325 326 <description> 327 <para> 328 Tell BitlBee after how many seconds it should attempt to bring an IM-connection back up after a crash. It's not a good idea to set this value very low, it will cause too much useless traffic when an IM-server is down for a few hours. 323 <bitlbee-setting name="auto_reconnect_delay" type="string" scope="global"> 324 <default>5*3<900</default> 325 326 <description> 327 <para> 328 Tell BitlBee after how many seconds it should attempt to bring a broken IM-connection back up. 329 </para> 330 331 <para> 332 This can be one integer, for a constant delay. One can also set it to something like "10*10", which means wait for ten seconds on the first reconnect, multiply it by ten on every failure. Once successfully connected, this delay is re-set to the initial value. With < you can give a maximum delay. 329 333 </para> 330 334 -
ipc.c
rd301872 r934dddf3 33 33 34 34 GSList *child_list = NULL; 35 static char *statefile = NULL;36 35 37 36 static void ipc_master_cmd_client( irc_t *data, char **cmd ) … … 63 62 } 64 63 64 static void ipc_master_cmd_deaf( irc_t *data, char **cmd ) 65 { 66 if( global.conf->runmode == RUNMODE_DAEMON ) 67 { 68 b_event_remove( global.listen_watch_source_id ); 69 close( global.listen_socket ); 70 71 global.listen_socket = global.listen_watch_source_id = -1; 72 73 ipc_to_children_str( "OPERMSG :Closed listening socket, waiting " 74 "for all users to disconnect." ); 75 } 76 else 77 { 78 ipc_to_children_str( "OPERMSG :The DEAF command only works in " 79 "normal daemon mode. Try DIE instead." ); 80 } 81 } 82 65 83 void ipc_master_cmd_rehash( irc_t *data, char **cmd ) 66 84 { … … 98 116 { "hello", 0, ipc_master_cmd_client, 0 }, 99 117 { "die", 0, ipc_master_cmd_die, 0 }, 118 { "deaf", 0, ipc_master_cmd_deaf, 0 }, 100 119 { "wallops", 1, NULL, IPC_CMD_TO_CHILDREN }, 101 120 { "wall", 1, NULL, IPC_CMD_TO_CHILDREN }, … … 441 460 } 442 461 462 #ifndef _WIN32 443 463 char *ipc_master_save_state() 444 464 { … … 481 501 } 482 502 483 void ipc_master_set_statefile( char *fn )484 {485 statefile = g_strdup( fn );486 }487 488 503 489 504 static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond ) … … 506 521 } 507 522 508 #ifndef _WIN32509 523 int ipc_master_listen_socket() 510 524 { … … 543 557 } 544 558 #else 559 int ipc_master_listen_socket() 560 { 545 561 /* FIXME: Open named pipe \\.\BITLBEE */ 562 return 0; 563 } 546 564 #endif 547 565 548 int ipc_master_load_state( )566 int ipc_master_load_state( char *statefile ) 549 567 { 550 568 struct bitlbee_child *child; … … 554 572 if( statefile == NULL ) 555 573 return 0; 574 556 575 fp = fopen( statefile, "r" ); 557 576 unlink( statefile ); /* Why do it later? :-) */ -
ipc.h
rd301872 r934dddf3 58 58 59 59 char *ipc_master_save_state(); 60 void ipc_master_set_statefile( char *fn ); 61 int ipc_master_load_state(); 60 int ipc_master_load_state( char *statefile ); 62 61 int ipc_master_listen_socket(); 63 62 -
irc.c
rd301872 r934dddf3 26 26 #define BITLBEE_CORE 27 27 #include "bitlbee.h" 28 #include "sock.h" 28 29 #include "crypting.h" 29 30 #include "ipc.h" … … 138 139 set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc ); 139 140 set_add( &irc->set, "auto_reconnect", "false", set_eval_bool, irc ); 140 set_add( &irc->set, "auto_reconnect_delay", " 300", set_eval_int, irc );141 set_add( &irc->set, "auto_reconnect_delay", "5*3<900", set_eval_account_reconnect_delay, irc ); 141 142 set_add( &irc->set, "buddy_sendbuffer", "false", set_eval_bool, irc ); 142 143 set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc ); … … 314 315 g_free( irc ); 315 316 316 if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) 317 if( global.conf->runmode == RUNMODE_INETD || 318 global.conf->runmode == RUNMODE_FORKDAEMON || 319 ( global.conf->runmode == RUNMODE_DAEMON && 320 global.listen_socket == -1 && 321 irc_connection_list == NULL ) ) 317 322 b_main_quit(); 318 323 } -
irc_commands.c
rd301872 r934dddf3 626 626 { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN }, 627 627 { "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 628 { "deaf", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 628 629 { "wallops", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 629 630 { "wall", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, -
lib/misc.c
rd301872 r934dddf3 373 373 void random_bytes( unsigned char *buf, int count ) 374 374 { 375 #ifndef _WIN32 375 376 static int use_dev = -1; 376 377 … … 422 423 423 424 if( !use_dev ) 425 #endif 424 426 { 425 427 int i; … … 582 584 md5_byte_t pass_md5[16]; 583 585 md5_state_t md5_state; 584 int ret, i; 585 586 if( base64_decode( hash, &pass_dec ) != 21 ) 587 { 588 ret = -1; 589 } 590 else 586 int ret = -1, i; 587 588 if( base64_decode( hash, &pass_dec ) == 21 ) 591 589 { 592 590 md5_init( &md5_state ); -
lib/ssl_bogus.c
rd301872 r934dddf3 61 61 return GAIM_INPUT_READ; 62 62 } 63 64 int ssl_pending( void *conn ) 65 { 66 return 0; 67 } -
protocols/msn/msn.c
rd301872 r934dddf3 113 113 { 114 114 struct msn_switchboard *sb; 115 struct msn_data *md = ic->proto_data;116 115 117 116 if( ( sb = msn_sb_by_handle( ic, who ) ) ) … … 122 121 { 123 122 struct msn_message *m; 124 char buf[1024];125 123 126 124 /* Create a message. We have to arrange a usable switchboard, and send the message later. */ … … 129 127 m->text = g_strdup( message ); 130 128 131 /* FIXME: *CHECK* the reliability of using spare sb's! */ 132 if( ( sb = msn_sb_spare( ic ) ) ) 133 { 134 debug( "Trying to use a spare switchboard to message %s", who ); 135 136 sb->who = g_strdup( who ); 137 g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who ); 138 if( msn_sb_write( sb, buf, strlen( buf ) ) ) 139 { 140 /* He/She should join the switchboard soon, let's queue the message. */ 141 sb->msgq = g_slist_append( sb->msgq, m ); 142 return( 1 ); 143 } 144 } 145 146 debug( "Creating a new switchboard to message %s", who ); 147 148 /* If we reach this line, there was no spare switchboard, so let's make one. */ 149 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); 150 if( !msn_write( ic, buf, strlen( buf ) ) ) 151 { 152 g_free( m->who ); 153 g_free( m->text ); 154 g_free( m ); 155 156 return( 0 ); 157 } 158 159 /* And queue the message to md. We'll pick it up when the switchboard comes up. */ 160 md->msgq = g_slist_append( md->msgq, m ); 161 162 /* FIXME: If the switchboard creation fails, the message will not be sent. */ 163 164 return( 1 ); 129 return msn_sb_write_msg( ic, m ); 165 130 } 166 131 … … 252 217 { 253 218 struct msn_switchboard *sb; 254 struct msn_data *md = ic->proto_data;255 char buf[1024];256 219 257 220 if( ( sb = msn_sb_by_handle( ic, who ) ) ) … … 263 226 { 264 227 struct msn_message *m; 265 266 if( ( sb = msn_sb_spare( ic ) ) )267 {268 debug( "Trying to reuse an existing switchboard as a groupchat with %s", who );269 g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who );270 if( msn_sb_write( sb, buf, strlen( buf ) ) )271 return msn_sb_to_chat( sb );272 }273 274 /* If the stuff above failed for some reason: */275 debug( "Creating a new switchboard to groupchat with %s", who );276 277 /* Request a new switchboard. */278 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );279 if( !msn_write( ic, buf, strlen( buf ) ) )280 return( 0 );281 228 282 229 /* Create a magic message. This is quite hackish, but who cares? :-P */ … … 285 232 m->text = g_strdup( GROUPCHAT_SWITCHBOARD_MESSAGE ); 286 233 287 /* Queue the magic message and cross your fingers. */ 288 md->msgq = g_slist_append( md->msgq, m ); 289 290 /* FIXME: Can I try to return something here already? */ 234 msn_sb_write_msg( ic, m ); 235 291 236 return NULL; 292 237 } -
protocols/msn/msn.h
rd301872 r934dddf3 23 23 Suite 330, Boston, MA 02111-1307 USA 24 24 */ 25 26 #ifndef _MSN_H 27 #define _MSN_H 25 28 26 29 /* Some hackish magicstrings to make special-purpose messages/switchboards. … … 176 179 void msn_sb_destroy( struct msn_switchboard *sb ); 177 180 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond ); 181 int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m ); 182 183 #endif //_MSN_H -
protocols/msn/ns.c
rd301872 r934dddf3 278 278 if( num_parts == 5 ) 279 279 { 280 int i, groupcount; 281 282 groupcount = atoi( cmd[4] ); 283 if( groupcount > 0 ) 284 { 285 /* valgrind says this is leaking memory, I'm guessing 286 that this happens during server redirects. */ 287 if( md->grouplist ) 288 { 289 for( i = 0; i < md->groupcount; i ++ ) 290 g_free( md->grouplist[i] ); 291 g_free( md->grouplist ); 292 } 293 294 md->groupcount = groupcount; 295 md->grouplist = g_new0( char *, md->groupcount ); 296 } 297 280 298 md->buddycount = atoi( cmd[3] ); 281 md->groupcount = atoi( cmd[4] );282 if( md->groupcount > 0 )283 md->grouplist = g_new0( char *, md->groupcount );284 285 299 if( !*cmd[3] || md->buddycount == 0 ) 286 300 msn_logged_in( ic ); … … 665 679 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 666 680 } 681 682 g_free( inbox ); 683 g_free( folders ); 667 684 } 668 685 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) -
protocols/msn/sb.c
rd301872 r934dddf3 44 44 return( 0 ); 45 45 } 46 47 return( 1 ); 48 } 49 50 int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m ) 51 { 52 struct msn_data *md = ic->proto_data; 53 struct msn_switchboard *sb; 54 char buf[1024]; 55 56 /* FIXME: *CHECK* the reliability of using spare sb's! */ 57 if( ( sb = msn_sb_spare( ic ) ) ) 58 { 59 debug( "Trying to use a spare switchboard to message %s", m->who ); 60 61 sb->who = g_strdup( m->who ); 62 g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, m->who ); 63 if( msn_sb_write( sb, buf, strlen( buf ) ) ) 64 { 65 /* He/She should join the switchboard soon, let's queue the message. */ 66 sb->msgq = g_slist_append( sb->msgq, m ); 67 return( 1 ); 68 } 69 } 70 71 debug( "Creating a new switchboard to message %s", m->who ); 72 73 /* If we reach this line, there was no spare switchboard, so let's make one. */ 74 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); 75 if( !msn_write( ic, buf, strlen( buf ) ) ) 76 { 77 g_free( m->who ); 78 g_free( m->text ); 79 g_free( m ); 80 81 return( 0 ); 82 } 83 84 /* And queue the message to md. We'll pick it up when the switchboard comes up. */ 85 md->msgq = g_slist_append( md->msgq, m ); 86 87 /* FIXME: If the switchboard creation fails, the message will not be sent. */ 46 88 47 89 return( 1 ); -
protocols/nogaim.c
rd301872 r934dddf3 267 267 protocols. */ 268 268 imc_set_away( ic, u->away ); 269 270 /* Apparently we're connected successfully, so reset the 271 exponential backoff timer. */ 272 ic->acc->auto_reconnect_delay = 0; 269 273 } 270 274 … … 290 294 user_t *t, *u; 291 295 account_t *a; 296 int delay; 292 297 293 298 /* Nested calls might happen sometimes, this is probably the best … … 329 334 } 330 335 else if( allow_reconnect && set_getbool( &irc->set, "auto_reconnect" ) && 331 set_getbool( &a->set, "auto_reconnect" ) ) 332 { 333 int delay = set_getint( &irc->set, "auto_reconnect_delay" ); 334 336 set_getbool( &a->set, "auto_reconnect" ) && 337 ( delay = account_reconnect_delay( a ) ) > 0 ) 338 { 335 339 imcb_log( ic, "Reconnecting in %d seconds..", delay ); 336 340 a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a ); -
protocols/yahoo/libyahoo2.c
rd301872 r934dddf3 69 69 #ifdef __MINGW32__ 70 70 # include <winsock2.h> 71 # define write(a,b,c) send(a,b,c,0)72 # define read(a,b,c) recv(a,b,c,0)73 71 #endif 74 72 -
protocols/yahoo/yahoo.c
rd301872 r934dddf3 665 665 666 666 imcb_error( ic, "%s", err ); 667 668 if( fatal )669 imc_logout( ic, TRUE );670 667 } 671 668 -
protocols/yahoo/yahoo_httplib.c
rd301872 r934dddf3 51 51 #ifdef __MINGW32__ 52 52 # include <winsock2.h> 53 # define write(a,b,c) send(a,b,c,0)54 # define read(a,b,c) recv(a,b,c,0)55 53 # define snprintf _snprintf 56 54 #endif -
sock.h
rd301872 r934dddf3 16 16 #else 17 17 # include <winsock2.h> 18 # ifndef _MSC_VER 19 # include <ws2tcpip.h> 20 # endif 18 # include <ws2tcpip.h> 21 19 # if !defined(BITLBEE_CORE) && defined(_MSC_VER) 22 20 # pragma comment(lib,"bitlbee.lib") 23 21 # endif 24 22 # include <io.h> 25 # define read(a,b,c) recv(a,b,c,0)26 # define write(a,b,c) send(a,b,c,0)27 # define umask _umask28 # define mode_t int29 23 # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } 30 24 # define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); } -
storage_text.c
rd301872 r934dddf3 27 27 #include "bitlbee.h" 28 28 #include "crypting.h" 29 #ifdef _WIN32 30 # define umask _umask 31 # define mode_t int 32 #endif 33 34 #ifndef F_OK 35 #define F_OK 0 36 #endif 29 37 30 38 static void text_init (void) -
storage_xml.c
rd301872 r934dddf3 30 30 #include "md5.h" 31 31 #include <glib/gstdio.h> 32 33 #if GLIB_CHECK_VERSION(2,8,0) 34 #include <glib/gstdio.h> 35 #else 36 /* GLib < 2.8.0 doesn't have g_access, so just use the system access(). */ 37 #include <unistd.h> 38 #define g_access access 39 #endif 32 40 33 41 typedef enum … … 244 252 static void xml_init( void ) 245 253 { 246 if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ))254 if( g_access( global.conf->configdir, F_OK ) != 0 ) 247 255 log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir ); 248 else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || g_access( global.conf->configdir, W_OK ) != 0 ) 256 else if( g_access( global.conf->configdir, F_OK ) != 0 || 257 g_access( global.conf->configdir, W_OK ) != 0 ) 249 258 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); 250 259 } … … 373 382 g_free( path2 ); 374 383 375 if( !overwrite && g_ file_test( path, G_FILE_TEST_EXISTS ))384 if( !overwrite && g_access( path, F_OK ) == 0 ) 376 385 return STORAGE_ALREADY_EXISTS; 377 386 … … 481 490 static storage_status_t xml_remove( const char *nick, const char *password ) 482 491 { 483 char s[512] ;492 char s[512], *lc; 484 493 storage_status_t status; 485 494 … … 488 497 return status; 489 498 490 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".xml" ); 499 lc = g_strdup( nick ); 500 nick_lc( lc ); 501 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, lc, ".xml" ); 502 g_free( lc ); 503 491 504 if( unlink( s ) == -1 ) 492 505 return STORAGE_OTHER_ERROR; -
unix.c
rd301872 r934dddf3 40 40 static void sighandler( int signal ); 41 41 42 int main( int argc, char *argv[] , char **envp)42 int main( int argc, char *argv[] ) 43 43 { 44 44 int i = 0; … … 60 60 if( global.conf->runmode == RUNMODE_INETD ) 61 61 { 62 log_link( LOGLVL_ERROR, LOGOUTPUT_IRC ); 63 log_link( LOGLVL_WARNING, LOGOUTPUT_IRC ); 64 62 65 i = bitlbee_inetd_init(); 63 66 log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); … … 66 69 else if( global.conf->runmode == RUNMODE_DAEMON ) 67 70 { 71 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG ); 72 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG ); 73 68 74 i = bitlbee_daemon_init(); 69 75 log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); … … 135 141 { 136 142 char *fn = ipc_master_save_state(); 137 char **args;138 int n, i;139 143 140 144 chdir( old_cwd ); 141 145 142 n = 0; 143 args = g_new0( char *, argc + 3 ); 144 args[n++] = argv[0]; 145 if( fn ) 146 { 147 args[n++] = "-R"; 148 args[n++] = fn; 149 } 150 for( i = 1; argv[i] && i < argc; i ++ ) 151 { 152 if( strcmp( argv[i], "-R" ) == 0 ) 153 i += 2; 154 155 args[n++] = argv[i]; 156 } 146 setenv( "_BITLBEE_RESTART_STATE", fn, 1 ); 147 g_free( fn ); 157 148 158 149 close( global.listen_socket ); 159 150 160 execve( args[0], args, envp ); 151 if( execv( argv[0], argv ) == -1 ) 152 /* Apparently the execve() failed, so let's just 153 jump back into our own/current main(). */ 154 /* Need more cleanup code to make this work. */ 155 return 1; /* main( argc, argv ); */ 161 156 } 162 157 … … 219 214 return( (double) time->tv_sec + (double) time->tv_usec / 1000000 ); 220 215 } 216 217
Note: See TracChangeset
for help on using the changeset viewer.