irctk

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

commit 9817c66e4ea6f7673c36099e4669e1fc8c6bdf1d
parent 80700e1850ace429cada23e4a39abcb34902d49f
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 16 Jun 2012 18:56:09 +0200

separate on the first colon for channel passwords

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

diff --git a/irctk.c b/irctk.c @@ -398,7 +398,6 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) argp_usage (state); break; } - } return 0; } @@ -465,19 +464,19 @@ char* first_chan() int join_channel(irc_session_t *s, char* chan) { char *password = chan; - int pos = strlen(password); + int pos = 0; int ret; // find the password if the password indicates a chan (last ':') - while (pos >= 0 && password[pos] != ':') - pos--; - if (pos) { - password += pos + 1; + while (password[pos] != ':' && password[pos]) + pos++; + if (password[pos]) { chan[pos] = 0; + password += pos + 1; } else { password = NULL; } ret = irc_cmd_join (s, chan, password); - if (pos) + if (password) chan[pos] = ':'; return ret; }