express: Fix printing of user left message and add printing of user

quit message

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-02-20 12:21:10 -05:00
parent 86e612da39
commit 48663bc45d
1 changed files with 16 additions and 10 deletions

View File

@ -207,18 +207,25 @@ _callback_channel_names(Express_Network *net EINA_UNUSED, const char *event EINA
void
_callback_user_quit(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("User Quit");
DBG("\tCount: %d", count);
DBG("\tUser: %s", source);
DBG("\tMessage:");
DBG("\t%s", params[0]);
Channel *chl;
char buff[PATH_MAX];
/* DBG("User Quit"); */
/* DBG("\tCount: %d", count); */
/* DBG("\tUser: %s", source); */
/* DBG("\tMessage:"); */
/* DBG("\t%s", params[0]); */
// param[0] == reason
// source == user
/* FIXME: We have a problem here. No channel gets passed in, so we will
* need to find the channel this user is in, and send the message to that
* channel */
* need to find all the channels this user is in, and send to channels */
if (!(chl = _window_channel_user_find(source))) return;
snprintf(buff, sizeof(buff), "%s has quit: %s", source, params[0]);
_channel_text_append(chl, "*", buff);
}
void
@ -235,7 +242,7 @@ _callback_user_part(Express_Network *net EINA_UNUSED, const char *event EINA_UNU
if (!(chl = _window_channel_find(params[0]))) return;
snprintf(buff, sizeof(buff), "User %s has left %s: %s\r\n",
snprintf(buff, sizeof(buff), "%s has left %s: %s",
source, params[0], params[1]);
_channel_text_append(chl, NULL, buff);
}
@ -258,8 +265,7 @@ _callback_user_join(Express_Network *net, const char *event EINA_UNUSED, const c
/* find the channel */
if (!(chl = _window_channel_find(params[0]))) return;
snprintf(buff, sizeof(buff), "User %s has joined %s\r\n",
source, params[0]);
snprintf(buff, sizeof(buff), "%s has joined %s\r\n", source, params[0]);
_channel_text_append(chl, NULL, buff);
}