diff options
author | Timo Sirainen <cras@irssi.org> | 2000-12-03 04:43:53 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-12-03 04:43:53 +0000 |
commit | b3a642e548724ff131ae2bb86bbbb6d80308483b (patch) | |
tree | 4e5185eaea4e252e44da7b5736eb5eac083d201f /src | |
parent | c8a90566caa3bd2d81d4348708c5019036267065 (diff) | |
download | irssi-b3a642e548724ff131ae2bb86bbbb6d80308483b.zip |
command() doesn't need cmdchar at start of command anymore.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@937 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/perl/common/Window.xs | 8 | ||||
-rw-r--r-- | src/perl/perl-common.c | 16 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/perl/common/Window.xs b/src/perl/common/Window.xs index f518b1dd..dec58b42 100644 --- a/src/perl/common/Window.xs +++ b/src/perl/common/Window.xs @@ -48,7 +48,7 @@ command(cmd, server=active_win->active_server, item=active_win->active) Irssi::Server server Irssi::Windowitem item CODE: - signal_emit("send command", 3, cmd, server, item); + perl_command(cmd, server, item); Irssi::Window window_find_name(name) @@ -101,7 +101,7 @@ command(server, cmd, item=active_win->active) CODE: if (item != NULL && item->server != SERVER(server)) item = NULL; - signal_emit("send command", 3, cmd, server, item); + perl_command(cmd, server, item); void print(server, channel, str, level) @@ -181,7 +181,7 @@ command(window, cmd, server=window->active_server, item=window->active) Irssi::Server server Irssi::Windowitem item CODE: - signal_emit("send command", 3, cmd, server, item); + perl_command(cmd, server, item); void window_item_add(window, item, automatic) @@ -281,7 +281,7 @@ command(item, cmd) Irssi::Windowitem item char *cmd CODE: - signal_emit("send command", 3, cmd, item->server, item); + perl_command(cmd, item->server, item); Irssi::Window window_create(item, automatic) diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index d6e6192d..b1a6e2f7 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -30,6 +30,7 @@ #include "module.h" #include "modules.h" #include "signals.h" +#include "settings.h" #include "chat-protocols.h" #include "servers.h" @@ -189,6 +190,21 @@ void printformat_perl(TEXT_DEST_REC *dest, char *format, char **arglist) g_free(module); } +void perl_command(const char *cmd, SERVER_REC *server, WI_ITEM_REC *item) +{ + const char *cmdchars; + char *sendcmd = (char *) cmd; + + cmdchars = settings_get_str("cmdchars"); + if (strchr(cmdchars, *cmd) == NULL) { + /* no command char - let's put it there.. */ + sendcmd = g_strdup_printf("%c%s", *cmdchars, cmd); + } + + signal_emit("send command", 3, cmd, server, item); + if (sendcmd != cmd) g_free(sendcmd); +} + static void perl_register_protocol(CHAT_PROTOCOL_REC *rec) { static char *items[] = { |