Index: lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as =================================================================== diff -u -r6071623eaaab7f58e5c1befe499b0fc1c76850dc -r0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c --- lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision 6071623eaaab7f58e5c1befe499b0fc1c76850dc) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/authoring/DesignDataModel.as (.../DesignDataModel.as) (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -647,7 +647,7 @@ * @return data obj */ - public static function getDataForInitializing(title:String, description:String, designID:Number, orgID:Number, lExportPortfolio:Boolean):Object{ + public static function getDataForInitializing(title:String, description:String, designID:Number, orgID:Number, lExportPortfolio:Boolean, enablePresence:Boolean, enableIm:Boolean):Object{ var data:Object = new Object(); if(title) { data.lessonName = title; } @@ -660,6 +660,12 @@ if(lExportPortfolio != null) { data.learnerExportPortfolio = lExportPortfolio } else { data.learnerExportPortfolio = false } + if(enablePresence != null) { data.enablePresence = enablePresence } + else { data.enablePresence = false } + + if(enableIm != null) { data.enableIm = enableIm } + else { data.enableIm = false } + data.copyType = COPY_TYPE_ID_RUN; return data; Index: lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Presence.as =================================================================== diff -u --- lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Presence.as (revision 0) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/learner/Presence.as (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,266 @@ +/*************************************************************************** + * Copyright (C) 2008 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ************************************************************************ + */ + +import org.lamsfoundation.lams.learner.*; +import org.lamsfoundation.lams.learner.ls.*; +import org.lamsfoundation.lams.common.Sequence; +import org.lamsfoundation.lams.common.ToolTip; +import org.lamsfoundation.lams.common.util.*; +import org.lamsfoundation.lams.common.dict.*; +import org.lamsfoundation.lams.common.style.*; +import org.lamsfoundation.lams.common.ApplicationParent; +import mx.controls.* +import mx.utils.* +import mx.managers.* +import mx.events.* + +class Presence extends MovieClip { + + //Height Properties + private var presenceHeightHide:Number = 20; + private var presenceHeightFull:Number = 217; + + //Open Close Identifier + private var _presenceIsExpanded:Boolean; + + //Presence stuff + private var selectedChatItem:Object; + private var lastClickX:Number; + private var lastClickY:Number; + private var clickInterval:Number; + private var dataGridInitialized:Boolean; + private var DOUBLECLICKSPEED:Number = 500; + private var chatDialog:MovieClip; + + //Component properties + private var _presence_mc:MovieClip; + private var presenceHead_pnl:MovieClip; + private var presenceTitle_lbl:Label; + private var presenceMinIcon:MovieClip; + private var presenceMaxIcon:MovieClip; + private var presenceClickTarget_mc:MovieClip; + private var _tip:ToolTip; + private var _users_dg:DataGrid; + + private var panel:MovieClip; + private var _lessonModel:LessonModel; + private var _lessonController:LessonController; + private var _tm:ThemeManager; + private var _dictionary:Dictionary; + + //These are defined so that the compiler can 'see' the events that are added at runtime by EventDispatcher + private var dispatchEvent:Function; + public var addEventListener:Function; + public var removeEventListener:Function; + + // Constructor + public function Presence() { + Debugger.log('PRESENCE: started constructor',Debugger.MED,'Presence','Presence'); + + // Set up this class to use the Flash event delegation model + EventDispatcher.initialize(this); + + _tm = ThemeManager.getInstance(); + _tip = new ToolTip(); + _dictionary = Dictionary.getInstance(); + _dictionary.addEventListener('init',Proxy.create(this,setLabels)); + this._visible = false; + + Stage.addListener(this); + + // Let it wait one frame to set up the components. + MovieClipUtils.doLater(Proxy.create(this,init)); + Debugger.log('PRESENCE: calling init method',Debugger.MED,'Presence','Presence'); + } + + // Called a frame after movie attached to allow components to initialise + public function init(){ + Debugger.log('PRESENCE: started init',Debugger.MED,'init','Presence'); + + //Delete the enterframe dispatcher + delete this.onEnterFrame; + _lessonModel = _lessonModel; + _lessonController = _lessonController; + _presence_mc = this; + _presenceIsExpanded = true; + dataGridInitialized = false; + presenceMaxIcon._visible = false; + presenceMinIcon._visible = true; + dataGridInitialized = false; + _lessonModel.setPresenceHeight(presenceHeightFull); + setLabels(); + resize(Stage.width); + + presenceClickTarget_mc.onRelease = Proxy.create(this, localOnRelease); + + this.onEnterFrame = setLabels; + } + + // Click handler + private function localOnRelease():Void{ + if (_presenceIsExpanded){ + _presenceIsExpanded = false + presenceMinIcon._visible = false; + presenceMaxIcon._visible = true; + _lessonModel.setPresenceHeight(presenceHeightHide); + + }else { + _presenceIsExpanded = true + presenceMinIcon._visible = true; + presenceMaxIcon._visible = false; + _lessonModel.setPresenceHeight(presenceHeightFull); + //Application.getInstance().onResize(); + } + } + + // Attempts a connection with a given Jabber server + public function attemptConnection():Void{ + Debugger.log('PRESENCE: attempting to connect through Javascript',Debugger.MED,'attemptConnection','Presence'); + + var myDate = new Date(); + var h = myDate.getHours().toString(), m = myDate.getMinutes().toString(), s = myDate.getSeconds().toString(); + var resource = "LAMSPRESENCE"+h+""+m+""+s; + + Debugger.log("PRESENCE: with arguements - " + String(_root.presenceServerUrl) + " " + String(_root.userID) + " " + String(_root.userID) + " " + String(resource) + " " + String(_root.lessonID) + " " + _root.firstName + _root.lastName + " " + "false" + " " + "true",Debugger.MED,'attemptConnection','Presence'); + _root.proxy.call("doLogin", _root.presenceServerUrl, _root.userID, _root.userID, resource, _root.lessonID, _root.firstName + _root.lastName, false, true); + } + + public function isPresenceExpanded():Boolean{ + return _presenceIsExpanded; + } + + public function presenceFullHeight():Number{ + return presenceHeightFull; + } + + public function showToolTip(btnObj, btnTT:String):Void{ + var Xpos = Application.HEADER_X+ 5; + var Ypos = Application.HEADER_Y+( btnObj._y+btnObj._height)+2; + var ttHolder = ApplicationParent.tooltip; + var ttMessage = Dictionary.getValue(btnTT); + var ttWidth = 150 + _tip.DisplayToolTip(ttHolder, ttMessage, Xpos, Ypos, undefined, ttWidth); + } + + public function hideToolTip():Void{ + _tip.CloseToolTip(); + } + + private function setStyles(){ + Debugger.log('PRESENCE: setting styles',Debugger.MED,'setStyles','Presence'); + var styleObj = _tm.getStyleObject('smallLabel'); + + styleObj = _tm.getStyleObject('textarea'); + presenceTitle_lbl.setStyle('styleName', styleObj); + + //For Panels + styleObj = _tm.getStyleObject('BGPanel'); + presenceHead_pnl.setStyle('styleName',styleObj); + } + + private function setLabels(){ + Debugger.log('PRESENCE: setting labels',Debugger.MED,'setLabels','Presence'); + + presenceTitle_lbl.text = Dictionary.getValue('pres_panel_lbl'); + setStyles(); + setupDataGrid(null); + delete this.onEnterFrame; + dispatchEvent({type:'load',target:this}); + + } + + public function setupDataGrid(dataProvider:Array){ + // If datagrid is not initialized, do so + if(!dataGridInitialized) { + Debugger.log('PRESENCE: setting up dataGrid',Debugger.MED,'setLabels','Presence'); + + _users_dg.addEventListener("cellPress", Proxy.create(this, cellPress)); + _users_dg.columnNames = ["nick"]; + + var col:mx.controls.gridclasses.DataGridColumn; + col = _users_dg.getColumnAt(0); + col.headerText = Dictionary.getValue('pres_colnamelearners_lbl'); + col.width = _users_dg._width; + dataGridInitialized = true; + } + + // If dataprovider is null (called from Presence), set label to loading and wait for call from javascript + if(!dataProvider) { + _users_dg.dataProvider = [{nick:Dictionary.getValue('pres_dataproviderloading_lbl')}]; + } + // Initialize dataprovider from javascript + else { + _users_dg.dataProvider = dataProvider; + _users_dg.sortItemsBy("nick"); + _users_dg.invalidate(); + } + + + } + + private function cellPress(event) { + // I'm not clicking on an empty cell + if (event.target.selectedItem.nick != undefined) { + //Double click action + if (clickInterval != null && _users_dg.selectedItem.nick == selectedChatItem.nick) { + Debugger.log('PRESENCE: double click event',Debugger.MED,'cellPress','Presence'); + + //_debugDialog = PopUpManager.createPopUp(Application.root, LFWindow, false,{title:'Debug',closeButton:true,scrollContentPath:'debugDialog'}); + + clearInterval(clickInterval); + clickInterval = null; + // First click + } else { + clearInterval(clickInterval); + clickInterval = null; + selectedChatItem = _users_dg.selectedItem; + lastClickX = _root._xmouse; + lastClickY = _root._ymouse; + clickInterval = setInterval(Proxy.create(this, endClickTimer), DOUBLECLICKSPEED); + } + } + } + + private function endClickTimer() { + // Do actions of first click + Debugger.log('PRESENCE: single click event',Debugger.MED,'cellPress','Presence'); + clearInterval(clickInterval); + //ajoutMenuChat(xK, yK); + clickInterval = null; + } + + public function resize(width:Number){ + panel._width = width; + + } + + function get className():String { + return 'Presence'; + } + + public function showPresence(v:Boolean) { + Debugger.log("Show/Hide Presence: " + v, Debugger.GEN, "showPresence", "Presence"); + this._visible = v; + } + +} \ No newline at end of file Index: lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LessonTabView.as =================================================================== diff -u -r327655a8d92f9ed44f5662c92704ade48ec4c1ed -r0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c --- lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LessonTabView.as (.../LessonTabView.as) (revision 327655a8d92f9ed44f5662c92704ade48ec4c1ed) +++ lams_flash/src/central/flash/org/lamsfoundation/lams/monitoring/mv/tabviews/LessonTabView.as (.../LessonTabView.as) (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -81,8 +81,6 @@ private var _monitorLesson_mc:MovieClip; private var _lessonStateArr:Array; private var bkg_pnl:MovieClip; - private var LSDescription_scp:ScrollPane; - private var LSDescriptionContent_mc:MovieClip; //Labels private var status_lbl:Label; @@ -104,7 +102,8 @@ //Text Items private var LSTitle_lbl:Label; - private var LSDescription_txa:TextArea; + private var LSDescription_lbl:Label; + private var sessionStatus_txt:Label; private var numLearners_txt:Label; private var class_txt:Label; @@ -401,10 +400,26 @@ private function populateLessonDetails():Void{ var s:Object = mm.getSequence(); - + var limit:Number = 120; + LSTitle_lbl.text = "" + s.name + ""; - LSDescription_txa.text = String(s.description); + var charCount:Array = StringUtils.scanString(String(s.description), "\n"); + s. + Debugger.log('DEBUG: '+ String(s.description) + ' with char count: ' + String(charCount.length), Debugger.MED,'populateLessonDetails','org.lamsfoundation.lams.LessonTabView'); + if(charCount.length > 3) { + Debugger.log('DEBUG: '+ String(charCount[2]), Debugger.MED,'populateLessonDetails','org.lamsfoundation.lams.LessonTabView'); + LSDescription_lbl.text = String(s.description).substr(0, charCount[2]); + LSDescription_lbl.text += "..."; + } + else if(s.description.length > limit) { + LSDescription_lbl.text = String(s.description).substr(0, limit); + LSDescription_lbl.text += "..."; + } + else { + LSDescription_lbl.text = String(s.description); + } + sessionStatus_txt.text = showStatus(s.state); numLearners_txt.text = String(s.noStartedLearners) + " " + Dictionary.getValue('ls_of_text')+" "+String(s.noPossibleLearners); learnerURL_txt.text = _root.serverURL+"launchlearner.do?lessonID="+_root.lessonID; @@ -708,7 +723,7 @@ * Opens the view competences dialog */ public function showCompetencesDialog(mm:MonitorModel) { - var opendialog:MovieClip = PopUpManager.createPopUp(mm.getMonitor().root, LFWindow, false,{title:Dictionary.getValue('view_competences_dlg'),closeButton:true,scrollContentPath:'viewCompetencesDialog'}); + var opendialog:MovieClip = PopUpManager.createPopUp(mm.getMonitor().root, LFWindow, false,{title:"View Competences",closeButton:true,scrollContentPath:'viewCompetencesDialog'}); opendialog.addEventListener('contentLoaded',Delegate.create(_monitorController,testFunction)); } Index: lams_learning/web/includes/JavaScriptFlashGateway.js =================================================================== diff -u --- lams_learning/web/includes/JavaScriptFlashGateway.js (revision 0) +++ lams_learning/web/includes/JavaScriptFlashGateway.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,455 @@ +/* +Macromedia(r) Flash(r) JavaScript Integration Kit License + + +Copyright (c) 2005 Macromedia, inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +3. The end-user documentation included with the redistribution, if any, must +include the following acknowledgment: + +"This product includes software developed by Macromedia, Inc. +(http://www.macromedia.com)." + +Alternately, this acknowledgment may appear in the software itself, if and +wherever such third-party acknowledgments normally appear. + +4. The name Macromedia must not be used to endorse or promote products derived +from this software without prior written permission. For written permission, +please contact devrelations@macromedia.com. + +5. Products derived from this software may not be called "Macromedia" or +"Macromedia Flash", nor may "Macromedia" or "Macromedia Flash" appear in their +name. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MACROMEDIA OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +-- + +This code is part of the Flash / JavaScript Integration Kit: +http://www.macromedia.com/go/flashjavascript/ + +Created by: + +Christian Cantrell +http://weblogs.macromedia.com/cantrell/ +mailto:cantrell@macromedia.com + +Mike Chambers +http://weblogs.macromedia.com/mesh/ +mailto:mesh@macromedia.com + +Macromedia +*/ + +/** + * Create a new Exception object. + * name: The name of the exception. + * message: The exception message. + */ +function Exception(name, message) +{ + if (name) + this.name = name; + if (message) + this.message = message; +} + +/** + * Set the name of the exception. + */ +Exception.prototype.setName = function(name) +{ + this.name = name; +} + +/** + * Get the exception's name. + */ +Exception.prototype.getName = function() +{ + return this.name; +} + +/** + * Set a message on the exception. + */ +Exception.prototype.setMessage = function(msg) +{ + this.message = msg; +} + +/** + * Get the exception message. + */ +Exception.prototype.getMessage = function() +{ + return this.message; +} + +/** + * Generates a browser-specific Flash tag. Create a new instance, set whatever + * properties you need, then call either toString() to get the tag as a string, or + * call write() to write the tag out. + */ + +/** + * Creates a new instance of the FlashTag. + * src: The path to the SWF file. + * width: The width of your Flash content. + * height: the height of your Flash content. + */ +function FlashTag(src, width, height) +{ + this.src = src; + this.width = width; + this.height = height; + this.version = '6,0,47,0'; + this.id = null; + this.bgcolor = 'ffffff'; + this.flashVars = null; +} + +/** + * Sets the Flash version used in the Flash tag. + */ +FlashTag.prototype.setVersion = function(v) +{ + this.version = v; +} + +/** + * Sets the ID used in the Flash tag. + */ +FlashTag.prototype.setId = function(id) +{ + this.id = id; +} + +/** + * Sets the background color used in the Flash tag. + */ +FlashTag.prototype.setBgcolor = function(bgc) +{ + this.bgcolor = bgc; +} + +/** + * Sets any variables to be passed into the Flash content. + */ +FlashTag.prototype.setFlashvars = function(fv) +{ + this.flashVars = fv; +} + +/** + * Get the Flash tag as a string. + */ +FlashTag.prototype.toString = function() +{ + var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0; + var flashTag = new String(); + if (ie) + { + flashTag += ''; + flashTag += ''; + flashTag += ''; + flashTag += ''; + if (this.flashVars != null) + { + flashTag += ''; + } + flashTag += ''; + } + else + { + flashTag += ''; + break; + case 'string': + doc.xml += ''+this._escapeXml(obj)+''; + break; + case 'number': + doc.xml += ''+obj+''; + break; + case 'boolean': + doc.xml += ''; + break; + case 'object': + if (obj == null) + { + doc.xml += ''; + } + else if (obj instanceof Date) + { + doc.xml += ''+obj.getTime()+''; + } + else if (obj instanceof Array) + { + doc.xml += ''; + for (var i = 0; i < obj.length; ++i) + { + this._serializeNode(obj[i], doc, null); + } + doc.xml += ''; + } + else + { + doc.xml += ''; + for (var n in obj) + { + if (typeof(obj[n]) == 'function') + continue; + this._serializeNode(obj[n], doc, n); + } + doc.xml += ''; + } + break; + default: + throw new Exception("FlashSerializationException", + "You can only serialize strings, numbers, booleans, objects, dates, arrays, nulls and undefined"); + break; + } +} + +/** + * Private + */ +FlashSerializer.prototype._addName= function(name) +{ + if (name != null) + { + return ' name="'+name+'"'; + } + return ''; +} + +/** + * Private + */ +FlashSerializer.prototype._escapeXml = function(str) +{ + if (this.useCdata) + return ''; + else + return str.replace(/&/g,'&').replace(/ Index: lams_learning/web/includes/jsjac-1.3.1/COPYING =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/COPYING (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/COPYING (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,11 @@ +JSJaC is licensed under the terms of the Mozilla Public License +version 1.1 or, at your option, under the terms of the GNU General +Public License version 2 or subsequent, or the terms of the GNU Lesser +General Public License version 2.1 or subsequent. + +The complete text of each of these license can be found in the same +directory as this file. See + +* MPL-1.1.txt - for version 1.1 of the Mozille Public License +* gpl-2.0.txt - for version 2 of the GNU General Public License +* lgpl-2.1.txt - for version 2.1 of the GNU Lesser General Public License \ No newline at end of file Index: lams_learning/web/includes/jsjac-1.3.1/ChangeLog =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/ChangeLog (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/ChangeLog (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,143 @@ +JSJaC v1.3.1 +============ +* changed licensing to Mozilla's tri-license model (MPL, GPL, LGPL) +* some little bugfixes + +JSJaC v1.3 +========== +* all handlers/callbacks now have their context set to the connection, + thus you can refer to it using 'this'. +* JSJaCConnection.unregisterHandler added +* lots of bugfixes + +JSJaC v1.2.2 +============ +* added mootools packer to generate a packed version of jsjac + (make target 'pack') +* json routines: don't extend Object +* fixed internal polling going wild when reconnecting +* JSJaCJID.prototype.clone and JSJaCJID.prototype.isEntity added +* Copyright and legelases statements added for code from external + resources + + +JSJaC v1.2.1 +============ +* fixed handlers for packets with empty childnodes (fixes #17) +* updated docs + +JSJaC v1.2 +========== +fixes: +* JSJaCConnection.prototype.getChild: rewrite + +new: +* JSJaCConstants.js: various XMPP Constants and error conditions +* JSJaCPacket.prototype.errorReply: create an error reply to a packet +* JSJaCIQ.prototype.reply: Create an iq reply with type 'result' +* JSJaCConnection.prototype.registerHandler: allow to register tagnames, namespaces and packet types. make events bubble and allow handlers to cancel bubbling of the event. +* JSJaCConnection.prototype.registerIQGet: here for your convenience +* JSJaCConnection.prototype.registerIQSet: here for your convenience +* JSJaCConnection.prototype.sendIQ: like send but with different callbacks for different types of iq replies ('error' & 'result') and default handlers + +stuff: +* include JSDoc for your convenience + +JSJaC v1.1.1 +============ +* fixed jsjac.js not having XmlDocument.create defined + +JSJaC v1.1 +========== +* fixed bug with empty JID giving null pointer exception when using getters +* use prototype property to declare member methods +* static methods for cookie retrieval/erase for convenience +* moved config vars to own file 'src/JSJaCConfig.js' +* fixed make process of single include file to not compress config vars + and place them on top of 'jsjac.js' + +JSJaC v1.0 +========== +* support for pausing sessions as described in http://www.xmpp.org/extensions/xep-0124.html#inactive +* bosh compliance v1.6 + +JSJaC v1.0beta1 +=============== + +* JSJacJID.js: dedicated class for handling with JIDs +* JSJaCPacket.js: getToJID(), getFromJID() return a JID object +* JSJaCPacket.js: setTo and setFrom accept JID object too +* jsextras.js: extends string with 'htmlEnc', extends Date with 'jabberDate', + 'hrTime' (static) and 'jab2date' (static) +* fixed all occurrences of 'for .. in' to be compliant with having prototypes + of objects (arrays) extended (like prototype.js does e.g.). +* buildNode: build nodes using script.aculo.us famous DOM builder +* appendNode: append nodes to root node, may also be used with DOM builder + syntax +* ConsoleLogger: debug logger using firebug's or safari's console +* getChild(name, ns): get child node with given name (and namespace) +* getChildVal(name, ns): get value of child node with given name + (and namespace) +* new API documentation using jsdoc +* new build system using jsmin to create single minimized file (jsjac.js) +* new events: onresume, packet_in/out, presence_in/out, message_in/out, + iq_in/out +* new status: resuming + +JSJaC v0.6 +========== + +* Support for Opera, Konqueror and Safari. +* Support for suspend/resume (makes it possible to save the state between + page transitions. +* Single include by JSJaC.js +* Many bugfixes and improvements concerning reliability. +* API change! Params to constructors and connect methods are now passed as + JSON objects. +* New event 'status_changed' to signal if sth going on with the status of + the connection (like errors, retries and so on) +* SASL Authentication (PLAIN, DIGEST-MD5, ANONYMOUS) + +JSJaC v0.5 +========== + +* lots of bug fixes and minor improvements +* make use of asynchronous request wherever possible +* fixed simpleclient +* fixed API docs + +JSJaC v0.4 +========== + +* ... + +JSJaC v0.3.x +============ +* Initial support for http binding (in polling mode though) + +* Initial support for safari (thanks to Matthew Hershberger) + + +JSJaC v0.2 +========== + +* send always does asychronous send now as http polling doesn't + support this. + + In detail: When sending a packet where we expect a reply to it + http polling doesn't make sure that this reply is contained + within the http body reply to the query sent. So we have to + setup a callback that handles the reply once it has been + delivered to us. + +* added a dedicated method syncedSend that sends in synchronous + mode + + First read above, then understand that you can't expect any + response to this call. It's there to make sure, sending is + finished before windows get closed + +* added events 'onconnect', 'ondisconnect' and 'onerror'. see API + for details. + +* removed method process() as polling is started at connect() now. Index: lams_learning/web/includes/jsjac-1.3.1/MPL-1.1.txt =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/MPL-1.1.txt (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/MPL-1.1.txt (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,470 @@ + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + Index: lams_learning/web/includes/jsjac-1.3.1/Makefile =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/Makefile (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/Makefile (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,57 @@ +OUTFILE=./jsjac.js +PACKFILE=./jsjac.packed.js +SRC=src/jsextras.js src/crypt.js src/JSJaCJSON.js src/xmlextras.js \ +src/JSJaCBuilder.js src/JSJaCConstants.js src/JSJaCConnection.js \ +src/JSJaCConsoleLogger.js src/JSJaCCookie.js src/JSJaCError.js \ +src/JSJaCJID.js src/JSJaCKeys.js src/JSJaCPacket.js \ +src/JSJaCHttpBindingConnection.js src/JSJaCHttpPollingConnection.js \ +src/JSJaC.js + +all: clean utils install doc + +install: build crunch + @echo "done." + +build: + @echo "building ..."; + @for i in ${SRC}; do \ + echo "\t$$i"; \ + cat "$$i" >> $(OUTFILE); \ + done + +crunch: + @echo "crunching ..." + @if [ -e $(OUTFILE) ]; then \ + utils/jsmin < $(OUTFILE) > $(OUTFILE).tmp && \ + cat src/header.js > $(OUTFILE) && \ + cat src/JSJaCConfig.js >> $(OUTFILE) && \ + cat $(OUTFILE).tmp >> $(OUTFILE) && \ + rm $(OUTFILE).tmp; \ + fi + +pack: clean utils build moo crunch doc + +moo: + @echo "packing..." + @if [ -e $(OUTFILE) ]; then \ + php ./utils/packer/pack.php $(OUTFILE) $(PACKFILE).tmp && \ + cat src/header.js > $(PACKFILE) && \ + cat src/JSJaCConfig.js >> $(PACKFILE) && \ + cat $(PACKFILE).tmp >> $(PACKFILE) && \ + rm $(PACKFILE).tmp; \ + else \ + echo "$(OUTFILE) not found. build failed?"; \ + fi + +doc: + @utils/JSDoc/jsdoc.pl --project-name JSJaC -d doc src/ + +utils: + @make -C utils +clean: + @rm -f $(OUTFILE) 2>/dev/null + @rm -f $(PACKFILE) 2>/dev/null + @rm -rf doc/ + @make -C utils clean + +.PHONY: doc utils Index: lams_learning/web/includes/jsjac-1.3.1/README =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/README (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/README (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,87 @@ +JSJaC - JavaScript Jabber Client Library +======================================== + +JSJaC is a jabber/XMPP client library written in JavaScript to ease +implementation of web based jabber/XMPP clients. For communication +with a jabber server it needs to support either [1]HTTP Polling or +[2]XMPP Over BOSH (formerl known as HTTP Binding). +JSJaC has an object oriented interface which should be quite easy to +use. +Communication is done by using the HTTPRequest object also refered to +as AJAX technology. Your browser must support this. +JSJaC is fully compatible with all major AJAX/JavaScript frameworks +like prototype, mootools, jQuery, dojo and YUI!. + +License +======= + +JSJaC is licensed under the terms of the GNU Lesser General Public +License (LGPL). Please refer to the file named 'COPYING' that came with +this distribution for details. + +Hints on Usage +============== + +Service Address +--------------- + +Due to security restrictions you may have to forward or proxy requests +to your jabber server's service address. + +Let's say your JSJaC based web application is located at +http://example.com. Your Jabber server is at jabber.example.com and +it's HTTP Binding service is located at +http://jabber.example.org:5280. + +As most browser don't allow scripts to connect to a different domain +and/or port as they have been loaded from you'd have to find a way how +to access this service at some URI hosted at http://example.com/. + +If you're using apache you could use mod_proxy and mod_rewrite to do +this job for you: + +%<--- + + Servername example.com + DocumentRoot /var/ww + AddDefaultCharset UTF-8 + RewriteEngine On + RewriteRule ^/http-bind/ http://jabber.example.com:5280/http-bind/ [P] + +%<--- + +With this you'd end up having access to the Jabber server's service at +http://example.com/http-bind/ (the httpbase address). + + +Debug Logger +------------ + +JSJaCConnection supports use of [3]JSDebugger which is available +separately. + +JSJaC also ships with a class 'JSJaCConsoleLogger' which lets you log to +Firebug's and Safari's console. + + +Example +------- +For an example on how to use this library within your web application +please have to look at 'examples/simpleclient.html'. + +Supported Browsers and Platforms +================================ + +The following browsers are known to work. Let me know about others! + +Microsoft Internet Explorer 6+7 +Firefox 2.0.x +Opera 9 +Safari 3 + + +References: +=========== +[1] http://www.xmpp.org/extensions/xep-0025.html +[2] http://www.xmpp.org/extensions/xep-0206.html +[3] http://svn.stefan-strigler.de/JSDebugger/trunk \ No newline at end of file Index: lams_learning/web/includes/jsjac-1.3.1/examples/simpleclient.html =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/examples/simpleclient.html (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/examples/simpleclient.html (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,314 @@ + + + + + JSJaC Simple Client + + + + + + + + + + + + +

JSJaC Simple Client

+ +
+ +
+

Login

+
+ + + + + + + + + +
Backend Type

 
+
+
+ + + + Index: lams_learning/web/includes/jsjac-1.3.1/gpl-2.0.txt =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/gpl-2.0.txt (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/gpl-2.0.txt (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. Index: lams_learning/web/includes/jsjac-1.3.1/jsjac.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/jsjac.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/jsjac.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,506 @@ +/* JSJaC - The JavaScript Jabber Client Library + * Copyright (C) 2004-2008 Stefan Strigler + * + * JSJaC is licensed under the terms of the Mozilla Public License + * version 1.1 or, at your option, under the terms of the GNU General + * Public License version 2 or subsequent, or the terms of the GNU Lesser + * General Public License version 2.1 or subsequent. + * + * Please visit http://zeank.in-berlin.de/jsjac/ for details about JSJaC. + */ + +var JSJAC_HAVEKEYS = true; // whether to use keys +var JSJAC_NKEYS = 16; // number of keys to generate +var JSJAC_INACTIVITY = 300; // qnd hack to make suspend/resume work more smoothly with polling +var JSJAC_ERR_COUNT = 10; // number of retries in case of connection errors + +var JSJAC_ALLOW_PLAIN = true; // whether to allow plaintext logins + +var JSJAC_CHECKQUEUEINTERVAL = 1; // msecs to poll send queue +var JSJAC_CHECKINQUEUEINTERVAL = 1; // msecs to poll incoming queue + +// Options specific to HTTP Binding (BOSH) +var JSJACHBC_BOSH_VERSION = "1.6"; +var JSJACHBC_USE_BOSH_VER = true; + +var JSJACHBC_MAX_HOLD = 1; +var JSJACHBC_MAX_WAIT = 300; + +var JSJACHBC_MAXPAUSE = 120; + +/*** END CONFIG ***/ + + +String.prototype.htmlEnc=function(){var str=this.replace(/&/g,"&");str=str.replace(//g,">");str=str.replace(/\"/g,""");str=str.replace(/\n/g,"
");return str;};Date.jab2date=function(ts){var date=new Date(Date.UTC(ts.substr(0,4),ts.substr(5,2)-1,ts.substr(8,2),ts.substr(11,2),ts.substr(14,2),ts.substr(17,2)));if(ts.substr(ts.length-6,1)!='Z'){var offset=new Date();offset.setTime(0);offset.setUTCHours(ts.substr(ts.length-5,2));offset.setUTCMinutes(ts.substr(ts.length-2,2));if(ts.substr(ts.length-6,1)=='+') +date.setTime(date.getTime()-offset.getTime());else if(ts.substr(ts.length-6,1)=='-') +date.setTime(date.getTime()+offset.getTime());} +return date;};Date.hrTime=function(ts){return Date.jab2date(ts).toLocaleString();};Date.prototype.jabberDate=function(){var padZero=function(i){if(i<10)return"0"+i;return i;};var jDate=this.getUTCFullYear()+"-";jDate+=padZero(this.getUTCMonth()+1)+"-";jDate+=padZero(this.getUTCDate())+"T";jDate+=padZero(this.getUTCHours())+":";jDate+=padZero(this.getUTCMinutes())+":";jDate+=padZero(this.getUTCSeconds())+"Z";return jDate;};Number.max=function(A,B){return(A>B)?A:B;};var hexcase=0;var b64pad="=";var chrsz=8;function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length*chrsz));} +function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length*chrsz));} +function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length*chrsz));} +function hex_hmac_sha1(key,data){return binb2hex(core_hmac_sha1(key,data));} +function b64_hmac_sha1(key,data){return binb2b64(core_hmac_sha1(key,data));} +function str_hmac_sha1(key,data){return binb2str(core_hmac_sha1(key,data));} +function sha1_vm_test() +{return hex_sha1("abc")=="a9993e364706816aba3e25717850c26c9cd0d89d";} +function core_sha1(x,len) +{x[len>>5]|=0x80<<(24-len%32);x[((len+64>>9)<<4)+15]=len;var w=Array(80);var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;var e=-1009589776;for(var i=0;i16)bkey=core_sha1(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++) +{ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;} +var hash=core_sha1(ipad.concat(str2binb(data)),512+data.length*chrsz);return core_sha1(opad.concat(hash),512+160);} +function rol(num,cnt) +{return(num<>>(32-cnt));} +function str2binb(str) +{var bin=Array();var mask=(1<>5]|=(str.charCodeAt(i/chrsz)&mask)<<(32-chrsz-i%32);return bin;} +function binb2str(bin) +{var str="";var mask=(1<>5]>>>(32-chrsz-i%32))&mask);return str;} +function binb2hex(binarray) +{var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i>2]>>((3-i%4)*8+4))&0xF)+ +hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8))&0xF);} +return str;} +function binb2b64(binarray) +{var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i>2]>>8*(3-i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*(3-(i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*(3-(i+2)%4))&0xFF);for(var j=0;j<4;j++) +{if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}} +return str;} +function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));} +function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));} +function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));} +function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));} +function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));} +function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));} +function md5_vm_test() +{return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";} +function core_md5(x,len) +{x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++) +{ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;} +var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);} +function safe_add(x,y) +{var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);} +function bit_rol(num,cnt) +{return(num<>>(32-cnt));} +function str2binl(str) +{var bin=Array();var mask=(1<>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;} +function binl2str(bin) +{var str="";var mask=(1<>5]>>>(i%32))&mask);return str;} +function binl2hex(binarray) +{var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i>2]>>((i%4)*8+4))&0xF)+ +hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);} +return str;} +function binl2b64(binarray) +{var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++) +{if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}} +return str;} +function utf8t2d(t) +{t=t.replace(/\r\n/g,"\n");var d=new Array;var test=String.fromCharCode(237);if(test.charCodeAt(0)<0) +for(var n=0;n0) +d[d.length]=c;else{d[d.length]=(((256+c)>>6)|192);d[d.length]=(((256+c)&63)|128);}} +else +for(var n=0;n127)&&(c<2048)){d[d.length]=((c>>6)|192);d[d.length]=((c&63)|128);} +else{d[d.length]=((c>>12)|224);d[d.length]=(((c>>6)&63)|128);d[d.length]=((c&63)|128);}} +return d;} +function utf8d2t(d) +{var r=new Array;var i=0;while(i191)&&(d[i]<224)){r[r.length]=String.fromCharCode(((d[i]&31)<<6)|(d[i+1]&63));i+=2;} +else{r[r.length]=String.fromCharCode(((d[i]&15)<<12)|((d[i+1]&63)<<6)|(d[i+2]&63));i+=3;}} +return r.join("");} +function b64arrays(){var b64s='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';b64=new Array();f64=new Array();for(var i=0;i>2];r[r.length]=b64[((d[i]&3)<<4)|(d[i+1]>>4)];r[r.length]=b64[((d[i+1]&15)<<2)|(d[i+2]>>6)];r[r.length]=b64[d[i+2]&63];i+=3;} +if((dl%3)==1) +r[r.length-1]=r[r.length-2]="=";if((dl%3)==2) +r[r.length-1]="=";var t=r.join("");return t;} +function b64t2d(t){var d=new Array;var i=0;t=t.replace(/\n|\r/g,"");t=t.replace(/=/g,"");while(i>4);d[d.length]=(((f64[t.charAt(i+1)]&15)<<4)|(f64[t.charAt(i+2)]>>2));d[d.length]=(((f64[t.charAt(i+2)]&3)<<6)|(f64[t.charAt(i+3)]));i+=4;} +if(t.length%4==2) +d=d.slice(0,d.length-2);if(t.length%4==3) +d=d.slice(0,d.length-1);return d;} +if(typeof(atob)=='undefined'||typeof(btoa)=='undefined') +b64arrays();if(typeof(atob)=='undefined'){atob=function(s){return utf8d2t(b64t2d(s));}} +if(typeof(btoa)=='undefined'){btoa=function(s){return b64d2t(utf8t2d(s));}} +function cnonce(size){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";var cnonce='';for(var i=0;i2) +eArg.childName=arguments[1];if(arguments.length>3) +eArg.childNS=arguments[2];if(arguments.length>4) +eArg.type=arguments[3];if(!this._events[event]) +this._events[event]=new Array(eArg);else +this._events[event]=this._events[event].concat(eArg);this._events[event]=this._events[event].sort(function(a,b){var aRank=0;var bRank=0;with(a){if(type=='*') +aRank++;if(childNS=='*') +aRank++;if(childName=='*') +aRank++;} +with(b){if(type=='*') +bRank++;if(childNS=='*') +bRank++;if(childName=='*') +bRank++;} +if(aRank>bRank) +return 1;if(aRank",this._doSASLAuthDone);} +this.oDbg.log("SASL ANONYMOUS requested but not supported",1);}else{if(this.mechs['DIGEST-MD5']){this.oDbg.log("SASL using mechanism 'DIGEST-MD5'",2);return this._sendRaw("",this._doSASLAuthDigestMd5S1);}else if(this.allow_plain&&this.mechs['PLAIN']){this.oDbg.log("SASL using mechanism 'PLAIN'",2);var authStr=this.username+'@'+ +this.domain+String.fromCharCode(0)+ +this.username+String.fromCharCode(0)+ +this.pass;this.oDbg.log("authenticating with '"+authStr+"'",2);authStr=btoa(authStr);return this._sendRaw(""+authStr+"",this._doSASLAuthDone);} +this.oDbg.log("No SASL mechanism applied",1);this.authtype='nonsasl';} +return false;};JSJaCConnection.prototype._doSASLAuthDigestMd5S1=function(el){if(el.nodeName!="challenge"){this.oDbg.log("challenge missing",1);this._handleEvent('onerror',JSJaCError('401','auth','not-authorized'));this.disconnect();}else{var challenge=atob(el.firstChild.nodeValue);this.oDbg.log("got challenge: "+challenge,2);this._nonce=challenge.substring(challenge.indexOf("nonce=")+7);this._nonce=this._nonce.substring(0,this._nonce.indexOf("\""));this.oDbg.log("nonce: "+this._nonce,2);if(this._nonce==''||this._nonce.indexOf('\"')!=-1){this.oDbg.log("nonce not valid, aborting",1);this.disconnect();return;} +this._digest_uri="xmpp/";this._digest_uri+=this.domain;this._cnonce=cnonce(14);this._nc='00000001';var A1=str_md5(this.username+':'+this.domain+':'+this.pass)+':'+this._nonce+':'+this._cnonce;var A2='AUTHENTICATE:'+this._digest_uri;var response=hex_md5(hex_md5(A1)+':'+this._nonce+':'+this._nc+':'+ +this._cnonce+':auth:'+hex_md5(A2));var rPlain='username="'+this.username+'",realm="'+this.domain+'",nonce="'+this._nonce+'",cnonce="'+this._cnonce+'",nc="'+this._nc+'",qop=auth,digest-uri="'+this._digest_uri+'",response="'+response+'",charset=utf-8';this.oDbg.log("response: "+rPlain,2);this._sendRaw(""+ +binb2b64(str2binb(rPlain))+"",this._doSASLAuthDigestMd5S2);}};JSJaCConnection.prototype._doSASLAuthDigestMd5S2=function(el){if(el.nodeName=='failure'){if(el.xml) +this.oDbg.log("auth error: "+el.xml,1);else +this.oDbg.log("auth error",1);this._handleEvent('onerror',JSJaCError('401','auth','not-authorized'));this.disconnect();return;} +var response=atob(el.firstChild.nodeValue);this.oDbg.log("response: "+response,2);var rspauth=response.substring(response.indexOf("rspauth=")+8);this.oDbg.log("rspauth: "+rspauth,2);var A1=str_md5(this.username+':'+this.domain+':'+this.pass)+':'+this._nonce+':'+this._cnonce;var A2=':'+this._digest_uri;var rsptest=hex_md5(hex_md5(A1)+':'+this._nonce+':'+this._nc+':'+ +this._cnonce+':auth:'+hex_md5(A2));this.oDbg.log("rsptest: "+rsptest,2);if(rsptest!=rspauth){this.oDbg.log("SASL Digest-MD5: server repsonse with wrong rspauth",1);this.disconnect();return;} +if(el.nodeName=='success') +this._reInitStream(this.domain,this._doStreamBind);else +this._sendRaw("",this._doSASLAuthDone);};JSJaCConnection.prototype._doSASLAuthDone=function(el){if(el.nodeName!='success'){this.oDbg.log("auth failed",1);this._handleEvent('onerror',JSJaCError('401','auth','not-authorized'));this.disconnect();}else +this._reInitStream(this.domain,this._doStreamBind);};JSJaCConnection.prototype._doStreamBind=function(){var iq=new JSJaCIQ();iq.setIQ(this.domain,'set','bind_1');iq.appendNode("bind",{xmlns:"urn:ietf:params:xml:ns:xmpp-bind"},[["resource",this.resource]]);this.oDbg.log(iq.xml());this.send(iq,this._doXMPPSess);};JSJaCConnection.prototype._doXMPPSess=function(iq){if(iq.getType()!='result'||iq.getType()=='error'){this.disconnect();if(iq.getType()=='error') +this._handleEvent('onerror',iq.getChild('error'));return;} +this.fulljid=iq.getChildVal("jid");this.jid=this.fulljid.substring(0,this.fulljid.lastIndexOf('/'));iq=new JSJaCIQ();iq.setIQ(this.domain,'set','sess_1');iq.appendNode("session",{xmlns:"urn:ietf:params:xml:ns:xmpp-session"},[]);this.oDbg.log(iq.xml());this.send(iq,this._doXMPPSessDone);};JSJaCConnection.prototype._doXMPPSessDone=function(iq){if(iq.getType()!='result'||iq.getType()=='error'){this.disconnect();if(iq.getType()=='error') +this._handleEvent('onerror',iq.getChild('error'));return;}else +this._handleEvent('onconnect');};JSJaCConnection.prototype._handleEvent=function(event,arg){event=event.toLowerCase();this.oDbg.log("incoming event '"+event+"'",3);if(!this._events[event]) +return;this.oDbg.log("handling event '"+event+"'",2);for(var i=0;i match for handler "+aEvent.handler,3);} +if(aEvent.handler.call(this,arg)) +break;} +else +if(aEvent.handler.call(this)) +break;}catch(e){this.oDbg.log(aEvent.handler+"\n>>>"+e.name+": "+e.message,1);}}}};JSJaCConnection.prototype._handlePID=function(aJSJaCPacket){if(!aJSJaCPacket.getID()) +return false;for(var i in this._regIDs){if(this._regIDs.hasOwnProperty(i)&&this._regIDs[i]&&i==aJSJaCPacket.getID()){var pID=aJSJaCPacket.getID();this.oDbg.log("handling "+pID,3);try{if(this._regIDs[i].cb.call(this,aJSJaCPacket,this._regIDs[i].arg)===false){return false;}else{this._unregisterPID(pID);return true;}}catch(e){this.oDbg.log(e.name+": "+e.message);this._unregisterPID(pID);return true;}}} +return false;};JSJaCConnection.prototype._handleResponse=function(req){var rootEl=this._parseResponse(req);if(!rootEl) +return;for(var i=0;iJSJAC_ERR_COUNT){this._abort();return false;} +this._setStatus('onerror_fallback');setTimeout(JSJaC.bind(this._resume,this),this.getPollInterval());return false;},this);}catch(e){} +var reqstr=this._getRequestString();if(typeof(this._rid)!='undefined') +this._req[slot].rid=this._rid;this.oDbg.log("sending: "+reqstr,4);this._req[slot].r.send(reqstr);};JSJaCConnection.prototype._registerPID=function(pID,cb,arg){if(!pID||!cb) +return false;this._regIDs[pID]=new Object();this._regIDs[pID].cb=cb;if(arg) +this._regIDs[pID].arg=arg;this.oDbg.log("registered "+pID,3);return true;};JSJaCConnection.prototype._sendEmpty=function JSJaCSendEmpty(){var slot=this._getFreeSlot();this._req[slot]=this._setupRequest(true);this._req[slot].r.onreadystatechange=JSJaC.bind(function(){if(this._req[slot].r.readyState==4){this.oDbg.log("async recv: "+this._req[slot].r.responseText,4);this._getStreamID(slot);}},this);if(typeof(this._req[slot].r.onerror)!='undefined'){this._req[slot].r.onerror=JSJaC.bind(function(e){this.oDbg.log('XmlHttpRequest error',1);return false;},this);} +var reqstr=this._getRequestString();this.oDbg.log("sending: "+reqstr,4);this._req[slot].r.send(reqstr);};JSJaCConnection.prototype._sendRaw=function(xml,cb,arg){if(cb) +this._sendRawCallbacks.push({fn:cb,arg:arg});this._pQueue.push(xml);this._process();return true;};JSJaCConnection.prototype._setStatus=function(status){if(!status||status=='') +return;if(status!=this._status){this._status=status;this._handleEvent('onstatuschanged',status);this._handleEvent('status_changed',status);}};JSJaCConnection.prototype._unregisterPID=function(pID){if(!this._regIDs[pID]) +return false;this._regIDs[pID]=null;this.oDbg.log("unregistered "+pID,3);return true;};function JSJaCConsoleLogger(level){this.level=level||4;this.start=function(){};this.log=function(msg,level){level=level||0;if(level>this.level) +return;if(typeof(console)=='undefined') +return;try{switch(level){case 0:console.warn(msg);break;case 1:console.error(msg);break;case 2:console.info(msg);break;case 4:console.debug(msg);break;default:console.log(msg);break;}}catch(e){try{console.log(msg)}catch(e){}}};this.setLevel=function(level){this.level=level;return this;};this.getLevel=function(){return this.level;};} +function JSJaCCookie(name,value,secs) +{if(window==this) +return new JSJaCCookie(name,value,secs);this.name=name;this.value=value;this.expires=secs;this.write=function(){if(this.secs){var date=new Date();date.setTime(date.getTime()+(this.secs*1000));var expires="; expires="+date.toGMTString();}else +var expires="";document.cookie=this.getName()+"="+this.getValue()+expires+"; path=/";};this.erase=function(){var c=new JSJaCCookie(this.getName(),"",-1);c.write();};this.getName=function(){return this.name;};this.setName=function(name){this.name=name;return this;};this.getValue=function(){return this.value;};this.setValue=function(value){this.value=value;return this;};} +JSJaCCookie.read=function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i','@'];function JSJaCJID(jid){this._node='';this._domain='';this._resource='';if(typeof(jid)=='string'){if(jid.indexOf('@')!=-1){this.setNode(jid.substring(0,jid.indexOf('@')));jid=jid.substring(jid.indexOf('@')+1);} +if(jid.indexOf('/')!=-1){this.setResource(jid.substring(jid.indexOf('/')+1));jid=jid.substring(0,jid.indexOf('/'));} +this.setDomain(jid);}else{this.setNode(jid.node);this.setDomain(jid.domain);this.setResource(jid.resource);}} +JSJaCJID.prototype.getNode=function(){return this._node;};JSJaCJID.prototype.getDomain=function(){return this._domain;};JSJaCJID.prototype.getResource=function(){return this._resource;};JSJaCJID.prototype.setNode=function(node){JSJaCJID._checkNodeName(node);this._node=node||'';return this;};JSJaCJID.prototype.setDomain=function(domain){if(!domain||domain=='') +throw new JSJaCJIDInvalidException("domain name missing");JSJaCJID._checkNodeName(domain);this._domain=domain;return this;};JSJaCJID.prototype.setResource=function(resource){this._resource=resource||'';return this;};JSJaCJID.prototype.toString=function(){var jid='';if(this.getNode()&&this.getNode()!='') +jid=this.getNode()+'@';jid+=this.getDomain();if(this.getResource()&&this.getResource()!="") +jid+='/'+this.getResource();return jid;};JSJaCJID.prototype.removeResource=function(){return this.setResource();};JSJaCJID.prototype.clone=function(){return new JSJaCJID(this.toString());};JSJaCJID.prototype.isEntity=function(jid){if(typeof jid=='string') +jid=(new JSJaCJID(jid));jid.removeResource();return(this.clone().removeResource().toString()===jid.toString());};JSJaCJID._checkNodeName=function(nodeprep){if(!nodeprep||nodeprep=='') +return;for(var i=0;ithis._inactivity*1000) +this._timerval=this._inactivity*1000;else +this._timerval=timerval;} +return this._timerval;};JSJaCHttpBindingConnection.prototype.isPolling=function(){return(this._hold==0)};JSJaCHttpBindingConnection.prototype._getFreeSlot=function(){for(var i=0;i";}else{reqstr+="/>";} +this._last_requests[this._rid]=new Object();this._last_requests[this._rid].xml=reqstr;this._last_rid=this._rid;for(var i in this._last_requests) +if(this._last_requests.hasOwnProperty(i)&&iJSJAC_ERR_COUNT){this._abort();return null;} +this.oDbg.log("repeating ("+this._errcnt+")",1);this._setStatus('proto_error_fallback');setTimeout(JSJaC.bind(this._resume,this),this.getPollInterval());return null;}}catch(e){this.oDbg.log("XMLHttpRequest error: status not available",1);this._errcnt++;if(this._errcnt>JSJAC_ERR_COUNT){this._abort();}else{this.oDbg.log("repeating ("+this._errcnt+")",1);this._setStatus('proto_error_fallback');setTimeout(JSJaC.bind(this._resume,this),this.getPollInterval());} +return null;} +var body=r.responseXML.documentElement;if(!body||body.tagName!='body'||body.namespaceURI!='http://jabber.org/protocol/httpbind'){this.oDbg.log("invalid response:\n"+r.responseText,1);clearTimeout(this._timeout);clearInterval(this._interval);clearInterval(this._inQto);this._connected=false;this.oDbg.log("Disconnected.",1);this._handleEvent('ondisconnect');this._setStatus('internal_server_error');this._handleEvent('onerror',JSJaCError('500','wait','internal-server-error'));return null;} +if(typeof(req.rid)!='undefined'&&this._last_requests[req.rid]){if(this._last_requests[req.rid].handled){this.oDbg.log("already handled "+req.rid,2);return null;}else +this._last_requests[req.rid].handled=true;} +if(body.getAttribute("type")=="terminate"){this.oDbg.log("session terminated:\n"+r.responseText,1);clearTimeout(this._timeout);clearInterval(this._interval);clearInterval(this._inQto);if(body.getAttribute("condition")=="remote-stream-error") +if(body.getElementsByTagName("conflict").length>0) +this._setStatus("session-terminate-conflict");this._handleEvent('onerror',JSJaCError('503','cancel',body.getAttribute('condition')));this._connected=false;this.oDbg.log("Disconnected.",1);this._handleEvent('ondisconnect');return null;} +this._errcnt=0;return r.responseXML.documentElement;};JSJaCHttpBindingConnection.prototype._reInitStream=function(to,cb,arg){this._reinit=true;cb.call(this,arg);};JSJaCHttpBindingConnection.prototype._resume=function(){if(this._pause==0&&this._rid>=this._last_rid) +this._rid=this._last_rid-1;this._process();};JSJaCHttpBindingConnection.prototype._setHold=function(hold){if(!hold||isNaN(hold)||hold<0) +hold=0;else if(hold>JSJACHBC_MAX_HOLD) +hold=JSJACHBC_MAX_HOLD;this._hold=hold;return this._hold;};JSJaCHttpBindingConnection.prototype._setupRequest=function(async){var req=new Object();var r=XmlHttp.create();try{r.open("POST",this._httpbase,async);r.setRequestHeader('Content-Type','text/xml; charset=utf-8');}catch(e){this.oDbg.log(e,1);} +req.r=r;this._rid++;req.rid=this._rid;return req;};JSJaCHttpBindingConnection.prototype._suspend=function(){if(this._pause==0) +return;var slot=this._getFreeSlot();this._req[slot]=this._setupRequest(false);var reqstr="\s*$/)) +response+='';doc=XmlDocument.create("doc");doc.loadXML(response);if(!this._parseStreamFeatures(doc)) +return;}catch(e){this.oDbg.log("loadXML: "+e.toString(),1);} +this._connected=true;if(this.register) +this._doInBandReg();else +this._doAuth();this._process(this._timerval);};JSJaCHttpPollingConnection.prototype._getSuspendVars=function(){return new Array();};JSJaCHttpPollingConnection.prototype._handleInitialResponse=function(){this.oDbg.log(this._req[0].r.getAllResponseHeaders(),4);var aPList=this._req[0].r.getResponseHeader('Set-Cookie');aPList=aPList.split(";");for(var i=0;i/,"");if(response.match(/"+response+"");if(!doc||doc.tagName=='parsererror'){this.oDbg.log("parsererror",1);doc=JSJaCHttpPollingConnection._parseTree(""+req.responseText);if(doc&&doc.tagName!='parsererror'){this.oDbg.log("stream closed",1);if(doc.getElementsByTagName('conflict').length>0) +this._setStatus("session-terminate-conflict");clearTimeout(this._timeout);clearInterval(this._interval);clearInterval(this._inQto);this._handleEvent('onerror',JSJaCError('503','cancel','session-terminate'));this._connected=false;this.oDbg.log("Disconnected.",1);this._handleEvent('ondisconnect');}else +this.oDbg.log("parsererror:"+doc,1);return doc;} +return doc;}catch(e){this.oDbg.log("parse error:"+e.message,1);} +return null;;};JSJaCHttpPollingConnection.prototype._reInitStream=function(to,cb,arg){this._sendRaw("",cb,arg);};JSJaCHttpPollingConnection.prototype._resume=function(){this._process(this._timerval);};JSJaCHttpPollingConnection.prototype._setupRequest=function(async){var r=XmlHttp.create();try{r.open("POST",this._httpbase,async);if(r.overrideMimeType) +r.overrideMimeType('text/plain; charset=utf-8');r.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}catch(e){this.oDbg.log(e,1);} +var req=new Object();req.r=r;return req;};JSJaCHttpPollingConnection.prototype._suspend=function(){};JSJaCHttpPollingConnection._parseTree=function(s){try{var r=XmlDocument.create("body","foo");if(typeof(r.loadXML)!='undefined'){r.loadXML(s);return r.documentElement;}else if(window.DOMParser) +return(new DOMParser()).parseFromString(s,"text/xml").documentElement;}catch(e){} +return null;};var JSJaC={Version:'1.3.1',require:function(libraryName){document.write('');},load:function(){var includes=['xmlextras','jsextras','crypt','JSJaCConfig','JSJaCConstants','JSJaCCookie','JSJaCJSON','JSJaCJID','JSJaCBuilder','JSJaCPacket','JSJaCError','JSJaCKeys','JSJaCConnection','JSJaCHttpPollingConnection','JSJaCHttpBindingConnection','JSJaCConsoleLogger'];var scripts=document.getElementsByTagName("script");var path='./';for(var i=0;i35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('34.D.aM=C(){p 19=h.2V(/&/g,"&cS;");19=19.2V(//g,">");19=19.2V(/\\"/g,"&dv;");19=19.2V(/\\n/g,"
");z 19};3u.aN=C(1Y){p 3h=J 3u(3u.cN(1Y.3a(0,4),1Y.3a(5,2)-1,1Y.3a(8,2),1Y.3a(11,2),1Y.3a(14,2),1Y.3a(17,2)));k(1Y.3a(1Y.F-6,1)!=\'Z\'){p 50=J 3u();50.6J(0);50.cf(1Y.3a(1Y.F-5,2));50.cp(1Y.3a(1Y.F-2,2));k(1Y.3a(1Y.F-6,1)==\'+\')3h.6J(3h.4P()-50.4P());H k(1Y.3a(1Y.F-6,1)==\'-\')3h.6J(3h.4P()+50.4P())}z 3h};3u.bQ=C(1Y){z 3u.aN(1Y).bi()};3u.D.bq=C(){p 4Y=C(i){k(i<10)z"0"+i;z i};p 4j=h.bN()+"-";4j+=4Y(h.bI()+1)+"-";4j+=4Y(h.bh())+"T";4j+=4Y(h.bz())+":";4j+=4Y(h.bl())+":";4j+=4Y(h.bm())+"Z";z 4j};9l.9t=C(A,B){z(A>B)?A:B};p 8m=0;p 8k="=";p 1w=8;C 56(s){z 98(4i(4h(s),s.F*1w))}C 8R(s){z 6Q(4i(4h(s),s.F*1w))}C d5(s){z 8K(4i(4h(s),s.F*1w))}C cZ(1x,1N){z 98(7t(1x,1N))}C cR(1x,1N){z 6Q(7t(1x,1N))}C cQ(1x,1N){z 8K(7t(1x,1N))}C cO(){z 56("9G")=="cP"}C 4i(x,3n){x[3n>>5]|=ae<<(24-3n%32);x[((3n+64>>9)<<4)+15]=3n;p w=1l(80);p a=9C;p b=-b0;p c=-b5;p d=ah;p e=-dw;L(p i=0;i16)2X=4i(2X,1x.F*1w);p 4T=1l(16),5r=1l(16);L(p i=0;i<16;i++){4T[i]=2X[i]^a4;5r[i]=2X[i]^a2}p 7n=4i(4T.3L(4h(1N)),7m+1N.F*1w);z 4i(5r.3L(7n),7m+cB)}C 7u(5i,5e){z(5i<<5e)|(5i>>>(32-5e))}C 4h(19){p 2W=1l();p 48=(1<<1w)-1;L(p i=0;i<19.F*1w;i+=1w)2W[i>>5]|=(19.5j(i/1w)&48)<<(32-1w-i%32);z 2W}C 8K(2W){p 19="";p 48=(1<<1w)-1;L(p i=0;i<2W.F*32;i+=1w)19+=34.3Q((2W[i>>5]>>>(32-1w-i%32))&48);z 19}C 98(1P){p 4R=8m?"9I":"9H";p 19="";L(p i=0;i<1P.F*4;i++){19+=4R.2h((1P[i>>2]>>((3-i%4)*8+4))&78)+4R.2h((1P[i>>2]>>((3-i%4)*8))&78)}z 19}C 6Q(1P){p 4J="6T+/";p 19="";L(p i=0;i<1P.F*4;i+=3){p 6Y=(((1P[i>>2]>>8*(3-i%4))&55)<<16)|(((1P[i+1>>2]>>8*(3-(i+1)%4))&55)<<8)|((1P[i+2>>2]>>8*(3-(i+2)%4))&55);L(p j=0;j<4;j++){k(i*8+j*6>1P.F*32)19+=8k;H 19+=4J.2h((6Y>>6*(3-j))&9N)}}z 19}C 3O(s){z 88(4r(5h(s),s.F*1w))}C cv(s){z 8l(4r(5h(s),s.F*1w))}C 8F(s){z 8e(4r(5h(s),s.F*1w))}C cX(1x,1N){z 88(7p(1x,1N))}C cw(1x,1N){z 8l(7p(1x,1N))}C cx(1x,1N){z 8e(7p(1x,1N))}C cy(){z 3O("9G")=="cz"}C 4r(x,3n){x[3n>>5]|=ae<<((3n)%32);x[(((3n+64)>>>9)<<4)+14]=3n;p a=9C;p b=-b0;p c=-b5;p d=ah;L(p i=0;i16)2X=4r(2X,1x.F*1w);p 4T=1l(16),5r=1l(16);L(p i=0;i<16;i++){4T[i]=2X[i]^a4;5r[i]=2X[i]^a2}p 7n=4r(4T.3L(5h(1N)),7m+1N.F*1w);z 4r(5r.3L(7n),7m+4t)}C 27(x,y){p 8p=(x&8d)+(y&8d);p a7=(x>>16)+(y>>16)+(8p>>16);z(a7<<16)|(8p&8d)}C ab(5i,5e){z(5i<<5e)|(5i>>>(32-5e))}C 5h(19){p 2W=1l();p 48=(1<<1w)-1;L(p i=0;i<19.F*1w;i+=1w)2W[i>>5]|=(19.5j(i/1w)&48)<<(i%32);z 2W}C 8e(2W){p 19="";p 48=(1<<1w)-1;L(p i=0;i<2W.F*32;i+=1w)19+=34.3Q((2W[i>>5]>>>(i%32))&48);z 19}C 88(1P){p 4R=8m?"9I":"9H";p 19="";L(p i=0;i<1P.F*4;i++){19+=4R.2h((1P[i>>2]>>((i%4)*8+4))&78)+4R.2h((1P[i>>2]>>((i%4)*8))&78)}z 19}C 8l(1P){p 4J="6T+/";p 19="";L(p i=0;i<1P.F*4;i+=3){p 6Y=(((1P[i>>2]>>8*(i%4))&55)<<16)|(((1P[i+1>>2]>>8*((i+1)%4))&55)<<8)|((1P[i+2>>2]>>8*((i+2)%4))&55);L(p j=0;j<4;j++){k(i*8+j*6>1P.F*32)19+=8k;H 19+=4J.2h((6Y>>6*(3-j))&9N)}}z 19}C a6(t){t=t.2V(/\\r\\n/g,"\\n");p d=J 1l;p 6Z=34.3Q(d2);k(6Z.5j(0)<0)L(p n=0;n0)d[d.F]=c;H{d[d.F]=(((9S+c)>>6)|9O);d[d.F]=(((9S+c)&63)|4t)}}H L(p n=0;nd3)&&(c>6)|9O);d[d.F]=((c&63)|4t)}H{d[d.F]=((c>>12)|ax);d[d.F]=(((c>>6)&63)|4t);d[d.F]=((c&63)|4t)}}z d}C 9X(d){p r=J 1l;p i=0;3T(idB)&&(d[i]>2];r[r.F]=52[((d[i]&3)<<4)|(d[i+1]>>4)];r[r.F]=52[((d[i+1]&15)<<2)|(d[i+2]>>6)];r[r.F]=52[d[i+2]&63];i+=3}k((dl%3)==1)r[r.F-1]=r[r.F-2]="=";k((dl%3)==2)r[r.F-1]="=";p t=r.5G("");z t}C aa(t){p d=J 1l;p i=0;t=t.2V(/\\n|\\r/g,"");t=t.2V(/=/g,"");3T(i>4);d[d.F]=(((44[t.2h(i+1)]&15)<<4)|(44[t.2h(i+2)]>>2));d[d.F]=(((44[t.2h(i+2)]&3)<<6)|(44[t.2h(i+3)]));i+=4}k(t.F%4==2)d=d.4I(0,d.F-2);k(t.F%4==3)d=d.4I(0,d.F-1);z d}k(X(5z)==\'1F\'||X(7g)==\'1F\')9E();k(X(5z)==\'1F\'){5z=C(s){z 9X(aa(s))}}k(X(7g)==\'1F\'){7g=C(s){z a8(a6(s))}}C 53(8O){p 4J="6T";p 53=\'\';L(p i=0;i<8O;i++){53+=4J.2h(58.9V(58.8S(J 3u().4P())*(4J.F-1)))}z 53}C 4Q(){}4Q.2v=C(4k){p m={\'\\b\':\'\\\\b\',\'\\t\':\'\\\\t\',\'\\n\':\'\\\\n\',\'\\f\':\'\\\\f\',\'\\r\':\'\\\\r\',\'"\':\'\\\\"\',\'\\\\\':\'\\\\\\\\\'},s={6U:C(x){p a=[\'[\'],b,f,i,l=x.F,v;L(i=0;i2)4V.2Z=1B[1];k(1B.F>3)4V.3i=1B[2];k(1B.F>4)4V.1k=1B[3];k(!h.2F[1i])h.2F[1i]=J 1l(4V);H h.2F[1i]=h.2F[1i].3L(4V);h.2F[1i]=h.2F[1i].gE(C(a,b){p 4X=0;p 57=0;6q(a){k(1k==\'*\')4X++;k(3i==\'*\')4X++;k(2Z==\'*\')4X++}6q(b){k(1k==\'*\')57++;k(3i==\'*\')57++;k(2Z==\'*\')57++}k(4X>57)z 1;k(4X<57)z-1;z 0});h.E.G("7R 2l L 1i \'"+1i+"\'",2)};R.D.gU=C(1i,2l){1i=1i.6I();k(!h.2F[1i])z;p 5y=h.2F[1i],6W=J 1l();L(p i=0;i<5y.F;i++)k(5y[i].2l!=2l)6W.5A(5y[i]);k(5y.F!=6W.F){h.2F[1i]=6W;h.E.G("aE 2l L 1i \'"+1i+"\'",2)}};R.D.gX=C(2Z,3i,2l){h.8h(\'I\',2Z,3i,\'8U\',2l)};R.D.gT=C(2Z,3i,2l){h.8h(\'I\',2Z,3i,\'4U\',2l)};R.D.gS=C(){1t{h.2i(\'gR\');p s=7j(2j.3x(\'4w\').6P());h.E.G(\'3x 5p: \'+s,2);p o=4Q.68(s);L(p i 3q o)k(o.4l(i))h[i]=o[i];k(h.1L){h.6X=J 3P();p u=h.6X.4G();L(p i=0;i",h.6p)}h.E.G("3t 7h ez 9x 1V eB",1)}H{k(h.5v[\'8y-6w\']){h.E.G("3t 8s 3J \'8y-6w\'",2);z h.4b("<1A 1d=\'2g:2o:2r:Q:1e:1I-3g\' 3J=\'8y-6w\'/>",h.9u)}H k(h.4M&&h.5v[\'8q\']){h.E.G("3t 8s 3J \'8q\'",2);p 5O=h.1O+\'@\'+h.1u+34.3Q(0)+h.1O+34.3Q(0)+h.3K;h.E.G("eC 6q \'"+5O+"\'",2);5O=7g(5O);z h.4b("<1A 1d=\'2g:2o:2r:Q:1e:1I-3g\' 3J=\'8q\'>"+5O+"",h.6p)}h.E.G("83 3t 3J eE",1);h.29=\'5s\'}z W};R.D.9u=C(el){k(el.3m!="4s"){h.E.G("4s 9p",1);h.18(\'1z\',2k(\'6k\',\'1A\',\'1V-7r\'));h.2T()}H{p 4s=5z(el.5g.4u);h.E.G("65 4s: "+4s,2);h.2M=4s.36(4s.2x("6R=")+7);h.2M=h.2M.36(0,h.2M.2x("\\""));h.E.G("6R: "+h.2M,2);k(h.2M==\'\'||h.2M.2x(\'\\"\')!=-1){h.E.G("6R 1V 9n, ao",1);h.2T();z}h.5I="1I/";h.5I+=h.1u;h.5k=53(14);h.6u=\'eD\';p 6r=8F(h.1O+\':\'+h.1u+\':\'+h.3K)+\':\'+h.2M+\':\'+h.5k;p 6v=\'ey:\'+h.5I;p 1n=3O(3O(6r)+\':\'+h.2M+\':\'+h.6u+\':\'+h.5k+\':1A:\'+3O(6v));p 8w=\'1O="\'+h.1O+\'",ew="\'+h.1u+\'",6R="\'+h.2M+\'",53="\'+h.5k+\'",er="\'+h.6u+\'",eq=1A,87-es="\'+h.5I+\'",1n="\'+1n+\'",8i=8j-8\';h.E.G("1n: "+8w,2);h.4b("<1n 1d=\'2g:2o:2r:Q:1e:1I-3g\'>"+6Q(4h(8w))+"",h.ag)}};R.D.ag=C(el){k(el.3m==\'ev\'){k(el.Q)h.E.G("1A 1f: "+el.Q,1);H h.E.G("1A 1f",1);h.18(\'1z\',2k(\'6k\',\'1A\',\'1V-7r\'));h.2T();z}p 1n=5z(el.5g.4u);h.E.G("1n: "+1n,2);p 5d=1n.36(1n.2x("5d=")+8);h.E.G("5d: "+5d,2);p 6r=8F(h.1O+\':\'+h.1u+\':\'+h.3K)+\':\'+h.2M+\':\'+h.5k;p 6v=\':\'+h.5I;p 6x=3O(3O(6r)+\':\'+h.2M+\':\'+h.6u+\':\'+h.5k+\':1A:\'+3O(6v));h.E.G("6x: "+6x,2);k(6x!=5d){h.E.G("3t dM-6w: 3M dL 6q dN 5d",1);h.2T();z}k(el.3m==\'b8\')h.7d(h.1u,h.7O);H h.4b("<1n 1d=\'2g:2o:2r:Q:1e:1I-3g\'/>",h.6p)};R.D.6p=C(el){k(el.3m!=\'b8\'){h.E.G("1A 4p",1);h.18(\'1z\',2k(\'6k\',\'1A\',\'1V-7r\'));h.2T()}H h.7d(h.1u,h.7O)};R.D.7O=C(){p I=J 2H();I.5D(h.1u,\'4U\',\'dQ\');I.4o("1o",{1d:"2g:2o:2r:Q:1e:1I-1o"},[["2t",h.2t]]);h.E.G(I.Q());h.2Q(I,h.bb)};R.D.bb=C(I){k(I.2q()!=\'4N\'||I.2q()==\'1f\'){h.2T();k(I.2q()==\'1f\')h.18(\'1z\',I.2C(\'1f\'));z}h.5C=I.49("1c");h.1c=h.5C.36(0,h.5C.dK(\'/\'));I=J 2H();I.5D(h.1u,\'4U\',\'dJ\');I.4o("4a",{1d:"2g:2o:2r:Q:1e:1I-4a"},[]);h.E.G(I.Q());h.2Q(I,h.as)};R.D.as=C(I){k(I.2q()!=\'4N\'||I.2q()==\'1f\'){h.2T();k(I.2q()==\'1f\')h.18(\'1z\',I.2C(\'1f\'));z}H h.18(\'8z\')};R.D.18=C(1i,1j){1i=1i.6I();h.E.G("dD 1i \'"+1i+"\'",3);k(!h.2F[1i])z;h.E.G("aj 1i \'"+1i+"\'",2);L(p i=0;i 6a L 2l "+2z.2l,3)}k(2z.2l.62(h,1j))1X}H k(2z.2l.62(h))1X}1s(e){h.E.G(2z.2l+"\\n>>>"+e.V+": "+e.2E,1)}}}};R.D.ap=C(5L){k(!5L.5m())z W;L(p i 3q h.2O){k(h.2O.4l(i)&&h.2O[i]&&i==5L.5m()){p 2y=5L.5m();h.E.G("aj "+2y,3);1t{k(h.2O[i].cb.62(h,5L,h.2O[i].1j)===W){z W}H{h.7E(2y);z 1g}}1s(e){h.E.G(e.V+": "+e.2E);h.7E(2y);z 1g}}}z W};R.D.aH=C(1b){p 5w=h.7H(1b);k(!5w)z;L(p i=0;i<5w.3N.F;i++){k(h.4E.F){p cb=h.4E[0];h.4E=h.4E.4I(1,h.4E.F);cb.fn.62(h,5w.3N.1y(i),cb.1j);5R}h.3I=h.3I.3L(5w.3N.1y(i))}};R.D.95=C(K){k(!K){h.E.G("dF 1G 68 ... ao",1);z W}p 6l;k(K.7A)6l=K.7A("1p://5o.P.1q/4d","1f").1y(0);H{p 6i=K.3X("1f");L(p i=0;i<6i.F;i++)k(6i.1y(i).3E=="1p://5o.P.1q/4d"){6l=6i.1y(i);1X}}k(6l){h.2i("6s");39(h.1S);1Z(h.2m);1Z(h.2D);h.18(\'1z\',2k(\'45\',\'2w\',\'4a-4g\'));h.1T=W;h.E.G("3H.",1);h.18(\'3G\');z W}h.5v=J 3A();p 6m=K.3X("dG");h.6o=W;L(p i=0;i<6m.F;i++)k(6m.1y(i).1r("1d")=="2g:2o:2r:Q:1e:1I-3g"){h.6o=1g;p 7G=6m.1y(i).3X("3J");L(p j=0;j<7G.F;j++)h.5v[7G.1y(j).5g.4u]=1g;1X}k(h.6o)h.E.G("3t aK",2);H{h.29=\'5s\';h.E.G("83 7Q L 3t aK",2)}z 1g};R.D.3d=C(2u){k(!h.43()){h.E.G("dI dH ...",1);k(h.2m)1Z(h.2m);z}h.4S(2u);k(h.1S)39(h.1S);p M=h.4K();k(M<0)z;k(X(h.N[M])!=\'1F\'&&X(h.N[M].r)!=\'1F\'&&h.N[M].r.2K!=4){h.E.G("dR "+M+" dS 1V e2");z}k(!h.5W()&&h.1C.F==0&&h.N[(M+1)%2]&&h.N[(M+1)%2].r.2K!=4){h.E.G("e1 e3 e4, e6 ...",2);z}k(!h.5W())h.E.G("e5 e0 M at "+M,2);h.N[M]=h.4H(1g);h.N[M].r.4D=1m.1o(C(){k(!h.43())z;k(h.N[M].r.2K==4){h.2i(\'dZ\');h.E.G("4F 7U: "+h.N[M].r.1Q,4);h.aH(h.N[M]);k(h.1C.F){h.1S=3b(1m.1o(h.3d,h),9z)}H{h.E.G("dU dT dV 3q "+h.3p()+" dW",4);h.1S=3b(1m.1o(h.3d,h),h.3p())}}},h);1t{h.N[M].r.1z=1m.1o(C(){k(!h.43())z;h.2R++;h.E.G(\'7W 1f (\'+h.2R+\')\',1);k(h.2R>7K){h.61();z W}h.2i(\'dY\');3b(1m.1o(h.59,h),h.3p());z W},h)}1s(e){}p O=h.5T();k(X(h.1W)!=\'1F\')h.N[M].35=h.1W;h.E.G("aD: "+O,4);h.N[M].r.2Q(O)};R.D.aA=C(2y,cb,1j){k(!2y||!cb)z W;h.2O[2y]=J 3A();h.2O[2y].cb=cb;k(1j)h.2O[2y].1j=1j;h.E.G("7R "+2y,3);z 1g};R.D.99=C dX(){p M=h.4K();h.N[M]=h.4H(1g);h.N[M].r.4D=1m.1o(C(){k(h.N[M].r.2K==4){h.E.G("4F 7U: "+h.N[M].r.1Q,4);h.6e(M)}},h);k(X(h.N[M].r.1z)!=\'1F\'){h.N[M].r.1z=1m.1o(C(e){h.E.G(\'7W 1f\',1);z W},h)}p O=h.5T();h.E.G("aD: "+O,4);h.N[M].r.2Q(O)};R.D.4b=C(Q,cb,1j){k(cb)h.4E.5A({fn:cb,1j:1j});h.1C.5A(Q);h.3d();z 1g};R.D.2i=C(1v){k(!1v||1v==\'\')z;k(1v!=h.6L){h.6L=1v;h.18(\'eF\',1v);h.18(\'eG\',1v)}};R.D.7E=C(2y){k(!h.2O[2y])z W;h.2O[2y]=1h;h.E.G("aE "+2y,3);z 1g};C a5(2G){h.2G=2G||4;h.fm=C(){};h.G=C(3C,2G){2G=2G||0;k(2G>h.2G)z;k(X(4C)==\'1F\')z;1t{6h(2G){2n 0:4C.fl(3C);1X;2n 1:4C.1f(3C);1X;2n 2:4C.92(3C);1X;2n 4:4C.fo(3C);1X;81:4C.G(3C);1X}}1s(e){1t{4C.G(3C)}1s(e){}}};h.fp=C(2G){h.2G=2G;z h};h.fr=C(){z h.2G}}C 2j(V,2P,5N){k(3y==h)z J 2j(V,2P,5N);h.V=V;h.2P=2P;h.5H=5N;h.7l=C(){k(h.5N){p 3h=J 3u();3h.6J(3h.4P()+(h.5N*4O));p 5H="; 5H="+3h.fj()}H p 5H="";3Z.5p=h.8P()+"="+h.6P()+5H+"; 7B=/"};h.5t=C(){p c=J 2j(h.8P(),"",-1);c.7l()};h.8P=C(){z h.V};h.fe=C(V){h.V=V;z h};h.6P=C(){z h.2P};h.fd=C(2P){h.2P=2P;z h}}2j.3x=C(V){p 8X=V+"=";p ca=3Z.5p.47(\';\');L(p i=0;i\',\'@\'];C 1U(1c){h.8Z=\'\';h.8T=\'\';h.8V=\'\';k(X(1c)==\'38\'){k(1c.2x(\'@\')!=-1){h.91(1c.36(0,1c.2x(\'@\')));1c=1c.36(1c.2x(\'@\')+1)}k(1c.2x(\'/\')!=-1){h.6B(1c.36(1c.2x(\'/\')+1));1c=1c.36(0,1c.2x(\'/\'))}h.94(1c)}H{h.91(1c.2b);h.94(1c.1u);h.6B(1c.2t)}}1U.D.Y=C(){z h.8Z};1U.D.9y=C(){z h.8T};1U.D.6C=C(){z h.8V};1U.D.91=C(2b){1U.8Y(2b);h.8Z=2b||\'\';z h};1U.D.94=C(1u){k(!1u||1u==\'\')4e J 6G("1u V 9p");1U.8Y(1u);h.8T=1u;z h};1U.D.6B=C(2t){h.8V=2t||\'\';z h};1U.D.2v=C(){p 1c=\'\';k(h.Y()&&h.Y()!=\'\')1c=h.Y()+\'@\';1c+=h.9y();k(h.6C()&&h.6C()!="")1c+=\'/\'+h.6C();z 1c};1U.D.96=C(){z h.6B()};1U.D.5P=C(){z J 1U(h.2v())};1U.D.fh=C(1c){k(X 1c==\'38\')1c=(J 1U(1c));1c.96();z(h.5P().96().2v()===1c.2v())};1U.8Y=C(6A){k(!6A||6A==\'\')z;L(p i=0;i<6E.F;i++){k(6A.2x(6E[i])!=-1){4e J 6G("9Z fs 3q ft: "+6E[i])}}};C 6G(2E){h.2E=2E;h.V="6G"}C 3P(8Q,E){p 9W=58.8S();h.42=J 1l();h.42[0]=9W.2v();k(E)h.E=E;H{h.E={};h.E.G=C(){}}k(8Q){L(p i=1;i<9L;i++){h.42[i]=8Q(h.42[i-1]);E.G(i+": "+h.42[i],4)}}h.6F=9L-1;h.3s=C(){z h.42[h.6F--]};h.6M=C(){z(h.6F==0)};h.8O=C(){z h.42.F};h.4G=C(){z(\'42,6F\').47(\',\')}}p 6H=1g;C 1a(V){h.V=V;k(X(6H)!=\'1F\'&&6H)h.K=2I.3F(V,\'P:8r\');H h.K=2I.3F(V,\'\')}1a.D.41=C(){z h.V};1a.D.2s=C(){z h.K};1a.D.Y=C(){k(h.2s()&&h.2s().1R)z h.2s().1R;H z 1h};1a.D.7y=C(1G){k(!1G||1G==\'\')h.Y().5u(\'1G\');H k(X(1G)==\'38\')h.Y().2p(\'1G\',1G);H h.Y().2p(\'1G\',1G.2v());z h};1a.D.9v=C(3j){k(!3j||3j==\'\')h.Y().5u(\'3j\');H k(X(3j)==\'38\')h.Y().2p(\'3j\',3j);H h.Y().2p(\'3j\',3j.2v());z h};1a.D.7s=C(2N){k(!2N||2N==\'\')h.Y().5u(\'2N\');H h.Y().2p(\'2N\',2N);z h};1a.D.5M=C(1k){k(!1k||1k==\'\')h.Y().5u(\'1k\');H h.Y().2p(\'1k\',1k);z h};1a.D.fC=C(4v){k(!4v||4v==\'\')h.Y().5u(\'Q:6z\');H h.Y().2p(\'Q:6z\',4v);z h};1a.D.9M=C(){z h.Y().1r(\'1G\')};1a.D.7C=C(){z h.Y().1r(\'3j\')};1a.D.fE=C(){z J 1U(h.9M())};1a.D.fF=C(){z J 1U(h.7C())};1a.D.5m=C(){z h.Y().1r(\'2N\')};1a.D.2q=C(){z h.Y().1r(\'1k\')};1a.D.fG=C(){z h.Y().1r(\'Q:6z\')};1a.D.fB=C(){z h.Y().3E};1a.D.2C=C(V,1e){k(!h.Y()){z 1h}V=V||\'*\';1e=1e||\'*\';k(h.Y().7A){z h.Y().7A(1e,V).1y(0)}p 5x=h.Y().3X(V);k(1e!=\'*\'){L(p i=0;i<5x.F;i++){k(5x.1y(i).3E==1e){z 5x.1y(i)}}}H{z 5x.1y(0)}z 1h}1a.D.49=C(V,1e){p 2b=h.2C(V,1e);k(2b&&2b.5g){z 2b.5g.4u}H{z\'\'}};1a.D.5P=C(){z 1a.8N(h.Y())};1a.D.fA=C(){z(h.2q()==\'1f\')};1a.D.fu=C(7v){p 5b=h.5P();5b.7y(h.7C());5b.9v();5b.5M(\'1f\');5b.4o(\'1f\',{3z:7v.3z,1k:7v.1k},[[7v.5K]]);z 5b};1a.D.Q=C(){k(h.2s().Q)z h.2s().Q;p Q=(J 5c()).5J(h.Y());k(X(Q)!=\'1F\')z Q;z(J 5c()).5J(h.K)};1a.D.fx=C(3S){z h.Y().1r(3S)};1a.D.ay=C(1M){L(p i=0;i<1M.3W.F;i++)k(1M.3W.1y(i).3m!=\'1d\')h.Y().2p(1M.3W.1y(i).3m,1M.3W.1y(i).4u);L(p i=0;i<1M.3N.F;i++)k(h.2s().7V)h.Y().1E(h.2s().7V(1M.3N.1y(i),1g));H h.Y().1E(1M.3N.1y(i).fy(1g))};1a.D.4m=C(3m,4u){p 1M=h.2C(3m);p 7P=h.2s().aJ(4u);k(1M)1t{1M.fc(7P,1M.5g)}1s(e){}H{1M=h.Y().1E(h.2s().3l(3m));1M.1E(7P)}z 1M};1a.D.4q=C(3U){z 2Y.4q(h.2s(),3U,1B[1],1B[2])};1a.D.4o=C(1J){k(X 1J==\'3V\'){z h.Y().1E(1J)}H{z h.Y().1E(h.4q(1J,1B[1],1B[2]))}};C 3o(){h.3e=1a;h.3e(\'aI\')}3o.D=J 1a;3o.D.9s=C(1v){h.4m("1v",1v);z h};3o.D.b1=C(33){k(33==\'eP\'||33==\'eR\'||33==\'eS\'||33==\'eU\')h.4m("33",33);z h};3o.D.9q=C(5E){h.4m("9w",5E);z h};3o.D.eT=C(33,1v,5E){k(33)h.b1(33);k(1v)h.9s(1v);k(5E)h.9q(5E);z h};3o.D.eO=C(){z h.49(\'1v\')};3o.D.eN=C(){z h.49(\'33\')};3o.D.eI=C(){z h.49(\'9w\')};C 2H(){h.3e=1a;h.3e(\'I\')}2H.D=J 1a;2H.D.5D=C(1G,1k,2N){k(1G)h.7y(1G);k(1k)h.5M(1k);k(2N)h.7s(2N);z h};2H.D.eH=C(1d){p 2e;1t{2e=h.2s().9d(1d,\'2e\')}1s(e){2e=h.2s().3l(\'2e\')}k(2e&&2e.1r(\'1d\')!=1d)2e.2p(\'1d\',1d);h.Y().1E(2e);z 2e};2H.D.8c=C(){z h.Y().3X(\'2e\').1y(0)};2H.D.eK=C(){k(h.8c())z h.8c().3E;H z 1h};2H.D.eM=C(2L){p 3D=h.5P();3D.7y(h.7C());3D.5M(\'4N\');k(2L){k(X 2L==\'38\')3D.2C().1E(3D.2s().4L(2L));H k(2L.eV==1l){p 2b=3D.2C();L(p i=0;i<2L.F;i++)k(X 2L[i]==\'38\')2b.1E(3D.2s().4L(2L[i]));H k(X 2L[i]==\'3V\')2b.1E(2L[i])}H k(X 2L==\'3V\')3D.2C().1E(2L)}z 3D};C 3v(){h.3e=1a;h.3e(\'2E\')}3v.D=J 1a;3v.D.f5=C(U){h.4m("U",U);z h};3v.D.f7=C(7q){h.4m("7q",7q);z h};3v.D.f8=C(7x){h.4m("7x",7x);z h};3v.D.fa=C(){z h.49(\'7x\')};3v.D.f9=C(){z h.49(\'U\')};3v.D.f4=C(){z h.49(\'7q\')};1a.8N=C(2b){p 1M;6h(2b.3m.6I()){2n\'aI\':1M=J 3o();1X;2n\'2E\':1M=J 3v();1X;2n\'I\':1M=J 2H();1X;81:z 1h}1M.ay(2b);z 1M};C 25(S){h.3e=R;h.3e(S);h.3B=8M;h.3k=0;h.2S=J 3A();h.5n=0;h.4f=0;h.5q=0;h.5Z=f0}25.D=J R();25.D.f2=C(S){h.1u=S.1u||\'9A\';h.1O=S.1O;h.2t=S.2t;h.3w=S.2A;h.1W=S.35;h.4f=S.8n;h.3k=S.8o;h.8W(S.8A-1);h.4S(h.2J);k(S.2B)h.5Z=S.2B;h.1T=1g;h.18(\'8z\');h.2m=3Y(1m.1o(h.66,h),6y);h.2D=3Y(1m.1o(h.6d,h),6n);h.1S=3b(1m.1o(h.3d,h),h.3p())};25.D.4S=C(2u){k(2u&&!8L(2u)){k(!h.5W())h.2J=9z;H k(h.4f&&2uh.3k*4O)h.2J=h.3k*4O;H h.2J=2u}z h.2J};25.D.5W=C(){z(h.3B==0)};25.D.4K=C(){L(p i=0;i"+3R+Q+""}H{O+="/>"}h.2S[h.1W]=J 3A();h.2S[h.1W].Q=O;h.5n=h.1W;L(p i 3q h.2S)k(h.2S.4l(i)&&i";z O};25.D.6e=C(M){h.E.G(h.N[M].r.1Q,4);k(!h.N[M].r.3r||!h.N[M].r.3r.1R){h.18(\'1z\',2k(\'45\',\'2w\',\'4y-4z\'));z}p U=h.N[M].r.3r.1R;k(U.1r(\'aL\')){h.4x=U.1r(\'aL\');h.E.G("65 4x: "+h.4x,2)}H{h.1S=3b(1m.1o(h.99,h),h.3p());z}h.1S=3b(1m.1o(h.3d,h),h.3p());k(!h.95(U))z;k(h.4B)h.90();H h.6K()};25.D.4G=C(){z(\'6g,5Y,4n,1W,5n,5Z,4f,3k,3B,2S,5q\').47(\',\')};25.D.7N=C(M){1t{h.E.G(h.N[M].r.6f(),4);h.E.G(h.N[M].r.1Q,4)}1s(ex){h.E.G("83 1n",4)}k(h.N[M].r.1v!=7I||!h.N[M].r.3r){h.E.G("9T 1n f6 (1v: "+h.N[M].r.1v+")",1);h.18(\'1z\',2k(\'45\',\'2w\',\'4y-4z\'));z}p U=h.N[M].r.3r.1R;k(!U||U.6b!=\'U\'||U.3E!=\'1p://P.1q/26/5X\'){h.E.G("8u U 1J eW eL U 3q 9T 1n",1);h.18("1z",2k("4W","2B","6t-4y-1f"));z}k(U.1r("1k")=="4g"){h.E.G("6c 1n:\\n"+h.N[M].r.1Q,1);39(h.1S);h.1T=W;h.E.G("3H.",1);h.18(\'3G\');h.18(\'1z\',2k(\'45\',\'2w\',\'4y-4z\'));z}h.3w=U.1r(\'2A\');h.E.G("65 2A: "+h.3w,2);k(U.1r(\'8n\'))h.4f=U.1r(\'8n\');k(U.1r(\'8o\'))h.3k=U.1r(\'8o\');k(U.1r(\'8A\'))h.8W(U.1r(\'8A\')-1);h.E.G("4U 3f 1G "+h.9Y(),2);k(U.1r(\'8D\'))h.eJ=U.1r(\'8D\');k(U.1r(\'aZ\'))h.5q=9l.9t(U.1r(\'aZ\'),eQ);h.4S(h.2J);h.1T=1g;h.2D=3Y(1m.1o(h.6d,h),6n);h.2m=3Y(1m.1o(h.66,h),6y);h.6e(M)};25.D.7H=C(1b){k(!h.43()||!1b)z 1h;p r=1b.r;1t{k(r.1v==7w||r.1v==ba){h.61();z 1h}k(r.1v!=7I||!r.3r){h.2R++;p 7F="6c 1n ("+r.1v+"):\\n"+r.6f()+"\\n"+r.1Q;k(!r.3r)7F+="\\fb 4p 1G 68!";h.E.G(7F,1);k(h.2R>7K){h.61();z 1h}h.E.G("am ("+h.2R+")",1);h.2i(\'al\');3b(1m.1o(h.59,h),h.3p());z 1h}}1s(e){h.E.G("7T 1f: 1v 1V fz",1);h.2R++;k(h.2R>7K){h.61()}H{h.E.G("am ("+h.2R+")",1);h.2i(\'al\');3b(1m.1o(h.59,h),h.3p())}z 1h}p U=r.3r.1R;k(!U||U.6b!=\'U\'||U.3E!=\'1p://P.1q/26/5X\'){h.E.G("6c 1n:\\n"+r.1Q,1);39(h.1S);1Z(h.2m);1Z(h.2D);h.1T=W;h.E.G("3H.",1);h.18(\'3G\');h.2i(\'6s\');h.18(\'1z\',2k(\'4W\',\'2B\',\'6t-3M-1f\'));z 1h}k(X(1b.35)!=\'1F\'&&h.2S[1b.35]){k(h.2S[1b.35].93){h.E.G("fw 93 "+1b.35,2);z 1h}H h.2S[1b.35].93=1g}k(U.1r("1k")=="4g"){h.E.G("4a fv:\\n"+r.1Q,1);39(h.1S);1Z(h.2m);1Z(h.2D);k(U.1r("7z")=="8J-1H-1f")k(U.3X("67").F>0)h.2i("4a-4g-67");h.18(\'1z\',2k(\'45\',\'2w\',U.1r(\'7z\')));h.1T=W;h.E.G("3H.",1);h.18(\'3G\');z 1h}h.2R=0;z r.3r.1R};25.D.7d=C(1G,cb,1j){h.8I=1g;cb.62(h,1j)};25.D.59=C(){k(h.5q==0&&h.1W>=h.5n)h.1W=h.5n-1;h.3d()};25.D.8W=C(3f){k(!3f||8L(3f)||3f<0)3f=0;H k(3f>8M)3f=8M;h.3B=3f;z h.3B};25.D.4H=C(4F){p 1b=J 3A();p r=2U.3F();1t{r.9D("9K",h.79,4F);r.9e(\'9r-9R\',\'4c/Q; 8i=8j-8\')}1s(e){h.E.G(e,1)}1b.r=r;h.1W++;1b.35=h.1W;z 1b};25.D.8v=C(){k(h.5q==0)z;p M=h.4K();h.N[M]=h.4H(W);p O="";h.E.G("9b: "+O,4);h.N[M].r.2Q(O)};C 28(S){h.3e=R;h.3e(S);6H=W}28.D=J R();28.D.5W=C(){z 1g};28.D.4K=C(){k(X(h.N[0])==\'1F\'||X(h.N[0].r)==\'1F\'||h.N[0].r.2K==4)z 0;H z-1};28.D.9a=C(){p O="0";k(5U){h.1L=J 3P(8R,h.E);1x=h.1L.3s();O+=";"+1x}p 97=h.1u;k(h.5S)97=h.5S;O+=",<1H:1H 1G=\'"+97+"\' 1d=\'P:8r\' 1d:1H=\'1p://5o.P.1q/4d\'";k(h.29==\'3g\'||h.29==\'6O\')O+=" 7a=\'1.0\'";O+=">";z O};28.D.5T=C(3R,5V){p O=h.3w;k(5U){O+=";"+h.1L.3s();k(h.1L.6M()){h.1L=J 3P(8R,h.E);O+=\';\'+h.1L.3s()}}O+=\',\';k(3R)O+=3R;3T(h.1C.F){O+=h.1C[0];h.1C=h.1C.4I(1,h.1C.F)}k(5V)O+=\'\';z O};28.D.6e=C(){k(h.N[0].r.1Q==\'\'){h.E.G("fk L 1H 2N",2);h.1S=3b(1m.1o(h.99,h),4O);z}h.E.G(h.N[0].r.1Q,4);k(h.N[0].r.1Q.6a(/2N=[\\\'\\"]([^\\\'\\"]+)[\\\'\\"]/))h.4x=fq.$1;h.E.G("65 4x: "+h.4x,2);p K;1t{p 1n=h.N[0].r.1Q;k(!1n.6a(/<\\/1H:1H>\\s*$/))1n+=\'\';K=2I.3F("K");K.4L(1n);k(!h.95(K))z}1s(e){h.E.G("4L: "+e.2v(),1)}h.1T=1g;k(h.4B)h.90();H h.6K();h.3d(h.2J)};28.D.4G=C(){z J 1l()};28.D.7N=C(){h.E.G(h.N[0].r.6f(),4);p 37=h.N[0].r.aq(\'aw-8G\');37=37.47(";");L(p i=0;i<37.F;i++){51=37[i].47("=");k(51[0]==\'av\')h.3w=51[1]}h.E.G("65 2A: "+h.3w,2);h.1T=1g;h.2m=3Y(1m.1o(h.66,h),6y);h.2D=3Y(1m.1o(h.6d,h),6n);h.6e()};28.D.7H=C(r){p 1b=r.r;k(!h.43())z 1h;k(1b.1v!=7I){h.E.G("6c 1n ("+1b.1v+"):"+1b.1Q+"\\n"+1b.6f(),1);h.2i(\'6s\');39(h.1S);1Z(h.2m);1Z(h.2D);h.1T=W;h.E.G("3H.",1);h.18(\'3G\');h.18(\'1z\',2k(\'45\',\'2w\',\'4y-4z\'));z 1h}h.E.G(1b.6f(),4);p 2A,37=1b.aq(\'aw-8G\');k(37==1h)2A="-1:0";H{37=37.47(";");p 2A;L(p i=0;i<37.F;i++){p 51=37[i].47("=");k(51[0]==\'av\')2A=51[1]}}k(X(2A)!=\'1F\'&&2A.2x(\':0\')!=-1){6h(2A.36(0,2A.2x(\':0\'))){2n\'0\':h.E.G("6c 1n:"+1b.1Q,1);1X;2n\'-1\':h.E.G("dE dP 5a",1);1X;2n\'-2\':h.E.G("dO e7",1);1X;2n\'-3\':h.E.G("e8 eu 5a",1);1X}h.2i(\'6s\');39(h.1S);1Z(h.2m);1Z(h.2D);h.18(\'1z\',2k(\'4W\',\'2B\',\'6t-3M-1f\'));h.1T=W;h.E.G("3H.",1);h.18(\'3G\');z 1h}k(!1b.1Q||1b.1Q==\'\')z 1h;1t{p 1n=1b.1Q.2V(/\\<\\?Q.+\\?\\>/,"");k(1n.6a(/<1H:1H/))1n+="";p K=28.8t(""+1n+"");k(!K||K.6b==\'7f\'){h.E.G("7f",1);K=28.8t("<1H:1H 1d:1H=\'1p://5o.P.1q/4d\'>"+1b.1Q);k(K&&K.6b!=\'7f\'){h.E.G("1H et",1);k(K.3X(\'67\').F>0)h.2i("4a-4g-67");39(h.1S);1Z(h.2m);1Z(h.2D);h.18(\'1z\',2k(\'45\',\'2w\',\'4a-4g\'));h.1T=W;h.E.G("3H.",1);h.18(\'3G\')}H h.E.G("7f:"+K,1);z K}z K}1s(e){h.E.G("68 1f:"+e.2E,1)}z 1h};28.D.7d=C(1G,cb,1j){h.4b("<1H:1H 1d:1H=\'1p://5o.P.1q/4d\' 1d=\'P:8r\' 1G=\'"+1G+"\' 7a=\'1.0\'>",cb,1j)};28.D.59=C(){h.3d(h.2J)};28.D.4H=C(4F){p r=2U.3F();1t{r.9D("9K",h.79,4F);k(r.9U)r.9U(\'4c/gN; 8i=8j-8\');r.9e(\'9r-9R\',\'bV/x-bG-bF-bT\')}1s(e){h.E.G(e,1)}p 1b=J 3A();1b.r=r;z 1b};28.D.8v=C(){};28.8t=C(s){1t{p r=2I.3F("U","9i");k(X(r.4L)!=\'1F\'){r.4L(s);z r.1R}H k(3y.6S)z(J 6S()).9P(s,"4c/Q").1R}1s(e){}z 1h};p 1m={d1:\'1.3.1\',ad:C(a9){3Z.7l(\'<8C 1k="4c/d6" 7o="\'+a9+\'">\')},6j:C(){p 8g=[\'da\',\'d9\',\'d8\',\'d7\',\'d0\',\'2j\',\'4Q\',\'1U\',\'2Y\',\'1a\',\'2k\',\'3P\',\'R\',\'28\',\'25\',\'a5\'];p 69=3Z.3X("8C");p 7B=\'./\';L(p i=0;i<69.F;i++){k(69.1y(i).7o&&69.1y(i).7o.6a(/1m\\.7M$/)){7B=69.1y(i).7o.2V(/1m.7M$/,\'\');1X}}L(p i=0;i<8g.F;i++)h.ad(7B+8g[i]+\'.7M\')},1o:C(fn,4k,1j){z C(){k(1j)fn.aX(4k,1j);H fn.aX(4k)}}};k(X R==\'1F\')1m.6j();',62,1074,'|||||||||||||||||this|||if|||||var||||||||||return|||function|prototype|oDbg|length|log|else|iq|new|doc|for|slot|_req|reqstr|jabber|xml|JSJaCConnection|oArg||body|name|false|typeof|getNode||||||||||_handleEvent|str|JSJaCPacket|req|jid|xmlns|ns|error|true|null|event|arg|type|Array|JSJaC|response|bind|http|org|getAttribute|catch|try|domain|status|chrsz|key|item|onerror|auth|arguments|_pQueue|STANZA_ERROR|appendChild|undefined|to|stream|xmpp|element|packet|_keys|aNode|data|username|binarray|responseText|documentElement|_timeout|_connected|JSJaCJID|not|_rid|break|ts|clearInterval||||||JSJaCHttpBindingConnection|protocol|safe_add|JSJaCHttpPollingConnection|authtype|md5_hh|node|md5_gg|md5_ff|query|md5_ii|urn|charAt|_setStatus|JSJaCCookie|JSJaCError|handler|_interval|case|ietf|setAttribute|getType|params|getDoc|resource|timerval|toString|cancel|indexOf|pID|aEvent|sid|wait|getChild|_inQto|message|_events|level|JSJaCIQ|XmlDocument|_timerval|readyState|payload|_nonce|id|_regIDs|value|send|_errcnt|_last_requests|disconnect|XmlHttp|replace|bin|bkey|JSJaCBuilder|childName||||show|String|rid|substring|aPList|string|clearTimeout|substr|setTimeout|aIq|_process|base|hold|sasl|date|childNS|from|_inactivity|createElement|nodeName|len|JSJaCPresence|getPollInterval|in|responseXML|getKey|SASL|Date|JSJaCMessage|_sid|read|window|code|Object|_hold|msg|rIQ|namespaceURI|create|ondisconnect|Disconnected|_inQ|mechanism|pass|concat|server|childNodes|hex_md5|JSJaCKeys|fromCharCode|raw|attr|while|elementName|object|attributes|getElementsByTagName|setInterval|document||pType|_k|connected|f64|503|prefixes|split|mask|getChildVal|session|_sendRaw|text|streams|throw|_min_polling|terminate|str2binb|core_sha1|jDate|obj|hasOwnProperty|_setChildNode|secure|appendNode|failed|buildNode|core_md5|challenge|128|nodeValue|xmllang|JSJaC_State|streamid|service|unavailable|children|register|console|onreadystatechange|_sendRawCallbacks|async|_getSuspendVars|_setupRequest|slice|tab|_getFreeSlot|loadXML|allow_plain|result|1000|getTime|JSJaCJSON|hex_tab|setPollInterval|ipad|set|eArg|500|aRank|padZero|handlers|offset|aArg|b64|cnonce|xmldoc|0xFF|hex_sha1|bRank|Math|_resume|Error|rPacket|XMLSerializer|rspauth|cnt|ActiveXObject|firstChild|str2binl|num|charCodeAt|_cnonce|prefix|getID|_last_rid|etherx|cookie|_pause|opad|nonsasl|erase|removeAttribute|mechs|rootEl|nodes|arr|atob|push|request|fulljid|setIQ|prio|modify|join|expires|_digest_uri|serializeToString|cond|aJSJaCPacket|setType|secs|authStr|clone|md5_cmn|continue|authhost|_getRequestString|JSJAC_HAVEKEYS|last|isPolling|httpbind|port|_wait||_abort|call|||got|_checkQueue|conflict|parse|scripts|match|tagName|invalid|_checkInQ|_getStreamID|getAllResponseHeaders|host|switch|errors|load|401|errorTag|lMec1|JSJAC_CHECKINQUEUEINTERVAL|has_sasl|_doSASLAuthDone|with|A1|internal_server_error|internal|_nc|A2|MD5|rsptest|JSJAC_CHECKQUEUEINTERVAL|lang|nodeprep|setResource|getResource|curNode|JSJACJID_FORBIDDEN|_indexAt|JSJaCJIDInvalidException|JSJACPACKET_USE_XMLNS|toLowerCase|setTime|_doAuth|_status|lastKey|found|saslanon|getValue|binb2b64|nonce|DOMParser|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|array|b64s|res|_keys2|triplet|test|implementation|_isStringOrNumber|pubsub|muc|attribute|__defineGetter__|getPrefix|Node|0xF|_httpbase|version|oldb|oldc|_reInitStream|olda|parsererror|btoa|ANONYMOUS|oldd|unescape|uo|write|512|hash|src|core_hmac_md5|subject|authorized|setID|core_hmac_sha1|rol|stanza_error|404|thread|setTo|condition|getElementsByTagNameNS|path|getFrom|doc2|_unregisterPID|errmsg|lMec2|_parseResponse|200|hasChildNodes|JSJAC_ERR_COUNT|createDocument|js|_handleInitialResponse|_doStreamBind|tNode|support|registered|param|XMLHttpRequest|recv|importNode|XmlHttpRequest|attrs|_text|Document||default|features|No|instanceof|_children|_xmllang|digest|binl2hex|default_handler|result_handler|_ID|getQuery|0xFFFF|binl2str|error_handler|includes|registerHandler|charset|utf|b64pad|binl2b64|hexcase|polling|inactivity|lsw|PLAIN|client|using|_parseTree|no|_suspend|rPlain|required|DIGEST|onconnect|requests|400|script|ver|anonymous|str_md5|Cookie|newkey|_reinit|remote|binb2str|isNaN|JSJACHBC_MAX_HOLD|wrapNode|size|getName|func|b64_sha1|random|_domain|get|_resource|_setHold|nameEQ|_checkNodeName|_node|_doInBandReg|setNode|info|handled|setDomain|_parseStreamFeatures|removeResource|streamto|binb2hex|_sendEmpty|_getInitialRequestString|Disconnecting|_doSASLAuth|createElementNS|setRequestHeader|_doLegacyAuth|_doLegacyAuth2|use_digest|foo|password|_doLegacyAuthDone|Number|x1f|valid|x00|missing|setPriority|Content|setStatus|max|_doSASLAuthDigestMd5S1|setFrom|priority|but|getDomain|100|localhost|407|1732584193|open|b64arrays|Resume|abc|0123456789abcdef|0123456789ABCDEF|iqHandler|POST|JSJAC_NKEYS|getTo|0x3F|192|parseFromString|100000|Type|256|initial|overrideMimeType|round|seed|utf8d2t|_getHold|forbidden|302|httpbase|0x5C5C5C5C|_doInBandRegDone|0x36363636|JSJaCConsoleLogger|utf8t2d|msw|b64d2t|libraryName|b64t2d|bit_rol|writing|require|0x80|registration|_doSASLAuthDigestMd5S2|271733878|installed|handling|XML|proto_error_fallback|repeating||aborting|_handlePID|getResponseHeader|Could|_doXMPPSessDone||find|ID|Set|224|_replaceNode|compress|_registerPID|number|owner|sending|unregistered|disco|JSJACHBC_USE_BOSH_VER|_handleResponse|presence|createTextNode|detected|authid|htmlEnc|jab2date|DomDocument|parser|addEventListener|does|objects|sha1_ft|browser|olde|sha1_kt|apply|Your|maxpause|271733879|setShow|Microsoft|MSXML2|MSXML|1732584194|JSJaCCookieException|stanzas|success|MSXML3|403|_doXMPPSess|NS_VERSION|NS_DISCO_ITEMS|dex|NS_SEARCH|Eaeflnr|getUTCDate|toLocaleString|items|temp|getUTCMinutes|getUTCSeconds|time|vcard|NS_DISCO_INFO|jabberDate||eval|NS_REGISTER|NS_AUTH_ERROR|NS_AUTH|NS_TIME|u00|removeChild|getUTCHours|isFinite|lastChild|XMLDocument|private|NS_VCARD|form|www|boolean|getUTCMonth|NS_PRIVATE|alert|NS_ROSTER|_attributes|getUTCFullYear|search|floor|hrTime|privacy|NS_PRIVACY|urlencoded|roster|application|145523070|1019803690|568446438|187363961|1163531501|1444681467||405537848|660478335|643717713|373897302|701558691|38016083|51403784|||1735328473|35309556|1530992060|setUTCHours|1272893353|1894007588|899497514|1926607734|378558|2022574463|1839030562|1069501632|165796510|setUTCMinutes|389564586|606105819|1044525330|176418897|680876936|b64_md5|b64_hmac_md5|str_hmac_md5|md5_vm_test|900150983cd24fb0d6963f7d28e17f72|1200080426|160|1804603682|40341101|1502002290|1236535329|1990404162|42063|1473231341|45705983|1770035416|1958414417|NS_LAST|UTC|sha1_vm_test|a9993e364706816aba3e25717850c26c9cd0d89d|str_hmac_sha1|b64_hmac_sha1|amp|343485551|718787259|1560198380|1309151649|hex_hmac_md5|1120210379|hex_hmac_sha1|JSJaCConstants|Version|237|127|2048|str_sha1|javascript|JSJaCConfig|crypt|jsextras|xmlextras|lt|30611744|421815835|640364487|530742520|995338651|1859775393|76029189|722521979|155497632||1094730640|681279174|358537222|198630844|1126891415|1894986606|1051523|2054922799|1873313359|quot|1009589776|1518500249|1416354905|57434055|1700485571|191|unexpected|incoming|Internal|nothing|mechanisms|lost|Connection|sess_1|lastIndexOf|repsonse|Digest|wrong|Bad|Server|bind_1|Slot|is|next|scheduling|poll|msec|JSJaCSendEmpty|onerror_fallback|processing|working|all|ready|slots|busy|Found|standby|Request|Key|present|Warning|used|Auth|NS_XDATA|reg1|_in|packet_in|nRead|Suspend|suspending|Failed||aborted|reading|auth1|auth2|qop|nc|uri|closed|Sequence|failure|realm||AUTHENTICATE|requested|login|supported|authenticating|00000001|applied|onstatuschanged|status_changed|setQuery|getPriority|_bosh_version|getQueryXMLNS|incorrect|reply|getShow|getStatus|chat|JSJACHBC_MAXPAUSE|away|xa|setPresence|dnd|constructor|or|route|JSJACHBC_BOSH_VERSION|delete|JSJACHBC_MAX_WAIT|restart|inherit|xbosh|getSubject|setBody|broken|setSubject|setThread|getBody|getThread|nResponse|replaceChild|setValue|setName|remove|CookieException|isEntity|jsjac|toGMTString|waiting|warn|start||debug|setLevel|RegExp|getLevel|char|nodename|errorReply|terminated|already|_getAttribute|cloneNode|available|isError|getXMLNS|setXMLLang|pause|getToJID|getFromJID|getXMLLang|escape|succesfully|ERR_REMOTE_SERVER_NOT_FOUND|ERR_REGISTRATION_REQUIRED|NS_SASL|ERR_REMOTE_SERVER_TIMEOUT|tls|redirect|ERR_REDIRECT|ERR_RECIPIENT_UNAVAILABLE|payment|NS_BIND|recipient|NS_SESSION|504|timeout|NS_STANZAS|subscription|NS_STREAM|ERR_BAD_REQUEST|JSJAC_ALLOW_PLAIN|ERR_SUBSCRIPTION_REQUIRED|NS_STREAMS|ERR_RESOURCE_CONSTRAINT|NS_TLS|constraint|ERR_SERVICE_UNAVAILABLE|402|ERR_PAYMENT_REQUIRED|ERR_FORBIDDEN|implemented|NS_FEATURE_COMPRESS|ERR_GONE|gone|NS_COMPRESS|feature|ERR_CONFLICT|bad|409|ERR_FEATURE_NOT_IMPLEMENTED|501|ERR_INTERNAL_SERVER_ERROR|ERR_ITEM_NOT_FOUND|ERR_NOT_ALLOWED|acceptable|405|allowed|ERR_NOT_AUTHORIZED||406|ERR_NOT_ACCEPTABLE|ERR_JID_MALFORMED|NS_FEATURE_IQREGISTER|NS_FEATURE_IQAUTH|malformed|intialized|ERR_UNEXPECTED_REQUEST|user|NS_MUC_USER|sort|NS_MUC|JSJAC_INACTIVITY|NS_MUC_ADMIN|admin|_out|disconnecting|JSJaCID_|stats|plain|expire|NS_XCONFERENCE|NS_EVENT|resuming|resume|registerIQSet|unregisterHandler|NS_STATS|conference|registerIQGet|NS_EXPIRE|NS_MUC_OWNER|meta|5222|NS_DELAY|_is_polling|connecting|NS_IQDATA|connect|commands|NS_COMMANDS|NS_PUBSUB_NMI|NS_PUBSUB_OWNER|900000|49999|NS_PUBSUB|onresume|NS_PUBSUB_EVENT|packet_out|delay|suspend|sendIQ'.split('|'),0,{})) Index: lams_learning/web/includes/jsjac-1.3.1/lgpl-2.1.txt =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/lgpl-2.1.txt (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/lgpl-2.1.txt (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaC.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaC.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaC.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,55 @@ +/** + * @fileoverview Magic dependency loading. Taken from script.aculo.us + * and modified to break it. + * @author Stefan Strigler steve@zeank.in-berlin.de + * @version $Revision$ + */ + +var JSJaC = { + Version: '1.3.1', + require: function(libraryName) { + // inserting via DOM fails in Safari 2.0, so brute force approach + document.write(''); + }, + load: function() { + var includes = + ['xmlextras', + 'jsextras', + 'crypt', + 'JSJaCConfig', + 'JSJaCConstants', + 'JSJaCCookie', + 'JSJaCJSON', + 'JSJaCJID', + 'JSJaCBuilder', + 'JSJaCPacket', + 'JSJaCError', + 'JSJaCKeys', + 'JSJaCConnection', + 'JSJaCHttpPollingConnection', + 'JSJaCHttpBindingConnection', + 'JSJaCConsoleLogger' + ]; + var scripts = document.getElementsByTagName("script"); + var path = './'; + for (var i=0; i + * The original parts of the code do have the following + * copyright and license notice:
+ * Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, + * http://mir.acu lo.us)
+ * script.aculo.us is freely distributable under the terms of an + * MIT-style license.
+ * For details, see the script.aculo.us web site: + * http://script.aculo.us/
+ */ +var JSJaCBuilder = { + /** + * @private + */ + buildNode: function(doc, elementName) { + + var element; + + // attributes (or text) + if(arguments[2]) + if(JSJaCBuilder._isStringOrNumber(arguments[2]) || + (arguments[2] instanceof Array)) { + element = doc.createElement(elementName); + JSJaCBuilder._children(doc, element, arguments[2]); + } else { + if (arguments[2]['xmlns']) { + try { + element = doc.createElementNS(arguments[2]['xmlns'],elementName); + } catch(e) { element = doc.createElement(elementName); } + } else + element = doc.createElement(elementName); + for(attr in arguments[2]) { + if (arguments[2].hasOwnProperty(attr)) { + if (attr == 'xmlns' && element.namespaceURI == attr) + continue; + element.setAttribute(attr, arguments[2][attr]); + } + } + + } + else + element = doc.createElement(elementName); + // text, or array of children + if(arguments[3]) + JSJaCBuilder._children(doc, element, arguments[3]); + + return element; + }, + + /** + * @private + */ + _text: function(doc, text) { + return doc.createTextNode(text); + }, + + /** + * @private + */ + _children: function(doc, element, children) { + if(typeof children=='object') { // array can hold nodes and text + for (var i in children) { + if (children.hasOwnProperty(i)) { + var e = children[i]; + if (typeof e=='object') { + if (e instanceof Array) { + var node = JSJaCBuilder.buildNode(doc, e[0], e[1], e[2]); + element.appendChild(node); + } else { + element.appendChild(e); + } + } else { + if(JSJaCBuilder._isStringOrNumber(e)) { + element.appendChild(JSJaCBuilder._text(doc, e)); + } + } + } + } + } else { + if(JSJaCBuilder._isStringOrNumber(children)) { + element.appendChild(JSJaCBuilder._text(doc, children)); + } + } + }, + + _attributes: function(attributes) { + var attrs = []; + for(attribute in attributes) + if (attributes.hasOwnProperty(attribute)) + attrs.push(attribute + + '="' + attributes[attribute].toString().htmlEnc() + '"'); + return attrs.join(" "); + }, + + _isStringOrNumber: function(param) { + return(typeof param=='string' || typeof param=='number'); + } +}; Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConfig.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConfig.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConfig.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,22 @@ + +var JSJAC_HAVEKEYS = true; // whether to use keys +var JSJAC_NKEYS = 16; // number of keys to generate +var JSJAC_INACTIVITY = 300; // qnd hack to make suspend/resume work more smoothly with polling +var JSJAC_ERR_COUNT = 10; // number of retries in case of connection errors + +var JSJAC_ALLOW_PLAIN = true; // whether to allow plaintext logins + +var JSJAC_CHECKQUEUEINTERVAL = 1; // msecs to poll send queue +var JSJAC_CHECKINQUEUEINTERVAL = 1; // msecs to poll incoming queue + +// Options specific to HTTP Binding (BOSH) +var JSJACHBC_BOSH_VERSION = "1.6"; +var JSJACHBC_USE_BOSH_VER = true; + +var JSJACHBC_MAX_HOLD = 1; +var JSJACHBC_MAX_WAIT = 300; + +var JSJACHBC_MAXPAUSE = 120; + +/*** END CONFIG ***/ + Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConnection.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConnection.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConnection.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,1253 @@ +/** + * @fileoverview Contains all things in common for all subtypes of connections + * supported. + * @author Stefan Strigler steve@zeank.in-berlin.de + * @version $Revision$ + */ + +/** + * Creates a new Jabber connection (a connection to a jabber server) + * @class Somewhat abstract base class for jabber connections. Contains all + * of the code in common for all jabber connections + * @constructor + * @param {JSON http://www.json.org/index} oArg JSON with properties:
+ * * httpbase the http base address of the service to be used for + * connecting to jabber
+ * * oDbg (optional) a reference to a debugger interface + */ +function JSJaCConnection(oArg) { + + if (oArg && oArg.oDbg && oArg.oDbg.log) + /** + * Reference to debugger interface + *(needs to implement method log) + * @type Debugger + */ + this.oDbg = oArg.oDbg; + else { + this.oDbg = new Object(); // always initialise a debugger + this.oDbg.log = function() { }; + } + + if (oArg && oArg.httpbase) + /** + * @private + */ + this._httpbase = oArg.httpbase; + + if (oArg && oArg.allow_plain) + /** + * @private + */ + this.allow_plain = oArg.allow_plain; + else + this.allow_plain = JSJAC_ALLOW_PLAIN; + + /** + * @private + */ + this._connected = false; + /** + * @private + */ + this._events = new Array(); + /** + * @private + */ + this._keys = null; + /** + * @private + */ + this._ID = 0; + /** + * @private + */ + this._inQ = new Array(); + /** + * @private + */ + this._pQueue = new Array(); + /** + * @private + */ + this._regIDs = new Array(); + /** + * @private + */ + this._req = new Array(); + /** + * @private + */ + this._status = 'intialized'; + /** + * @private + */ + this._errcnt = 0; + /** + * @private + */ + this._inactivity = JSJAC_INACTIVITY; + /** + * @private + */ + this._sendRawCallbacks = new Array(); + + if (oArg && oArg.timerval) + this.setPollInterval(oArg.timerval); +} + +JSJaCConnection.prototype.connect = function(oArg) { + this._setStatus('connecting'); + + this.domain = oArg.domain || 'localhost'; + this.username = oArg.username; + this.resource = oArg.resource; + this.pass = oArg.pass; + this.register = oArg.register; + + this.authhost = oArg.authhost || this.domain; + this.authtype = oArg.authtype || 'sasl'; + + if (oArg.xmllang && oArg.xmllang != '') + this._xmllang = oArg.xmllang; + + this.host = oArg.host || this.domain; + this.port = oArg.port || 5222; + if (oArg.secure) + this.secure = 'true'; + else + this.secure = 'false'; + + if (oArg.wait) + this._wait = oArg.wait; + + this.jid = this.username + '@' + this.domain; + this.fulljid = this.jid + '/' + this.resource; + + this._rid = Math.round( 100000.5 + ( ( (900000.49999) - (100000.5) ) * Math.random() ) ); + + // setupRequest must be done after rid is created but before first use in reqstr + var slot = this._getFreeSlot(); + this._req[slot] = this._setupRequest(true); + + var reqstr = this._getInitialRequestString(); + + this.oDbg.log(reqstr,4); + + this._req[slot].r.onreadystatechange = + JSJaC.bind(function() { + if (this._req[slot].r.readyState == 4) { + this.oDbg.log("async recv: "+this._req[slot].r.responseText,4); + this._handleInitialResponse(slot); // handle response + } + }, this); + + if (typeof(this._req[slot].r.onerror) != 'undefined') { + this._req[slot].r.onerror = + JSJaC.bind(function(e) { + this.oDbg.log('XmlHttpRequest error',1); + return false; + }, this); + } + + this._req[slot].r.send(reqstr); +}; + +/** + * Tells whether this connection is connected + * @return true if this connections is connected, + * false otherwise + * @type boolean + */ +JSJaCConnection.prototype.connected = function() { return this._connected; }; + +/** + * Disconnects from jabber server and terminates session (if applicable) + */ +JSJaCConnection.prototype.disconnect = function() { + this._setStatus('disconnecting'); + + if (!this.connected()) + return; + this._connected = false; + + clearInterval(this._interval); + clearInterval(this._inQto); + + if (this._timeout) + clearTimeout(this._timeout); // remove timer + + var slot = this._getFreeSlot(); + // Intentionally synchronous + this._req[slot] = this._setupRequest(false); + + request = this._getRequestString(false, true); + + this.oDbg.log("Disconnecting: " + request,4); + this._req[slot].r.send(request); + + try { + JSJaCCookie.read('JSJaC_State').erase(); + } catch (e) {} + + this.oDbg.log("Disconnected: "+this._req[slot].r.responseText,2); + this._handleEvent('ondisconnect'); +}; + +/** + * Gets current value of polling interval + * @return Polling interval in milliseconds + * @type int + */ +JSJaCConnection.prototype.getPollInterval = function() { + return this._timerval; +}; + +/** + * Registers an event handler (callback) for this connection. + + *

Note: All of the packet handlers for specific packets (like + * message_in, presence_in and iq_in) fire only if there's no + * callback associated with the id.
+ + *

Example:
+ * con.registerHandler('iq', 'query', 'jabber:iq:version', handleIqVersion); + + + * @param {String} event One of + + *

    + *
  • onConnect - connection has been established and authenticated
  • + *
  • onDisconnect - connection has been disconnected
  • + *
  • onResume - connection has been resumed
  • + + *
  • onStatusChanged - connection status has changed, current + * status as being passed argument to handler. See {@link #status}.
  • + + *
  • onError - an error has occured, error node is supplied as + * argument, like this:
    <error code='404' type='cancel'>
    + * <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    + * </error>
  • + + *
  • packet_in - a packet has been received (argument: the + * packet)
  • + + *
  • packet_out - a packet is to be sent(argument: the + * packet)
  • + + *
  • message_in | message - a message has been received (argument: + * the packet)
  • + + *
  • message_out - a message packet is to be sent (argument: the + * packet)
  • + + *
  • presence_in | presence - a presence has been received + * (argument: the packet)
  • + + *
  • presence_out - a presence packet is to be sent (argument: the + * packet)
  • + + *
  • iq_in | iq - an iq has been received (argument: the packet)
  • + *
  • iq_out - an iq is to be sent (argument: the packet)
  • + *
+ + * @param {String} childName A childnode's name that must occur within a + * retrieved packet [optional] + + * @param {String} childNS A childnode's namespace that must occure within + * a retrieved packet (works only if childName is given) [optional] + + * @param {String} type The type of the packet to handle (works only if childName and chidNS are given (both may be set to '*' in order to get skipped) [optional] + + * @param {Function} handler The handler to be called when event occurs. If your handler returns 'true' it cancels bubbling of the event. No other registered handlers for this event will be fired. + */ +JSJaCConnection.prototype.registerHandler = function(event) { + event = event.toLowerCase(); // don't be case-sensitive here + var eArg = {handler: arguments[arguments.length-1], + childName: '*', + childNS: '*', + type: '*'}; + if (arguments.length > 2) + eArg.childName = arguments[1]; + if (arguments.length > 3) + eArg.childNS = arguments[2]; + if (arguments.length > 4) + eArg.type = arguments[3]; + if (!this._events[event]) + this._events[event] = new Array(eArg); + else + this._events[event] = this._events[event].concat(eArg); + + // sort events in order how specific they match criterias thus using + // wildcard patterns puts them back in queue when it comes to + // bubbling the event + this._events[event] = + this._events[event].sort(function(a,b) { + var aRank = 0; + var bRank = 0; + with (a) { + if (type == '*') + aRank++; + if (childNS == '*') + aRank++; + if (childName == '*') + aRank++; + } + with (b) { + if (type == '*') + bRank++; + if (childNS == '*') + bRank++; + if (childName == '*') + bRank++; + } + if (aRank > bRank) + return 1; + if (aRank < bRank) + return -1; + return 0; + }); + this.oDbg.log("registered handler for event '"+event+"'",2); +}; + +JSJaCConnection.prototype.unregisterHandler = function(event,handler) { + event = event.toLowerCase(); // don't be case-sensitive here + + if (!this._events[event]) + return; + + var arr = this._events[event], res = new Array(); + for (var i=0; i + *
  • 'initializing' ... well + *
  • 'connecting' if connect() was called + *
  • 'resuming' if resume() was called + *
  • 'processing' if it's about to operate as normal + *
  • 'onerror_fallback' if there was an error with the request object + *
  • 'protoerror_fallback' if there was an error at the http binding protocol flow (most likely that's where you interested in) + *
  • 'internal_server_error' in case of an internal server error + *
  • 'suspending' if suspend() is being called + *
  • 'aborted' if abort() was called + *
  • 'disconnecting' if disconnect() has been called + * + * @type String + */ +JSJaCConnection.prototype.status = function() { return this._status; }; + +/** + * Suspsends this connection (saving state for later resume) + */ +JSJaCConnection.prototype.suspend = function() { + + // remove timers + clearTimeout(this._timeout); + clearInterval(this._interval); + clearInterval(this._inQto); + + this._suspend(); + + var u = ('_connected,_keys,_ID,_inQ,_pQueue,_regIDs,_errcnt,_inactivity,domain,username,resource,jid,fulljid,_sid,_httpbase,_timerval,_is_polling').split(','); + u = u.concat(this._getSuspendVars()); + var s = new Object(); + + for (var i=0; i", + this._doSASLAuthDone); + } + this.oDbg.log("SASL ANONYMOUS requested but not supported",1); + } else { + if (this.mechs['DIGEST-MD5']) { + this.oDbg.log("SASL using mechanism 'DIGEST-MD5'",2); + return this._sendRaw("", + this._doSASLAuthDigestMd5S1); + } else if (this.allow_plain && this.mechs['PLAIN']) { + this.oDbg.log("SASL using mechanism 'PLAIN'",2); + var authStr = this.username+'@'+ + this.domain+String.fromCharCode(0)+ + this.username+String.fromCharCode(0)+ + this.pass; + this.oDbg.log("authenticating with '"+authStr+"'",2); + authStr = btoa(authStr); + return this._sendRaw(""+authStr+"", + this._doSASLAuthDone); + } + this.oDbg.log("No SASL mechanism applied",1); + this.authtype = 'nonsasl'; // fallback + } + return false; +}; + +/** + * @private + */ +JSJaCConnection.prototype._doSASLAuthDigestMd5S1 = function(el) { + if (el.nodeName != "challenge") { + this.oDbg.log("challenge missing",1); + this._handleEvent('onerror',JSJaCError('401','auth','not-authorized')); + this.disconnect(); + } else { + var challenge = atob(el.firstChild.nodeValue); + this.oDbg.log("got challenge: "+challenge,2); + this._nonce = challenge.substring(challenge.indexOf("nonce=")+7); + this._nonce = this._nonce.substring(0,this._nonce.indexOf("\"")); + this.oDbg.log("nonce: "+this._nonce,2); + if (this._nonce == '' || this._nonce.indexOf('\"') != -1) { + this.oDbg.log("nonce not valid, aborting",1); + this.disconnect(); + return; + } + + this._digest_uri = "xmpp/"; + // if (typeof(this.host) != 'undefined' && this.host != '') { + // this._digest-uri += this.host; + // if (typeof(this.port) != 'undefined' && this.port) + // this._digest-uri += ":" + this.port; + // this._digest-uri += '/'; + // } + this._digest_uri += this.domain; + + this._cnonce = cnonce(14); + + this._nc = '00000001'; + + var A1 = str_md5(this.username+':'+this.domain+':'+this.pass)+ + ':'+this._nonce+':'+this._cnonce; + + var A2 = 'AUTHENTICATE:'+this._digest_uri; + + var response = hex_md5(hex_md5(A1)+':'+this._nonce+':'+this._nc+':'+ + this._cnonce+':auth:'+hex_md5(A2)); + + var rPlain = 'username="'+this.username+'",realm="'+this.domain+ + '",nonce="'+this._nonce+'",cnonce="'+this._cnonce+'",nc="'+this._nc+ + '",qop=auth,digest-uri="'+this._digest_uri+'",response="'+response+ + '",charset=utf-8'; + + this.oDbg.log("response: "+rPlain,2); + + this._sendRaw(""+ + binb2b64(str2binb(rPlain))+"", + this._doSASLAuthDigestMd5S2); + } +}; + +/** + * @private + */ +JSJaCConnection.prototype._doSASLAuthDigestMd5S2 = function(el) { + if (el.nodeName == 'failure') { + if (el.xml) + this.oDbg.log("auth error: "+el.xml,1); + else + this.oDbg.log("auth error",1); + this._handleEvent('onerror',JSJaCError('401','auth','not-authorized')); + this.disconnect(); + return; + } + + var response = atob(el.firstChild.nodeValue); + this.oDbg.log("response: "+response,2); + + var rspauth = response.substring(response.indexOf("rspauth=")+8); + this.oDbg.log("rspauth: "+rspauth,2); + + var A1 = str_md5(this.username+':'+this.domain+':'+this.pass)+ + ':'+this._nonce+':'+this._cnonce; + + var A2 = ':'+this._digest_uri; + + var rsptest = hex_md5(hex_md5(A1)+':'+this._nonce+':'+this._nc+':'+ + this._cnonce+':auth:'+hex_md5(A2)); + this.oDbg.log("rsptest: "+rsptest,2); + + if (rsptest != rspauth) { + this.oDbg.log("SASL Digest-MD5: server repsonse with wrong rspauth",1); + this.disconnect(); + return; + } + + if (el.nodeName == 'success') + this._reInitStream(this.domain, this._doStreamBind); + else // some extra turn + this._sendRaw("", + this._doSASLAuthDone); +}; + +/** + * @private + */ +JSJaCConnection.prototype._doSASLAuthDone = function (el) { + if (el.nodeName != 'success') { + this.oDbg.log("auth failed",1); + this._handleEvent('onerror',JSJaCError('401','auth','not-authorized')); + this.disconnect(); + } else + this._reInitStream(this.domain, this._doStreamBind); +}; + +/** + * @private + */ +JSJaCConnection.prototype._doStreamBind = function() { + var iq = new JSJaCIQ(); + iq.setIQ(this.domain,'set','bind_1'); + iq.appendNode("bind", {xmlns: "urn:ietf:params:xml:ns:xmpp-bind"}, + [["resource", this.resource]]); + this.oDbg.log(iq.xml()); + this.send(iq,this._doXMPPSess); +}; + +/** + * @private + */ +JSJaCConnection.prototype._doXMPPSess = function(iq) { + if (iq.getType() != 'result' || iq.getType() == 'error') { // failed + this.disconnect(); + if (iq.getType() == 'error') + this._handleEvent('onerror',iq.getChild('error')); + return; + } + + this.fulljid = iq.getChildVal("jid"); + this.jid = this.fulljid.substring(0,this.fulljid.lastIndexOf('/')); + + iq = new JSJaCIQ(); + iq.setIQ(this.domain,'set','sess_1'); + iq.appendNode("session", {xmlns: "urn:ietf:params:xml:ns:xmpp-session"}, + []); + this.oDbg.log(iq.xml()); + this.send(iq,this._doXMPPSessDone); +}; + +/** + * @private + */ +JSJaCConnection.prototype._doXMPPSessDone = function(iq) { + if (iq.getType() != 'result' || iq.getType() == 'error') { // failed + this.disconnect(); + if (iq.getType() == 'error') + this._handleEvent('onerror',iq.getChild('error')); + return; + } else + this._handleEvent('onconnect'); +}; + +/** + * @private + */ +JSJaCConnection.prototype._handleEvent = function(event,arg) { + event = event.toLowerCase(); // don't be case-sensitive here + this.oDbg.log("incoming event '"+event+"'",3); + if (!this._events[event]) + return; + this.oDbg.log("handling event '"+event+"'",2); + for (var i=0;i match for handler "+aEvent.handler,3); + } + if (aEvent.handler.call(this,arg)) // handled! + break; + } + else + if (aEvent.handler.call(this)) // handled! + break; + } catch (e) { this.oDbg.log(aEvent.handler+"\n>>>"+e.name+": "+ e.message,1); } + } + } +}; + +/** + * @private + */ +JSJaCConnection.prototype._handlePID = function(aJSJaCPacket) { + if (!aJSJaCPacket.getID()) + return false; + for (var i in this._regIDs) { + if (this._regIDs.hasOwnProperty(i) && + this._regIDs[i] && i == aJSJaCPacket.getID()) { + var pID = aJSJaCPacket.getID(); + this.oDbg.log("handling "+pID,3); + try { + if (this._regIDs[i].cb.call(this, aJSJaCPacket,this._regIDs[i].arg) === false) { + // don't unregister + return false; + } else { + this._unregisterPID(pID); + return true; + } + } catch (e) { + // broken handler? + this.oDbg.log(e.name+": "+ e.message); + this._unregisterPID(pID); + return true; + } + } + } + return false; +}; + +/** + * @private + */ +JSJaCConnection.prototype._handleResponse = function(req) { + var rootEl = this._parseResponse(req); + + if (!rootEl) + return; + + for (var i=0; i JSJAC_ERR_COUNT) { + // abort + this._abort(); + return false; + } + + this._setStatus('onerror_fallback'); + + // schedule next tick + setTimeout(JSJaC.bind(this._resume, this),this.getPollInterval()); + return false; + }, this); + } catch(e) { } // well ... no onerror property available, maybe we + // can catch the error somewhere else ... + + var reqstr = this._getRequestString(); + + if (typeof(this._rid) != 'undefined') // remember request id if any + this._req[slot].rid = this._rid; + + this.oDbg.log("sending: " + reqstr,4); + this._req[slot].r.send(reqstr); +}; + +/** + * @private + */ +JSJaCConnection.prototype._registerPID = function(pID,cb,arg) { + if (!pID || !cb) + return false; + this._regIDs[pID] = new Object(); + this._regIDs[pID].cb = cb; + if (arg) + this._regIDs[pID].arg = arg; + this.oDbg.log("registered "+pID,3); + return true; +}; + +/** + * send empty request + * waiting for stream id to be able to proceed with authentication + * @private + */ +JSJaCConnection.prototype._sendEmpty = function JSJaCSendEmpty() { + var slot = this._getFreeSlot(); + this._req[slot] = this._setupRequest(true); + + this._req[slot].r.onreadystatechange = + JSJaC.bind(function() { + if (this._req[slot].r.readyState == 4) { + this.oDbg.log("async recv: "+this._req[slot].r.responseText,4); + this._getStreamID(slot); // handle response + } + },this); + + if (typeof(this._req[slot].r.onerror) != 'undefined') { + this._req[slot].r.onerror = + JSJaC.bind(function(e) { + this.oDbg.log('XmlHttpRequest error',1); + return false; + }, this); + } + + var reqstr = this._getRequestString(); + this.oDbg.log("sending: " + reqstr,4); + this._req[slot].r.send(reqstr); +}; + +/** + * @private + */ +JSJaCConnection.prototype._sendRaw = function(xml,cb,arg) { + if (cb) + this._sendRawCallbacks.push({fn: cb, arg: arg}); + + this._pQueue.push(xml); + this._process(); + + return true; +}; + +/** + * @private + */ +JSJaCConnection.prototype._setStatus = function(status) { + if (!status || status == '') + return; + if (status != this._status) { // status changed! + this._status = status; + this._handleEvent('onstatuschanged', status); + this._handleEvent('status_changed', status); + } +}; + +/** + * @private + */ +JSJaCConnection.prototype._unregisterPID = function(pID) { + if (!this._regIDs[pID]) + return false; + this._regIDs[pID] = null; + this.oDbg.log("unregistered "+pID,3); + return true; +}; Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConsoleLogger.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConsoleLogger.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConsoleLogger.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,74 @@ +/** + * @fileoverview Contains Debugger interface for Firebug and Safari + * @class Implementation of the Debugger interface for {@link + * http://www.getfirebug.com/ Firebug} and Safari + * Creates a new debug logger to be passed to jsjac's connection + * constructor. Of course you can use it for debugging in your code + * too. + * @constructor + * @param {int} level The maximum level for debugging messages to be + * displayed. Thus you can tweak the verbosity of the logger. A value + * of 0 means very low traffic whilst a value of 4 makes logging very + * verbose about what's going on. + */ +function JSJaCConsoleLogger(level) { + /** + * @private + */ + this.level = level || 4; + + /** + * Empty function for API compatibility + */ + this.start = function() {}; + /** + * Logs a message to firebug's/safari's console + * @param {String} msg The message to be logged. + * @param {int} level The message's verbosity level. Importance is + * from 0 (very important) to 4 (not so important). A value of 1 + * denotes an error in the usual protocol flow. + */ + this.log = function(msg, level) { + level = level || 0; + if (level > this.level) + return; + if (typeof(console) == 'undefined') + return; + try { + switch (level) { + case 0: + console.warn(msg); + break; + case 1: + console.error(msg); + break; + case 2: + console.info(msg); + break; + case 4: + console.debug(msg); + break; + default: + console.log(msg); + break; + } + } catch(e) { try { console.log(msg) } catch(e) {} } + }; + + /** + * Sets verbosity level. + * @param {int} level The maximum level for debugging messages to be + * displayed. Thus you can tweak the verbosity of the logger. A + * value of 0 means very low traffic whilst a value of 4 makes + * logging very verbose about what's going on. + * @return This debug logger + * @type ConsoleLogger + */ + this.setLevel = function(level) { this.level = level; return this; }; + /** + * Gets verbosity level. + * @return The level + * @type int + */ + this.getLevel = function() { return this.level; }; +} Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConstants.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConstants.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCConstants.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,97 @@ +var NS_DISCO_ITEMS = "http://jabber.org/protocol/disco#items"; +var NS_DISCO_INFO = "http://jabber.org/protocol/disco#info"; +var NS_VCARD = "vcard-temp"; +var NS_AUTH = "jabber:iq:auth"; +var NS_AUTH_ERROR = "jabber:iq:auth:error"; +var NS_REGISTER = "jabber:iq:register"; +var NS_SEARCH = "jabber:iq:search"; +var NS_ROSTER = "jabber:iq:roster"; +var NS_PRIVACY = "jabber:iq:privacy"; +var NS_PRIVATE = "jabber:iq:private"; +var NS_VERSION = "jabber:iq:version"; +var NS_TIME = "jabber:iq:time"; +var NS_LAST = "jabber:iq:last"; +var NS_XDATA = "jabber:x:data"; +var NS_IQDATA = "jabber:iq:data"; +var NS_DELAY = "jabber:x:delay"; +var NS_EXPIRE = "jabber:x:expire"; +var NS_EVENT = "jabber:x:event"; +var NS_XCONFERENCE = "jabber:x:conference"; +var NS_STATS = "http://jabber.org/protocol/stats"; +var NS_MUC = "http://jabber.org/protocol/muc"; +var NS_MUC_USER = "http://jabber.org/protocol/muc#user"; +var NS_MUC_ADMIN = "http://jabber.org/protocol/muc#admin"; +var NS_MUC_OWNER = "http://jabber.org/protocol/muc#owner"; +var NS_PUBSUB = "http://jabber.org/protocol/pubsub"; +var NS_PUBSUB_EVENT = "http://jabber.org/protocol/pubsub#event"; +var NS_PUBSUB_OWNER = "http://jabber.org/protocol/pubsub#owner"; +var NS_PUBSUB_NMI = "http://jabber.org/protocol/pubsub#node-meta-info"; +var NS_COMMANDS = "http://jabber.org/protocol/commands"; +var NS_STREAM = "http://etherx.jabber.org/streams"; + +var NS_STANZAS = "urn:ietf:params:xml:ns:xmpp-stanzas"; +var NS_STREAMS = "urn:ietf:params:xml:ns:xmpp-streams"; + +var NS_TLS = "urn:ietf:params:xml:ns:xmpp-tls"; +var NS_SASL = "urn:ietf:params:xml:ns:xmpp-sasl"; +var NS_SESSION = "urn:ietf:params:xml:ns:xmpp-session"; +var NS_BIND = "urn:ietf:params:xml:ns:xmpp-bind"; + +var NS_FEATURE_IQAUTH = "http://jabber.org/features/iq-auth"; +var NS_FEATURE_IQREGISTER = "http://jabber.org/features/iq-register"; +var NS_FEATURE_COMPRESS = "http://jabber.org/features/compress"; + +var NS_COMPRESS = "http://jabber.org/protocol/compress"; + +function STANZA_ERROR(code, type, cond) { + if (window == this) + return new STANZA_ERROR(code, type, cond); + + this.code = code; + this.type = type; + this.cond = cond; +} + +var ERR_BAD_REQUEST = + STANZA_ERROR("400", "modify", "bad-request"); +var ERR_CONFLICT = + STANZA_ERROR("409", "cancel", "conflict"); +var ERR_FEATURE_NOT_IMPLEMENTED = + STANZA_ERROR("501", "cancel", "feature-not-implemented"); +var ERR_FORBIDDEN = + STANZA_ERROR("403", "auth", "forbidden"); +var ERR_GONE = + STANZA_ERROR("302", "modify", "gone"); +var ERR_INTERNAL_SERVER_ERROR = + STANZA_ERROR("500", "wait", "internal-server-error"); +var ERR_ITEM_NOT_FOUND = + STANZA_ERROR("404", "cancel", "item-not-found"); +var ERR_JID_MALFORMED = + STANZA_ERROR("400", "modify", "jid-malformed"); +var ERR_NOT_ACCEPTABLE = + STANZA_ERROR("406", "modify", "not-acceptable"); +var ERR_NOT_ALLOWED = + STANZA_ERROR("405", "cancel", "not-allowed"); +var ERR_NOT_AUTHORIZED = + STANZA_ERROR("401", "auth", "not-authorized"); +var ERR_PAYMENT_REQUIRED = + STANZA_ERROR("402", "auth", "payment-required"); +var ERR_RECIPIENT_UNAVAILABLE = + STANZA_ERROR("404", "wait", "recipient-unavailable"); +var ERR_REDIRECT = + STANZA_ERROR("302", "modify", "redirect"); +var ERR_REGISTRATION_REQUIRED = + STANZA_ERROR("407", "auth", "registration-required"); +var ERR_REMOTE_SERVER_NOT_FOUND = + STANZA_ERROR("404", "cancel", "remote-server-not-found"); +var ERR_REMOTE_SERVER_TIMEOUT = + STANZA_ERROR("504", "wait", "remote-server-timeout"); +var ERR_RESOURCE_CONSTRAINT = + STANZA_ERROR("500", "wait", "resource-constraint"); +var ERR_SERVICE_UNAVAILABLE = + STANZA_ERROR("503", "cancel", "service-unavailable"); +var ERR_SUBSCRIPTION_REQUIRED = + STANZA_ERROR("407", "auth", "subscription-required"); +var ERR_UNEXPECTED_REQUEST = + STANZA_ERROR("400", "wait", "unexpected-request"); + Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCCookie.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCCookie.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCCookie.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,157 @@ +/* Copyright 2003-2006 Peter-Paul Koch + */ + +/** + * @fileoverview OO interface to handle cookies. + * Taken from {@link http://www.quirksmode.org/js/cookies.html + * http://www.quirksmode.org/js/cookies.html} + * Regarding licensing of this code the author states: + * + * "You may copy, tweak, rewrite, sell or lease any code example on + * this site, with one single exception." + * + * @author Stefan Strigler + * @version $Revision$ + */ + +/** + * Creates a new Cookie + * @class Class representing browser cookies for storing small amounts of data + * @constructor + * @param {String} name The name of the value to store + * @param {String} value The value to store + * @param {int} secs Number of seconds until cookie expires (may be empty) + */ +function JSJaCCookie(name,value,secs) +{ + if (window == this) + return new JSJaCCookie(name, value, secs); + + /** + * This cookie's name + * @type String + */ + this.name = name; + /** + * This cookie's value + * @type String + */ + this.value = value; + /** + * Time in seconds when cookie expires (thus being delete by + * browser). A value of -1 denotes a session cookie which means that + * stored data gets lost when browser is being closed. + * @type int + */ + this.expires = secs; + + /** + * Stores this cookie + */ + this.write = function() { + if (this.secs) { + var date = new Date(); + date.setTime(date.getTime()+(this.secs*1000)); + var expires = "; expires="+date.toGMTString(); + } else + var expires = ""; + document.cookie = this.getName()+"="+this.getValue()+expires+"; path=/"; + }; + /** + * Deletes this cookie + */ + this.erase = function() { + var c = new JSJaCCookie(this.getName(),"",-1); + c.write(); + }; + + /** + * Gets the name of this cookie + * @return The name + * @type String + */ + this.getName = function() { + return this.name; + }; + + /** + * Sets the name of this cookie + * @param {String} name The name for this cookie + * @return This cookie + * @type Cookie + */ + this.setName = function(name) { + this.name = name; + return this; + }; + + /** + * Gets the value of this cookie + * @return The value + * @type String + */ + this.getValue = function() { + return this.value; + }; + + /** + * Sets the value of this cookie + * @param {String} value The value for this cookie + * @return This cookie + * @type Cookie + */ + this.setValue = function(value) { + this.value = value; + return this; + }; +} + +/** + * Reads the value for given name from cookies and return new + * Cookie object + * @param {String} name The name of the cookie to read + * @return A cookie object of the given name + * @type Cookie + * @throws CookieException when cookie with given name could not be found + */ +JSJaCCookie.read = function(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return new JSJaCCookie(name, c.substring(nameEQ.length,c.length)); + } + throw new JSJaCCookieException("Cookie not found"); +}; + +/** + * Reads the value for given name from cookies and returns + * its valued new + * @param {String} name The name of the cookie to read + * @return The value of the cookie read + * @type String + * @throws CookieException when cookie with given name could not be found + */ +JSJaCCookie.get = function(name) { + return JSJaCCookie.read(name).getValue(); +}; + +/** + * Deletes cookie with given name + * @param {String} name The name of the cookie to delete + * @throws CookieException when cookie with given name could not be found + */ +JSJaCCookie.remove = function(name) { + JSJaCCookie.read(name).erase(); +}; + +/** + * Some exception denoted to dealing with cookies + * @constructor + * @param {String} msg The message to pass to the exception + */ +function JSJaCCookieException(msg) { + this.message = msg; + this.name = "CookieException"; +} Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCError.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCError.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCError.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,15 @@ + +/** + * an error packet for internal use + * @private + * @constructor + */ +function JSJaCError(code,type,condition) { + var xmldoc = XmlDocument.create("error","jsjac"); + + xmldoc.documentElement.setAttribute('code',code); + xmldoc.documentElement.setAttribute('type',type); + xmldoc.documentElement.appendChild(xmldoc.createElement(condition)). + setAttribute('xmlns','urn:ietf:params:xml:ns:xmpp-stanzas'); + return xmldoc.documentElement; +} Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCHttpBindingConnection.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCHttpBindingConnection.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCHttpBindingConnection.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,517 @@ +/** + * @fileoverview All stuff related to HTTP Binding + * @author Stefan Strigler steve@zeank.in-berlin.de + * @version $Revision$ + */ + +/** + * Instantiates an HTTP Binding session + * @class Implementation of {@link + * http://www.xmpp.org/extensions/xep-0206.html XMPP Over BOSH} + * formerly known as HTTP Binding. + * @extends JSJaCConnection + * @constructor + */ +function JSJaCHttpBindingConnection(oArg) { + /** + * @ignore + */ + this.base = JSJaCConnection; + this.base(oArg); + + // member vars + /** + * @private + */ + this._hold = JSJACHBC_MAX_HOLD; + /** + * @private + */ + this._inactivity = 0; + /** + * @private + */ + this._last_requests = new Object(); // 'hash' storing hold+1 last requests + /** + * @private + */ + this._last_rid = 0; // I know what you did last summer + /** + * @private + */ + this._min_polling = 0; + + /** + * @private + */ + this._pause = 0; + /** + * @private + */ + this._wait = JSJACHBC_MAX_WAIT; +} +JSJaCHttpBindingConnection.prototype = new JSJaCConnection(); + +/** + * Inherit an instantiated HTTP Binding session + */ +JSJaCHttpBindingConnection.prototype.inherit = function(oArg) { + this.domain = oArg.domain || 'localhost'; + this.username = oArg.username; + this.resource = oArg.resource; + this._sid = oArg.sid; + this._rid = oArg.rid; + this._min_polling = oArg.polling; + this._inactivity = oArg.inactivity; + this._setHold(oArg.requests-1); + this.setPollInterval(this._timerval); + if (oArg.wait) + this._wait = oArg.wait; // for whatever reason + + this._connected = true; + + this._handleEvent('onconnect'); + + this._interval= setInterval(JSJaC.bind(this._checkQueue, this), + JSJAC_CHECKQUEUEINTERVAL); + this._inQto = setInterval(JSJaC.bind(this._checkInQ, this), + JSJAC_CHECKINQUEUEINTERVAL); + this._timeout = setTimeout(JSJaC.bind(this._process, this), + this.getPollInterval()); +}; + +/** + * Sets poll interval + * @param {int} timerval the interval in seconds + */ +JSJaCHttpBindingConnection.prototype.setPollInterval = function(timerval) { + if (timerval && !isNaN(timerval)) { + if (!this.isPolling()) + this._timerval = 100; + else if (this._min_polling && timerval < this._min_polling*1000) + this._timerval = this._min_polling*1000; + else if (this._inactivity && timerval > this._inactivity*1000) + this._timerval = this._inactivity*1000; + else + this._timerval = timerval; + } + return this._timerval; +}; + +/** + * whether this session is in polling mode + * @type boolean + */ +JSJaCHttpBindingConnection.prototype.isPolling = function() { return (this._hold == 0) }; + +/** + * @private + */ +JSJaCHttpBindingConnection.prototype._getFreeSlot = function() { + for (var i=0; i"; + } else { + reqstr += "/>"; + } + + this._last_requests[this._rid] = new Object(); + this._last_requests[this._rid].xml = reqstr; + this._last_rid = this._rid; + + for (var i in this._last_requests) + if (this._last_requests.hasOwnProperty(i) && + i < this._rid-this._hold) + delete(this._last_requests[i]); // truncate + } + + return reqstr; +}; + +/** + * @private + */ +JSJaCHttpBindingConnection.prototype._getInitialRequestString = function() { + var reqstr = " JSJAC_ERR_COUNT) { + // abort + this._abort(); + return null; + } + this.oDbg.log("repeating ("+this._errcnt+")",1); + + this._setStatus('proto_error_fallback'); + + // schedule next tick + setTimeout(JSJaC.bind(this._resume, this), + this.getPollInterval()); + + return null; + } + } catch (e) { + this.oDbg.log("XMLHttpRequest error: status not available", 1); + this._errcnt++; + if (this._errcnt > JSJAC_ERR_COUNT) { + // abort + this._abort(); + } else { + this.oDbg.log("repeating ("+this._errcnt+")",1); + + this._setStatus('proto_error_fallback'); + + // schedule next tick + setTimeout(JSJaC.bind(this._resume, this), + this.getPollInterval()); + } + return null; + } + + var body = r.responseXML.documentElement; + if (!body || body.tagName != 'body' || + body.namespaceURI != 'http://jabber.org/protocol/httpbind') { + this.oDbg.log("invalid response:\n" + r.responseText,1); + + clearTimeout(this._timeout); // remove timer + clearInterval(this._interval); + clearInterval(this._inQto); + + this._connected = false; + this.oDbg.log("Disconnected.",1); + this._handleEvent('ondisconnect'); + + this._setStatus('internal_server_error'); + this._handleEvent('onerror', + JSJaCError('500','wait','internal-server-error')); + + return null; + } + + if (typeof(req.rid) != 'undefined' && this._last_requests[req.rid]) { + if (this._last_requests[req.rid].handled) { + this.oDbg.log("already handled "+req.rid,2); + return null; + } else + this._last_requests[req.rid].handled = true; + } + + + // Check for errors from the server + if (body.getAttribute("type") == "terminate") { + this.oDbg.log("session terminated:\n" + r.responseText,1); + + clearTimeout(this._timeout); // remove timer + clearInterval(this._interval); + clearInterval(this._inQto); + + if (body.getAttribute("condition") == "remote-stream-error") + if (body.getElementsByTagName("conflict").length > 0) + this._setStatus("session-terminate-conflict"); + this._handleEvent('onerror',JSJaCError('503','cancel',body.getAttribute('condition'))); + this._connected = false; + this.oDbg.log("Disconnected.",1); + this._handleEvent('ondisconnect'); + return null; + } + + // no error + this._errcnt = 0; + return r.responseXML.documentElement; +}; + +/** + * @private + */ +JSJaCHttpBindingConnection.prototype._reInitStream = function(to,cb,arg) { + /* [TODO] we can't handle 'to' here as this is not (yet) supported + * by the protocol + */ + + // tell http binding to reinit stream with/before next request + this._reinit = true; + cb.call(this,arg); // proceed with next callback + + /* [TODO] make sure that we're checking for new stream features when + * 'cb' finishes + */ +}; + +/** + * @private + */ +JSJaCHttpBindingConnection.prototype._resume = function() { + /* make sure to repeat last request as we can be sure that + * it had failed (only if we're not using the 'pause' attribute + */ + if (this._pause == 0 && this._rid >= this._last_rid) + this._rid = this._last_rid-1; + + this._process(); +}; + +/** + * @private + */ +JSJaCHttpBindingConnection.prototype._setHold = function(hold) { + if (!hold || isNaN(hold) || hold < 0) + hold = 0; + else if (hold > JSJACHBC_MAX_HOLD) + hold = JSJACHBC_MAX_HOLD; + this._hold = hold; + return this._hold; +}; + +/** + * @private + */ +JSJaCHttpBindingConnection.prototype._setupRequest = function(async) { + var req = new Object(); + var r = XmlHttp.create(); + try { + r.open("POST",this._httpbase,async); + r.setRequestHeader('Content-Type','text/xml; charset=utf-8'); + } catch(e) { this.oDbg.log(e,1); } + req.r = r; + this._rid++; + req.rid = this._rid; + return req; +}; + +/** + * @private + */ +JSJaCHttpBindingConnection.prototype._suspend = function() { + if (this._pause == 0) + return; // got nothing to do + + var slot = this._getFreeSlot(); + // Intentionally synchronous + this._req[slot] = this._setupRequest(false); + + var reqstr = "true if this is a polling connection, + * false otherwise. + * @type boolean + */ +JSJaCHttpPollingConnection.prototype.isPolling = function() { return true; }; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._getFreeSlot = function() { + if (typeof(this._req[0]) == 'undefined' || + typeof(this._req[0].r) == 'undefined' || + this._req[0].r.readyState == 4) + return 0; + else + return -1; +}; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._getInitialRequestString = function() { + var reqstr = "0"; + if (JSJAC_HAVEKEYS) { + this._keys = new JSJaCKeys(b64_sha1,this.oDbg); // generate first set of keys + key = this._keys.getKey(); + reqstr += ";"+key; + } + var streamto = this.domain; + if (this.authhost) + streamto = this.authhost; + + reqstr += ",\s*$/)) + response += ''; + + doc = XmlDocument.create("doc"); + doc.loadXML(response); + if (!this._parseStreamFeatures(doc)) + return; + } catch(e) { + this.oDbg.log("loadXML: "+e.toString(),1); + } + + this._connected = true; + + if (this.register) + this._doInBandReg(); + else + this._doAuth(); + + this._process(this._timerval); // start polling +}; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._getSuspendVars = function() { + return new Array(); +}; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._handleInitialResponse = function() { + // extract session ID + this.oDbg.log(this._req[0].r.getAllResponseHeaders(),4); + var aPList = this._req[0].r.getResponseHeader('Set-Cookie'); + aPList = aPList.split(";"); + for (var i=0;i/,""); + if (response.match(/"+response+""); + + if (!doc || doc.tagName == 'parsererror') { + this.oDbg.log("parsererror",1); + + doc = JSJaCHttpPollingConnection._parseTree(""+req.responseText); + if (doc && doc.tagName != 'parsererror') { + this.oDbg.log("stream closed",1); + + if (doc.getElementsByTagName('conflict').length > 0) + this._setStatus("session-terminate-conflict"); + + clearTimeout(this._timeout); // remove timer + clearInterval(this._interval); + clearInterval(this._inQto); + this._handleEvent('onerror',JSJaCError('503','cancel','session-terminate')); + this._connected = false; + this.oDbg.log("Disconnected.",1); + this._handleEvent('ondisconnect'); + } else + this.oDbg.log("parsererror:"+doc,1); + + return doc; + } + + return doc; + } catch (e) { + this.oDbg.log("parse error:"+e.message,1); + } + return null;; +}; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._reInitStream = function(to,cb,arg) { + this._sendRaw("",cb,arg); +}; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._resume = function() { + this._process(this._timerval); +}; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._setupRequest = function(async) { + var r = XmlHttp.create(); + try { + r.open("POST",this._httpbase,async); + if (r.overrideMimeType) + r.overrideMimeType('text/plain; charset=utf-8'); + r.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + } catch(e) { this.oDbg.log(e,1); } + + var req = new Object(); + req.r = r; + return req; +}; + +/** + * @private + */ +JSJaCHttpPollingConnection.prototype._suspend = function() {}; + +/*** [static] ***/ + +/** + * @private + */ +JSJaCHttpPollingConnection._parseTree = function(s) { + try { + var r = XmlDocument.create("body","foo"); + if (typeof(r.loadXML) != 'undefined') { + r.loadXML(s); + return r.documentElement; + } else if (window.DOMParser) + return (new DOMParser()).parseFromString(s, "text/xml").documentElement; + } catch (e) { } + return null; +}; Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJID.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJID.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJID.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,198 @@ +/** + * @fileoverview This file contains all things that make life easier when + * dealing with JIDs + * @author Stefan Strigler + * @version $Revision$ + */ + +/** + * list of forbidden chars for nodenames + * @private + */ +var JSJACJID_FORBIDDEN = ['"',' ','&','\'','/',':','<','>','@']; + +/** + * Creates a new JSJaCJID object + * @class JSJaCJID models xmpp jid objects + * @constructor + * @param {Object} jid jid may be either of type String or a JID represented + * by JSON with fields 'node', 'domain' and 'resource' + * @throws JSJaCJIDInvalidException Thrown if jid is not valid + * @return a new JSJaCJID object + */ +function JSJaCJID(jid) { + /** + *@private + */ + this._node = ''; + /** + *@private + */ + this._domain = ''; + /** + *@private + */ + this._resource = ''; + + if (typeof(jid) == 'string') { + if (jid.indexOf('@') != -1) { + this.setNode(jid.substring(0,jid.indexOf('@'))); + jid = jid.substring(jid.indexOf('@')+1); + } + if (jid.indexOf('/') != -1) { + this.setResource(jid.substring(jid.indexOf('/')+1)); + jid = jid.substring(0,jid.indexOf('/')); + } + this.setDomain(jid); + } else { + this.setNode(jid.node); + this.setDomain(jid.domain); + this.setResource(jid.resource); + } +} + + +/** + * Gets the node part of the jid + * @return A string representing the node name + * @type String + */ +JSJaCJID.prototype.getNode = function() { return this._node; }; + +/** + * Gets the domain part of the jid + * @return A string representing the domain name + * @type String + */ +JSJaCJID.prototype.getDomain = function() { return this._domain; }; + +/** + * Gets the resource part of the jid + * @return A string representing the resource + * @type String + */ +JSJaCJID.prototype.getResource = function() { return this._resource; }; + + +/** + * Sets the node part of the jid + * @param {String} node Name of the node + * @throws JSJaCJIDInvalidException Thrown if node name contains invalid chars + * @return This object + * @type JSJaCJID + */ +JSJaCJID.prototype.setNode = function(node) { + JSJaCJID._checkNodeName(node); + this._node = node || ''; + return this; +}; + +/** + * Sets the domain part of the jid + * @param {String} domain Name of the domain + * @throws JSJaCJIDInvalidException Thrown if domain name contains invalid + * chars or is empty + * @return This object + * @type JSJaCJID + */ +JSJaCJID.prototype.setDomain = function(domain) { + if (!domain || domain == '') + throw new JSJaCJIDInvalidException("domain name missing"); + // chars forbidden for a node are not allowed in domain names + // anyway, so let's check + JSJaCJID._checkNodeName(domain); + this._domain = domain; + return this; +}; + +/** + * Sets the resource part of the jid + * @param {String} resource Name of the resource + * @return This object + * @type JSJaCJID + */ +JSJaCJID.prototype.setResource = function(resource) { + this._resource = resource || ''; + return this; +}; + +/** + * The string representation of the full jid + * @return A string representing the jid + * @type String + */ +JSJaCJID.prototype.toString = function() { + var jid = ''; + if (this.getNode() && this.getNode() != '') + jid = this.getNode() + '@'; + jid += this.getDomain(); // we always have a domain + if (this.getResource() && this.getResource() != "") + jid += '/' + this.getResource(); + return jid; +}; + +/** + * Removes the resource part of the jid + * @return This object + * @type JSJaCJID + */ +JSJaCJID.prototype.removeResource = function() { + return this.setResource(); +}; + +/** + * creates a copy of this JSJaCJID object + * @return A copy of this + * @type JSJaCJID + */ +JSJaCJID.prototype.clone = function() { + return new JSJaCJID(this.toString()); +}; + +/** + * Compares two jids if they belong to the same entity (i.e. w/o resource) + * @param {String} jid a jid as string or JSJaCJID object + * @return 'true' if jid is same entity as this + * @type Boolean + */ +JSJaCJID.prototype.isEntity = function(jid) { + if (typeof jid == 'string') + jid = (new JSJaCJID(jid)); + jid.removeResource(); + return (this.clone().removeResource().toString() === jid.toString()); +}; + +/** + * Check if node name is valid + * @private + * @param {String} node A name for a node + * @throws JSJaCJIDInvalidException Thrown if name for node is not allowed + */ +JSJaCJID._checkNodeName = function(nodeprep) { + if (!nodeprep || nodeprep == '') + return; + for (var i=0; i< JSJACJID_FORBIDDEN.length; i++) { + if (nodeprep.indexOf(JSJACJID_FORBIDDEN[i]) != -1) { + throw new JSJaCJIDInvalidException("forbidden char in nodename: "+JSJACJID_FORBIDDEN[i]); + } + } +}; + +/** + * Creates a new Exception of type JSJaCJIDInvalidException + * @class Exception to indicate invalid values for a jid + * @constructor + * @param {String} message The message associated with this Exception + */ +function JSJaCJIDInvalidException(message) { + /** + * The exceptions associated message + * @type String + */ + this.message = message; + /** + * The name of the exception + * @type String + */ + this.name = "JSJaCJIDInvalidException"; +} Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJSON.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJSON.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCJSON.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,127 @@ +/* Copyright (c) 2005-2007 Sam Stephenson + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + json.js + taken from prototype.js, made static +*/ +function JSJaCJSON() {} +JSJaCJSON.toString = function (obj) { + var m = { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + s = { + array: function (x) { + var a = ['['], b, f, i, l = x.length, v; + for (i = 0; i < l; i += 1) { + v = x[i]; + f = s[typeof v]; + if (f) { + v = f(v); + if (typeof v == 'string') { + if (b) { + a[a.length] = ','; + } + a[a.length] = v; + b = true; + } + } + } + a[a.length] = ']'; + return a.join(''); + }, + 'boolean': function (x) { + return String(x); + }, + 'null': function (x) { + return "null"; + }, + number: function (x) { + return isFinite(x) ? String(x) : 'null'; + }, + object: function (x) { + if (x) { + if (x instanceof Array) { + return s.array(x); + } + var a = ['{'], b, f, i, v; + for (i in x) { + if (x.hasOwnProperty(i)) { + v = x[i]; + f = s[typeof v]; + if (f) { + v = f(v); + if (typeof v == 'string') { + if (b) { + a[a.length] = ','; + } + a.push(s.string(i), ':', v); + b = true; + } + } + } + } + + a[a.length] = '}'; + return a.join(''); + } + return 'null'; + }, + string: function (x) { + if (/["\\\x00-\x1f]/.test(x)) { + x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) { + var c = m[b]; + if (c) { + return c; + } + c = b.charCodeAt(); + return '\\u00' + + Math.floor(c / 16).toString(16) + + (c % 16).toString(16); + }); + } + return '"' + x + '"'; +} + }; + +switch (typeof(obj)) { + case 'object': + return s.object(obj); + case 'array': + return s.array(obj); + + } +}; + +JSJaCJSON.parse = function (str) { + try { + return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( + str.replace(/"(\\.|[^"\\])*"/g, ''))) && + eval('(' + str + ')'); + } catch (e) { + return false; + } +}; Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCKeys.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCKeys.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCKeys.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,66 @@ + +/** + * Creates a new set of hash keys + * @class Reflects a set of sha1/md5 hash keys for securing sessions + * @constructor + * @param {Function} func The hash function to be used for creating the keys + * @param {Debugger} oDbg Reference to debugger implementation [optional] + */ +function JSJaCKeys(func,oDbg) { + var seed = Math.random(); + + /** + * @private + */ + this._k = new Array(); + this._k[0] = seed.toString(); + if (oDbg) + /** + * Reference to Debugger + * @type Debugger + */ + this.oDbg = oDbg; + else { + this.oDbg = {}; + this.oDbg.log = function() {}; + } + + if (func) { + for (var i=1; itrue if there's only one key left, false otherwise + * @type boolean + */ + this.lastKey = function() { return (this._indexAt == 0); }; + /** + * Returns number of overall/initial stack size + * @return Number of keys created + * @type int + */ + this.size = function() { return this._k.length; }; + + /** + * @private + */ + this._getSuspendVars = function() { + return ('_k,_indexAt').split(','); + } +} Index: lams_learning/web/includes/jsjac-1.3.1/src/JSJaCPacket.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/JSJaCPacket.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/JSJaCPacket.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,674 @@ +/** + * @fileoverview Contains all Jabber/XMPP packet related classes. + * @author Stefan Strigler steve@zeank.in-berlin.de + * @version $Revision$ + */ + +var JSJACPACKET_USE_XMLNS = true; + +/** + * Creates a new packet with given root tag name (for internal use) + * @class Somewhat abstract base class for all kinds of specialised packets + * @param {String} name The root tag name of the packet + * (i.e. one of 'message', 'iq' or 'presence') + */ +function JSJaCPacket(name) { + /** + * @private + */ + this.name = name; + + if (typeof(JSJACPACKET_USE_XMLNS) != 'undefined' && JSJACPACKET_USE_XMLNS) + /** + * @private + */ + this.doc = XmlDocument.create(name,'jabber:client'); + else + /** + * @private + */ + this.doc = XmlDocument.create(name,''); +} + +/** + * Gets the type (name of root element) of this packet, i.e. one of + * 'presence', 'message' or 'iq' + * @return the top level tag name + * @type String + */ +JSJaCPacket.prototype.pType = function() { return this.name; }; + +/** + * Gets the associated Document for this packet. + * @type {@link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#i-Document Document} + */ +JSJaCPacket.prototype.getDoc = function() { + return this.doc; +}; +/** + * Gets the root node of this packet + * @type {@link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 Node} + */ +JSJaCPacket.prototype.getNode = function() { + if (this.getDoc() && this.getDoc().documentElement) + return this.getDoc().documentElement; + else + return null; +}; + +/** + * Sets the 'to' attribute of the root node of this packet + * @param {String} to + * @type JSJaCPacket + */ +JSJaCPacket.prototype.setTo = function(to) { + if (!to || to == '') + this.getNode().removeAttribute('to'); + else if (typeof(to) == 'string') + this.getNode().setAttribute('to',to); + else + this.getNode().setAttribute('to',to.toString()); + return this; +}; +/** + * Sets the 'from' attribute of the root node of this + * packet. Usually this is not needed as the server will take care + * of this automatically. + * @type JSJaCPacket + */ +JSJaCPacket.prototype.setFrom = function(from) { + if (!from || from == '') + this.getNode().removeAttribute('from'); + else if (typeof(from) == 'string') + this.getNode().setAttribute('from',from); + else + this.getNode().setAttribute('from',from.toString()); + return this; +}; +/** + * Sets 'id' attribute of the root node of this packet. + * @param {String} id The id of the packet. + * @type JSJaCPacket + */ +JSJaCPacket.prototype.setID = function(id) { + if (!id || id == '') + this.getNode().removeAttribute('id'); + else + this.getNode().setAttribute('id',id); + return this; +}; +/** + * Sets the 'type' attribute of the root node of this packet. + * @param {String} type The type of the packet. + * @type JSJaCPacket + */ +JSJaCPacket.prototype.setType = function(type) { + if (!type || type == '') + this.getNode().removeAttribute('type'); + else + this.getNode().setAttribute('type',type); + return this; +}; +/** + * Sets 'xml:lang' for this packet + * @param {String} xmllang The xml:lang of the packet. + * @type JSJaCPacket + */ +JSJaCPacket.prototype.setXMLLang = function(xmllang) { + if (!xmllang || xmllang == '') + this.getNode().removeAttribute('xml:lang'); + else + this.getNode().setAttribute('xml:lang',xmllang); + return this; +}; + +/** + * Gets the 'to' attribute of this packet + * @type String + */ +JSJaCPacket.prototype.getTo = function() { + return this.getNode().getAttribute('to'); +}; +/** + * Gets the 'from' attribute of this packet. + * @type String + */ +JSJaCPacket.prototype.getFrom = function() { + return this.getNode().getAttribute('from'); +}; +/** + * Gets the 'to' attribute of this packet as a JSJaCJID object + * @type JSJaCJID + */ +JSJaCPacket.prototype.getToJID = function() { + return new JSJaCJID(this.getTo()); +}; +/** + * Gets the 'from' attribute of this packet as a JSJaCJID object + * @type JSJaCJID + */ +JSJaCPacket.prototype.getFromJID = function() { + return new JSJaCJID(this.getFrom()); +}; +/** + * Gets the 'id' of this packet + * @type String + */ +JSJaCPacket.prototype.getID = function() { + return this.getNode().getAttribute('id'); +}; +/** + * Gets the 'type' of this packet + * @type String + */ +JSJaCPacket.prototype.getType = function() { + return this.getNode().getAttribute('type'); +}; +/** + * Gets the 'xml:lang' of this packet + * @type String + */ +JSJaCPacket.prototype.getXMLLang = function() { + return this.getNode().getAttribute('xml:lang'); +}; +/** + * Gets the 'xmlns' (xml namespace) of the root node of this packet + * @type String + */ +JSJaCPacket.prototype.getXMLNS = function() { + return this.getNode().namespaceURI; +}; + +/** + * Gets a child element of this packet. If no params given returns first child. + * @param {String} name Tagname of child to retrieve. Use '*' to match any tag. [optional] + * @param {String} ns Namespace of child. Use '*' to match any ns.[optional] + * @return The child node, null if none found + * @type {@link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 Node} + */ +JSJaCPacket.prototype.getChild = function(name, ns) { + if (!this.getNode()) { + return null; + } + + name = name || '*'; + ns = ns || '*'; + + if (this.getNode().getElementsByTagNameNS) { + return this.getNode().getElementsByTagNameNS(ns, name).item(0); + } + + // fallback + var nodes = this.getNode().getElementsByTagName(name); + if (ns != '*') { + for (var i=0; i + * The original parts of the code do have the following copyright + * and license notice:
    + * Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, + * http://mir.acu lo.us)
    + * script.aculo.us is freely distributable under the terms of an + * MIT-style licen se. // For details, see the script.aculo.us web + * site: http://script.aculo.us/
    + * @author Thomas Fuchs + * @author Stefan Strigler + * @return The newly created node + * @type {@link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 Node} + */ +JSJaCPacket.prototype.buildNode = function(elementName) { + return JSJaCBuilder.buildNode(this.getDoc(), + elementName, + arguments[1], + arguments[2]); +}; + +/** + * Appends node created by buildNode to this packets parent node. + * @param {@link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 Node} element The node to append or + * @param {String} element A name plus an object hash with attributes (optional) plus an array of childnodes (optional) + * @see #buildNode + * @return This packet + * @type JSJaCPacket + */ +JSJaCPacket.prototype.appendNode = function(element) { + if (typeof element=='object') { // seems to be a prebuilt node + return this.getNode().appendChild(element) + } else { // build node + return this.getNode().appendChild(this.buildNode(element, + arguments[1], + arguments[2])); + } +}; + + +/** + * A jabber/XMPP presence packet + * @class Models the XMPP notion of a 'presence' packet + * @extends JSJaCPacket + */ +function JSJaCPresence() { + /** + * @ignore + */ + this.base = JSJaCPacket; + this.base('presence'); +} +JSJaCPresence.prototype = new JSJaCPacket; + +/** + * Sets the status message for current status. Usually this is set + * to some human readable string indicating what the user is + * doing/feel like currently. + * @param {String} status A status message + * @return this + * @type JSJaCPacket + */ +JSJaCPresence.prototype.setStatus = function(status) { + this._setChildNode("status", status); + return this; +}; +/** + * Sets the online status for this presence packet. + * @param {String} show An XMPP complient status indicator. Must + * be one of 'chat', 'away', 'xa', 'dnd' + * @return this + * @type JSJaCPacket + */ +JSJaCPresence.prototype.setShow = function(show) { + if (show == 'chat' || show == 'away' || show == 'xa' || show == 'dnd') + this._setChildNode("show",show); + return this; +}; +/** + * Sets the priority of the resource bind to with this connection + * @param {int} prio The priority to set this resource to + * @return this + * @type JSJaCPacket + */ +JSJaCPresence.prototype.setPriority = function(prio) { + this._setChildNode("priority", prio); + return this; +}; +/** + * Some combined method that allowes for setting show, status and + * priority at once + * @param {String} show A status message + * @param {String} status A status indicator as defined by XMPP + * @param {int} prio A priority for this resource + * @return this + * @type JSJaCPacket + */ +JSJaCPresence.prototype.setPresence = function(show,status,prio) { + if (show) + this.setShow(show); + if (status) + this.setStatus(status); + if (prio) + this.setPriority(prio); + return this; +}; + +/** + * Gets the status message of this presence + * @return The (human readable) status message + * @type String + */ +JSJaCPresence.prototype.getStatus = function() { + return this.getChildVal('status'); +}; +/** + * Gets the status of this presence. + * Either one of 'chat', 'away', 'xa' or 'dnd' or null. + * @return The status indicator as defined by XMPP + * @type String + */ +JSJaCPresence.prototype.getShow = function() { + return this.getChildVal('show'); +}; +/** + * Gets the priority of this status message + * @return A resource priority + * @type int + */ +JSJaCPresence.prototype.getPriority = function() { + return this.getChildVal('priority'); +}; + + +/** + * A jabber/XMPP iq packet + * @class Models the XMPP notion of an 'iq' packet + * @extends JSJaCPacket + */ +function JSJaCIQ() { + /** + * @ignore + */ + this.base = JSJaCPacket; + this.base('iq'); +} +JSJaCIQ.prototype = new JSJaCPacket; + +/** + * Some combined method to set 'to', 'type' and 'id' at once + * @param {String} to the recepients JID + * @param {String} type A XMPP compliant iq type (one of 'set', 'get', 'result' and 'error' + * @param {String} id A packet ID + * @return this + * @type JSJaCIQ + */ +JSJaCIQ.prototype.setIQ = function(to,type,id) { + if (to) + this.setTo(to); + if (type) + this.setType(type); + if (id) + this.setID(id); + return this; +}; +/** + * Creates a 'query' child node with given XMLNS + * @param {String} xmlns The namespace for the 'query' node + * @return The query node + * @type {@link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 Node} + */ +JSJaCIQ.prototype.setQuery = function(xmlns) { + var query; + try { + query = this.getDoc().createElementNS(xmlns,'query'); + } catch (e) { + // fallback + query = this.getDoc().createElement('query'); + } + if (query && query.getAttribute('xmlns') != xmlns) // fix opera 8.5x + query.setAttribute('xmlns',xmlns); + this.getNode().appendChild(query); + return query; +}; + +/** + * Gets the 'query' node of this packet + * @return The query node + * @type {@link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 Node} + */ +JSJaCIQ.prototype.getQuery = function() { + return this.getNode().getElementsByTagName('query').item(0); +}; +/** + * Gets the XMLNS of the query node contained within this packet + * @return The namespace of the query node + * @type String + */ +JSJaCIQ.prototype.getQueryXMLNS = function() { + if (this.getQuery()) + return this.getQuery().namespaceURI; + else + return null; +}; + +/** + * Creates an IQ reply with type set to 'result'. If given appends payload to first child if IQ. Payload maybe XML as string or a DOM element (or an array of such elements as well). + * @param {Element} payload A payload to be appended [optional] + * @return An IQ reply packet + * @type JSJaCIQ + */ +JSJaCIQ.prototype.reply = function(payload) { + var rIQ = this.clone(); + rIQ.setTo(this.getFrom()); + rIQ.setType('result'); + if (payload) { + if (typeof payload == 'string') + rIQ.getChild().appendChild(rIQ.getDoc().loadXML(payload)); + else if (payload.constructor == Array) { + var node = rIQ.getChild(); + for (var i=0; inull is being returned. + * @type JSJaCPacket + */ +JSJaCPacket.wrapNode = function(node) { + var aNode; + switch (node.nodeName.toLowerCase()) { + case 'presence': + aNode = new JSJaCPresence(); + break; + case 'message': + aNode = new JSJaCMessage(); + break; + case 'iq': + aNode = new JSJaCIQ(); + break; + default : // unknown + return null; + } + + aNode._replaceNode(node); + + return aNode; +}; + Index: lams_learning/web/includes/jsjac-1.3.1/src/Makefile =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/Makefile (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/Makefile (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,6 @@ + +all: + @cd .. && make && cd src + +pack: + @cd .. && make pack && cd src Index: lams_learning/web/includes/jsjac-1.3.1/src/crypt.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/crypt.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/crypt.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,646 @@ +/* Copyright (c) 1998 - 2007, Paul Johnston & Contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following + * disclaimer. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @fileoverview Collection of MD5 and SHA1 hashing and encoding + * methods. + * @author Stefan Strigler steve@zeank.in-berlin.de + * @version $Revision$ + */ + +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));} +function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));} +function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));} +function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} +function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} +function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} + +/* + * Perform a simple self-test to see if the VM is working + */ +function sha1_vm_test() +{ + return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; +} + +/* + * Calculate the SHA-1 of an array of big-endian words, and a bit length + */ +function core_sha1(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << (24 - len % 32); + x[((len + 64 >> 9) << 4) + 15] = len; + + var w = Array(80); + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + var e = -1009589776; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + var olde = e; + + for(var j = 0; j < 80; j++) + { + if(j < 16) w[j] = x[i + j]; + else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); + var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), + safe_add(safe_add(e, w[j]), sha1_kt(j))); + e = d; + d = c; + c = rol(b, 30); + b = a; + a = t; + } + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + e = safe_add(e, olde); + } + return Array(a, b, c, d, e); + +} + +/* + * Perform the appropriate triplet combination function for the current + * iteration + */ +function sha1_ft(t, b, c, d) +{ + if(t < 20) return (b & c) | ((~b) & d); + if(t < 40) return b ^ c ^ d; + if(t < 60) return (b & c) | (b & d) | (c & d); + return b ^ c ^ d; +} + +/* + * Determine the appropriate additive constant for the current iteration + */ +function sha1_kt(t) +{ + return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : + (t < 60) ? -1894007588 : -899497514; +} + +/* + * Calculate the HMAC-SHA1 of a key and some data + */ +function core_hmac_sha1(key, data) +{ + var bkey = str2binb(key); + if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); + return core_sha1(opad.concat(hash), 512 + 160); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert an 8-bit or 16-bit string to an array of big-endian words + * In 8-bit function, characters >255 have their hi-byte silently ignored. + */ +function str2binb(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32); + return bin; +} + +/* + * Convert an array of big-endian words to a string + */ +function binb2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); + return str; +} + +/* + * Convert an array of big-endian words to a hex string. + */ +function binb2hex(binarray) +{ + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of big-endian words to a base-64 string + */ +function binb2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} + +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +// var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +// var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +// var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} +function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} +function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} +function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } +function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } +function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } + +/* + * Perform a simple self-test to see if the VM is working + */ +function md5_vm_test() +{ + return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; +} + +/* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ +function core_md5(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); + d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); + d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); + d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i+10], 17, -42063); + b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); + d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); + d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); + c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); + d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); + c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); + d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); + c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); + d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); + c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); + d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); + d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); + d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); + d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); + d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); + d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); + d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); + d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + return Array(a, b, c, d); + +} + +/* + * These functions implement the four basic operations the algorithm uses. + */ +function md5_cmn(q, a, b, x, s, t) +{ + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); +} +function md5_ff(a, b, c, d, x, s, t) +{ + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); +} +function md5_gg(a, b, c, d, x, s, t) +{ + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); +} +function md5_hh(a, b, c, d, x, s, t) +{ + return md5_cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5_ii(a, b, c, d, x, s, t) +{ + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); +} + +/* + * Calculate the HMAC-MD5, of a key and some data + */ +function core_hmac_md5(key, data) +{ + var bkey = str2binl(key); + if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); + return core_md5(opad.concat(hash), 512 + 128); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bit_rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert a string to an array of little-endian words + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. + */ +function str2binl(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); + return bin; +} + +/* + * Convert an array of little-endian words to a string + */ +function binl2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); + return str; +} + +/* + * Convert an array of little-endian words to a hex string. + */ +function binl2hex(binarray) +{ + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of little-endian words to a base-64 string + */ +function binl2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} + +/* ############################################################################# + UTF-8 Decoder and Encoder + base64 Encoder and Decoder + written by Tobias Kieslich, justdreams + Contact: tobias@justdreams.de http://www.justdreams.de/ + ############################################################################# */ + +// returns an array of byterepresenting dezimal numbers which represent the +// plaintext in an UTF-8 encoded version. Expects a string. +// This function includes an exception management for those nasty browsers like +// NN401, which returns negative decimal numbers for chars>128. I hate it!! +// This handling is unfortunately limited to the user's charset. Anyway, it works +// in most of the cases! Special signs with an unicode>256 return numbers, which +// can not be converted to the actual unicode and so not to the valid utf-8 +// representation. Anyway, this function does always return values which can not +// misinterpretd by RC4 or base64 en- or decoding, because every value is >0 and +// <255!! +// Arrays are faster and easier to handle in b64 encoding or encrypting.... +function utf8t2d(t) +{ + t = t.replace(/\r\n/g,"\n"); + var d=new Array; var test=String.fromCharCode(237); + if (test.charCodeAt(0) < 0) + for(var n=0; n0) + d[d.length]= c; + else { + d[d.length]= (((256+c)>>6)|192); + d[d.length]= (((256+c)&63)|128);} + } + else + for(var n=0; n 1byte + if (c<128) + d[d.length]= c; + // all the signs between 127 and 2047 => 2byte + else if((c>127) && (c<2048)) { + d[d.length]= ((c>>6)|192); + d[d.length]= ((c&63)|128);} + // all the signs between 2048 and 66536 => 3byte + else { + d[d.length]= ((c>>12)|224); + d[d.length]= (((c>>6)&63)|128); + d[d.length]= ((c&63)|128);} + } + return d; +} + +// returns plaintext from an array of bytesrepresenting dezimal numbers, which +// represent an UTF-8 encoded text; browser which does not understand unicode +// like NN401 will show "?"-signs instead +// expects an array of byterepresenting decimals; returns a string +function utf8d2t(d) +{ + var r=new Array; var i=0; + while(i191) && (d[i]<224)) { + r[r.length]= String.fromCharCode(((d[i]&31)<<6) | (d[i+1]&63)); i+=2;} + else { + r[r.length]= String.fromCharCode(((d[i]&15)<<12) | ((d[i+1]&63)<<6) | (d[i+2]&63)); i+=3;} + } + return r.join(""); +} + +// included in it creates two arrays which makes base64 +// en- and decoding faster +// this speed is noticeable especially when coding larger texts (>5k or so) +function b64arrays() { + var b64s='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + b64 = new Array();f64 =new Array(); + for (var i=0; i>2]; + r[r.length] = b64[((d[i]&3)<<4) | (d[i+1]>>4)]; + r[r.length] = b64[((d[i+1]&15)<<2) | (d[i+2]>>6)]; + r[r.length] = b64[d[i+2]&63]; + i+=3; + } + // this is again for the padding + if ((dl%3) == 1) + r[r.length-1] = r[r.length-2] = "="; + if ((dl%3) == 2) + r[r.length-1] = "="; + // we join the array to return a textstring + var t=r.join(""); + return t; +} + +// returns array of byterepresenting numbers created of an base64 encoded text +// it is still the slowest function in this modul; I hope I can make it faster +// expects string; returns an array +function b64t2d(t) { + var d=new Array; var i=0; + // here we fix this CRLF sequenz created by MS-OS; arrrgh!!! + t=t.replace(/\n|\r/g,""); t=t.replace(/=/g,""); + while (i>4); + d[d.length] = (((f64[t.charAt(i+1)]&15)<<4) | (f64[t.charAt(i+2)]>>2)); + d[d.length] = (((f64[t.charAt(i+2)]&3)<<6) | (f64[t.charAt(i+3)])); + i+=4; + } + if (t.length%4 == 2) + d = d.slice(0, d.length-2); + if (t.length%4 == 3) + d = d.slice(0, d.length-1); + return d; +} + +if (typeof(atob) == 'undefined' || typeof(btoa) == 'undefined') + b64arrays(); + +if (typeof(atob) == 'undefined') { + atob = function(s) { + return utf8d2t(b64t2d(s)); + } +} + +if (typeof(btoa) == 'undefined') { + btoa = function(s) { + return b64d2t(utf8t2d(s)); + } +} + +function cnonce(size) { + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + var cnonce = ''; + for (var i=0; i/g,">"); + str = str.replace(/\"/g,"""); + str = str.replace(/\n/g,"
    "); + return str; +}; + +/** + * Converts from jabber timestamps to JavaScript Date objects + * @addon + * @param {String} ts A string representing a jabber datetime timestamp as + * defined by {@link http://www.xmpp.org/extensions/xep-0082.html XEP-0082} + * @return A javascript Date object corresponding to the jabber DateTime given + * @type Date + */ +Date.jab2date = function(ts) { + var date = new Date(Date.UTC(ts.substr(0,4),ts.substr(5,2)-1,ts.substr(8,2),ts.substr(11,2),ts.substr(14,2),ts.substr(17,2))); + if (ts.substr(ts.length-6,1) != 'Z') { // there's an offset + var offset = new Date(); + offset.setTime(0); + offset.setUTCHours(ts.substr(ts.length-5,2)); + offset.setUTCMinutes(ts.substr(ts.length-2,2)); + if (ts.substr(ts.length-6,1) == '+') + date.setTime(date.getTime() - offset.getTime()); + else if (ts.substr(ts.length-6,1) == '-') + date.setTime(date.getTime() + offset.getTime()); + } + return date; +}; + +/** + * Takes a timestamp in the form of 2004-08-13T12:07:04+02:00 as argument + * and converts it to some sort of humane readable format + * @addon + */ +Date.hrTime = function(ts) { + return Date.jab2date(ts).toLocaleString(); +}; + +/** + * somewhat opposit to {@link #hrTime} + * expects a javascript Date object as parameter and returns a jabber + * date string conforming to + * {@link http://www.xmpp.org/extensions/xep-0082.html XEP-0082} + * @see #hrTime + * @return The corresponding jabber DateTime string + * @type String + */ +Date.prototype.jabberDate = function() { + var padZero = function(i) { + if (i < 10) return "0" + i; + return i; + }; + + var jDate = this.getUTCFullYear() + "-"; + jDate += padZero(this.getUTCMonth()+1) + "-"; + jDate += padZero(this.getUTCDate()) + "T"; + jDate += padZero(this.getUTCHours()) + ":"; + jDate += padZero(this.getUTCMinutes()) + ":"; + jDate += padZero(this.getUTCSeconds()) + "Z"; + + return jDate; +}; + +/** + * Determines the maximum of two given numbers + * @addon + * @param {Number} A a number + * @param {Number} B another number + * @return the maximum of A and B + * @type Number + */ +Number.max = function(A, B) { + return (A > B)? A : B; +}; Index: lams_learning/web/includes/jsjac-1.3.1/src/xmlextras.js =================================================================== diff -u --- lams_learning/web/includes/jsjac-1.3.1/src/xmlextras.js (revision 0) +++ lams_learning/web/includes/jsjac-1.3.1/src/xmlextras.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,232 @@ + +/* Copyright 2006 Erik Arvidsson + * + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/** + * @fileoverview Wrapper to make working with XmlHttpRequest and the + * DOM more convenient (cross browser compliance). + * this code is taken from + * http://webfx.eae.net/dhtml/xmlextras/xmlextras.html + * @author Stefan Strigler steve@zeank.in-berlin.de + * @version $Revision$ + */ + +/** + * XmlHttp factory + * @private + */ +function XmlHttp() {} + +/** + * creates a cross browser compliant XmlHttpRequest object + */ +XmlHttp.create = function () { + try { + if (window.XMLHttpRequest) { + var req = new XMLHttpRequest(); + + // some versions of Moz do not support the readyState property + // and the onreadystate event so we patch it! + if (req.readyState == null) { + req.readyState = 1; + req.addEventListener("load", function () { + req.readyState = 4; + if (typeof req.onreadystatechange == "function") + req.onreadystatechange(); + }, false); + } + + return req; + } + if (window.ActiveXObject) { + return new ActiveXObject(XmlHttp.getPrefix() + ".XmlHttp"); + } + } + catch (ex) {} + // fell through + throw new Error("Your browser does not support XmlHttp objects"); +}; + +/** + * used to find the Automation server name + * @private + */ +XmlHttp.getPrefix = function() { + if (XmlHttp.prefix) // I know what you did last summer + return XmlHttp.prefix; + + var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"]; + var o; + for (var i = 0; i < prefixes.length; i++) { + try { + // try to create the objects + o = new ActiveXObject(prefixes[i] + ".XmlHttp"); + return XmlHttp.prefix = prefixes[i]; + } + catch (ex) {}; + } + + throw new Error("Could not find an installed XML parser"); +}; + + +/** + * XmlDocument factory + * @private + */ +function XmlDocument() {} + +XmlDocument.create = function (name,ns) { + name = name || 'foo'; + ns = ns || ''; + try { + var doc; + // DOM2 + if (document.implementation && document.implementation.createDocument) { + doc = document.implementation.createDocument(ns, name, null); + // some versions of Moz do not support the readyState property + // and the onreadystate event so we patch it! + if (doc.readyState == null) { + doc.readyState = 1; + doc.addEventListener("load", function () { + doc.readyState = 4; + if (typeof doc.onreadystatechange == "function") + doc.onreadystatechange(); + }, false); + } + } else if (window.ActiveXObject) { + doc = new ActiveXObject(XmlDocument.getPrefix() + ".DomDocument"); + } + + if (!doc.documentElement || doc.documentElement.tagName != name || + (doc.documentElement.namespaceURI && + doc.documentElement.namespaceURI != ns)) { + try { + if (ns != '') + doc.appendChild(doc.createElement(name)). + setAttribute('xmlns',ns); + else + doc.appendChild(doc.createElement(name)); + } catch (dex) { + doc = document.implementation.createDocument(ns,name,null); + + if (doc.documentElement == null) + doc.appendChild(doc.createElement(name)); + + // fix buggy opera 8.5x + if (ns != '' && + doc.documentElement.getAttribute('xmlns') != ns) { + doc.documentElement.setAttribute('xmlns',ns); + } + } + } + + return doc; + } + catch (ex) { alert(ex.name+": "+ex.message); } + throw new Error("Your browser does not support XmlDocument objects"); +}; + +/** + * used to find the Automation server name + * @private + */ +XmlDocument.getPrefix = function() { + if (XmlDocument.prefix) + return XmlDocument.prefix; + + var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"]; + var o; + for (var i = 0; i < prefixes.length; i++) { + try { + // try to create the objects + o = new ActiveXObject(prefixes[i] + ".DomDocument"); + return XmlDocument.prefix = prefixes[i]; + } + catch (ex) {}; + } + + throw new Error("Could not find an installed XML parser"); +}; + + +// Create the loadXML method +if (typeof(Document) != 'undefined' && window.DOMParser) { + + /** + * XMLDocument did not extend the Document interface in some + * versions of Mozilla. + * @private + */ + Document.prototype.loadXML = function (s) { + + // parse the string to a new doc + var doc2 = (new DOMParser()).parseFromString(s, "text/xml"); + + // remove all initial children + while (this.hasChildNodes()) + this.removeChild(this.lastChild); + + // insert and import nodes + for (var i = 0; i < doc2.childNodes.length; i++) { + this.appendChild(this.importNode(doc2.childNodes[i], true)); + } + }; + } + +// Create xml getter for Mozilla +if (window.XMLSerializer && + window.Node && Node.prototype && Node.prototype.__defineGetter__) { + + /** + * xml getter + * + * This serializes the DOM tree to an XML String + * + * Usage: var sXml = oNode.xml + * @deprecated + * @private + */ + // XMLDocument did not extend the Document interface in some versions + // of Mozilla. Extend both! + XMLDocument.prototype.__defineGetter__("xml", function () { + return (new XMLSerializer()).serializeToString(this); + }); + /** + * xml getter + * + * This serializes the DOM tree to an XML String + * + * Usage: var sXml = oNode.xml + * @deprecated + * @private + */ + Document.prototype.__defineGetter__("xml", function () { + return (new XMLSerializer()).serializeToString(this); + }); + + /** + * xml getter + * + * This serializes the DOM tree to an XML String + * + * Usage: var sXml = oNode.xml + * @deprecated + * @private + */ + Node.prototype.__defineGetter__("xml", function () { + return (new XMLSerializer()).serializeToString(this); + }); + } Index: lams_learning/web/includes/presence.js =================================================================== diff -u --- lams_learning/web/includes/presence.js (revision 0) +++ lams_learning/web/includes/presence.js (revision 0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c) @@ -0,0 +1,404 @@ + +/* ******* Constants ******* */ +var GROUPCHAT_MSG = ""; +var PRIVATE_MSG = "private_message"; +var PALETTE = ["#0000FF", "#006699", "#0066FF", "#6633FF", "#00CCFF", "#009900", "#00CC33", "#339900", "#008080", "#66FF66", "#CC6600", "#FF6600", "#FF9900", "#CC6633", "#FF9933", "#990000", "#A50021", "#990033", "#CC3300", "#FF6666", "#330033", "#663399", "#6633CC", "#660099", "#FF00FF", "#999900", "#808000", "#FF9FF2", "#666633", "#292929", "#666666"]; +/* ******* Connection variables ******* */ +var CONFERENCEROOM = ""; +var XMPPDOMAIN = ""; +var USERNAME = ""; +var PASSWORD = ""; +var NICK = ""; +var RESOURCE = ""; +var FROMFLASH; +/* ******* Helper Functions ******* */ +function getColour(nick) { + var charSum = 0; + for (var i = 0; i < nick.length; i++) { + charSum += nick.charCodeAt(i); + } + return PALETTE[charSum % (PALETTE.length)]; +} +function htmlEnc(str) { + if (!str) { + return null; + } + str = str.replace(/&/g, "&"); + str = str.replace(//g, ">"); + str = str.replace(/\"/g, """); + str = str.replace(/\n/g, "
    "); + return str; +} + +function createElem(name, attrs, style, text) { + var e = document.createElement(name); + if (attrs) { + for (var key in attrs) { + if (key == "attrClass") { + e.className = attrs[key]; + } else { + if (key == "attrId") { + e.id = attrs[key]; + } else { + e.setAttribute(key, attrs[key]); + } + } + } + } + if (style) { + for (key in style) { + e.style[key] = style[key]; + } + } + if (text) { + e.appendChild(document.createTextNode(text)); + } + return e; +} + +/* ******* Roster ******* */ +function RosterUser(nick) { + this.nick = nick; + this.status = "unavailable"; +} +function getRosterUserByNick(nick) { + for (var i = 0; i < this.users.length; i++) { + if (this.users[i].nick == nick) { + return this.users[i]; + } + } + return null; +} +function AddRosterUser(user) { + this.users[this.users.length] = user; +} +function UpdateRosterUser(user) { + // TODO do we need this. +} +function RemoveRosterUser() { +} +function GetAllRosterUsers() { + return this.users; +} + +function UpdateRosterDisplay() { + if(FROMFLASH){ + // send users to flash + var availableUsers = []; + for (var i = 0; i < this.users.length; i++) { + if (this.users[i].status != "unavailable") { + availableUsers[availableUsers.length] = this.users[i]; + } + } + flashProxy.call("sendUsersToFlash", availableUsers); + } + else { + // send roster to no flash version + var rosterDiv = document.getElementById("roster"); + rosterDiv.innerHTML = ""; + for (var i = 0; i < this.users.length; i++) { + if (this.users[i].status != "unavailable") { + var className = "unselected"; + if (i == this.currentIndex) { + className = "selected"; + } + var nick = this.users[i].nick; + var userDiv = createElem("div", {attrId:"user-" + i, attrClass:className, onClick:"selectUser(this);"}, {width:"100%", color:"#0000FF"}, this.users[i].nick); + rosterDiv.appendChild(userDiv); + } + } + } +} +function Roster() { + this.users = []; + this.currentIndex = null; + // objects methods + this.getUserByNick = getRosterUserByNick; + this.addUser = AddRosterUser; + this.updateUser = UpdateRosterUser; + this.removeUser = RemoveRosterUser; + this.updateDisplay = UpdateRosterDisplay; + this.getAllUsers = GetAllRosterUsers; +} +var roster = new Roster(); + +function selectUser(userDiv) { + if (MODE == "teacher") { + var newIndex = userDiv.id.substring(userDiv.id.indexOf("-") + 1, userDiv.id.length); + if (roster.currentIndex == newIndex) { + roster.currentIndex = null; + } else { + roster.currentIndex = newIndex; + } + + // update "send message to" display + var sendToUserSpan = document.getElementById("sendToUser"); + var sendToEveryoneSpan = document.getElementById("sendToEveryone"); + if (roster.currentIndex == null) { + sendToEveryoneSpan.style.display = "inline"; + sendToUserSpan.style.display = "none"; + } else { + sendToEveryoneSpan.style.display = "none"; + sendToUserSpan.style.display = "inline"; + var nick = roster.users[roster.currentIndex].nick; + var nickElem = createElem("span", null, {color:getColour(nick)}, nick); + sendToUserSpan.innerHTML = ""; // clear previous user name + sendToUserSpan.appendChild(nickElem); + } + roster.updateDisplay(); + } +} + +/* ******* Chat functions ******* */ +function setFocusOnTextarea() { + document.forms[0].msg.focus(); +} +function scrollMessageDisplay() { + var iRespDiv = document.getElementById("iResp"); + iRespDiv.scrollTop = iRespDiv.scrollHeight; +} +function generateMessageHTML(nick, message, type) { + var colour = getColour(nick); + var fromElem = createElem("div", {attrClass:"messageFrom"}, null, nick); + var msgElem = createElem("div", {attrClass:"message " + type}, {color:colour}, null); + msgElem.innerHTML = message; + msgElem.insertBefore(fromElem, msgElem.firstChild); + return msgElem; +} +function updateMessageDisplay(htmlMessage) { + var iRespDiv = document.getElementById("iResp"); + iRespDiv.appendChild(htmlMessage); + iRespDiv.scrollTop = iRespDiv.scrollHeight; +} +function sendMsg(aForm) { + if (aForm.msg.value === "") { + return false; // do not send empty messages. + } + var aMsg = new JSJaCMessage(); + if (MODE == "teacher" && !(roster.currentIndex === null)) { + var toNick = roster.users[roster.currentIndex].nick; + aMsg.setTo(CONFERENCEROOM + "/" + toNick); + aMsg.setType("chat"); + var message = "[" + toNick + "] " + aForm.msg.value; + aMsg.setBody(message); + // apending the private message to the incoming window, + // since the jabber server will not echo sent private messages. + // TODO: need to check if this is correct behaviour + if (!(NICK == toNick)) { + updateMessageDisplay(generateMessageHTML(NICK, message, PRIVATE_MSG)); + } + } else { + aMsg.setTo(CONFERENCEROOM); + aMsg.setType("groupchat"); + aMsg.setBody(aForm.msg.value); + } + + // } + aMsg.setFrom(USERNAME + "@" + XMPPDOMAIN + "/" + RESOURCE); + con.send(aMsg); + aForm.msg.value = ""; + return false; +} + +/* ******* Event Handlers ******* */ +function handleEvent(aJSJaCPacket) { + document.getElementById("iResp").innerHTML += "IN (raw):
    " + htmlEnc(aJSJaCPacket.xml()) + "
    "; +} +function handleMessage(aJSJaCPacket) { + var nick = aJSJaCPacket.getFrom().substring(aJSJaCPacket.getFrom().indexOf("/") + 1); + var message = htmlEnc(aJSJaCPacket.getBody()); + var type = aJSJaCPacket.getType(); + var htmlMessage; + if (type == "chat") { + htmlMessage = generateMessageHTML(nick, message, PRIVATE_MSG); + } else { + if (type == "groupchat") { + htmlMessage = generateMessageHTML(nick, message, GROUPCHAT_MSG); + } else { + /* somethings wrong, dont add anything.*/ + htmlMessage = ""; + } + } + updateMessageDisplay(htmlMessage); +} +function handlePresence(presence) { + // debug statement for presence + //alert("presence"); + var from = presence.getFrom(); + var status = presence.getStatus(); + var show = presence.getShow(); + var type = presence.getType(); + // get x element for MUC + var x; + for (var i = 0; i < presence.getNode().getElementsByTagName("x").length; i++) { + if (presence.getNode().getElementsByTagName("x").item(i).getAttribute("xmlns") == "http://jabber.org/protocol/muc#user") { + x = presence.getNode().getElementsByTagName("x").item(i); + break; + } + } + + // extract nick. + var nick; + if (from.indexOf("/") != -1) { + nick = from.substring(from.indexOf("/") + 1); + } + var user = roster.getUserByNick(nick); + if (!user) { + user = new RosterUser(nick); + roster.addUser(user); + } + if (show) { + user.status = show; + } else { + if (type) { + if (type == "unavailable") { + user.status = "unavailable"; + } + } else { + // default: means presence is available. + user.status = "available"; + } + } + + if(FROMFLASH){ + // notify flash + flashProxy.call("sendMessageToFlash", "Presence handled"); + } + else { + // NoFlash equivalent + } + + roster.updateDisplay(); +} +function handleConnected() { + //debug statement for connecton + //alert("connected"); + + // send presence + var aPresence = new JSJaCPresence(); + aPresence.setTo(CONFERENCEROOM + "/" + NICK); + aPresence.setFrom(USERNAME + "@" + XMPPDOMAIN); + var x = aPresence.getDoc().createElement("x"); + x.setAttribute("xmlns", "http://jabber.org/protocol/muc"); + x.appendChild(aPresence.getDoc().createElement("password")).appendChild(aPresence.getDoc().createTextNode(PASSWORD)); + aPresence.getNode().appendChild(x); + con.send(aPresence); + + // set up roster + roster = new Roster(); + + if(FROMFLASH){ + // notify flash + flashProxy.call("sendMessageToFlash", "Connected"); + } + else { + // NoFlash equivalent + } +} +function handleError(e) { + //debug statement for error� + //alert("error" + e.getAttribute("code")); + + if(FROMFLASH){ + // notify flash + flashProxy.call("sendMessageToFlash", "Code: " + e.getAttribute("code") + " Type: " + e.getAttribute("type")); + } + + switch(e.getAttribute("code")){ + // unauthorized, try register + case "401": + doLogin(null, null, null, null, null, null, true, null); + break; + } +} + +function breakPoint() { + var i = 0; +} + +/* ******* Init ******* */ +function doLogin(presenceServerUrl, userID, password, resource, chatroom, nickname, register, fromFlash) { + try { + // if register is set to false (first time login), store connection info, otherwise, just use it again + if(!register) { + USERNAME = userID; + PASSWORD = password; + RESOURCE = resource; + XMPPDOMAIN = presenceServerUrl; + NICK = nickname; + CONFERENCEROOM = chatroom + "@conference." + presenceServerUrl; + FROMFLASH = fromFlash; + // debug statement for connection information + //alert(HTTPBASE + USERNAME + PASSWORD + RESOURCE + XMPPDOMAIN + NICK + CONFERENCEROOM + FROMFLASH); + } + + // setup args for contructor + // HTTPBASE is defined in controlFrame for flash interface and in mainnoflash for flashless interface + var oArgs = {httpbase:HTTPBASE, timerval:6000}; + if (typeof (oDbg) != "undefined") { + oArgs.oDbg = oDbg; + } + con = new JSJaCHttpBindingConnection(oArgs); + con.registerHandler("message", handleMessage); + con.registerHandler("presence", handlePresence); + con.registerHandler("iq", handleEvent); + con.registerHandler("onconnect", handleConnected); + con.registerHandler("onerror", handleError); + + // setup args for connect method + oArgs = {domain:XMPPDOMAIN, username:USERNAME, resource:RESOURCE, pass:PASSWORD, register:register}; + con.connect(oArgs); + + if(FROMFLASH){ + // notify flash + flashProxy.call("sendMessageToFlash", "Attempting connection"); + } + else { + // NoFlash equivalent + } + } + catch (e) { + flashProxy.call("sendMessageToFlash", e.toString()); + } + finally { + return false; + } +} +function getUsers() { + flashProxy.call("sendMessageToFlash", GetAllRosterUsers()); +} +function init() { + /* + if (typeof (Debugger) == "function") { + var oDbg = new Debugger(4, "simpleclient"); + oDbg.start(); + } + doLogin(); + */ +} +onload = init; +onunload = function () { + if (typeof (con) != "undefined" && con.disconnect) { + con.disconnect(); + } +}; +/* ******* Helper functions ******* */ +function checkEnter(e) { //e is event object passed from function invocation + var characterCode; //literal character code will be stored in this variable + if (e && e.which) { //if which property of event object is supported (NN4) + e = e; + characterCode = e.which; //character code is contained in NN4's which property + } else { + e = event; + characterCode = e.keyCode; //character code is contained in IE's keyCode property + } + if (characterCode == 13) { //if generated character code is equal to ascii 13 (if enter key) + //document.forms[0].submit(); //submit the form + sendMsg(document.forms[0]); + return false; + } else { + return true; + } +} + Index: lams_learning/web/lams_learner.swf =================================================================== diff -u -re0eebc7060d775eda138515e2166ddbe04a5ada7 -r0b7d091f6bf6d5b3b2bd72b450903f0dc0f8b76c Binary files differ