commit f419a6d90e61b456e17ac56acfb07b2796d6e7c5
parent df352120811f241c9bddf6fb44d6f22edd6ec2fd
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Wed, 11 Jul 2012 22:17:55 +0200
command-to-event
Diffstat:
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/irctk.c b/irctk.c
@@ -149,9 +149,13 @@ static struct argp_option options[] = {
{"event-to-message", 'm', 0, 0,
"Translate server events to a human-readable description",
PARSING},
- /*{"no-command-to-event", 0, 0, 0,
+ {"command-to-event", 'e', 0, 0,
+ "Interpret messages starting with \"/quit\", \"/me\", etc. as commands"
+ " unless escaped (default)",
+ PARSING, },
+ {"no-command-to-event", 'E', 0, 0,
"Don't generate events from messages with \"/quit\", \"/me\"...",
- PARSING, }, */ // TODO
+ PARSING, },
{"username", 'U', "name", 0,
"Unix username (default: same as nick)",
@@ -192,6 +196,7 @@ struct arguments
int own;
enum event_tos event_to;
+ int command_to_event;
enum track track;
int join;
@@ -210,7 +215,6 @@ struct arguments
int show_nick_prefix;
int filter;
int prune;
- int command_to_event;
};
typedef struct arguments irc_ctx_t;
@@ -242,6 +246,7 @@ void initialize_args()
args.own = 0;
args.event_to = NOTHING;
+ args.command_to_event = 1;
args.track = NO;
args.join = 1;
@@ -256,7 +261,6 @@ void initialize_args()
args.last_chan_in[0] = 0;
args.last_nick_in[0] = 0;
args.last_chans_out[0] = 0;
- args.command_to_event = 1;
}
@@ -294,6 +298,12 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
case 'm':
arguments->event_to = MESSAGE;
break;
+ case 'E':
+ arguments->command_to_event = 0;
+ break;
+ case 'e':
+ arguments->command_to_event = 1;
+ break;
case 'i':
arguments->interval = (int) (atof(arg) * 1000000.);
break;