Mercurial > ~mikael > mcabber > hg
diff mcabber/src/commands.c @ 1187:16abe7ec3056
Fix a conflict between verbatim multiline mode and the key binding system
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Fri, 20 Apr 2007 17:14:38 +0200 |
parents | 807815928754 |
children | be06bbe7e449 |
line wrap: on
line diff
--- 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}