From 511c56d2fc933c8cbcbc46c1c1cdc338986194bd Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Fri, 17 Apr 2015 22:45:58 +0200 Subject: degesch: stub IRC command handlers --- degesch.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/degesch.c b/degesch.c index f38f299..be20eb9 100644 --- a/degesch.c +++ b/degesch.c @@ -1473,6 +1473,48 @@ irc_to_utf8 (struct app_context *ctx, const char *text) return iconv_xstrdup (ctx->latin1_to_utf8, (char *) text, len, NULL); } +static void +irc_handle_join (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: if the user is us, create a new buffer and activate it. + // TODO: log a message +} + +static void +irc_handle_kick (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: remove user from the channel + // TODO: log a message +} + +static void +irc_handle_mode (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: parse the mode change and apply it + // TODO: log a message +} + +static void +irc_handle_nick (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: rename the user in all relevant channels + // TODO: if it's us, rename ourselves + // TODO: log a message in all relevant channels +} + +static void +irc_handle_notice (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: log a message +} + +static void +irc_handle_part (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: remove user from the channel + // TODO: log a message +} + static void irc_handle_ping (struct app_context *ctx, const struct irc_message *msg) { @@ -1482,6 +1524,25 @@ irc_handle_ping (struct app_context *ctx, const struct irc_message *msg) irc_send (ctx, "PONG"); } +static void +irc_handle_privmsg (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: log a message +} + +static void +irc_handle_quit (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: remove user from all channels + // TODO: log a message +} + +static void +irc_handle_topic (struct app_context *ctx, const struct irc_message *msg) +{ + // TODO: log a message +} + static struct irc_handler { char *name; @@ -1490,8 +1551,16 @@ static struct irc_handler g_irc_handlers[] = { // This list needs to stay sorted - // TODO: handle as much as we can - { "PING", irc_handle_ping }, + { "JOIN", irc_handle_join }, + { "KICK", irc_handle_kick }, + { "MODE", irc_handle_mode }, + { "NICK", irc_handle_nick }, + { "NOTICE", irc_handle_notice }, + { "PART", irc_handle_part }, + { "PING", irc_handle_ping }, + { "PRIVMSG", irc_handle_privmsg }, + { "QUIT", irc_handle_quit }, + { "TOPIC", irc_handle_topic }, }; static int -- cgit v1.2.3-70-g09d2