summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index 5bb6b7d..1918914 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1242,6 +1242,7 @@ initiate_quit (struct app_context *ctx)
// Initiate a connection close
buffer_send_status (ctx, ctx->global_buffer, "Shutting down");
if (ctx->irc_fd != -1)
+ // XXX: when we go async, we'll have to flush output buffers first
irc_shutdown (ctx);
ctx->quitting = true;
@@ -1853,9 +1854,14 @@ irc_process_message (const struct irc_message *msg,
unsigned long dummy;
if (xstrtoul (&dummy, msg->command, 10))
{
+ // Get rid of the first parameter, if there's any at all,
+ // as it contains our nickname and is of no practical use to the user
struct str_vector copy;
str_vector_init (&copy);
str_vector_add_vector (&copy, msg->params.vector + !!msg->params.len);
+
+ // Join the parameter vector back, recode it to our internal encoding
+ // and send it to the server buffer
char *reconstructed = join_str_vector (&copy, ' ');
str_vector_free (&copy);
char *utf8 = irc_to_utf8 (ctx, reconstructed);
@@ -2329,6 +2335,7 @@ on_irc_reconnect_timeout (void *user_data)
static void
irc_queue_reconnect (struct app_context *ctx)
{
+ // TODO: exponentional backoff
hard_assert (ctx->irc_fd == -1);
buffer_send_status (ctx, ctx->server_buffer,
"Trying to reconnect in %ld seconds...", ctx->reconnect_delay);
@@ -2360,6 +2367,7 @@ on_irc_disconnected (struct app_context *ctx)
if (ctx->quitting)
try_finish_quit (ctx);
else if (!ctx->reconnect)
+ // XXX: not sure if we want this in a client
initiate_quit (ctx);
else
irc_queue_reconnect (ctx);