Changes in / [934dddf3:d301872]
- Files:
-
- 3 deleted
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
r934dddf3 rd301872 19 19 coverage 20 20 bitlbee.info 21 bitlbee.exe -
Makefile
r934dddf3 rd301872 10 10 11 11 # Program variables 12 objects = account.o bitlbee.o c rypting.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS)user.o12 objects = account.o bitlbee.o conf.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.o 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.o18 LFLAGS+=-lws2_3219 EFLAGS+=-lsecur3220 OUTFILE=bitlbee.exe21 else22 objects += unix.o conf.o log.o23 OUTFILE=bitlbee24 endif25 15 26 16 # Expansion of variables -
account.c
r934dddf3 rd301872 79 79 return NULL; 80 80 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 ) 81 if( strcmp( set->key, "username" ) == 0 ) 100 82 { 101 83 g_free( acc->user ); … … 108 90 acc->pass = g_strdup( value ); 109 91 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 else 102 { 103 acc->server = NULL; 104 return g_strdup( set->def ); 105 } 110 106 } 111 107 else if( strcmp( set->key, "auto_connect" ) == 0 ) … … 238 234 } 239 235 } 240 241 struct account_reconnect_delay242 {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's260 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 else314 {315 a->auto_reconnect_delay = 0;316 }317 318 return a->auto_reconnect_delay;319 } -
account.h
r934dddf3 rd301872 35 35 36 36 int auto_connect; 37 int auto_reconnect_delay;38 37 int reconnect; 39 38 … … 53 52 54 53 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 );57 54 58 55 #define ACC_SET_NOSAVE 1 -
bitlbee.c
r934dddf3 rd301872 118 118 119 119 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 120 ipc_master_load_state( getenv( "_BITLBEE_RESTART_STATE" ));120 ipc_master_load_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 _WIN32126 125 if( ( fp = fopen( global.conf->pidfile, "w" ) ) ) 127 126 { … … 133 132 log_message( LOGLVL_WARNING, "Warning: Couldn't write PID to `%s'", global.conf->pidfile ); 134 133 } 135 #endif136 134 137 135 return( 0 ); … … 142 140 if( !irc_new( 0 ) ) 143 141 return( 1 ); 142 143 log_link( LOGLVL_ERROR, LOGOUTPUT_IRC ); 144 log_link( LOGLVL_WARNING, LOGOUTPUT_IRC ); 144 145 145 146 return( 0 ); … … 253 254 struct sockaddr_in conn_info; 254 255 int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, &size ); 256 pid_t client_pid = 0; 255 257 256 258 if( new_socket == -1 ) … … 260 262 } 261 263 262 #ifndef _WIN32263 264 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 264 265 { 265 pid_t client_pid = 0;266 266 int fds[2]; 267 267 … … 320 320 } 321 321 else 322 #endif323 322 { 324 323 log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket ); -
bitlbee.h
r934dddf3 rd301872 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 0x050133 34 31 #define PACKAGE "BitlBee" 35 32 #define BITLBEE_VERSION "1.2.1" … … 51 48 #include <stdio.h> 52 49 #include <ctype.h> 53 #include <errno.h>54 55 50 #ifndef _WIN32 56 51 #include <syslog.h> 52 #include <errno.h> 57 53 #endif 58 54 -
conf.c
r934dddf3 rd301872 148 148 else if( opt == 'R' ) 149 149 { 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 ); 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 ); 154 155 } 155 156 else if( opt == 'u' ) -
configure
r934dddf3 rd301872 20 20 ipcsocket='/var/run/bitlbee.sock' 21 21 pcdir='$prefix/lib/pkgconfig' 22 systemlibdirs="/lib /usr/lib /usr/local/lib"23 22 24 23 msn=1 … … 110 109 PCDIR=$pcdir 111 110 112 TARGET=$target113 111 ARCH=$arch 114 112 CPU=$cpu 113 OUTFILE=bitlbee 115 114 116 115 DESTDIR= … … 135 134 EOF 136 135 137 138 139 136 if [ -n "$target" ]; then 140 PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig 141 export PKG_CONFIG_LIBDIR 137 PKG_CONFIG_PATH=/usr/$target/lib/pkgconfig 142 138 PATH=/usr/$target/bin:$PATH 143 139 CC=$target-cc 144 140 LD=$target-ld 145 systemlibdirs="/usr/$target/lib" 146 fi 147 141 fi 148 142 149 143 if [ "$debug" = "1" ]; then … … 291 285 elif [ "$ssl" = "nss" ]; then 292 286 detect_nss 293 elif [ "$ssl" = "sspi" ]; then294 echo295 287 elif [ "$ssl" = "openssl" ]; then 296 288 echo … … 349 341 echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings 350 342 351 for i in $systemlibdirs; do343 for i in /lib /usr/lib /usr/local/lib; do 352 344 if [ -f $i/libresolv.a ]; then 353 345 echo '#define HAVE_RESOLV_A' >> config.h … … 509 501 echo 'Cygwin is not officially supported.' 510 502 ;; 511 Windows )512 ;;513 503 * ) 514 504 echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' -
doc/user-guide/commands.xml
r934dddf3 rd301872 321 321 </bitlbee-setting> 322 322 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. 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. 333 329 </para> 334 330 -
ipc.c
r934dddf3 rd301872 33 33 34 34 GSList *child_list = NULL; 35 static char *statefile = NULL; 35 36 36 37 static void ipc_master_cmd_client( irc_t *data, char **cmd ) … … 62 63 } 63 64 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 else77 {78 ipc_to_children_str( "OPERMSG :The DEAF command only works in "79 "normal daemon mode. Try DIE instead." );80 }81 }82 83 65 void ipc_master_cmd_rehash( irc_t *data, char **cmd ) 84 66 { … … 116 98 { "hello", 0, ipc_master_cmd_client, 0 }, 117 99 { "die", 0, ipc_master_cmd_die, 0 }, 118 { "deaf", 0, ipc_master_cmd_deaf, 0 },119 100 { "wallops", 1, NULL, IPC_CMD_TO_CHILDREN }, 120 101 { "wall", 1, NULL, IPC_CMD_TO_CHILDREN }, … … 460 441 } 461 442 462 #ifndef _WIN32463 443 char *ipc_master_save_state() 464 444 { … … 501 481 } 502 482 483 void ipc_master_set_statefile( char *fn ) 484 { 485 statefile = g_strdup( fn ); 486 } 487 503 488 504 489 static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond ) … … 521 506 } 522 507 508 #ifndef _WIN32 523 509 int ipc_master_listen_socket() 524 510 { … … 557 543 } 558 544 #else 559 int ipc_master_listen_socket()560 {561 545 /* FIXME: Open named pipe \\.\BITLBEE */ 562 return 0;563 }564 546 #endif 565 547 566 int ipc_master_load_state( char *statefile)548 int ipc_master_load_state() 567 549 { 568 550 struct bitlbee_child *child; … … 572 554 if( statefile == NULL ) 573 555 return 0; 574 575 556 fp = fopen( statefile, "r" ); 576 557 unlink( statefile ); /* Why do it later? :-) */ -
ipc.h
r934dddf3 rd301872 58 58 59 59 char *ipc_master_save_state(); 60 int ipc_master_load_state( char *statefile ); 60 void ipc_master_set_statefile( char *fn ); 61 int ipc_master_load_state(); 61 62 int ipc_master_listen_socket(); 62 63 -
irc.c
r934dddf3 rd301872 26 26 #define BITLBEE_CORE 27 27 #include "bitlbee.h" 28 #include "sock.h"29 28 #include "crypting.h" 30 29 #include "ipc.h" … … 139 138 set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc ); 140 139 set_add( &irc->set, "auto_reconnect", "false", set_eval_bool, irc ); 141 set_add( &irc->set, "auto_reconnect_delay", " 5*3<900", set_eval_account_reconnect_delay, irc );140 set_add( &irc->set, "auto_reconnect_delay", "300", set_eval_int, irc ); 142 141 set_add( &irc->set, "buddy_sendbuffer", "false", set_eval_bool, irc ); 143 142 set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc ); … … 315 314 g_free( irc ); 316 315 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 ) ) 316 if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) 322 317 b_main_quit(); 323 318 } -
irc_commands.c
r934dddf3 rd301872 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 },629 628 { "wallops", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 630 629 { "wall", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, -
lib/misc.c
r934dddf3 rd301872 373 373 void random_bytes( unsigned char *buf, int count ) 374 374 { 375 #ifndef _WIN32376 375 static int use_dev = -1; 377 376 … … 423 422 424 423 if( !use_dev ) 425 #endif426 424 { 427 425 int i; … … 584 582 md5_byte_t pass_md5[16]; 585 583 md5_state_t md5_state; 586 int ret = -1, i; 587 588 if( base64_decode( hash, &pass_dec ) == 21 ) 584 int ret, i; 585 586 if( base64_decode( hash, &pass_dec ) != 21 ) 587 { 588 ret = -1; 589 } 590 else 589 591 { 590 592 md5_init( &md5_state ); -
lib/ssl_bogus.c
r934dddf3 rd301872 61 61 return GAIM_INPUT_READ; 62 62 } 63 64 int ssl_pending( void *conn )65 {66 return 0;67 } -
protocols/msn/msn.c
r934dddf3 rd301872 113 113 { 114 114 struct msn_switchboard *sb; 115 struct msn_data *md = ic->proto_data; 115 116 116 117 if( ( sb = msn_sb_by_handle( ic, who ) ) ) … … 121 122 { 122 123 struct msn_message *m; 124 char buf[1024]; 123 125 124 126 /* Create a message. We have to arrange a usable switchboard, and send the message later. */ … … 127 129 m->text = g_strdup( message ); 128 130 129 return msn_sb_write_msg( ic, m ); 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 ); 130 165 } 131 166 … … 217 252 { 218 253 struct msn_switchboard *sb; 254 struct msn_data *md = ic->proto_data; 255 char buf[1024]; 219 256 220 257 if( ( sb = msn_sb_by_handle( ic, who ) ) ) … … 226 263 { 227 264 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 ); 228 281 229 282 /* Create a magic message. This is quite hackish, but who cares? :-P */ … … 232 285 m->text = g_strdup( GROUPCHAT_SWITCHBOARD_MESSAGE ); 233 286 234 msn_sb_write_msg( ic, m ); 235 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? */ 236 291 return NULL; 237 292 } -
protocols/msn/msn.h
r934dddf3 rd301872 23 23 Suite 330, Boston, MA 02111-1307 USA 24 24 */ 25 26 #ifndef _MSN_H27 #define _MSN_H28 25 29 26 /* Some hackish magicstrings to make special-purpose messages/switchboards. … … 179 176 void msn_sb_destroy( struct msn_switchboard *sb ); 180 177 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
r934dddf3 rd301872 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; 280 md->buddycount = atoi( cmd[3] ); 281 md->groupcount = atoi( cmd[4] ); 282 if( md->groupcount > 0 ) 295 283 md->grouplist = g_new0( char *, md->groupcount ); 296 } 297 298 md->buddycount = atoi( cmd[3] ); 284 299 285 if( !*cmd[3] || md->buddycount == 0 ) 300 286 msn_logged_in( ic ); … … 679 665 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 680 666 } 681 682 g_free( inbox );683 g_free( folders );684 667 } 685 668 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) -
protocols/msn/sb.c
r934dddf3 rd301872 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. */88 46 89 47 return( 1 ); -
protocols/nogaim.c
r934dddf3 rd301872 267 267 protocols. */ 268 268 imc_set_away( ic, u->away ); 269 270 /* Apparently we're connected successfully, so reset the271 exponential backoff timer. */272 ic->acc->auto_reconnect_delay = 0;273 269 } 274 270 … … 294 290 user_t *t, *u; 295 291 account_t *a; 296 int delay;297 292 298 293 /* Nested calls might happen sometimes, this is probably the best … … 334 329 } 335 330 else if( allow_reconnect && set_getbool( &irc->set, "auto_reconnect" ) && 336 set_getbool( &a->set, "auto_reconnect" ) && 337 ( delay = account_reconnect_delay( a ) ) > 0 ) 338 { 331 set_getbool( &a->set, "auto_reconnect" ) ) 332 { 333 int delay = set_getint( &irc->set, "auto_reconnect_delay" ); 334 339 335 imcb_log( ic, "Reconnecting in %d seconds..", delay ); 340 336 a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a ); -
protocols/yahoo/libyahoo2.c
r934dddf3 rd301872 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) 71 73 #endif 72 74 -
protocols/yahoo/yahoo.c
r934dddf3 rd301872 665 665 666 666 imcb_error( ic, "%s", err ); 667 668 if( fatal ) 669 imc_logout( ic, TRUE ); 667 670 } 668 671 -
protocols/yahoo/yahoo_httplib.c
r934dddf3 rd301872 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) 53 55 # define snprintf _snprintf 54 56 #endif -
sock.h
r934dddf3 rd301872 16 16 #else 17 17 # include <winsock2.h> 18 # include <ws2tcpip.h> 18 # ifndef _MSC_VER 19 # include <ws2tcpip.h> 20 # endif 19 21 # if !defined(BITLBEE_CORE) && defined(_MSC_VER) 20 22 # pragma comment(lib,"bitlbee.lib") 21 23 # endif 22 24 # 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 _umask 28 # define mode_t int 23 29 # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } 24 30 # define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); } -
storage_text.c
r934dddf3 rd301872 27 27 #include "bitlbee.h" 28 28 #include "crypting.h" 29 #ifdef _WIN3230 # define umask _umask31 # define mode_t int32 #endif33 34 #ifndef F_OK35 #define F_OK 036 #endif37 29 38 30 static void text_init (void) -
storage_xml.c
r934dddf3 rd301872 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 #else36 /* GLib < 2.8.0 doesn't have g_access, so just use the system access(). */37 #include <unistd.h>38 #define g_access access39 #endif40 32 41 33 typedef enum … … 252 244 static void xml_init( void ) 253 245 { 254 if( g_access( global.conf->configdir, F_OK ) != 0)246 if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) ) 255 247 log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir ); 256 else if( g_access( global.conf->configdir, F_OK ) != 0 || 257 g_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 ) 258 249 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); 259 250 } … … 382 373 g_free( path2 ); 383 374 384 if( !overwrite && g_ access( path, F_OK ) == 0)375 if( !overwrite && g_file_test( path, G_FILE_TEST_EXISTS ) ) 385 376 return STORAGE_ALREADY_EXISTS; 386 377 … … 490 481 static storage_status_t xml_remove( const char *nick, const char *password ) 491 482 { 492 char s[512] , *lc;483 char s[512]; 493 484 storage_status_t status; 494 485 … … 497 488 return status; 498 489 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 490 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".xml" ); 504 491 if( unlink( s ) == -1 ) 505 492 return STORAGE_OTHER_ERROR; -
unix.c
r934dddf3 rd301872 40 40 static void sighandler( int signal ); 41 41 42 int main( int argc, char *argv[] )42 int main( int argc, char *argv[], char **envp ) 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 65 62 i = bitlbee_inetd_init(); 66 63 log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION ); … … 69 66 else if( global.conf->runmode == RUNMODE_DAEMON ) 70 67 { 71 log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );72 log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );73 74 68 i = bitlbee_daemon_init(); 75 69 log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); … … 141 135 { 142 136 char *fn = ipc_master_save_state(); 137 char **args; 138 int n, i; 143 139 144 140 chdir( old_cwd ); 145 141 146 setenv( "_BITLBEE_RESTART_STATE", fn, 1 ); 147 g_free( fn ); 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 } 148 157 149 158 close( global.listen_socket ); 150 159 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 ); */ 160 execve( args[0], args, envp ); 156 161 } 157 162 … … 214 219 return( (double) time->tv_sec + (double) time->tv_usec / 1000000 ); 215 220 } 216 217
Note: See TracChangeset
for help on using the changeset viewer.