degesch: update TODO/FIXME comments

This commit is contained in:
Přemysl Eric Janouch 2015-04-15 12:38:21 +02:00
parent ba9e51fb9f
commit c2c9d4dc58

View File

@ -177,9 +177,6 @@ enum buffer_type
BUFFER_PM ///< Private messages (query) BUFFER_PM ///< Private messages (query)
}; };
// TODO: now I can't just print messages with print_status() etc.,
// all that stuff has to go in a buffer now
struct buffer struct buffer
{ {
LIST_HEADER (struct buffer) LIST_HEADER (struct buffer)
@ -746,6 +743,9 @@ buffer_line_display (struct app_context *ctx, struct buffer_line *line)
if (ctx->readline_prompt_shown) if (ctx->readline_prompt_shown)
app_readline_hide (&state); app_readline_hide (&state);
// TODO: write the line to a log file; note that the global and server
// buffers musn't collide with filenames
printf ("%s\n", text.str); printf ("%s\n", text.str);
str_free (&text); str_free (&text);
@ -1079,6 +1079,7 @@ ca_error:
} }
// Only inform the user if we're not actually verifying // Only inform the user if we're not actually verifying
// FIXME: print to the server buffer
print_warning ("%s", error->message); print_warning ("%s", error->message);
error_free (error); error_free (error);
return true; return true;
@ -1103,10 +1104,12 @@ irc_initialize_ssl (struct app_context *ctx, struct error **e)
{ {
char *path = resolve_config_filename (ssl_cert); char *path = resolve_config_filename (ssl_cert);
if (!path) if (!path)
// FIXME: print to the global buffer
print_error ("%s: %s", "cannot open file", ssl_cert); print_error ("%s: %s", "cannot open file", ssl_cert);
// XXX: perhaps we should read the file ourselves for better messages // XXX: perhaps we should read the file ourselves for better messages
else if (!SSL_use_certificate_file (ctx->ssl, path, SSL_FILETYPE_PEM) else if (!SSL_use_certificate_file (ctx->ssl, path, SSL_FILETYPE_PEM)
|| !SSL_use_PrivateKey_file (ctx->ssl, path, SSL_FILETYPE_PEM)) || !SSL_use_PrivateKey_file (ctx->ssl, path, SSL_FILETYPE_PEM))
// FIXME: print to the global buffer
print_error ("%s: %s", "setting the SSL client certificate failed", print_error ("%s: %s", "setting the SSL client certificate failed",
ERR_error_string (ERR_get_error (), NULL)); ERR_error_string (ERR_get_error (), NULL));
free (path); free (path);
@ -1184,8 +1187,8 @@ irc_establish_connection (struct app_context *ctx,
else else
real_host = buf; real_host = buf;
// XXX: we shouldn't mix these statuses with `struct error'; choose 1!
char *address = format_host_port_pair (real_host, port); char *address = format_host_port_pair (real_host, port);
// FIXME: print to the server buffer
print_status ("connecting to %s...", address); print_status ("connecting to %s...", address);
free (address); free (address);
@ -1347,6 +1350,7 @@ irc_process_message (const struct irc_message *msg,
|| !strcasecmp (msg->command, "376") // RPL_ENDOFMOTD || !strcasecmp (msg->command, "376") // RPL_ENDOFMOTD
|| !strcasecmp (msg->command, "422"))) // ERR_NOMOTD || !strcasecmp (msg->command, "422"))) // ERR_NOMOTD
{ {
// FIXME: print to the server buffer
print_status ("successfully connected"); print_status ("successfully connected");
ctx->irc_ready = true; ctx->irc_ready = true;
@ -1362,6 +1366,7 @@ irc_process_message (const struct irc_message *msg,
// This is going to be a lot more complicated // This is going to be a lot more complicated
if (show_to_user) if (show_to_user)
// TODO: ensure proper encoding // TODO: ensure proper encoding
// FIXME: print to the server buffer
print_status ("%s", raw); print_status ("%s", raw);
} }
@ -1526,6 +1531,7 @@ on_irc_reconnect_timeout (void *user_data)
if (irc_connect (ctx, &e)) if (irc_connect (ctx, &e))
return; return;
// FIXME: print to the server buffer
print_error ("%s", e->message); print_error ("%s", e->message);
error_free (e); error_free (e);
irc_queue_reconnect (ctx); irc_queue_reconnect (ctx);
@ -1535,6 +1541,7 @@ static void
irc_queue_reconnect (struct app_context *ctx) irc_queue_reconnect (struct app_context *ctx)
{ {
hard_assert (ctx->irc_fd == -1); hard_assert (ctx->irc_fd == -1);
// FIXME: print to the server buffer
print_status ("trying to reconnect in %ld seconds...", print_status ("trying to reconnect in %ld seconds...",
ctx->reconnect_delay); ctx->reconnect_delay);
poller_timer_set (&ctx->reconnect_tmr, ctx->reconnect_delay * 1000); poller_timer_set (&ctx->reconnect_tmr, ctx->reconnect_delay * 1000);
@ -1574,6 +1581,7 @@ static void
on_irc_ping_timeout (void *user_data) on_irc_ping_timeout (void *user_data)
{ {
struct app_context *ctx = user_data; struct app_context *ctx = user_data;
// FIXME: print to the server buffer
print_error ("connection timeout"); print_error ("connection timeout");
on_irc_disconnected (ctx); on_irc_disconnected (ctx);
} }
@ -1617,10 +1625,12 @@ on_irc_readable (const struct pollfd *fd, struct app_context *ctx)
case IRC_READ_AGAIN: case IRC_READ_AGAIN:
goto end; goto end;
case IRC_READ_ERROR: case IRC_READ_ERROR:
// FIXME: print to the server buffer
print_error ("reading from the IRC server failed"); print_error ("reading from the IRC server failed");
disconnected = true; disconnected = true;
goto end; goto end;
case IRC_READ_EOF: case IRC_READ_EOF:
// FIXME: print to the server buffer
print_status ("the IRC server closed the connection"); print_status ("the IRC server closed the connection");
disconnected = true; disconnected = true;
goto end; goto end;
@ -1630,6 +1640,7 @@ on_irc_readable (const struct pollfd *fd, struct app_context *ctx)
if (buf->len >= (1 << 20)) if (buf->len >= (1 << 20))
{ {
// FIXME: print to the server buffer
print_error ("the IRC server seems to spew out data frantically"); print_error ("the IRC server seems to spew out data frantically");
irc_shutdown (ctx); irc_shutdown (ctx);
goto end; goto end;
@ -1682,6 +1693,7 @@ irc_connect (struct app_context *ctx, struct error **e)
{ {
char *address = format_host_port_pair (irc_host, irc_port); char *address = format_host_port_pair (irc_host, irc_port);
char *socks_address = format_host_port_pair (socks_host, socks_port); char *socks_address = format_host_port_pair (socks_host, socks_port);
// FIXME: print to the server buffer
print_status ("connecting to %s via %s...", address, socks_address); print_status ("connecting to %s via %s...", address, socks_address);
free (socks_address); free (socks_address);
free (address); free (address);
@ -1706,6 +1718,7 @@ irc_connect (struct app_context *ctx, struct error **e)
ctx->irc_fd = -1; ctx->irc_fd = -1;
return false; return false;
} }
// FIXME: print to the server buffer
print_status ("connection established"); print_status ("connection established");
poller_fd_init (&ctx->irc_event, &ctx->poller, ctx->irc_fd); poller_fd_init (&ctx->irc_event, &ctx->poller, ctx->irc_fd);
@ -1940,6 +1953,7 @@ load_config (struct app_context *ctx, struct error **e)
str_init (&value); str_init (&value);
if (!unescape_string (iter.link->data, &value, &e)) if (!unescape_string (iter.link->data, &value, &e))
{ {
// FIXME: use the "e" argument, don't print it
print_error ("error reading configuration: %s: %s", print_error ("error reading configuration: %s: %s",
iter.link->key, e->message); iter.link->key, e->message);
error_free (e); error_free (e);
@ -2061,10 +2075,13 @@ main (int argc, char *argv[])
refresh_prompt (&ctx); refresh_prompt (&ctx);
// TODO: connect asynchronously (first step towards multiple servers) // TODO: connect asynchronously (first step towards multiple servers)
// TODO: print load_config() errors to the global buffer,
// switch buffers and print irc_connect() errors to the server buffer?
struct error *e = NULL; struct error *e = NULL;
if (!load_config (&ctx, &e) if (!load_config (&ctx, &e)
|| !irc_connect (&ctx, &e)) || !irc_connect (&ctx, &e))
{ {
// FIXME: print to the global buffer
print_error ("%s", e->message); print_error ("%s", e->message);
error_free (e); error_free (e);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);