diff options
| -rw-r--r-- | ipc.c | 21 | ||||
| -rw-r--r-- | irc.c | 4 | ||||
| -rw-r--r-- | irc.h | 4 | 
3 files changed, 20 insertions, 9 deletions
| @@ -35,12 +35,15 @@ static int ipc_master_cmd_client( irc_t *data, char **cmd )  {  	struct bitlbee_child *child = (void*) data; -	child->host = g_strdup( cmd[1] ); -	child->nick = g_strdup( cmd[2] ); -	child->realname = g_strdup( cmd[3] ); +	if( child ) +	{ +		child->host = g_strdup( cmd[1] ); +		child->nick = g_strdup( cmd[2] ); +		child->realname = g_strdup( cmd[3] ); +	}  	ipc_to_children_str( "OPERMSG :Client connecting (PID=%d): %s@%s (%s)\r\n", -	                     child->pid, child->nick, child->host, child->realname ); +	                     child ? child->pid : -1, cmd[2], cmd[1], cmd[3] );  	return 1;  } @@ -307,7 +310,10 @@ void ipc_to_master_str( char *format, ... )  	}  	else if( global.conf->runmode == RUNMODE_DAEMON )  	{ -		char **cmd; +		char **cmd, *s; +		 +		if( ( s = strchr( msg_buf, '\r' ) ) ) +			*s = 0;  		cmd = irc_parse_line( msg_buf );  		ipc_command_exec( NULL, cmd, ipc_master_commands ); @@ -360,7 +366,10 @@ void ipc_to_children_str( char *format, ... )  	}  	else if( global.conf->runmode == RUNMODE_DAEMON )  	{ -		char **cmd; +		char **cmd, *s; +		 +		if( ( s = strchr( msg_buf, '\r' ) ) ) +			*s = 0;  		cmd = irc_parse_line( msg_buf );  		ipc_to_children( cmd ); @@ -187,6 +187,8 @@ void irc_free(irc_t * irc)  		if( storage_save( irc, TRUE ) != STORAGE_OK )  			irc_usermsg( irc, "Error while saving settings!" ); +	closesocket( irc->fd ); +	  	if( irc->ping_source_id > 0 )  		g_source_remove( irc->ping_source_id );  	g_source_remove( irc->r_watch_source_id ); @@ -693,7 +695,7 @@ void irc_login( irc_t *irc )  	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 FAQ's are answered there." ); -	if( global.conf->runmode == RUNMODE_FORKDAEMON ) +	if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )  		ipc_to_master_str( "CLIENT %s %s :%s\r\n", irc->host, irc->nick, irc->realname );  	irc->status = USTATUS_LOGGED_IN; @@ -40,11 +40,11 @@  typedef enum  { -	USTATUS_OFFLINE, +	USTATUS_OFFLINE = 0,  	USTATUS_AUTHORIZED,  	USTATUS_LOGGED_IN,  	USTATUS_IDENTIFIED, -	USTATUS_SHUTDOWN +	USTATUS_SHUTDOWN = -1  } irc_status_t;  typedef struct channel | 
