diff options
-rw-r--r-- | m4/ac_espik_debug.m4 | 2 | ||||
-rw-r--r-- | src/espik_irc.c | 8 | ||||
-rw-r--r-- | src/espik_irc.h | 8 | ||||
-rw-r--r-- | src/espik_net.c | 17 |
4 files changed, 17 insertions, 18 deletions
diff --git a/m4/ac_espik_debug.m4 b/m4/ac_espik_debug.m4 index 0f6dcaf..dcef075 100644 --- a/m4/ac_espik_debug.m4 +++ b/m4/ac_espik_debug.m4 @@ -20,7 +20,7 @@ AC_DEFUN([AC_ESPIK_DEBUG], DEBUG_LDFLAGS="-s" fi - AC_MSG_RESULT($debug: $DEBUG_CFLAGS$DEBUG_LDFLAGS) + AC_MSG_RESULT($debug ($DEBUG_CFLAGS$DEBUG_LDFLAGS)) AC_SUBST(DEBUG_CFLAGS) AC_SUBST(DEBUG_LDFLAGS) diff --git a/src/espik_irc.c b/src/espik_irc.c index d0e0a07..2555297 100644 --- a/src/espik_irc.c +++ b/src/espik_irc.c @@ -21,12 +21,6 @@ typedef struct char* (*format) (char *dest, char *msg); } cmd_t; -typedef struct -{ - char* buf; - int len; -} buf_t; - cmd_t cmd_tab[] = { { "JOIN", irc_join }, { "PART", irc_part }, @@ -91,7 +85,7 @@ unsigned short sendmsg_len (char* msg) return (strlen (msg) + 2); } -static buf_t make_buffer(int len) +buf_t make_buffer(int len) { buf_t buf; espik_enter(); diff --git a/src/espik_irc.h b/src/espik_irc.h index 4e0614d..5d72095 100644 --- a/src/espik_irc.h +++ b/src/espik_irc.h @@ -1,6 +1,12 @@ #ifndef HAVE_ESPIK_IRC_H #define HAVE_ESPIK_IRC_H +typedef struct +{ + char* buf; + int len; +} buf_t; + unsigned short sendmsg_len (char*); char* irc_send (char*); char* irc_privmsg (char*, char *); @@ -13,9 +19,11 @@ char* irc_raw (char*, char*); char* irc_nick(char*, char*); char** separate_commandline (char*); +buf_t make_buffer(int); /*void string_upper (char*);*/ /*Ecore_Con_Server* irc_connect (char*, int);*/ /*void irc_disconnect (Ecore_Con_Server*);*/ + #endif /* HAVE_ESPIK_IRC_H */ diff --git a/src/espik_net.c b/src/espik_net.c index 2731165..4ecb7ce 100644 --- a/src/espik_net.c +++ b/src/espik_net.c @@ -11,6 +11,7 @@ #include "espik_common_handler.h" #include "espik_error.h" #include "espik_debug.h" +#include "espik_irc.h" #include "espik.h" typedef int (*Handler_Func) (void* data, int ev_type, void* ev); @@ -113,27 +114,23 @@ void espik_con_shutdown () void espik_raw_send (char *msg) { - int len; - char* out; + buf_t buf; espik_enter(); - len = strlen (msg) + 3; + buf = make_buffer (strlen(msg) + 3); - out = malloc (sizeof (char) * len); + snprintf (buf.buf, buf.len, "%s\r\n", msg); - snprintf (out, len, "%s\r\n", msg); - - espik_debug_print ("msg: %s\nout: %s", msg, out); + espik_debug_print ("msg: %s\nout: %s", msg, buf.buf); /* printf ("out[len-3]: 0x%X\n", out[len - 3]); printf ("out[len-2]: 0x%X\n", out[len - 2]); printf ("out[len-1]: 0x%X\n", out[len - 1]); */ - ret = ecore_con_server_send (con_sock, out, strlen (out)); + ret = ecore_con_server_send (con_sock, buf.buf, buf.len); /* espik_debug_print ("%d", ret); */ - - free (out); + free (buf.buf); espik_leave(); } |