setup proper hook for user_quit callback.
Implement user part & join callbacks Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
57b625f9fe
commit
8a6554a10f
|
@ -10,13 +10,6 @@ _callback_server_connected(Express_Network *net, const char *event EINA_UNUSED,
|
|||
_window_network_channels_create(net);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_server_disconnected(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)
|
||||
{
|
||||
DBG("Server %s Disconnected", source);
|
||||
_window_network_channels_destroy(net);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_server_motd(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)
|
||||
{
|
||||
|
@ -97,3 +90,62 @@ _callback_channel_topic(Express_Network *net EINA_UNUSED, const char *event EINA
|
|||
_channel_text_append(chl, NULL, buff);
|
||||
_channel_text_append(chl, NULL, params[2]);
|
||||
}
|
||||
|
||||
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]);
|
||||
|
||||
// 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 */
|
||||
}
|
||||
|
||||
void
|
||||
_callback_user_part(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)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
DBG("User Part %s", params[0]);
|
||||
DBG("\tCount: %d", count);
|
||||
DBG("\tUser: %s", source);
|
||||
DBG("\tMessage:");
|
||||
DBG("\t%s", params[1]);
|
||||
|
||||
if (!(chl = _window_channel_find(params[0]))) return;
|
||||
|
||||
snprintf(buff, sizeof(buff), "User %s has left %s: %s",
|
||||
source, params[0], params[1]);
|
||||
_channel_text_append(chl, NULL, buff);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_user_join(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)
|
||||
{
|
||||
/* Channel *chl = NULL; */
|
||||
/* char buff[PATH_MAX]; */
|
||||
|
||||
DBG("User Join %s", params[0]);
|
||||
DBG("\tCount: %d", count);
|
||||
DBG("\tUser: %s", source);
|
||||
DBG("\tMessage:");
|
||||
DBG("\t%s", params[1]);
|
||||
|
||||
/* FIXME: For some reason, JOIN messages are not stripping out the
|
||||
* /r/n at the end of params[0].
|
||||
*
|
||||
* This needs investigating in the network code */
|
||||
|
||||
/* if (!(chl = _window_channel_find(params[0]))) return; */
|
||||
|
||||
/* snprintf(buff, sizeof(buff), "User %s has joined %s", source, params[0]); */
|
||||
/* _channel_text_append(chl, NULL, buff); */
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
# define _CALLBACKS_H_ 1
|
||||
|
||||
void _callback_server_connected(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_server_disconnected(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_server_motd(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
|
||||
void _callback_channel_message(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_channel_notice(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_channel_topic(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
|
||||
void _callback_user_quit(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_user_part(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_user_join(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue