Skip to content

Commit bad01c7

Browse files
committed
Rehash command now also works in inetd mode. Other "IPC" commands only make
sense in daemon mode.
1 parent 1364a73 commit bad01c7

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

ipc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int ipc_master_cmd_die( irc_t *data, char **cmd )
5858
return 1;
5959
}
6060

61-
static int ipc_master_cmd_rehash( irc_t *data, char **cmd )
61+
int ipc_master_cmd_rehash( irc_t *data, char **cmd )
6262
{
6363
runmode_t oldmode;
6464

ipc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define BITLBEE_CORE
2727
#include "bitlbee.h"
2828

29+
2930
struct bitlbee_child
3031
{
3132
pid_t pid;
@@ -37,6 +38,7 @@ struct bitlbee_child
3738
char *realname;
3839
};
3940

41+
4042
void ipc_master_read( gpointer data, gint source, GaimInputCondition cond );
4143
void ipc_child_read( gpointer data, gint source, GaimInputCondition cond );
4244

@@ -48,4 +50,8 @@ void ipc_to_master_str( char *format, ... );
4850
void ipc_to_children( char **cmd );
4951
void ipc_to_children_str( char *format, ... );
5052

53+
/* We need this function in inetd mode, so let's just make it non-static. */
54+
int ipc_master_cmd_rehash( irc_t *data, char **cmd );
55+
56+
5157
extern GSList *child_list;

irc_commands.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,10 @@ static int irc_cmd_completions( irc_t *irc, char **cmd )
579579

580580
static int irc_cmd_rehash( irc_t *irc, char **cmd )
581581
{
582-
ipc_to_master( cmd );
582+
if( global.conf->runmode == RUNMODE_INETD )
583+
ipc_master_cmd_rehash( NULL, NULL );
584+
else
585+
ipc_to_master( cmd );
583586

584587
irc_reply( irc, 382, "%s :Rehashing", CONF_FILE );
585588

@@ -655,6 +658,8 @@ int irc_exec( irc_t *irc, char *cmd[] )
655658
}
656659

657660
if( irc_commands[i].flags & IRC_CMD_TO_MASTER )
661+
/* IPC doesn't make sense in inetd mode,
662+
but the function will catch that. */
658663
ipc_to_master( cmd );
659664
else
660665
return irc_commands[i].execute( irc, cmd );

0 commit comments

Comments
 (0)