aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-01-19 18:52:19 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2006-01-19 18:52:19 +0100
commit5424c76c7813f82e2f98546f6a46b73d80181877 (patch)
treec7853e03c0202e8586103bb88e311f1183fe94d0
parentbd9b00f4fed3560eab98f15cf9923aed13467d5d (diff)
Rehash command now also works in inetd mode. Other "IPC" commands only make
sense in daemon mode.
-rw-r--r--ipc.c2
-rw-r--r--ipc.h6
-rw-r--r--irc_commands.c7
3 files changed, 13 insertions, 2 deletions
diff --git a/ipc.c b/ipc.c
index 4777113a..e0bf1319 100644
--- a/ipc.c
+++ b/ipc.c
@@ -58,7 +58,7 @@ static int ipc_master_cmd_die( irc_t *data, char **cmd )
return 1;
}
-static int ipc_master_cmd_rehash( irc_t *data, char **cmd )
+int ipc_master_cmd_rehash( irc_t *data, char **cmd )
{
runmode_t oldmode;
diff --git a/ipc.h b/ipc.h
index 56449a7c..308b6e4b 100644
--- a/ipc.h
+++ b/ipc.h
@@ -26,6 +26,7 @@
#define BITLBEE_CORE
#include "bitlbee.h"
+
struct bitlbee_child
{
pid_t pid;
@@ -37,6 +38,7 @@ struct bitlbee_child
char *realname;
};
+
void ipc_master_read( gpointer data, gint source, GaimInputCondition cond );
void ipc_child_read( gpointer data, gint source, GaimInputCondition cond );
@@ -48,4 +50,8 @@ void ipc_to_master_str( char *format, ... );
void ipc_to_children( char **cmd );
void ipc_to_children_str( char *format, ... );
+/* We need this function in inetd mode, so let's just make it non-static. */
+int ipc_master_cmd_rehash( irc_t *data, char **cmd );
+
+
extern GSList *child_list;
diff --git a/irc_commands.c b/irc_commands.c
index 152df767..e31a92e8 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -579,7 +579,10 @@ static int irc_cmd_completions( irc_t *irc, char **cmd )
static int irc_cmd_rehash( irc_t *irc, char **cmd )
{
- ipc_to_master( cmd );
+ if( global.conf->runmode == RUNMODE_INETD )
+ ipc_master_cmd_rehash( NULL, NULL );
+ else
+ ipc_to_master( cmd );
irc_reply( irc, 382, "%s :Rehashing", CONF_FILE );
@@ -655,6 +658,8 @@ int irc_exec( irc_t *irc, char *cmd[] )
}
if( irc_commands[i].flags & IRC_CMD_TO_MASTER )
+ /* IPC doesn't make sense in inetd mode,
+ but the function will catch that. */
ipc_to_master( cmd );
else
return irc_commands[i].execute( irc, cmd );