1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@252 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-05-29 17:34:47 +00:00 committed by cras
parent 329fbd3ee8
commit 9747762593
3 changed files with 19 additions and 5 deletions

View File

@ -197,10 +197,10 @@ void bot_commands_init(void)
void bot_commands_deinit(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_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_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_mask_notflags", (SIGNAL_FUNC) botnet_event_user_mask_notflags);
signal_remove("botnet event user_pass", (SIGNAL_FUNC) botnet_event_user_pass); signal_remove("botnet event user_pass", (SIGNAL_FUNC) botnet_event_user_pass);
} }

View File

@ -248,6 +248,11 @@ void botnet_connect(BOTNET_REC *botnet)
botnet_listen(botnet); botnet_listen(botnet);
} }
if (botnet->uplinks == NULL) {
/* we have no uplinks */
return;
}
/* find some bot where we can try to connect to */ /* find some bot where we can try to connect to */
now = time(NULL); now = time(NULL);
uplink = best = NULL; uplink = best = NULL;
@ -270,6 +275,7 @@ void botnet_connect(BOTNET_REC *botnet)
if (best == NULL) { if (best == NULL) {
/* reconnect later */ /* reconnect later */
botnet->reconnect = TRUE; botnet->reconnect = TRUE;
return;
} }
/* connect to uplink */ /* connect to uplink */
@ -369,6 +375,8 @@ static void botnet_event(BOT_REC *bot, const char *data)
if (bot->connected) if (bot->connected)
return; return;
signal_stop_by_name("botnet event");
if (bot->uplink) { if (bot->uplink) {
botnet_connect_event_uplink(bot, data); botnet_connect_event_uplink(bot, data);
return; return;

View File

@ -84,7 +84,6 @@ void botnet_broadcast(BOTNET_REC *botnet, BOT_REC *except_bot,
{ {
GSList *tmp; GSList *tmp;
g_return_if_fail(botnet != NULL);
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
if (botnet != NULL) { if (botnet != NULL) {
@ -104,10 +103,17 @@ void botnet_send_cmd(BOTNET_REC *botnet, const char *source,
const char *target, const char *data) const char *target, const char *data)
{ {
GNode *node; 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); 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 : str = g_strdup_printf("%s %s %s", source != NULL ? source :
botnet->nick, target, data); botnet->nick, target, data);