From 367817b07854296b42617280807e8bf373d74097 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Thu, 28 Jan 2021 05:48:48 -0500 Subject: [PATCH] express: Delay channel creation until user has identified... Also fix quit message... --- src/bin/callbacks.c | 40 ++++++++++++++++++++++++++++++---------- src/bin/callbacks.h | 1 + 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/bin/callbacks.c b/src/bin/callbacks.c index 85aace4..9ef69ad 100644 --- a/src/bin/callbacks.c +++ b/src/bin/callbacks.c @@ -41,10 +41,9 @@ _find_crlf(const char *data, int length, int *lf) } void -_callback_server_connected(Express_Network *net, const char *event EINA_UNUSED, const char *source, const char **params EINA_UNUSED, unsigned int count EINA_UNUSED, void *data EINA_UNUSED) +_callback_server_connected(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params EINA_UNUSED, unsigned int count EINA_UNUSED, void *data EINA_UNUSED) { DBG("Server %s Connected", source); - _window_network_channels_create(net); } void @@ -265,7 +264,7 @@ _callback_user_quit(Express_Network *net EINA_UNUSED, const char *event EINA_UNU /* DBG("\tMessage:"); */ /* DBG("\t%s", params[0]); */ - snprintf(buff, sizeof(buff), "%s has %s", source, params[0]); + snprintf(buff, sizeof(buff), "%s has quit: %s", source, params[0]); channels = _window_channels_user_find(source); EINA_LIST_FOREACH(channels, l, chl) @@ -340,13 +339,13 @@ _callback_user_private(Express_Network *net, const char *event EINA_UNUSED, cons { Channel * chl = NULL; - /* DBG("User Private %s", params[0]); */ - /* DBG("\tCount: %d", count); */ - /* DBG("\tUser: %s", source); */ - /* DBG("\tMessage:"); */ - /* DBG("\t%s", params[1]); // message */ - /* DBG("\t%s", params[2]); */ - /* DBG("\t%s", params[3]); */ + DBG("User Private %s", params[0]); + DBG("\tCount: %d", count); + DBG("\tUser: %s", source); + DBG("\tMessage:"); + DBG("\t%s", params[1]); // message + DBG("\t%s", params[2]); + DBG("\t%s", params[3]); if (!(chl = _window_channel_find(source))) { @@ -396,3 +395,24 @@ _callback_user_nick(Express_Network *net EINA_UNUSED, const char *event EINA_UNU _channel_text_append(chl, "*", buff, _row_color_simple_create(COLOR_NICK_CHANGE)); } + +void +_callback_user_mode(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED) +{ + char user[PATH_MAX]; + int crlf = 0, lf = 0; + + crlf = _find_crlf(params[0], strlen(params[0]), &lf); + if (crlf > 0) + eina_strlcpy(user, params[0], crlf + lf - 1); + else + eina_strlcpy(user, params[0], strlen(params[0]) + 1); + + /* DBG("User Mode %s", user); */ + /* DBG("\tCount: %d", count); */ + /* DBG("\tUser: %s", source); */ + /* DBG("\tMessage:"); */ + /* DBG("\t%s", params[1]); */ + + _window_network_channels_create(net); +} diff --git a/src/bin/callbacks.h b/src/bin/callbacks.h index 233e4fb..0f8e1d5 100644 --- a/src/bin/callbacks.h +++ b/src/bin/callbacks.h @@ -18,5 +18,6 @@ void _callback_user_part(Express_Network *net, const char *event, const char *so void _callback_user_join(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data); void _callback_user_private(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data); void _callback_user_nick(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data); +void _callback_user_mode(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED); #endif