diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-06-15 01:03:34 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-06-15 01:04:58 +0200 |
commit | 3582789cf51f0bf02b274429b5817d0f143441d4 (patch) | |
tree | b2be6d60333e2156322c93832d6a32174a8c0ef0 | |
parent | f2998db30b494d0247d302bb5f97e4e2bf70d21a (diff) | |
download | xK-3582789cf51f0bf02b274429b5817d0f143441d4.tar.gz xK-3582789cf51f0bf02b274429b5817d0f143441d4.tar.xz xK-3582789cf51f0bf02b274429b5817d0f143441d4.zip |
ZyklonB: unfuck registration
-rw-r--r-- | zyklonb.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -126,7 +126,7 @@ struct bot_context int irc_fd; ///< Socket FD of the server struct str read_buffer; ///< Input yet to be processed struct poller_fd irc_event; ///< IRC FD event - bool irc_ready; ///< Whether we may send messages now + bool irc_registered; ///< Whether we may send messages now struct poller_fd signal_event; ///< Signal FD event struct poller_timer ping_tmr; ///< We should send a ping @@ -158,7 +158,7 @@ bot_context_init (struct bot_context *self) self->irc_fd = -1; str_init (&self->read_buffer); - self->irc_ready = false; + self->irc_registered = false; self->ssl = NULL; self->ssl_ctx = NULL; @@ -910,7 +910,7 @@ plugin_process_message (const struct irc_message *msg, printf ("%s\n", msg->params.vector[1]); } } - else if (plugin->initialized && ctx->irc_ready) + else if (plugin->initialized && ctx->irc_registered) { // Pass everything else through to the IRC server // XXX: when the server isn't ready yet, these messages get silently @@ -1371,7 +1371,7 @@ static void irc_forward_message_to_plugins (struct bot_context *ctx, const char *raw) { // For consistency with plugin_process_message() - if (!ctx->irc_ready) + if (!ctx->irc_registered) return; for (struct plugin *plugin = ctx->plugins; @@ -1411,12 +1411,10 @@ irc_process_message (const struct irc_message *msg, else irc_send (ctx, "PONG"); } - else if (!ctx->irc_ready && (!strcasecmp (msg->command, "MODE") - || !strcasecmp (msg->command, "376") // RPL_ENDOFMOTD - || !strcasecmp (msg->command, "422"))) // ERR_NOMOTD + else if (!ctx->irc_registered && !strcasecmp (msg->command, "001")) { print_status ("successfully connected"); - ctx->irc_ready = true; + ctx->irc_registered = true; const char *autojoin = str_map_find (&ctx->config, "autojoin"); if (autojoin) @@ -1544,7 +1542,7 @@ on_irc_disconnected (struct bot_context *ctx) xclose (ctx->irc_fd); ctx->irc_fd = -1; - ctx->irc_ready = false; + ctx->irc_registered = false; ctx->irc_event.closed = true; poller_fd_reset (&ctx->irc_event); |