diff options
author | beber <beber> | 2005-12-07 14:48:53 +0000 |
---|---|---|
committer | beber <beber> | 2005-12-07 14:48:53 +0000 |
commit | 2035bb64f7775c24f865bf29be1f458e8dfae932 (patch) | |
tree | b79d426dcff309bee32f568dd23ff3ce8a77e7e0 /src/espik_irc.c | |
parent | don't use valgrind (diff) | |
download | espik-2035bb64f7775c24f865bf29be1f458e8dfae932.tar.xz |
use espik_debug_print everywhere
more ignore
corect debug macro when there is no arguments
some indent
some // -> /* */
add a macro for fd output (stderr, stdout)
include debug
and so ..
Diffstat (limited to 'src/espik_irc.c')
-rw-r--r-- | src/espik_irc.c | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/src/espik_irc.c b/src/espik_irc.c index a87f904..731d7ad 100644 --- a/src/espik_irc.c +++ b/src/espik_irc.c @@ -3,14 +3,15 @@ #include <stdio.h> #include <Ecore.h> -//#include <Ecore_Con.h> +/*#include <Ecore_Con.h>*/ #include "espik_global.h" #include "espik_irc.h" #include "espik_error.h" -//#include "espik_common_handler.h" +/*#include "espik_common_handler.h"*/ #include "espik.h" #include "espik_net.h" +#include "espik_debug.h" char* current_chan; @@ -75,9 +76,7 @@ void string_upper (char *str) if (str[i] >= 0x61 && str[i] <= 0x7A) str[i] -= 0x20; } -#if _ESPIK_DEBUG_ - printf("string_upper: %s\n", str); -#endif + espik_debug_print ("string_upper: %s", str); } #endif @@ -101,8 +100,8 @@ char* irc_privmsg (char* chan, char* msg) buf_t out; out = make_buffer (strlen ("PRIVMSG") + 1 /* "PRIVMSG " */ - + strlen (chan) + 2 /* ":<channel> " */ - + strlen (msg) + 1); /* "<msg>EOF" */ + + strlen (chan) + 2 /* ":<channel> " */ + + strlen (msg) + 1); /* "<msg>EOF" */ snprintf (out.buf, out.len, "PRIVMSG %s :%s", chan, msg); @@ -113,17 +112,17 @@ char* irc_join (char* chan __UNUSED__, char* msg) { buf_t out; - /* COuld also by '&' and so one ... + /* Could also by '&' and so one ... * have to look on RFC, dev will be done with # only */ if (msg[0] != '#') { - printf ("%s is not a channel\n", msg); - printf ("Usage: /JOIN #channel\n"); + espik_debug_print ("%s is not a channel", msg); + espik_debug_print ("Usage: /JOIN #channel"); return (0); } out = make_buffer (strlen ("JOIN") + 1 /* "JOIN " */ - + strlen (msg) + 1); /* "<msg>EOF" */ + + strlen (msg) + 1); /* "<msg>EOF" */ snprintf (out.buf, out.len, "JOIN %s", msg); @@ -137,8 +136,8 @@ char* irc_part (char* chan, char* msg) if (msg[0] != '#') { out = make_buffer (strlen ("PART") + 1 /* "PART " */ - + strlen (chan) + 2 /* ":<chan> " */ - + strlen (msg) + 1); /* "<msg>EOF" */ + + strlen (chan) + 2 /* ":<chan> " */ + + strlen (msg) + 1); /* "<msg>EOF" */ snprintf (out.buf, out.len, "PART %s :%s", chan, msg); } @@ -148,9 +147,9 @@ char* irc_part (char* chan, char* msg) sep = separate_commandline (msg); - out = make_buffer (strlen ("PART") + 1 /* "PART " */ - + strlen (sep[0]) + 2 /* ":<chan> " */ - + strlen (sep[1]) + 1); /* "<msg>EOF" */ + out = make_buffer (strlen ("PART") + 1 /* "PART " */ + + strlen (sep[0]) + 2 /* ":<chan> " */ + + strlen (sep[1]) + 1); /* "<msg>EOF" */ snprintf (out.buf, out.len, "PART %s :%s", sep[0], sep[1]); } @@ -163,13 +162,11 @@ char* irc_quit (char* chan __UNUSED__, char* msg) buf_t out; out = make_buffer (strlen ("QUIT") + 2 /* "QUIT :" */ - + strlen (msg) + 1); /* "<msg>EOF" */ + + strlen (msg) + 1); /* "<msg>EOF" */ snprintf (out.buf, out.len, "QUIT :%s", msg); -#if _ESPIK_DEBUG_ - printf ("msg : %s\nout: %s\n", msg, out.buf); -#endif + espik_debug_print ("msg : %s\nout: %s", msg, out.buf); /* espik_raw_send (out); @@ -191,13 +188,11 @@ char* irc_nick (char* chan __UNUSED__, char* nick) buf_t out; out = make_buffer (strlen ("NICK") + 1 /* "NICK " */ - + strlen (nick) + 1); /* "<nick>EOF" */ + + strlen (nick) + 1); /* "<nick>EOF" */ snprintf (out.buf, out.len, "NICK %s", nick); -#if _ESPIK_DEBUG_ - printf ("NICK CHANGED REQUEST: %s\n", nick); -#endif + espik_debug_print ("NICK CHANGED REQUEST: %s", nick); return (out.buf); } @@ -210,9 +205,9 @@ Ecore_Con_Server* irc_connect (char* host __UNUSED__, int port __UNUSED__) void irc_disconnect (Ecore_Con_Server *sock) { - printf ("> irc_disconnect\n"); + espik_debug_print ("> irc_disconnect"); ecore_main_loop_quit (); - printf ("< irc_disconnect\n"); + espik_debug_print ("< irc_disconnect"); } #endif @@ -231,9 +226,7 @@ char* irc_send (char* msg) cmd_and_message = separate_commandline (msg + 1); -#if _ESPIK_DEBUG_ -/* printf ("irc_send: <separate_commandline\n"); */ -#endif +/* espik_debug_print ("irc_send: <separate_commandline"); */ /*string_upper (cmd_and_message[0]);*/ @@ -248,7 +241,7 @@ char* irc_send (char* msg) } if (!out) { - printf ("%s is not a know command\n", cmd_and_message[0]); + espik_debug_print ("%s is not a know command", cmd_and_message[0]); return (0); } } @@ -260,9 +253,7 @@ char* irc_send (char* msg) if (!out) return (0); -#if _ESPIK_DEBUG_ - printf ("%s\n", out); -#endif + espik_debug_print ("%sn", out); return (out); } |