summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-04-12 19:45:59 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-04-12 19:45:59 +0000
commitd5c15a8ee394ca824fe13f0ab99f55cf2a6bba59 (patch)
treefcca9d66c1dd44eecef24dcf208d838920bff52d
parentdfed19a3c8d69dc3f0bac4afbf068868b2bc1be4 (diff)
downloadirssi-d5c15a8ee394ca824fe13f0ab99f55cf2a6bba59.zip
/EXEC -out now sends /msg -nick | -channel so it works properly with silc
channels. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2668 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/core/fe-exec.c16
-rw-r--r--src/fe-common/core/fe-exec.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/fe-common/core/fe-exec.c b/src/fe-common/core/fe-exec.c
index 80972634..bfc75465 100644
--- a/src/fe-common/core/fe-exec.c
+++ b/src/fe-common/core/fe-exec.c
@@ -28,6 +28,9 @@
#include "misc.h"
#include "levels.h"
+#include "channels.h"
+#include "queries.h"
+
#include "printtext.h"
#include "fe-exec.h"
#include "fe-windows.h"
@@ -370,7 +373,7 @@ static void handle_exec(const char *args, GHashTable *optlist,
{
PROCESS_REC *rec;
char *target, *level;
- int notice, signum, interactive;
+ int notice, signum, interactive, target_nick, target_channel;
/* check that there's no unknown options. we allowed them
because signals can be used as options, but there should be
@@ -403,11 +406,14 @@ static void handle_exec(const char *args, GHashTable *optlist,
return;
/* common options */
+ target_channel = target_nick = FALSE;
if (g_hash_table_lookup(optlist, "out") != NULL) {
/* redirect output to active channel/query */
if (item == NULL)
cmd_return_error(CMDERR_NOT_JOINED);
- target = item->name;
+ target = item->name;
+ target_channel = IS_CHANNEL(item);
+ target_nick = IS_QUERY(item);
} else if (g_hash_table_lookup(optlist, "msg") != NULL) {
/* redirect output to /msg <nick> */
target = g_hash_table_lookup(optlist, "msg");
@@ -487,6 +493,8 @@ static void handle_exec(const char *args, GHashTable *optlist,
rec->id = process_get_new_id();
rec->target = g_strdup(target);
rec->target_win = active_win;
+ rec->target_channel = target_channel;
+ rec->target_nick = target_nick;
rec->args = g_strdup(args);
rec->notice = notice;
rec->silent = g_hash_table_lookup(optlist, "-") != NULL;
@@ -572,7 +580,9 @@ static void sig_exec_input(PROCESS_REC *rec, const char *text)
server = item != NULL ? item->server :
active_win->active_server;
- str = g_strconcat(rec->target, " ", text, NULL);
+ str = g_strconcat(rec->target_nick ? "-nick " :
+ rec->target_channel ? "-channel " : "",
+ rec->target, " ", text, NULL);
signal_emit(rec->notice ? "command notice" : "command msg",
3, str, server, item);
g_free(str);
diff --git a/src/fe-common/core/fe-exec.h b/src/fe-common/core/fe-exec.h
index bebd1f82..a3b7edee 100644
--- a/src/fe-common/core/fe-exec.h
+++ b/src/fe-common/core/fe-exec.h
@@ -38,6 +38,8 @@ struct PROCESS_REC {
unsigned int shell:1; /* start the program via /bin/sh */
unsigned int notice:1; /* send text with /notice, not /msg if target is set */
unsigned int silent:1; /* don't print "process exited with level xx" */
+ unsigned int target_channel:1; /* target is a channel */
+ unsigned int target_nick:1; /* target is a nick */
};
extern GSList *processes;