irctk

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

commit 61415786e174985308afb1826d74859e8fa7ed7f
parent f6210bc9a3c5bab22f0aa89a30a57197b3f14956
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 16 Jun 2012 14:32:17 +0200

nick as default username and realname

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

diff --git a/irctk.c b/irctk.c @@ -141,10 +141,10 @@ static struct argp_option options[] = { PARSING}, {"username", 'U', "name", 0, - "Unix username (default: irctk)", + "Unix username (default: same as nick)", NAME}, {"realname", 'R', "name", 0, - "Full name (default: irctk)", + "Full name (default: same as nick)", NAME}, {"force-nick", 'N', 0, 0, //TODO "Don't give up if the nick is invalid (revert to default) or already taken (add trailing underscores)", @@ -181,6 +181,7 @@ struct arguments char *username; int username_set; // to get nick as default username char *realname; + int realname_set; // to get nick as default username int force_nick; int command; @@ -224,7 +225,8 @@ void initialize_args() args.username_set = 0; args.username = args.nick; - args.realname = "irctk"; + args.realname_set = 0; + args.realname = args.nick; args.force_nick = 0; args.filter = 0; @@ -272,6 +274,7 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) arguments->username = arg; break; case 'R': + arguments->realname_set = 1; arguments->realname = arg; break; case 'o': @@ -335,6 +338,8 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) arguments->nick = arguments->raw_dest; if (!arguments->username_set) arguments->username = arguments->raw_dest; + if (!arguments->realname_set) + arguments->realname = arguments->raw_dest; arguments->password = arguments->raw_dest + i + 1; saw_pass = i; } @@ -347,6 +352,8 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) arguments->nick = arguments->raw_dest; if (!arguments->username_set) arguments->username = arguments->raw_dest; + if (!arguments->realname_set) + arguments->realname = arguments->raw_dest; saw_pass = i; } saw_login = i;