diff isshouni.js @ 5:4a063df30be9

Correctly exit.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 23 Feb 2012 21:47:21 +0100
parents e6f5077c2ea9
children 377a9b42226a
line wrap: on
line diff
--- a/isshouni.js
+++ b/isshouni.js
@@ -48,6 +48,9 @@ var disconnect = function() {
   cl.send(new xmpp.Element('presence', {to: config.muc + '/' + config.nick, type: 'unavailable'}));
   process.stdin.end();
   cl.end();
+
+  tty.setRawMode(false);
+  setTimeout(process.exit, 1000);
 };
 
 var send_message = function(name, arg, type) {
@@ -126,10 +129,10 @@ var on_presence = function(from, stanza)
   if (!connected)
     return;
 
-  console.log('New participant: ' + from.resource);
+  /*console.log('New participant: ' + from.resource);
 
   if (paused)
-    send_message('paused', undefined, 'chat');
+    send_message('paused', undefined, 'chat');*/
 };
 
 cl.on('error', function(e) {
@@ -149,9 +152,7 @@ var commands = {
     return 'pause';
   },
   'q': function() {
-    tty.setRawMode(false);
     disconnect();
-    process.exit();
     return 'quit';
   },
 };