diff --git a/src/bin/callbacks.c b/src/bin/callbacks.c index 7e3fd7d..58d0a4d 100644 --- a/src/bin/callbacks.c +++ b/src/bin/callbacks.c @@ -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); }