From c3d96a8b2d00d0801fa0869574396aa3136b242b Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sun, 19 Apr 2015 21:34:33 +0200
Subject: degesch: add some comments
---
degesch.c | 8 ++++++++
1 file changed, 8 insertions(+)
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 (©);
str_vector_add_vector (©, 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 (©, ' ');
str_vector_free (©);
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);
--
cgit v1.2.3-70-g09d2