diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/espik_common_handler.c | 25 | ||||
-rw-r--r-- | src/espik_config.h | 10 | ||||
-rw-r--r-- | src/espik_irc.c | 10 | ||||
-rw-r--r-- | src/espik_irc_return_value.h | 14 |
4 files changed, 53 insertions, 6 deletions
diff --git a/src/espik_common_handler.c b/src/espik_common_handler.c index b0c854b..2f81f8d 100644 --- a/src/espik_common_handler.c +++ b/src/espik_common_handler.c @@ -16,7 +16,30 @@ int server_data (void* data __UNUSED__, int ev_type __UNUSED__, Ecore_Con_Event_Server_Data* ev) { - printf ("%s\n", (char*)ev->data); + unsigned int i; + char* msg; + + msg = strdup((char*)ev->data); + + printf ("%s\n", msg); + + for (i=0 ; i < strlen(msg) ; i++) + { + if (msg[i] == ' ') + msg[i] = '\0'; + } + +#if 1 + printf ("server_data: msg: %s\n", msg); +#endif + + if (! (strcmp (msg, "PING"))) + { + irc_send("/raw PONG guybrush.melee"); +#if 1 + printf ("server_data: <irc_send\n"); +#endif + } return (0); } diff --git a/src/espik_config.h b/src/espik_config.h index 99a1329..d6eeffa 100644 --- a/src/espik_config.h +++ b/src/espik_config.h @@ -27,8 +27,16 @@ struct _espik_config char* nick; char* pass; - struct serveur* next; + struct server* next; } server; + + struct + { + char* name; + } channel; + + struct server* current_server; + struct channel* cuurent_channel; }; #endif /* _HAVE_ESPIK_CONFIG_H */ diff --git a/src/espik_irc.c b/src/espik_irc.c index c049694..83412dc 100644 --- a/src/espik_irc.c +++ b/src/espik_irc.c @@ -207,17 +207,25 @@ char* irc_send (char* msg) if (msg[0] == '/') { + #if 1 + printf ("irc_send: msg[0] == '/'\n"); + #endif char** cmd_and_message; cmd_t* cmd; cmd_and_message = separate_commandline (msg + 1); + + #if 1 + printf ("irc_send: <separate_commandline\n"); + #endif + string_upper (cmd_and_message[0]); for (cmd = cmd_tab; cmd->cmd_name != 0; cmd++) { if ((strcmp (cmd_and_message[0], cmd->cmd_name)) == 0) - { + { out = cmd->format (current_chan, cmd_and_message[1]); /* WHy do job after found the good to do ? */ break; diff --git a/src/espik_irc_return_value.h b/src/espik_irc_return_value.h index 8eba544..3511a33 100644 --- a/src/espik_irc_return_value.h +++ b/src/espik_irc_return_value.h @@ -1,9 +1,17 @@ #ifndef _HAVE_ESPIK_IRC_RETURN_VALUE_H #define _HAVE_ESPIK_IRC_RETURN_VALUE_H -#define ERR_NONICKNAMEGIVEN 431 +#define RPL_WELCOME 001 /* Welcome to the IRC <nick>!<user>@<host> */ +#define RPL_YOURHOST 002 /* Your host is <servername>, running version <ver>" */ +#define RPL_CREATED 003 /* This server was created <date>" */ +#define RPL_MYINFO 004 /* <servername> <version> <available user mode> <available channel mode> */ +#define RPL_BOUNCE 005 /* Try server <server name>, port <port number> + Server suggest you to connect to another server */ +#define RPL_USERHOST 006 /* :*1<reply> *( " " <reply> )" */ + +#define ERR_NONICKNAMEGIVEN 431 #define ERR_ERRONEUSNICKNAME 432 -#define ERR_NICKNAMEINUSE 433 -#define ERR_NICKCOLLISION 436 +#define ERR_NICKNAMEINUSE 433 +#define ERR_NICKCOLLISION 436 #endif /*_HAVE_ESPIK_IRC_RETURN_VALUE_H */ |