degesch: fix irc_process_message()
This commit is contained in:
parent
f9125c38c0
commit
6c4e7f8fdc
16
degesch.c
16
degesch.c
|
@ -1517,8 +1517,8 @@ 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
|
// XXX: should we really print this?
|
||||||
print_status ("successfully connected");
|
buffer_send_status (ctx, ctx->server_buffer, "successfully connected");
|
||||||
ctx->irc_ready = true;
|
ctx->irc_ready = true;
|
||||||
|
|
||||||
const char *autojoin = str_map_find (&ctx->config, "autojoin");
|
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,
|
struct irc_handler *handler = bsearch (&key, g_irc_handlers,
|
||||||
N_ELEMENTS (g_irc_handlers), sizeof key, irc_handler_cmp_by_name);
|
N_ELEMENTS (g_irc_handlers), sizeof key, irc_handler_cmp_by_name);
|
||||||
if (handler)
|
if (handler)
|
||||||
|
{
|
||||||
handler->handler (ctx, msg);
|
handler->handler (ctx, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Numerics typically have human-readable information
|
// Numerics typically have human-readable information
|
||||||
unsigned long dummy;
|
unsigned long dummy;
|
||||||
if (xstrtoul (&dummy, msg->command, 10))
|
if (xstrtoul (&dummy, msg->command, 10))
|
||||||
// TODO: ensure proper encoding
|
{
|
||||||
// FIXME: print to the server buffer
|
// TODO: check for valid UTF-8 and eventually try recoding from fallback
|
||||||
print_status ("%s", raw);
|
char *reconstructed = join_str_vector (&msg->params, ' ');
|
||||||
|
buffer_send_status (ctx, ctx->server_buffer, "%s", reconstructed);
|
||||||
|
free (reconstructed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- User input handling -----------------------------------------------------
|
// --- User input handling -----------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue