express: Delay channel creation until user has identified...

Also fix quit message...
This commit is contained in:
Christopher Michael 2021-01-28 05:48:48 -05:00
parent f4f969feec
commit 367817b078
2 changed files with 31 additions and 10 deletions

View File

@ -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);
}

View File

@ -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