summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irc/bot/bot-commands.c4
-rw-r--r--src/irc/bot/botnet-connection.c8
-rw-r--r--src/irc/bot/botnet.c12
3 files changed, 19 insertions, 5 deletions
diff --git a/src/irc/bot/bot-commands.c b/src/irc/bot/bot-commands.c
index c6ee1c93..67d5855f 100644
--- a/src/irc/bot/bot-commands.c
+++ b/src/irc/bot/bot-commands.c
@@ -197,10 +197,10 @@ void bot_commands_init(void)
void bot_commands_deinit(void)
{
- signal_remove("botnet event user_remove", (SIGNAL_FUNC) botnet_event_user_add);
+ signal_remove("botnet event user_add", (SIGNAL_FUNC) botnet_event_user_add);
signal_remove("botnet event user_flags", (SIGNAL_FUNC) botnet_event_user_flags);
signal_remove("botnet event user_chan_flags", (SIGNAL_FUNC) botnet_event_user_chan_flags);
- signal_remove("botnet event user_remove_mask", (SIGNAL_FUNC) botnet_event_user_add_mask);
+ signal_remove("botnet event user_add_mask", (SIGNAL_FUNC) botnet_event_user_add_mask);
signal_remove("botnet event user_mask_notflags", (SIGNAL_FUNC) botnet_event_user_mask_notflags);
signal_remove("botnet event user_pass", (SIGNAL_FUNC) botnet_event_user_pass);
}
diff --git a/src/irc/bot/botnet-connection.c b/src/irc/bot/botnet-connection.c
index 6a057758..68c33d0a 100644
--- a/src/irc/bot/botnet-connection.c
+++ b/src/irc/bot/botnet-connection.c
@@ -248,6 +248,11 @@ void botnet_connect(BOTNET_REC *botnet)
botnet_listen(botnet);
}
+ if (botnet->uplinks == NULL) {
+ /* we have no uplinks */
+ return;
+ }
+
/* find some bot where we can try to connect to */
now = time(NULL);
uplink = best = NULL;
@@ -270,6 +275,7 @@ void botnet_connect(BOTNET_REC *botnet)
if (best == NULL) {
/* reconnect later */
botnet->reconnect = TRUE;
+ return;
}
/* connect to uplink */
@@ -369,6 +375,8 @@ static void botnet_event(BOT_REC *bot, const char *data)
if (bot->connected)
return;
+ signal_stop_by_name("botnet event");
+
if (bot->uplink) {
botnet_connect_event_uplink(bot, data);
return;
diff --git a/src/irc/bot/botnet.c b/src/irc/bot/botnet.c
index 01954703..e85a9857 100644
--- a/src/irc/bot/botnet.c
+++ b/src/irc/bot/botnet.c
@@ -84,7 +84,6 @@ void botnet_broadcast(BOTNET_REC *botnet, BOT_REC *except_bot,
{
GSList *tmp;
- g_return_if_fail(botnet != NULL);
g_return_if_fail(data != NULL);
if (botnet != NULL) {
@@ -104,10 +103,17 @@ void botnet_send_cmd(BOTNET_REC *botnet, const char *source,
const char *target, const char *data)
{
GNode *node;
- char *str;
+ char *str;
+
+ g_return_if_fail(botnet != NULL);
+ g_return_if_fail(target != NULL);
+ g_return_if_fail(data != NULL);
node = bot_find_path(botnet, target);
- g_return_if_fail(node != NULL);
+ if (node == NULL) {
+ g_warning("Can't find route for target %s", target);
+ return;
+ }
str = g_strdup_printf("%s %s %s", source != NULL ? source :
botnet->nick, target, data);