]> git.babelmonkeys.de Git - xmppchat.git/blobdiff - js/main.js
Separate config
[xmppchat.git] / js / main.js
index 857dc258418421771bf40b6d4582fdb4c608e962..c64776da37ac3b9bcffbce38cf17703797323adb 100644 (file)
@@ -1,7 +1,3 @@
-var BOSH_LOCATION = '/http-bind/';
-var room = 'guests@conference.babelmonkeys.de';
-var jid = 'muckl@babelmonkeys.de'
-var password = 'ooje0OjuJeekaek6';
 var connection = null;
 var nickname;
 
@@ -63,7 +59,7 @@ function addBubble(nick) {
        if (!document.getElementById(id)) {
                var div = '';
                div += '<div id="' + id + '" class="bubble" onmousedown="startDrag(this)" style="display: none">';
-               div += '<a href="#" onclick="' +"document.getElementById('" + id + "').style.display='none'" + '">Close</a>';
+               div += '<a href="#" onclick="' +"$('#" + id + "').hide('slow')" + '">Close</a>';
                div += '<div id="' + id + 'Chat" class="bubbleChat"></div>';
                div += '<form id="' + id + 'Form" class="bubbleForm" onsubmit="return sendChatMessage(this,' + "'" + nick + "');" + '" action="#">';
                div += '<input type="text" name="text" id="' + id + 'Text" class="bubbleForm"/>';
@@ -112,8 +108,10 @@ function handlePresence(presence) {
        if (type == 'unavailable') {
                element = document.getElementById(nick);
                roster_list.removeChild(element);
+               $('#chat').append('<div class="msg"><span class="server">' + nick + ' left the groupchat</span></div>');
        } else {
                roster_list.innerHTML += '<li id="' + nick + '" onclick="addBubble(' + "'" + nick + "')" + '" >' + nick + '</li>';
+               $('#chat').append('<div class="msg"><span class="server">' + nick + ' joined the groupchat</span></div>');
        }
 
        return true;
@@ -123,9 +121,10 @@ function handleIQ(iq) {
        var to = iq.getAttribute('to');
        var from = iq.getAttribute('from');
        var type = iq.getAttribute('type');
-       var content = iq.childNodes;
 
-       var reply = $iq({to: from, from: to, type: 'error'}).cnode(content).up().c('error', {type: 'cancel'}).c('feature-not-implemented', {xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'});
+       //FIXME: Clients SHOULD send the content of the original stanza back for analysis
+
+       var reply = $iq({to: from, from: to, type: 'error'}).c('error', {type: 'cancel'}).c('feature-not-implemented', {xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'});
 
        connection.send(reply.tree());