degesch: add some comments
This commit is contained in:
parent
c946c46f1f
commit
c3d96a8b2d
|
@ -1242,6 +1242,7 @@ initiate_quit (struct app_context *ctx)
|
||||||
// Initiate a connection close
|
// Initiate a connection close
|
||||||
buffer_send_status (ctx, ctx->global_buffer, "Shutting down");
|
buffer_send_status (ctx, ctx->global_buffer, "Shutting down");
|
||||||
if (ctx->irc_fd != -1)
|
if (ctx->irc_fd != -1)
|
||||||
|
// XXX: when we go async, we'll have to flush output buffers first
|
||||||
irc_shutdown (ctx);
|
irc_shutdown (ctx);
|
||||||
|
|
||||||
ctx->quitting = true;
|
ctx->quitting = true;
|
||||||
|
@ -1853,9 +1854,14 @@ irc_process_message (const struct irc_message *msg,
|
||||||
unsigned long dummy;
|
unsigned long dummy;
|
||||||
if (xstrtoul (&dummy, msg->command, 10))
|
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;
|
struct str_vector copy;
|
||||||
str_vector_init (©);
|
str_vector_init (©);
|
||||||
str_vector_add_vector (©, msg->params.vector + !!msg->params.len);
|
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 (©, ' ');
|
char *reconstructed = join_str_vector (©, ' ');
|
||||||
str_vector_free (©);
|
str_vector_free (©);
|
||||||
char *utf8 = irc_to_utf8 (ctx, reconstructed);
|
char *utf8 = irc_to_utf8 (ctx, reconstructed);
|
||||||
|
@ -2329,6 +2335,7 @@ on_irc_reconnect_timeout (void *user_data)
|
||||||
static void
|
static void
|
||||||
irc_queue_reconnect (struct app_context *ctx)
|
irc_queue_reconnect (struct app_context *ctx)
|
||||||
{
|
{
|
||||||
|
// TODO: exponentional backoff
|
||||||
hard_assert (ctx->irc_fd == -1);
|
hard_assert (ctx->irc_fd == -1);
|
||||||
buffer_send_status (ctx, ctx->server_buffer,
|
buffer_send_status (ctx, ctx->server_buffer,
|
||||||
"Trying to reconnect in %ld seconds...", ctx->reconnect_delay);
|
"Trying to reconnect in %ld seconds...", ctx->reconnect_delay);
|
||||||
|
@ -2360,6 +2367,7 @@ on_irc_disconnected (struct app_context *ctx)
|
||||||
if (ctx->quitting)
|
if (ctx->quitting)
|
||||||
try_finish_quit (ctx);
|
try_finish_quit (ctx);
|
||||||
else if (!ctx->reconnect)
|
else if (!ctx->reconnect)
|
||||||
|
// XXX: not sure if we want this in a client
|
||||||
initiate_quit (ctx);
|
initiate_quit (ctx);
|
||||||
else
|
else
|
||||||
irc_queue_reconnect (ctx);
|
irc_queue_reconnect (ctx);
|
||||||
|
|
Loading…
Reference in New Issue