irctk

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

commit 7d27118e15d6e048b664363ff9c6d9f99e1f5ebd
parent a8b11d9063f34864b31e2b1bc570d6b585603e54
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 17 Jun 2012 01:42:10 +0200

initialize last_chan_in and last_chan_out at the right moment

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

diff --git a/TODO b/TODO @@ -3,4 +3,3 @@ handle nick following ssl support password support exit when killed, advertising the signal -listen on the right channel when we must '_' diff --git a/irctk.c b/irctk.c @@ -569,6 +569,8 @@ int do_cmd_msg(irc_session_t *s, char* chan, char* line) int rsl = -1; int is_local = 1; + debug("do_cmd_msg %s %s\n", chan, line); + /* TODOponey ask the server to notify, if possible */ /* TODO2 find a way to get real host name (part after !) */ @@ -640,6 +642,7 @@ int cmd_msg_chan(irc_session_t *s, char *target, char* line) char *one_target; int rsl; + debug("cmd_msg_chan %s %s\n", target, line); one_target = target; while (cont) @@ -668,6 +671,8 @@ int cmd_msg(irc_session_t *s, char* target, line l) int ret; char *msg[2*MAX_LEN+2]; + debug("cmd_msg %s %s, last_in %s", target, l.line, l.last_in); + /* Manage the fact that target may be "" */ if (!target[0]) { @@ -690,6 +695,7 @@ int cmd_msg(irc_session_t *s, char* target, line l) args.last_nick_in[0] = 0; } } + debug("will cmd_msg_chan %s %s\n", l.last_in, l.line); return cmd_msg_chan(s, l.last_in, l.line); case DEFAULT_LAST_OUT: @@ -1062,6 +1068,10 @@ int start (int max_wait) } } + // initialize last_chan_in and last_chan_out + strncpy(args.last_chan_in, first_chan(), MAX_LEN-1); + strncpy(args.last_chans_out, first_chan(), MAX_LEN-1); + while ((l = pop(&fifo_in)).line) { debug("startloop : got %s, waiting", l.line); if (!args.ready) { @@ -1129,10 +1139,6 @@ int main (int argc, char **argv) // parse command line arguments to set option values argp_parse (&argp, argc, argv, 0, 0, &args); - // initialize last_chan_in and last_chan_out - strncpy(args.last_chan_in, first_chan(), MAX_LEN-1); - strncpy(args.last_chans_out, first_chan(), MAX_LEN-1); - // initialize the fifo init(&fifo_in);