1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Added /EXEC -level option.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2096 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-11-19 20:37:55 +00:00 committed by cras
parent 0ffcbdc9b4
commit 360083dea8
2 changed files with 9 additions and 6 deletions

View File

@ -369,7 +369,7 @@ static void handle_exec(const char *args, GHashTable *optlist,
WI_ITEM_REC *item) WI_ITEM_REC *item)
{ {
PROCESS_REC *rec; PROCESS_REC *rec;
char *target; char *target, *level;
int notice, signum, interactive; int notice, signum, interactive;
/* check that there's no unknown options. we allowed them /* 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->silent = g_hash_table_lookup(optlist, "-") != NULL;
rec->name = g_strdup(g_hash_table_lookup(optlist, "name")); 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, rec->read_tag = g_input_add(rec->in, G_INPUT_READ,
(GInputFunction) sig_exec_input_reader, (GInputFunction) sig_exec_input_reader,
rec); rec);
@ -569,11 +572,10 @@ static void sig_exec_input(PROCESS_REC *rec, const char *text)
3, str, server, item); 3, str, server, item);
g_free(str); g_free(str);
} else if (rec->target_item != NULL) { } else if (rec->target_item != NULL) {
printtext(NULL, rec->target_item->name, MSGLEVEL_CLIENTCRAP, printtext(NULL, rec->target_item->name,
"%s", text); rec->level, "%s", text);
} else { } else {
printtext_window(rec->target_win, MSGLEVEL_CLIENTCRAP, printtext_window(rec->target_win, rec->level, "%s", text);
"%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) void fe_exec_init(void)
{ {
command_bind("exec", NULL, (SIGNAL_FUNC) cmd_exec); 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_exec_input = signal_get_uniq_id("exec input");
signal_add("pidwait", (SIGNAL_FUNC) sig_pidwait); signal_add("pidwait", (SIGNAL_FUNC) sig_pidwait);

View File

@ -30,6 +30,7 @@ struct PROCESS_REC {
LINEBUF_REC *databuf; LINEBUF_REC *databuf;
int read_tag; int read_tag;
int level; /* what level to use when printing the text */
char *target; /* send text with /msg <target> ... */ char *target; /* send text with /msg <target> ... */
WINDOW_REC *target_win; /* print text to this window */ WINDOW_REC *target_win; /* print text to this window */
EXEC_WI_REC *target_item; /* print text to this exec window item */ EXEC_WI_REC *target_item; /* print text to this exec window item */