changeset 101:4f3ad00b5187

[/trunk] Changeset 115 by mikael * Remove trailing spaces in commands * Fix a bug in last change related to completion (didn't compile)
author mikael
date Thu, 21 Apr 2005 17:31:28 +0000
parents 8fedef290c4e
children 2b4cc6bc5bf2
files mcabber/src/commands.c mcabber/src/screen.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/commands.c	Thu Apr 21 17:21:49 2005 +0000
+++ b/mcabber/src/commands.c	Thu Apr 21 17:31:28 2005 +0000
@@ -120,10 +120,20 @@
 // currently selected buddy.
 int process_line(char *line)
 {
+  char *p;
   if (*line != '/') {
     send_message(line); // FIXME: are we talking to a _buddy_?
     return 0;
   }
+
+  /* It is a command */
+  // Remove trailing spaces:
+  for (p=line ; *p ; p++)
+    ;
+  for (p-- ; p>line && (*p == ' ') ; p--)
+    *p = 0;
+
+  // Command "quit"?
   if (!strcasecmp(line, "/quit")) {
     return 255;
   }
--- a/mcabber/src/screen.c	Thu Apr 21 17:21:49 2005 +0000
+++ b/mcabber/src/screen.c	Thu Apr 21 17:31:28 2005 +0000
@@ -636,8 +636,8 @@
   if (row == -1) return;    // No completion if no leading slash
 
   if (row == 0) {   // Command completion
+    const char *cchar;
     if (!completion_started) {
-      const char *cchar;
       GSList *list = compl_get_category_list(COMPL_CMD);
       if (list) {
         char *prefix = g_strndup(&inputLine[1], ptr_inputline-inputLine-1);