irctk

libircclient binding for scripts
git clone https://a3nm.net/git/irctk/
Log | Files | Refs | README

commit 8b7d9df46eca6db192b30b7155fccb5883835fe4
parent 7e97056e3e552aa01dd0513336ec79ef5e804efe
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 16 Jun 2012 16:55:07 +0200

escaping

Diffstat:
irctk.c | 15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/irctk.c b/irctk.c @@ -35,9 +35,7 @@ enum default_destinations {DEFAULT_FIRST, DEFAULT_LAST_IN, DEFAULT_LAST_OUT, DEFAULT_ALL}; -#define NOTHING 0 -#define COMMAND 1 -#define MESSAGE 2 +enum event_tos {NOTHING, COMMAND, MESSAGE}; // TODO get rid of that #define MAX_LEN 4096 @@ -173,7 +171,7 @@ struct arguments int with_host; int own; - int event_to; + enum event_tos event_to; char *username; int username_set; // to get nick as default username @@ -797,8 +795,6 @@ void dcc_file_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void event_channel (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count) { - //TODO if event_to == COMMAND, escape with "/ /blah" - int i=0; int ok = 1, ok2; const char* pruned; @@ -825,7 +821,10 @@ void event_channel (irc_session_t * session, const char * event, const char * or /* TODO not robust, and useless since we use STRIPNICKS */ //while(origin[i++] != '!') putchar(origin[i-1]); printf("%s", origin); - printf("> %s\n", params[1] ); + printf("> "); + if (params[1][0] == '/' && args.event_to == COMMAND) + printf("/ "); // escape slashes + printf("%s\n", params[1] ); } else { pruned = params[1]; ok2 = 1; @@ -1015,8 +1014,6 @@ int start (int max_wait) while (waiting < max_wait && !args.ready) { debug("waiting (%d)", waiting); - // TODO manage timeouts, try reconnects, handle errors, etc. - // TODO manage duplicate pseudos sleep(1); waiting++; }