irctk

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

commit 01f2608e4a80191ecef7274befa3292162211dbe
parent 69173382103ad5ad24aab5535ee8e081e91c7669
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed, 11 Jul 2012 23:22:44 +0200

better -f and -F

Diffstat:
TODO | 1+
irctk.c | 21+++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/TODO b/TODO @@ -1,4 +1,5 @@ irc_color_convert_to_mirc +DCC Remove UUOCs in readme ssl support password support diff --git a/irctk.c b/irctk.c @@ -1470,13 +1470,18 @@ void event_channel (irc_session_t *session, const char *event, if (args.filter) if (strcmp(params[0], args.nick)) { - for (i=0; i<strlen(args.nick); i++) - if (args.nick[i] != params[1][i] || !params[1][i]) { + int len = strlen(args.nick); + int offset = 0; + while (params[1][offset] == ' ') + offset++; + for (i=0; i<len; i++) + if (args.nick[i] != params[1][offset + i] || !params[1][offset + i]) { ok = 0; break; } - /* TODO test that the address ends with ',', ':', ' ', - * otherwise prefix nicks can match */ + if (params[1][offset + len] != ':' && params[1][offset + len] != ' ' && params[1][offset + len] != ',') { + ok = 0; + } } if (ok) { @@ -1494,8 +1499,9 @@ void event_channel (irc_session_t *session, const char *event, printf("%s\n", params[1] ); } else { pruned = params[1]; + while (pruned[0] == ' ') pruned++; ok2 = 1; - while(pruned[0] != ':') { + while(pruned[0] != ':' && pruned[0] != ',' && pruned[0] != ' ') { if (!pruned[0] || pruned[0] == ' ') { ok2 = 0; break; @@ -1534,7 +1540,6 @@ void event_privmsg (irc_session_t *session, const char *event, saw_user(origin); manage_event(session, event, origin, params, count); - /* TODO sure? */ event_channel (session, event, origin, params, count); } @@ -1574,9 +1579,6 @@ irc_session_t* do_connect() callbacks.event_unknown = manage_event; callbacks.event_numeric = event_numeric; - //TODO callbacks.event_dcc_chat_req = irc_event_dcc_chat; - //TODO callbacks.event_dcc_send_req = irc_event_dcc_send; - s = irc_create_session (&callbacks); if (!s) @@ -1601,7 +1603,6 @@ irc_session_t* do_connect() static void* irc_thread (void *arg) { irc_session_t * sp = (irc_session_t *) arg; - // TODO, also do you need '#' or not? // TODO when SSL will be supported // irc_option_set(sp, LIBIRC_OPTION_SSL_NO_VERIFY); irc_run(sp);