summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/chat-commands.c43
-rw-r--r--src/fe-common/core/window-commands.c18
2 files changed, 47 insertions, 14 deletions
diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c
index 69c2fc91..e86fdf9d 100644
--- a/src/core/chat-commands.c
+++ b/src/core/chat-commands.c
@@ -438,41 +438,66 @@ static void cmd_foreach(const char *data, SERVER_REC *server,
/* SYNTAX: FOREACH SERVER <command> */
static void cmd_foreach_server(const char *data, SERVER_REC *server)
{
- GSList *list;
+ GSList *list;
+ const char *cmdchars;
+ char *str;
+
+ cmdchars = settings_get_str("cmdchars");
+ str = strchr(cmdchars, *data) != NULL ? g_strdup(data) :
+ g_strdup_printf("%c%s", *cmdchars, data);
list = g_slist_copy(servers);
while (list != NULL) {
- signal_emit("send command", 3, data, list->data, NULL);
- list = g_slist_remove(list, list->data);
+ signal_emit("send command", 3, str, list->data, NULL);
+ list = g_slist_remove(list, list->data);
}
+
+ g_free(str);
}
/* SYNTAX: FOREACH CHANNEL <command> */
static void cmd_foreach_channel(const char *data)
{
- GSList *list;
+ GSList *list;
+ const char *cmdchars;
+ char *str;
+
+ cmdchars = settings_get_str("cmdchars");
+ str = strchr(cmdchars, *data) != NULL ? g_strdup(data) :
+ g_strdup_printf("%c%s", *cmdchars, data);
list = g_slist_copy(channels);
while (list != NULL) {
CHANNEL_REC *rec = list->data;
- signal_emit("send command", 3, data, rec->server, rec);
- list = g_slist_remove(list, list->data);
+ signal_emit("send command", 3, str, rec->server, rec);
+ list = g_slist_remove(list, list->data);
}
+
+ g_free(str);
}
/* SYNTAX: FOREACH QUERY <command> */
static void cmd_foreach_query(const char *data)
{
- GSList *list;
+ GSList *list;
+ const char *cmdchars;
+ char *str;
+
+ cmdchars = settings_get_str("cmdchars");
+ str = strchr(cmdchars, *data) != NULL ? g_strdup(data) :
+ g_strdup_printf("%c%s", *cmdchars, data);
+
list = g_slist_copy(queries);
while (list != NULL) {
QUERY_REC *rec = list->data;
- signal_emit("send command", 3, data, rec->server, rec);
- list = g_slist_remove(list, list->data);
+ signal_emit("send command", 3, str, rec->server, rec);
+ list = g_slist_remove(list, list->data);
}
+
+ g_free(str);
}
void chat_commands_init(void)
diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c
index 9e4aab3a..57c81ac2 100644
--- a/src/fe-common/core/window-commands.c
+++ b/src/fe-common/core/window-commands.c
@@ -839,23 +839,31 @@ static void cmd_layout(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
/* SYNTAX: FOREACH WINDOW <command> */
static void cmd_foreach_window(const char *data)
{
- WINDOW_REC *old;
- GSList *list;
+ WINDOW_REC *old;
+ GSList *list;
+ const char *cmdchars;
+ char *str;
- old = active_win;
+ cmdchars = settings_get_str("cmdchars");
+ str = strchr(cmdchars, *data) != NULL ? g_strdup(data) :
+ g_strdup_printf("%c%s", *cmdchars, data);
+
+ old = active_win;
list = g_slist_copy(windows);
while (list != NULL) {
WINDOW_REC *rec = list->data;
active_win = rec;
- signal_emit("send command", 3, data, rec->active_server,
+ signal_emit("send command", 3, str, rec->active_server,
rec->active);
- list = g_slist_remove(list, list->data);
+ list = g_slist_remove(list, list->data);
}
if (g_slist_find(windows, old) != NULL)
active_win = old;
+
+ g_free(str);
}
void window_commands_init(void)