Start processing network callbacks (this is prep for showing txt).

Signed-off-by: Chris Michael <devilhorns@comcast.net>
This commit is contained in:
Chris Michael 2014-01-20 17:32:08 +00:00
parent b4099082d9
commit b2c045a1d8
1 changed files with 60 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#include "private.h"
#include "callbacks.h"
#include "window.h"
#include "channel.h"
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)
@ -15,3 +16,62 @@ _callback_server_disconnected(Express_Network *net, const char *event EINA_UNUSE
DBG("Server %s Disconnected", source);
_window_network_channels_destroy(net);
}
void
_callback_server_motd(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data)
{
Channel *chl;
/* DBG("Server Motd"); */
/* DBG("\tServer: %s", source); */
/* DBG("\tUser: %s", params[0]); */
/* DBG("\tMessage:"); */
/* DBG("\t%s", params[1]); */
if (!(chl = _window_channel_find("Default"))) return;
_channel_text_append(chl, params[1]);
}
void
_callback_channel_message(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data)
{
Channel *chl = NULL;
/* DBG("Channel Message: %s", params[0]); */
/* DBG("\tUser: %s", source); */
/* DBG("\tMessage:"); */
/* DBG("\t%s", params[1]); */
if (!(chl = _window_channel_find(params[0]))) return;
_channel_text_append(chl, params[1]);
}
void
_callback_channel_notice(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data)
{
Channel *chl = NULL;
/* DBG("Channel Notice: %s", params[0]); */
/* DBG("\tServer: %s", source); */
/* DBG("\tMessage:"); */
/* DBG("\t%s", params[1]); */
if (!strcmp(params[0], "*"))
{
/* FIXME: Really this should find the first channel that
* belongs to each server and print the text there ... OR
* print this text to ALL channels....
*
* NB: For testing, just using the default channel for now */
if (!(chl = _window_channel_find("Default")))
chl = _window_channel_focused_get();
}
else
{
if (!(chl = _window_channel_find(params[0])))
chl = _window_channel_focused_get();
}
if (!chl) return;
_channel_text_append(chl, params[1]);
}