add support for TOPIC_TIME message
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
b63ed66841
commit
6225e686bc
|
@ -2,6 +2,7 @@
|
|||
#include "callbacks.h"
|
||||
#include "window.h"
|
||||
#include "channel.h"
|
||||
#include <time.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,27 +16,27 @@ _callback_server_motd(Express_Network *net EINA_UNUSED, const char *event EINA_U
|
|||
{
|
||||
Channel *chl;
|
||||
|
||||
DBG("Server Motd");
|
||||
DBG("\tServer: %s", source);
|
||||
DBG("\tCount: %d", count);
|
||||
DBG("\tUser: %s", params[0]);
|
||||
DBG("\tMessage:");
|
||||
DBG("\t%s", params[1]);
|
||||
/* DBG("Server Motd"); */
|
||||
/* DBG("\tServer: %s", source); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", params[0]); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
if (!(chl = _window_channel_server_find(source))) return;
|
||||
_channel_text_append(chl, NULL, params[1]);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_channel_message(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count, void *data EINA_UNUSED)
|
||||
_callback_channel_message(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)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
|
||||
DBG("Channel Message: %s", params[0]);
|
||||
DBG("\tCount: %d", count);
|
||||
DBG("\tUser: %s", source);
|
||||
DBG("\tMessage:");
|
||||
DBG("\t%s", params[1]);
|
||||
/* DBG("Channel Message: %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;
|
||||
|
||||
|
@ -47,11 +48,11 @@ _callback_channel_notice(Express_Network *net EINA_UNUSED, const char *event EIN
|
|||
{
|
||||
Channel *chl = NULL;
|
||||
|
||||
DBG("Channel Notice: %s", params[0]);
|
||||
DBG("\tCount: %d", count);
|
||||
DBG("\tServer: %s", source);
|
||||
DBG("\tMessage:");
|
||||
DBG("\t%s", params[1]);
|
||||
/* DBG("Channel Notice: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tServer: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
if (!strcmp(params[0], "*"))
|
||||
{
|
||||
|
@ -73,17 +74,17 @@ _callback_channel_notice(Express_Network *net EINA_UNUSED, const char *event EIN
|
|||
}
|
||||
|
||||
void
|
||||
_callback_channel_topic(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count, void *data EINA_UNUSED)
|
||||
_callback_channel_topic(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
DBG("Channel Topic: %s", params[0]);
|
||||
DBG("\tCount: %d", count);
|
||||
DBG("\tUser: %s", source);
|
||||
DBG("\tMessage:");
|
||||
DBG("\t%s", params[1]);
|
||||
DBG("\t%s", params[2]);
|
||||
/* DBG("Channel Topic: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
/* DBG("\t%s", params[2]); */
|
||||
|
||||
if (!(chl = _window_channel_find(params[1]))) return;
|
||||
snprintf(buff, sizeof(buff), "Topic for %s is: ", params[1]);
|
||||
|
@ -91,6 +92,31 @@ _callback_channel_topic(Express_Network *net EINA_UNUSED, const char *event EINA
|
|||
_channel_text_append(chl, NULL, params[2]);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_channel_topic_time(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX], *strtime;
|
||||
time_t stamp;
|
||||
|
||||
/* DBG("Channel Topic Time: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
/* DBG("\t%s", params[2]); */
|
||||
/* DBG("\t%s", params[3]); */
|
||||
|
||||
stamp = atol(params[3]);
|
||||
strtime = ctime(&stamp);
|
||||
strtime[24] = 0;
|
||||
|
||||
if (!(chl = _window_channel_find(params[1]))) return;
|
||||
snprintf(buff, sizeof(buff), "Topic for %s set by %s at %s",
|
||||
params[1], params[2], strtime);
|
||||
_channel_text_append(chl, NULL, buff);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -114,11 +140,11 @@ _callback_user_part(Express_Network *net EINA_UNUSED, const char *event EINA_UNU
|
|||
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]);
|
||||
/* 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;
|
||||
|
||||
|
@ -133,11 +159,11 @@ _callback_user_join(Express_Network *net, const char *event EINA_UNUSED, const c
|
|||
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]);
|
||||
/* DBG("User Join %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
/* skip user join messages for our own nick */
|
||||
if (!strcmp(source, express_network_nickname_get(net))) return;
|
||||
|
|
|
@ -7,6 +7,7 @@ void _callback_server_motd(Express_Network *net, const char *event, const char *
|
|||
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_channel_topic_time(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);
|
||||
|
|
Loading…
Reference in New Issue