summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-04-17 22:11:36 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-04-17 22:11:36 +0200
commit6c4e7f8fdcc67b76f372aab4409d702a4bca1b49 (patch)
tree482ea9c2acfac377480d85c1fc6ef2f2c971793b
parentf9125c38c0e9560649f9be6c4d6565ed8fc9fb6e (diff)
downloadxK-6c4e7f8fdcc67b76f372aab4409d702a4bca1b49.tar.gz
xK-6c4e7f8fdcc67b76f372aab4409d702a4bca1b49.tar.xz
xK-6c4e7f8fdcc67b76f372aab4409d702a4bca1b49.zip
degesch: fix irc_process_message()
-rw-r--r--degesch.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/degesch.c b/degesch.c
index 23e2ae1..6dd6be7 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1517,8 +1517,8 @@ irc_process_message (const struct irc_message *msg,
|| !strcasecmp (msg->command, "376") // RPL_ENDOFMOTD
|| !strcasecmp (msg->command, "422"))) // ERR_NOMOTD
{
- // FIXME: print to the server buffer
- print_status ("successfully connected");
+ // XXX: should we really print this?
+ buffer_send_status (ctx, ctx->server_buffer, "successfully connected");
ctx->irc_ready = true;
const char *autojoin = str_map_find (&ctx->config, "autojoin");
@@ -1530,14 +1530,20 @@ irc_process_message (const struct irc_message *msg,
struct irc_handler *handler = bsearch (&key, g_irc_handlers,
N_ELEMENTS (g_irc_handlers), sizeof key, irc_handler_cmp_by_name);
if (handler)
+ {
handler->handler (ctx, msg);
+ return;
+ }
// Numerics typically have human-readable information
unsigned long dummy;
if (xstrtoul (&dummy, msg->command, 10))
- // TODO: ensure proper encoding
- // FIXME: print to the server buffer
- print_status ("%s", raw);
+ {
+ // TODO: check for valid UTF-8 and eventually try recoding from fallback
+ char *reconstructed = join_str_vector (&msg->params, ' ');
+ buffer_send_status (ctx, ctx->server_buffer, "%s", reconstructed);
+ free (reconstructed);
+ }
}
// --- User input handling -----------------------------------------------------