diff mcabber/mcabber/screen.c @ 2164:038c4d601011

Simplify handling of command '/quit'
author franky
date Fri, 17 Oct 2014 22:31:03 +0200
parents 798baf5db4eb
children db6ca1e1e082
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c	Fri Oct 17 22:15:46 2014 +0200
+++ b/mcabber/mcabber/screen.c	Fri Oct 17 22:31:03 2014 +0200
@@ -3680,12 +3680,11 @@
 //  readline_accept_line(down_history)
 // Validate current command line.
 // If down_history is true, load the next history line.
-int readline_accept_line(int down_history)
+void readline_accept_line(int down_history)
 {
   scr_check_auto_away(TRUE);
   last_activity_buddy = current_buddy;
-  if (process_line(inputLine))
-    return 255;
+  process_line(inputLine);
   // Add line to history
   scr_cmdhisto_addline(inputLine);
   // Reset the line
@@ -3703,7 +3702,6 @@
     // Reset history line pointer
     cmdhisto_cur = NULL;
   }
-  return 0;
 }
 
 //  readline_clear_history()
@@ -4335,7 +4333,7 @@
   doupdate();
 }
 
-static int bindcommand(keycode kcode)
+static void bindcommand(keycode kcode)
 {
   gchar asciikey[16], asciicode[16];
   const gchar *boundcmd;
@@ -4359,10 +4357,9 @@
   if (boundcmd) {
     gchar *cmdline = from_utf8(boundcmd);
     scr_check_auto_away(TRUE);
-    if (process_command(cmdline, TRUE))
-      return 255; // Quit
+    process_command(cmdline, TRUE);
     g_free(cmdline);
-    return 0;
+    return;
   }
 
   scr_LogPrint(LPRINT_NORMAL, "Unknown key=%s", asciikey);
@@ -4371,7 +4368,6 @@
     scr_LogPrint(LPRINT_NORMAL,
                  "WARNING: Compiled without full UTF-8 support!");
 #endif
-  return -1;
 }
 
 //  scr_process_key(key)
@@ -4392,10 +4388,7 @@
         break;
     case MKEY_META:
     default:
-        if (bindcommand(kcode) == 255) {
-          mcabber_set_terminate_ui();
-          return;
-        }
+        bindcommand(kcode);
         key = ERR; // Do not process any further
   }
 
@@ -4417,10 +4410,7 @@
         break;
     case 13:    // Enter
     case 343:   // Enter on Maemo
-        if (readline_accept_line(FALSE) == 255) {
-          mcabber_set_terminate_ui();
-          return;
-        }
+        readline_accept_line(FALSE);
         break;
     case 3:     // Ctrl-C
         scr_handle_CtrlC();
@@ -4467,10 +4457,8 @@
       check_offset(1);
     } else {
       // Look for a key binding.
-      if (!kcode.utf8 && (bindcommand(kcode) == 255)) {
-          mcabber_set_terminate_ui();
-          return;
-        }
+      if (!kcode.utf8)
+        bindcommand(kcode);
     }
   }