changeset 6:377a9b42226a default tip

Add logging fonctions and don’t listen to messages from the room itself.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 23 Feb 2012 23:51:31 +0100
parents 4a063df30be9
children
files isshouni.js
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/isshouni.js
+++ b/isshouni.js
@@ -73,7 +73,7 @@ var send_command = function(text) {
 };
 
 cl.on('stanza', function(stanza) {
-  //console.log(stanza.toString());
+  console.log(stanza.toString());
 
   var type = stanza.attrs['type'];
   var from = new JID(stanza.attrs['from']);
@@ -97,7 +97,7 @@ cl.on('stanza', function(stanza) {
 });
 
 var on_message = function(from, stanza) {
-  if (from.resource === config.nick)
+  if (from.resource && from.resource === config.nick)
     return;
 
   var message = stanza.getChild('body');
@@ -110,7 +110,7 @@ var on_message = function(from, stanza) 
   if (!payload)
     return;
 
-  //send_command('osd_show_text "' + from.resource + ' did ' + payload.name + '"');
+  send_command('osd_show_text "' + from.resource + ' did ' + payload.name + '"');
 
   if (payload.name === 'pause') {
     send_command('pause');