diff mcabber/src/main.c @ 1359:7daf906fbcdc

The command /quit can be used in bindings, hooks and sourced files (It used to work in bindings only)
author Mikael Berthe <mikael@lilotux.net>
date Sun, 11 Nov 2007 13:05:57 +0100
parents d1d12a09b04a
children 6d4770f35ddd
line wrap: on
line diff
--- a/mcabber/src/main.c	Sun Nov 11 12:22:41 2007 +0100
+++ b/mcabber/src/main.c	Sun Nov 11 13:05:57 2007 +0100
@@ -51,6 +51,8 @@
 # define WAIT_ANY -1
 #endif
 
+static unsigned int terminate_ui;
+
 static struct termios *backup_termios;
 
 char *mcabber_version(void)
@@ -336,6 +338,11 @@
 #endif /* HAVE_GPGME */
 }
 
+void mcabber_set_terminate_ui(void)
+{
+  terminate_ui = TRUE;
+}
+
 int main(int argc, char **argv)
 {
   char *configFile = NULL;
@@ -472,12 +479,12 @@
 
   scr_LogPrint(LPRINT_DEBUG, "Entering into main loop...");
 
-  for (ret = 0 ; ret != 255 ; ) {
+  while (!terminate_ui) {
     scr_DoUpdate();
     scr_Getch(&kcode);
 
     if (kcode.value != ERR) {
-      ret = process_key(kcode);
+      process_key(kcode);
     } else {
       scr_CheckAutoAway(FALSE);