diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/espik_common_handler.c | 16 | ||||
-rw-r--r-- | src/espik_irc.c | 11 |
2 files changed, 15 insertions, 12 deletions
diff --git a/src/espik_common_handler.c b/src/espik_common_handler.c index 68a23e8..a816161 100644 --- a/src/espik_common_handler.c +++ b/src/espik_common_handler.c @@ -35,10 +35,18 @@ int server_data (void* data __UNUSED__, int ev_type __UNUSED__, if (! (strcmp (msg, "PING"))) { - irc_send("/raw PONG guybrush.melee"); -#if 1 - printf ("server_data: <irc_send\n"); -#endif + char* pong; + int len; + + len = 10 /* "/raw PONG " */ + + strlen ("guybrush.melee"); + + pong = malloc (sizeof(char) * len); + snprintf (pong, len, "/raw PONG guybrush.melee"); + irc_send(pong); + #if 1 + printf ("server_data: <irc_send\n"); + #endif } return (0); diff --git a/src/espik_irc.c b/src/espik_irc.c index 8d62c29..dbe2e2d 100644 --- a/src/espik_irc.c +++ b/src/espik_irc.c @@ -38,7 +38,6 @@ char** separate_commandline (char *msg) /* Yes, do nothing, just get len ! */ for (len = 0; msg[len] != ' '; len++); - two_words = malloc (sizeof(char*) * 2); msg[len] = '\0'; @@ -207,14 +206,10 @@ 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); + cmd_and_message = separate_commandline (msg + 1); #if 1 printf ("irc_send: <separate_commandline\n"); @@ -239,11 +234,11 @@ char* irc_send (char* msg) } else { - out = irc_privmsg (current_chan, msg); + out = irc_privmsg (current_chan, msg); } if (!out) - return (0); + return (0); printf ("%s\n", out); |