Don't forward messages while !irc_ready
This commit is contained in:
parent
a4e18d306e
commit
16852048ed
@ -1256,6 +1256,27 @@ process_privmsg (struct bot_context *ctx, const struct irc_message *msg)
|
|||||||
str_vector_free (&list);
|
str_vector_free (&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
irc_forward_message_to_plugins (struct bot_context *ctx, const char *raw)
|
||||||
|
{
|
||||||
|
// For consistency with plugin_process_message()
|
||||||
|
if (!ctx->irc_ready)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (struct plugin_data *plugin = ctx->plugins;
|
||||||
|
plugin; plugin = plugin->next)
|
||||||
|
{
|
||||||
|
if (plugin->is_zombie)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (plugin->initialized)
|
||||||
|
plugin_send (plugin, "%s", raw);
|
||||||
|
else
|
||||||
|
// TODO: make sure that this buffer doesn't get too large either
|
||||||
|
str_append_printf (&plugin->queued_output, "%s\r\n", raw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
irc_process_message (const struct irc_message *msg,
|
irc_process_message (const struct irc_message *msg,
|
||||||
const char *raw, void *user_data)
|
const char *raw, void *user_data)
|
||||||
@ -1270,19 +1291,7 @@ irc_process_message (const struct irc_message *msg,
|
|||||||
//
|
//
|
||||||
// I should probably even rip out the autojoin...
|
// I should probably even rip out the autojoin...
|
||||||
|
|
||||||
// First forward the message to all the plugins
|
irc_forward_message_to_plugins (ctx, raw);
|
||||||
for (struct plugin_data *plugin = ctx->plugins;
|
|
||||||
plugin; plugin = plugin->next)
|
|
||||||
{
|
|
||||||
if (plugin->is_zombie)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (plugin->initialized)
|
|
||||||
plugin_send (plugin, "%s", raw);
|
|
||||||
else
|
|
||||||
// TODO: make sure that this buffer doesn't get too large either
|
|
||||||
str_append_printf (&plugin->queued_output, "%s\r\n", raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcasecmp (msg->command, "PING"))
|
if (!strcasecmp (msg->command, "PING"))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user