--- a/mcabber/src/commands.c Fri Apr 20 16:35:39 2007 +0200
+++ b/mcabber/src/commands.c Fri Apr 20 17:14:38 2007 +0200
@@ -355,17 +355,19 @@
}
}
-// process_command(line)
+// process_command(line, iscmd)
// Process a command line.
+// If iscmd is TRUE, process the command even if verbatim mmode is set;
+// it is intended to be used for key bindings.
// Return 255 if this is the /quit command, and 0 for the other commands.
-int process_command(char *line)
+int process_command(char *line, guint iscmd)
{
char *p;
char *xpline;
cmd *curcmd;
// We do alias expansion here
- if (scr_get_multimode() != 2)
+ if (iscmd || scr_get_multimode() != 2)
xpline = expandalias(line);
else
xpline = line; // No expansion in verbatim multi-line mode
@@ -381,7 +383,7 @@
*p = 0;
// Command "quit"?
- if ((scr_get_multimode() != 2)
+ if ((iscmd || scr_get_multimode() != 2)
&& (!strncasecmp(xpline, mkcmdstr("quit"), strlen(mkcmdstr("quit"))))) {
if (!xpline[5] || xpline[5] == ' ') {
g_free(xpline);
@@ -390,7 +392,7 @@
}
// If verbatim multi-line mode, we check if another /msay command is typed
- if ((scr_get_multimode() == 2)
+ if (!iscmd && scr_get_multimode() == 2
&& (strncasecmp(xpline, mkcmdstr("msay "), strlen(mkcmdstr("msay "))))) {
// It isn't an /msay command
scr_append_multiline(xpline);
@@ -455,8 +457,8 @@
return 0;
}
- /* It is (probably) a command -- except for verbatim multi-line mode */
- return process_command(line);
+ /* It is _probably_ a command -- except for verbatim multi-line mode */
+ return process_command(line, FALSE);
}
// Helper routine for buffer item_{lock,unlock}
--- a/mcabber/src/commands.h Fri Apr 20 16:35:39 2007 +0200
+++ b/mcabber/src/commands.h Fri Apr 20 17:14:38 2007 +0200
@@ -14,7 +14,7 @@
void cmd_init(void);
cmd *cmd_get(const char *command);
int process_line(char *line);
-int process_command(char *line);
+int process_command(char *line, guint iscmd);
char *expandalias(char *line);
extern char *mcabber_version(void);
--- a/mcabber/src/screen.c Fri Apr 20 16:35:39 2007 +0200
+++ b/mcabber/src/screen.c Fri Apr 20 17:14:38 2007 +0200
@@ -2632,7 +2632,7 @@
{
// Validate current multi-line
if (scr_get_multimode())
- process_command(mkcmdstr("msay send"));
+ process_command(mkcmdstr("msay send"), TRUE);
}
// which_row()
@@ -2891,7 +2891,7 @@
{
if (!Curses) return;
// Leave multi-line mode
- process_command(mkcmdstr("msay abort"));
+ process_command(mkcmdstr("msay abort"), TRUE);
// Same as Ctrl-g, now
scr_cancel_current_completion();
scr_end_current_completion();
@@ -3084,7 +3084,7 @@
boundcmd_locale = from_utf8(boundcmd);
cmdline = g_strdup_printf(mkcmdstr("%s"), boundcmd_locale);
scr_CheckAutoAway(TRUE);
- if (process_command(cmdline))
+ if (process_command(cmdline, TRUE))
return 255; // Quit
g_free(boundcmd_locale);
g_free(cmdline);
--- a/mcabber/src/settings.c Fri Apr 20 16:35:39 2007 +0200
+++ b/mcabber/src/settings.c Fri Apr 20 17:14:38 2007 +0200
@@ -147,7 +147,7 @@
// Set the leading COMMAND_CHAR to build a command line
// and process the command
*(--line) = COMMAND_CHAR;
- process_command(line);
+ process_command(line, TRUE);
} else {
scr_LogPrint(LPRINT_LOGNORM,
"Error in configuration file (l. %d): no assignment", ln);