From 360083dea8cdee61f61ef35ab65a70b67eba48d4 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 19 Nov 2001 20:37:55 +0000 Subject: [PATCH] Added /EXEC -level option. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2096 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/fe-exec.c | 14 ++++++++------ src/fe-common/core/fe-exec.h | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fe-common/core/fe-exec.c b/src/fe-common/core/fe-exec.c index e0a1b0ca..388f88ac 100644 --- a/src/fe-common/core/fe-exec.c +++ b/src/fe-common/core/fe-exec.c @@ -369,7 +369,7 @@ static void handle_exec(const char *args, GHashTable *optlist, WI_ITEM_REC *item) { PROCESS_REC *rec; - char *target; + char *target, *level; int notice, signum, interactive; /* check that there's no unknown options. we allowed them @@ -492,6 +492,9 @@ static void handle_exec(const char *args, GHashTable *optlist, rec->silent = g_hash_table_lookup(optlist, "-") != NULL; rec->name = g_strdup(g_hash_table_lookup(optlist, "name")); + level = g_hash_table_lookup(optlist, "level"); + rec->level = level == NULL ? MSGLEVEL_CLIENTNOTICE : level2bits(level); + rec->read_tag = g_input_add(rec->in, G_INPUT_READ, (GInputFunction) sig_exec_input_reader, rec); @@ -569,11 +572,10 @@ static void sig_exec_input(PROCESS_REC *rec, const char *text) 3, str, server, item); g_free(str); } else if (rec->target_item != NULL) { - printtext(NULL, rec->target_item->name, MSGLEVEL_CLIENTCRAP, - "%s", text); + printtext(NULL, rec->target_item->name, + rec->level, "%s", text); } else { - printtext_window(rec->target_win, MSGLEVEL_CLIENTCRAP, - "%s", text); + printtext_window(rec->target_win, rec->level, "%s", text); } } @@ -603,7 +605,7 @@ static void event_text(const char *data, SERVER_REC *server, EXEC_WI_REC *item) void fe_exec_init(void) { command_bind("exec", NULL, (SIGNAL_FUNC) cmd_exec); - command_set_options("exec", "!- interactive nosh +name out +msg +notice +in window close"); + command_set_options("exec", "!- interactive nosh +name out +msg +notice +in window close +level"); signal_exec_input = signal_get_uniq_id("exec input"); signal_add("pidwait", (SIGNAL_FUNC) sig_pidwait); diff --git a/src/fe-common/core/fe-exec.h b/src/fe-common/core/fe-exec.h index 7f569ece..e82a4c7e 100644 --- a/src/fe-common/core/fe-exec.h +++ b/src/fe-common/core/fe-exec.h @@ -30,6 +30,7 @@ struct PROCESS_REC { LINEBUF_REC *databuf; int read_tag; + int level; /* what level to use when printing the text */ char *target; /* send text with /msg ... */ WINDOW_REC *target_win; /* print text to this window */ EXEC_WI_REC *target_item; /* print text to this exec window item */