# HG changeset patch # User Emmanuel Gil Peyrot # Date 1330026252 -3600 # Node ID 0082e861cf16ad7702ab24207b54b1274bd0b564 # Parent 88eb49491a1edb85f22515aa7a03906728461af1 Fix text message handling and new participant. diff --git a/isshouni.js b/isshouni.js --- a/isshouni.js +++ b/isshouni.js @@ -83,10 +83,10 @@ cl.on('stanza', function(stanza) { return; if (stanza.is('presence') && type !== 'unavailable') - return on_presence(stanza); + return on_presence(from, stanza); if (stanza.is('message')) - return on_message(stanza); + return on_message(from, stanza); }); var on_message = function(from, stanza) { @@ -95,7 +95,9 @@ var on_message = function(from, stanza) var message = stanza.getChild('body'); if (message) - send_command('osd_show_text "' + from.resource + ': ' + message.getText() + '"'); + message = message.getText(); + if (message) + send_command('osd_show_text "' + from.resource + ': ' + message + '"'); var payload = stanza.getChild(null, 'urn:linkmauve:player'); if (!payload) @@ -117,6 +119,13 @@ var on_presence = function(from, stanza) connected = true; return; } + if (!connected) + return; + + console.log('New participant: ' + from.resource); + + if (paused) + send_message('paused', undefined, 'chat'); }; cl.on('error', function(e) {