Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #63: Fix youHaveBeenKicked/BannedBy to support kick/ban message…

…s without an actor

fixed #64: adding japanese translation

fixed accidental overwrite of chinese translation (raptorMessageBlocked again..)

fixed #56: Updating french translation, thanks to @ajoly
  • Loading branch information...
commit 4aff6ddd791ce921fd7786695f642e7496ea1f10 1 parent cc0aae8
@mweibel mweibel authored
View
123 candy.bundle.js
@@ -2491,14 +2491,20 @@ Candy.View.Observer = (function(self, $) {
self.Presence.notifyPrivateChats(user, args.type);
// Client has been kicked or banned
} else if (args.type === 'kick' || args.type === 'ban') {
- var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : args.roomName,
- actionLabel;
+ var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : null,
+ actionLabel,
+ translationParams = [args.roomName];
+
+ if (actorName) {
+ translationParams.push(actorName);
+ }
+
switch(args.type) {
case 'kick':
- actionLabel = $.i18n._('youHaveBeenKickedBy', [args.roomName, actorName]);
+ actionLabel = $.i18n._((actorName ? 'youHaveBeenKickedBy' : 'youHaveBeenKicked'), translationParams);
break;
case 'ban':
- actionLabel = $.i18n._('youHaveBeenBannedBy', [args.roomName, actorName]);
+ actionLabel = $.i18n._((actorName ? 'youHaveBeenBannedBy' : 'youHaveBeenBanned'), translationParams);
break;
}
Candy.View.Pane.Chat.Modal.show(Mustache.to_html(Candy.View.Template.Chat.Context.adminMessageReason, {
@@ -4366,9 +4372,11 @@ Candy.View.Translation = {
'subject' : 'Subject:',
'reasonWas' : 'Reason was: %s.',
'kickActionLabel' : 'Kick',
- 'youHaveBeenKickedBy' : 'You have been kicked from %s by %s',
+ 'youHaveBeenKickedBy' : 'You have been kicked from %2$s by %1$s',
+ 'youHaveBeenKicked' : 'You have been kicked from %s',
'banActionLabel' : 'Ban',
- 'youHaveBeenBannedBy' : 'You have been banned from %s by %s',
+ 'youHaveBeenBannedBy' : 'You have been banned from %1$s by %2$s',
+ 'youHaveBeenBanned' : 'You have been banned from %s',
'privateActionLabel' : 'Private chat',
'ignoreActionLabel' : 'Ignore',
@@ -4430,9 +4438,11 @@ Candy.View.Translation = {
'subject' : 'Titel:',
'reasonWas' : 'Begründung: %s.',
'kickActionLabel' : 'Kick',
- 'youHaveBeenKickedBy' : 'Du wurdest soeben aus dem Raum %s gekickt (%s)',
+ 'youHaveBeenKickedBy' : 'Du wurdest soeben aus dem Raum %1$s gekickt (%2$s)',
+ 'youHaveBeenKicked' : 'Du wurdest soeben aus dem Raum %s gekickt',
'banActionLabel' : 'Ban',
- 'youHaveBeenBannedBy' : 'Du wurdest soeben aus dem Raum %s verbannt (%s)',
+ 'youHaveBeenBannedBy' : 'Du wurdest soeben aus dem Raum %1$s verbannt (%2$s)',
+ 'youHaveBeenBanned' : 'Du wurdest soeben aus dem Raum %s verbannt',
'privateActionLabel' : 'Privater Chat',
'ignoreActionLabel' : 'Ignorieren',
@@ -4494,9 +4504,11 @@ Candy.View.Translation = {
'subject' : 'Titre:',
'reasonWas' : 'Justification: %s.',
'kickActionLabel' : 'Kick',
- 'youHaveBeenKickedBy' : 'Tu as été expulsé (%s)',
+ 'youHaveBeenKickedBy' : 'Tu as été expulsé de le salon %1$s (%2$s)',
+ 'youHaveBeenKicked' : 'Tu as été expulsé de le salon %s',
'banActionLabel' : 'Ban',
- 'youHaveBeenBannedBy' : 'Tu as été banni (%s)',
+ 'youHaveBeenBannedBy' : 'Tu as été banni de le salon %1$s (%2$s)',
+ 'youHaveBeenBanned' : 'Tu as été banni de le salon %s',
'privateActionLabel' : 'Chat privé',
'ignoreActionLabel' : 'Ignorer',
@@ -4526,6 +4538,15 @@ Candy.View.Translation = {
'tooltipAdministration' : 'Administrer le salon',
'tooltipUsercount' : 'Nombre d\'utilisateurs dans le salon',
+ 'enterRoomPassword' : 'Le salon "%s" est protégé par un mot de passe.',
+ 'enterRoomPasswordSubmit' : 'Entrer dans le salon',
+ 'passwordEnteredInvalid' : 'Le mot de passe four le salon "%s" est invalide.',
+
+ 'nicknameConflict': 'Le nom d\'utilisateur est déjà utilisé. Choisi un autre.',
+
+ 'errorMembersOnly': 'Tu ne peut pas entrer de le salon "%s": droits insuffisants.',
+ 'errorMaxOccupantsReached': 'Tu ne peut pas entrer de le salon "%s": Limite d\'utilisateur atteint.',
+
'antiSpamMessage' : 'S\'il te plaît, pas de spam. Tu as été bloqué pendant une courte période..'
},
@@ -4549,9 +4570,11 @@ Candy.View.Translation = {
'subject' : 'Onderwerp:',
'reasonWas' : 'De reden was: %s.',
'kickActionLabel' : 'Verwijderen',
- 'youHaveBeenKickedBy' : 'Je bent verwijderd van %s door %s',
+ 'youHaveBeenKickedBy' : 'Je bent verwijderd van %1$s door %2$s',
+ 'youHaveBeenKicked' : 'Je bent verwijderd van %s',
'banActionLabel' : 'Blokkeren',
- 'youHaveBeenBannedBy' : 'Je bent geblokkeerd van %s door %s',
+ 'youHaveBeenBannedBy' : 'Je bent geblokkeerd van %1$s door %2$s',
+ 'youHaveBeenBanned' : 'Je bent geblokkeerd van %s',
'privateActionLabel' : 'Prive gesprek',
'ignoreActionLabel' : 'Negeren',
@@ -4613,9 +4636,11 @@ Candy.View.Translation = {
'subject' : 'Asunto:',
'reasonWas' : 'La razón fue: %s.',
'kickActionLabel' : 'Expulsar',
- 'youHaveBeenKickedBy' : 'Has sido expulsado de %s por %s',
+ 'youHaveBeenKickedBy' : 'Has sido expulsado de %1$s por %2$s',
+ 'youHaveBeenKicked' : 'Has sido expulsado de %s',
'banActionLabel' : 'Prohibir',
- 'youHaveBeenBannedBy' : 'Has sido expulsado permanentemente de %s por %s',
+ 'youHaveBeenBannedBy' : 'Has sido expulsado permanentemente de %1$s por %2$s',
+ 'youHaveBeenBanned' : 'Has sido expulsado permanentemente de %s',
'privateActionLabel' : 'Chat privado',
'ignoreActionLabel' : 'Ignorar',
@@ -4677,9 +4702,9 @@ Candy.View.Translation = {
'subject': '主题:',
'reasonWas': '原因是: %s.',
'kickActionLabel': '踢除',
- 'youHaveBeenKickedBy': '你在 %s 被管理者 %s 请出房间',
+ 'youHaveBeenKickedBy': '你在 %1$s 被管理者 %2$s 请出房间',
'banActionLabel': '禁言',
- 'youHaveBeenBannedBy': '你在 %s 被管理者 %s 禁言',
+ 'youHaveBeenBannedBy': '你在 %1$s 被管理者 %2$s 禁言',
'privateActionLabel': '单独对话',
'ignoreActionLabel': '忽略',
@@ -4718,6 +4743,70 @@ Candy.View.Translation = {
'errorMembersOnly': '您的权限不够,不能登录房间 "%s" ',
'errorMaxOccupantsReached': '房间 "%s" 的人数已达上限,您不能登录',
- 'raptorMessageBlocked': '因为您在短时间内发送过多的消息 服务器要阻止您一小段时间。'
+ 'antiSpamMessage': '因为您在短时间内发送过多的消息 服务器要阻止您一小段时间。'
+ },
+
+ 'ja' : {
+ 'status' : 'ステータス: %s',
+ 'statusConnecting' : '接続中…',
+ 'statusConnected' : '接続されました',
+ 'statusDisconnecting' : 'ディスコネクト中…',
+ 'statusDisconnected' : 'ディスコネクトされました',
+ 'statusAuthfail' : '認証に失敗しました',
+
+ 'roomSubject' : 'トピック:',
+ 'messageSubmit' : '送信',
+
+ 'labelUsername' : 'ユーザーネーム:',
+ 'labelPassword' : 'パスワード:',
+ 'loginSubmit' : 'ログイン',
+ 'loginInvalid' : 'ユーザーネームが正しくありません',
+
+ 'reason' : '理由:',
+ 'subject' : 'トピック:',
+ 'reasonWas' : '理由: %s。',
+ 'kickActionLabel' : 'キック',
+ 'youHaveBeenKickedBy' : 'あなたは%2$sにより%1$sからキックされました。',
+ 'banActionLabel' : 'アカウントバン',
+ 'youHaveBeenBannedBy' : 'あなたは%2$sにより%1$sからアカウントバンされました。',
+
+ 'privateActionLabel' : 'プライベートメッセージ',
+ 'ignoreActionLabel' : '無視する',
+ 'unignoreActionLabel' : '無視をやめる',
+
+ 'setSubjectActionLabel' : 'トピックを変える',
+
+ 'administratorMessageSubject' : '管理者',
+
+ 'userJoinedRoom' : '%sは入室しました。',
+ 'userLeftRoom' : '%sは退室しました。',
+ 'userHasBeenKickedFromRoom' : '%sは部屋からキックされました。',
+ 'userHasBeenBannedFromRoom' : '%sは部屋からアカウントバンされました。',
+
+ 'presenceUnknownWarningSubject' : '忠告:',
+ 'presenceUnknownWarning' : 'このユーザーのステータスは不明です。',
+
+ 'dateFormat' : 'dd.mm.yyyy',
+ 'timeFormat' : 'HH:MM:ss',
+
+ 'tooltipRole' : 'モデレーター',
+ 'tooltipIgnored' : 'このユーザーを無視設定にしている',
+ 'tooltipEmoticons' : '絵文字',
+ 'tooltipSound' : '新しいメッセージが届くたびに音を鳴らす',
+ 'tooltipAutoscroll' : 'オートスクロール',
+ 'tooltipStatusmessage' : 'ステータスメッセージを表示',
+ 'tooltipAdministration' : '部屋の管理',
+ 'tooltipUsercount' : 'この部屋の参加者の数',
+
+ 'enterRoomPassword' : '"%s"の部屋に入るにはパスワードが必要です。',
+ 'enterRoomPasswordSubmit' : '部屋に入る',
+ 'passwordEnteredInvalid' : '"%s"のパスワードと異なるパスワードを入力しました。',
+
+ 'nicknameConflict' : 'このユーザーネームはすでに利用されているため、別のユーザーネームを選んでください。',
+
+ 'errorMembersOnly' : '"%s"の部屋に入ることができません: 利用権限を満たしていません。',
+ 'errorMaxOccupantsReached' : '"%s"の部屋に入ることができません: 参加者の数はすでに上限に達しました。',
+
+ 'antiSpamMessage' : 'スパムなどの行為はやめてください。あなたは一時的にブロックされました。'
}
};
View
2  candy.min.js
1 addition, 1 deletion not shown
View
39 libs/libs.bundle.js
@@ -4248,7 +4248,7 @@ var Mustache = function() {
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
- * Version: 0.9.1 (201012171436)
+ * Version: 0.9.2 (201111281039)
*/
(function($) {
/**
@@ -4355,21 +4355,44 @@ $.i18n = {
printf: function(S, L) {
if (!L) return S;
- var nS = "";
+ var nS = "",
+ search = /%(\d+)\$s/g;
+ // replace %n1$ where n is a number
+ while (result = search.exec(S)) {
+ var index = parseInt(result[1], 10) -1;
+ S = S.replace('%' + result[1] + '\$s', (L[index]));
+ L.splice(index, 1);
+ }
var tS = S.split("%s");
-
- for(var i=0; i<L.length; i++) {
- if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != L.length-1)
- tS[i] += "s"+tS.splice(i+1,1)[0];
- nS += tS[i] + L[i];
+ if (tS.length > 1) {
+ for(var i = 0; i < L.length; i++) {
+ if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != L.length-1)
+ tS[i] += "s"+tS.splice(i+1,1)[0];
+ nS += tS[i] + L[i];
+ }
}
return nS + tS[tS.length-1];
}
};
+/*
+ * _t
+ * Allows you to translate a jQuery selector
+ *
+ * eg $('h1')._t('some text')
+ *
+ * @param string str : The string to translate
+ * @param property_list params : params for using printf() on the string
+ * @return element : chained and translated element(s)
+*/
+$.fn._t = function(str, params) {
+ return $(this).text($.i18n._(str, params));
+};
+
-})(jQuery);/*
+})(jQuery);
+/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
View
2  libs/libs.min.js
@@ -1 +1 @@
-var Base64=(function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var b={encode:function(e){var c="";var m,k,h;var l,j,g,f;var d=0;do{m=e.charCodeAt(d++);k=e.charCodeAt(d++);h=e.charCodeAt(d++);l=m>>2;j=((m&3)<<4)|(k>>4);g=((k&15)<<2)|(h>>6);f=h&63;if(isNaN(k)){g=f=64}else{if(isNaN(h)){f=64}}c=c+a.charAt(l)+a.charAt(j)+a.charAt(g)+a.charAt(f)}while(d<e.length);return c},decode:function(e){var c="";var m,k,h;var l,j,g,f;var d=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{l=a.indexOf(e.charAt(d++));j=a.indexOf(e.charAt(d++));g=a.indexOf(e.charAt(d++));f=a.indexOf(e.charAt(d++));m=(l<<2)|(j>>4);k=((j&15)<<4)|(g>>2);h=((g&3)<<6)|f;c=c+String.fromCharCode(m);if(g!=64){c=c+String.fromCharCode(k)}if(f!=64){c=c+String.fromCharCode(h)}}while(d<e.length);return c}};return b})();var MD5=(function(){var o=0;var a="";var l=8;var j=function(r,u){var t=(r&65535)+(u&65535);var s=(r>>16)+(u>>16)+(t>>16);return(s<<16)|(t&65535)};var n=function(r,s){return(r<<s)|(r>>>(32-s))};var b=function(u){var t=[];var r=(1<<l)-1;for(var s=0;s<u.length*l;s+=l){t[s>>5]|=(u.charCodeAt(s/l)&r)<<(s%32)}return t};var g=function(t){var u="";var r=(1<<l)-1;for(var s=0;s<t.length*32;s+=l){u+=String.fromCharCode((t[s>>5]>>>(s%32))&r)}return u};var q=function(t){var s=o?"0123456789ABCDEF":"0123456789abcdef";var u="";for(var r=0;r<t.length*4;r++){u+=s.charAt((t[r>>2]>>((r%4)*8+4))&15)+s.charAt((t[r>>2]>>((r%4)*8))&15)}return u};var p=function(u){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var w="";var v,r;for(var s=0;s<u.length*4;s+=3){v=(((u[s>>2]>>8*(s%4))&255)<<16)|(((u[s+1>>2]>>8*((s+1)%4))&255)<<8)|((u[s+2>>2]>>8*((s+2)%4))&255);for(r=0;r<4;r++){if(s*8+r*6>u.length*32){w+=a}else{w+=t.charAt((v>>6*(3-r))&63)}}}return w};var d=function(z,v,u,r,y,w){return j(n(j(j(v,z),j(r,w)),y),u)};var k=function(v,u,A,z,r,y,w){return d((u&A)|((~u)&z),v,u,r,y,w)};var c=function(v,u,A,z,r,y,w){return d((u&z)|(A&(~z)),v,u,r,y,w)};var m=function(v,u,A,z,r,y,w){return d(u^A^z,v,u,r,y,w)};var i=function(v,u,A,z,r,y,w){return d(A^(u|(~z)),v,u,r,y,w)};var f=function(C,w){C[w>>5]|=128<<((w)%32);C[(((w+64)>>>9)<<4)+14]=w;var B=1732584193;var A=-271733879;var z=-1732584194;var y=271733878;var v,u,t,r;for(var s=0;s<C.length;s+=16){v=B;u=A;t=z;r=y;B=k(B,A,z,y,C[s+0],7,-680876936);y=k(y,B,A,z,C[s+1],12,-389564586);z=k(z,y,B,A,C[s+2],17,606105819);A=k(A,z,y,B,C[s+3],22,-1044525330);B=k(B,A,z,y,C[s+4],7,-176418897);y=k(y,B,A,z,C[s+5],12,1200080426);z=k(z,y,B,A,C[s+6],17,-1473231341);A=k(A,z,y,B,C[s+7],22,-45705983);B=k(B,A,z,y,C[s+8],7,1770035416);y=k(y,B,A,z,C[s+9],12,-1958414417);z=k(z,y,B,A,C[s+10],17,-42063);A=k(A,z,y,B,C[s+11],22,-1990404162);B=k(B,A,z,y,C[s+12],7,1804603682);y=k(y,B,A,z,C[s+13],12,-40341101);z=k(z,y,B,A,C[s+14],17,-1502002290);A=k(A,z,y,B,C[s+15],22,1236535329);B=c(B,A,z,y,C[s+1],5,-165796510);y=c(y,B,A,z,C[s+6],9,-1069501632);z=c(z,y,B,A,C[s+11],14,643717713);A=c(A,z,y,B,C[s+0],20,-373897302);B=c(B,A,z,y,C[s+5],5,-701558691);y=c(y,B,A,z,C[s+10],9,38016083);z=c(z,y,B,A,C[s+15],14,-660478335);A=c(A,z,y,B,C[s+4],20,-405537848);B=c(B,A,z,y,C[s+9],5,568446438);y=c(y,B,A,z,C[s+14],9,-1019803690);z=c(z,y,B,A,C[s+3],14,-187363961);A=c(A,z,y,B,C[s+8],20,1163531501);B=c(B,A,z,y,C[s+13],5,-1444681467);y=c(y,B,A,z,C[s+2],9,-51403784);z=c(z,y,B,A,C[s+7],14,1735328473);A=c(A,z,y,B,C[s+12],20,-1926607734);B=m(B,A,z,y,C[s+5],4,-378558);y=m(y,B,A,z,C[s+8],11,-2022574463);z=m(z,y,B,A,C[s+11],16,1839030562);A=m(A,z,y,B,C[s+14],23,-35309556);B=m(B,A,z,y,C[s+1],4,-1530992060);y=m(y,B,A,z,C[s+4],11,1272893353);z=m(z,y,B,A,C[s+7],16,-155497632);A=m(A,z,y,B,C[s+10],23,-1094730640);B=m(B,A,z,y,C[s+13],4,681279174);y=m(y,B,A,z,C[s+0],11,-358537222);z=m(z,y,B,A,C[s+3],16,-722521979);A=m(A,z,y,B,C[s+6],23,76029189);B=m(B,A,z,y,C[s+9],4,-640364487);y=m(y,B,A,z,C[s+12],11,-421815835);z=m(z,y,B,A,C[s+15],16,530742520);A=m(A,z,y,B,C[s+2],23,-995338651);B=i(B,A,z,y,C[s+0],6,-198630844);y=i(y,B,A,z,C[s+7],10,1126891415);z=i(z,y,B,A,C[s+14],15,-1416354905);A=i(A,z,y,B,C[s+5],21,-57434055);B=i(B,A,z,y,C[s+12],6,1700485571);y=i(y,B,A,z,C[s+3],10,-1894986606);z=i(z,y,B,A,C[s+10],15,-1051523);A=i(A,z,y,B,C[s+1],21,-2054922799);B=i(B,A,z,y,C[s+8],6,1873313359);y=i(y,B,A,z,C[s+15],10,-30611744);z=i(z,y,B,A,C[s+6],15,-1560198380);A=i(A,z,y,B,C[s+13],21,1309151649);B=i(B,A,z,y,C[s+4],6,-145523070);y=i(y,B,A,z,C[s+11],10,-1120210379);z=i(z,y,B,A,C[s+2],15,718787259);A=i(A,z,y,B,C[s+9],21,-343485551);B=j(B,v);A=j(A,u);z=j(z,t);y=j(y,r)}return[B,A,z,y]};var e=function(t,w){var v=b(t);if(v.length>16){v=f(v,t.length*l)}var r=new Array(16),u=new Array(16);for(var s=0;s<16;s++){r[s]=v[s]^909522486;u[s]=v[s]^1549556828}var x=f(r.concat(b(w)),512+w.length*l);return f(u.concat(x),512+128)};var h={hexdigest:function(r){return q(f(b(r),r.length*l))},b64digest:function(r){return p(f(b(r),r.length*l))},hash:function(r){return g(f(b(r),r.length*l))},hmac_hexdigest:function(r,s){return q(e(r,s))},hmac_b64digest:function(r,s){return p(e(r,s))},hmac_hash:function(r,s){return g(e(r,s))},test:function(){return MD5.hexdigest("abc")==="900150983cd24fb0d6963f7d28e17f72"}};return h})();if(!Function.prototype.bind){Function.prototype.bind=function(e){var d=this;var c=Array.prototype.slice;var b=Array.prototype.concat;var a=c.call(arguments,1);return function(){return d.apply(e?e:this,b.call(a,c.call(arguments,0)))}}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b){var a=this.length;var c=Number(arguments[1])||0;c=(c<0)?Math.ceil(c):Math.floor(c);if(c<0){c+=a}for(;c<a;c++){if(c in this&&this[c]===b){return c}}return -1}}(function(f){var e;function c(h,g){return new e.Builder(h,g)}function a(g){return new e.Builder("message",g)}function d(g){return new e.Builder("iq",g)}function b(g){return new e.Builder("presence",g)}e={VERSION:"8d27954",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas"},addNamespace:function(g,h){e.NS[g]=h},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3,CDATA:4},TIMEOUT:1.1,SECONDARY_TIMEOUT:0.1,forEachChild:function(k,l,j){var h,g;for(h=0;h<k.childNodes.length;h++){g=k.childNodes[h];if(g.nodeType==e.ElementType.NORMAL&&(!l||this.isTagEqual(g,l))){j(g)}}},isTagEqual:function(h,g){return h.tagName.toLowerCase()==g.toLowerCase()},_xmlGenerator:null,_makeGenerator:function(){var g;if(document.implementation.createDocument===undefined){g=this._getIEXmlDom();g.appendChild(g.createElement("strophe"))}else{g=document.implementation.createDocument("jabber:client","strophe",null)}return g},xmlGenerator:function(){if(!e._xmlGenerator){e._xmlGenerator=e._makeGenerator()}return e._xmlGenerator},_getIEXmlDom:function(){var h=null;var j=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(var i=0;i<j.length;i++){if(h===null){try{h=new ActiveXObject(j[i])}catch(g){h=null}}else{break}}return h},xmlElement:function(j){if(!j){return null}var m=e.xmlGenerator().createElement(j);var g,l,h;for(g=1;g<arguments.length;g++){if(!arguments[g]){continue}if(typeof(arguments[g])=="string"||typeof(arguments[g])=="number"){m.appendChild(e.xmlTextNode(arguments[g]))}else{if(typeof(arguments[g])=="object"&&typeof(arguments[g].sort)=="function"){for(l=0;l<arguments[g].length;l++){if(typeof(arguments[g][l])=="object"&&typeof(arguments[g][l].sort)=="function"){m.setAttribute(arguments[g][l][0],arguments[g][l][1])}}}else{if(typeof(arguments[g])=="object"){for(h in arguments[g]){if(arguments[g].hasOwnProperty(h)){m.setAttribute(h,arguments[g][h])}}}}}}return m},xmlescape:function(g){g=g.replace(/\&/g,"&amp;");g=g.replace(/</g,"&lt;");g=g.replace(/>/g,"&gt;");g=g.replace(/'/g,"&apos;");g=g.replace(/"/g,"&quot;");return g},xmlTextNode:function(g){g=e.xmlescape(g);return e.xmlGenerator().createTextNode(g)},getText:function(h){if(!h){return null}var j="";if(h.childNodes.length===0&&h.nodeType==e.ElementType.TEXT){j+=h.nodeValue}for(var g=0;g<h.childNodes.length;g++){if(h.childNodes[g].nodeType==e.ElementType.TEXT){j+=h.childNodes[g].nodeValue}}return j},copyElement:function(j){var g,h;if(j.nodeType==e.ElementType.NORMAL){h=e.xmlElement(j.tagName);for(g=0;g<j.attributes.length;g++){h.setAttribute(j.attributes[g].nodeName.toLowerCase(),j.attributes[g].value)}for(g=0;g<j.childNodes.length;g++){h.appendChild(e.copyElement(j.childNodes[g]))}}else{if(j.nodeType==e.ElementType.TEXT){h=e.xmlGenerator().createTextNode(j.nodeValue)}}return h},escapeNode:function(g){return g.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(g){return g.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(g){if(g.indexOf("@")<0){return null}return g.split("@")[0]},getDomainFromJid:function(g){var h=e.getBareJidFromJid(g);if(h.indexOf("@")<0){return h}else{var i=h.split("@");i.splice(0,1);return i.join("@")}},getResourceFromJid:function(g){var h=g.split("/");if(h.length<2){return null}h.splice(0,1);return h.join("/")},getBareJidFromJid:function(g){return g?g.split("/")[0]:null},log:function(h,g){return},debug:function(g){this.log(this.LogLevel.DEBUG,g)},info:function(g){this.log(this.LogLevel.INFO,g)},warn:function(g){this.log(this.LogLevel.WARN,g)},error:function(g){this.log(this.LogLevel.ERROR,g)},fatal:function(g){this.log(this.LogLevel.FATAL,g)},serialize:function(j){var g;if(!j){return null}if(typeof(j.tree)==="function"){j=j.tree()}var l=j.nodeName;var h,k;if(j.getAttribute("_realname")){l=j.getAttribute("_realname")}g="<"+l;for(h=0;h<j.attributes.length;h++){if(j.attributes[h].nodeName!="_realname"){g+=" "+j.attributes[h].nodeName.toLowerCase()+"='"+j.attributes[h].value.replace(/&/g,"&amp;").replace(/\'/g,"&apos;").replace(/</g,"&lt;")+"'"}}if(j.childNodes.length>0){g+=">";for(h=0;h<j.childNodes.length;h++){k=j.childNodes[h];switch(k.nodeType){case e.ElementType.NORMAL:g+=e.serialize(k);break;case e.ElementType.TEXT:g+=k.nodeValue;break;case e.ElementType.CDATA:g+="<![CDATA["+k.nodeValue+"]]>"}}g+="</"+l+">"}else{g+="/>"}return g},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(g,h){e._connectionPlugins[g]=h}};e.Builder=function(h,g){if(h=="presence"||h=="message"||h=="iq"){if(g&&!g.xmlns){g.xmlns=e.NS.CLIENT}else{if(!g){g={xmlns:e.NS.CLIENT}}}}this.nodeTree=e.xmlElement(h,g);this.node=this.nodeTree};e.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return e.serialize(this.nodeTree)},up:function(){this.node=this.node.parentNode;return this},attrs:function(h){for(var g in h){if(h.hasOwnProperty(g)){this.node.setAttribute(g,h[g])}}return this},c:function(h,g,i){var j=e.xmlElement(h,g,i);this.node.appendChild(j);if(!i){this.node=j}return this},cnode:function(i){var k=e.xmlGenerator();try{var h=(k.importNode!==undefined)}catch(j){var h=false}var g=h?k.importNode(i,true):e.copyElement(i);this.node.appendChild(g);this.node=g;return this},t:function(g){var h=e.xmlTextNode(g);this.node.appendChild(h);return this}};e.Handler=function(k,j,h,i,m,l,g){this.handler=k;this.ns=j;this.name=h;this.type=i;this.id=m;this.options=g||{matchbare:false};if(!this.options.matchBare){this.options.matchBare=false}if(this.options.matchBare){this.from=l?e.getBareJidFromJid(l):null}else{this.from=l}this.user=true};e.Handler.prototype={isMatch:function(h){var j;var i=null;if(this.options.matchBare){i=e.getBareJidFromJid(h.getAttribute("from"))}else{i=h.getAttribute("from")}j=false;if(!this.ns){j=true}else{var g=this;e.forEachChild(h,null,function(k){if(k.getAttribute("xmlns")==g.ns){j=true}});j=j||h.getAttribute("xmlns")==this.ns}if(j&&(!this.name||e.isTagEqual(h,this.name))&&(!this.type||h.getAttribute("type")==this.type)&&(!this.id||h.getAttribute("id")==this.id)&&(!this.from||i==this.from)){return true}return false},run:function(h){var g=null;try{g=this.handler(h)}catch(i){if(i.sourceURL){e.fatal("error: "+this.handler+" "+i.sourceURL+":"+i.line+" - "+i.name+": "+i.message)}else{if(i.fileName){if(typeof(console)!="undefined"){console.trace();console.error(this.handler," - error - ",i,i.message)}e.fatal("error: "+this.handler+" "+i.fileName+":"+i.lineNumber+" - "+i.name+": "+i.message)}else{e.fatal("error: "+this.handler)}}throw i}return g},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}};e.TimedHandler=function(h,g){this.period=h;this.handler=g;this.lastCalled=new Date().getTime();this.user=true};e.TimedHandler.prototype={run:function(){this.lastCalled=new Date().getTime();return this.handler()},reset:function(){this.lastCalled=new Date().getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}};e.Request=function(i,h,g,j){this.id=++e._requestId;this.xmlData=i;this.data=e.serialize(i);this.origFunc=h;this.func=h;this.rid=g;this.date=NaN;this.sends=j||0;this.abort=false;this.dead=null;this.age=function(){if(!this.date){return 0}var k=new Date();return(k-this.date)/1000};this.timeDead=function(){if(!this.dead){return 0}var k=new Date();return(k-this.dead)/1000};this.xhr=this._newXHR()};e.Request.prototype={getResponse:function(){var g=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){g=this.xhr.responseXML.documentElement;if(g.tagName=="parsererror"){e.error("invalid response received");e.error("responseText: "+this.xhr.responseText);e.error("responseXML: "+e.serialize(this.xhr.responseXML));throw"parsererror"}}else{if(this.xhr.responseText){e.error("invalid response received");e.error("responseText: "+this.xhr.responseText);e.error("responseXML: "+e.serialize(this.xhr.responseXML))}}return g},_newXHR:function(){var g=null;if(window.XMLHttpRequest){g=new XMLHttpRequest();if(g.overrideMimeType){g.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){g=new ActiveXObject("Microsoft.XMLHTTP")}}g.onreadystatechange=this.func.bind(null,this);return g}};e.Connection=function(g){this.service=g;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.features=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold=1;this.wait=60;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var h in e._connectionPlugins){if(e._connectionPlugins.hasOwnProperty(h)){var j=e._connectionPlugins[h];var i=function(){};i.prototype=j;this[h]=new i();this[h].init(this)}}};e.Connection.prototype={reset:function(){this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*10000)},pause:function(){this.paused=true},resume:function(){this.paused=false},getUniqueId:function(g){if(typeof(g)=="string"||typeof(g)=="number"){return ++this._uniqueId+":"+g}else{return ++this._uniqueId+""}},connect:function(h,i,l,k,j){this.jid=h;this.pass=i;this.connect_callback=l;this.disconnecting=false;this.connected=false;this.authenticated=false;this.errors=0;this.wait=k||this.wait;this.hold=j||this.hold;this.domain=e.getDomainFromJid(this.jid);var g=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":e.NS.BOSH});this._changeConnectStatus(e.Status.CONNECTING,null);this._requests.push(new e.Request(g.tree(),this._onRequestStateChange.bind(this,this._connect_cb.bind(this)),g.tree().getAttribute("rid")));this._throttledRequestHandler()},attach:function(i,g,j,m,l,k,h){this.jid=i;this.sid=g;this.rid=j;this.connect_callback=m;this.domain=e.getDomainFromJid(this.jid);this.authenticated=true;this.connected=true;this.wait=l||this.wait;this.hold=k||this.hold;this.window=h||this.window;this._changeConnectStatus(e.Status.ATTACHED,null)},xmlInput:function(g){return},xmlOutput:function(g){return},rawInput:function(g){return},rawOutput:function(g){return},send:function(h){if(h===null){return}if(typeof(h.sort)==="function"){for(var g=0;g<h.length;g++){this._queueData(h[g])}}else{if(typeof(h.tree)==="function"){this._queueData(h.tree())}else{this._queueData(h)}}this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},flush:function(){clearTimeout(this._idleTimeout);this._onIdle()},sendIQ:function(j,n,g,k){var l=null;var i=this;if(typeof(j.tree)==="function"){j=j.tree()}var m=j.getAttribute("id");if(!m){m=this.getUniqueId("sendIQ");j.setAttribute("id",m)}var h=this.addHandler(function(p){if(l){i.deleteTimedHandler(l)}var o=p.getAttribute("type");if(o=="result"){if(n){n(p)}}else{if(o=="error"){if(g){g(p)}}else{throw {name:"StropheError",message:"Got bad IQ type of "+o}}}},null,"iq",null,m);if(k){l=this.addTimedHandler(k,function(){i.deleteHandler(h);if(g){g(null)}return false})}this.send(j);return m},_queueData:function(g){if(g===null||!g.tagName||!g.childNodes){throw {name:"StropheError",message:"Cannot queue non-DOMElement."}}this._data.push(g)},_sendRestart:function(){this._data.push("restart");this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},addTimedHandler:function(i,h){var g=new e.TimedHandler(i,h);this.addTimeds.push(g);return g},deleteTimedHandler:function(g){this.removeTimeds.push(g)},addHandler:function(l,k,i,j,n,m,h){var g=new e.Handler(l,k,i,j,n,m,h);this.addHandlers.push(g);return g},deleteHandler:function(g){this.removeHandlers.push(g)},disconnect:function(g){this._changeConnectStatus(e.Status.DISCONNECTING,g);e.info("Disconnect was called because: "+g);if(this.connected){this._disconnectTimeout=this._addSysTimedHandler(3000,this._onDisconnectTimeout.bind(this));this._sendTerminate()}},_changeConnectStatus:function(g,m){for(var h in e._connectionPlugins){if(e._connectionPlugins.hasOwnProperty(h)){var j=this[h];if(j.statusChanged){try{j.statusChanged(g,m)}catch(i){e.error(""+h+" plugin caused an exception changing status: "+i)}}}}if(this.connect_callback){try{this.connect_callback(g,m)}catch(l){e.error("User connection callback caused an exception: "+l)}}},_buildBody:function(){var g=c("body",{rid:this.rid++,xmlns:e.NS.HTTPBIND});if(this.sid!==null){g.attrs({sid:this.sid})}return g},_removeRequest:function(h){e.debug("removing request");var g;for(g=this._requests.length-1;g>=0;g--){if(h==this._requests[g]){this._requests.splice(g,1)}}h.xhr.onreadystatechange=function(){};this._throttledRequestHandler()},_restartRequest:function(g){var h=this._requests[g];if(h.dead===null){h.dead=new Date()}this._processRequest(g)},_processRequest:function(k){var p=this._requests[k];var s=-1;try{if(p.xhr.readyState==4){s=p.xhr.status}}catch(n){e.error("caught an error in _requests["+k+"], reqStatus: "+s)}if(typeof(s)=="undefined"){s=-1}if(p.sends>5){this._onDisconnectTimeout();return}var j=p.age();var h=(!isNaN(j)&&j>Math.floor(e.TIMEOUT*this.wait));var l=(p.dead!==null&&p.timeDead()>Math.floor(e.SECONDARY_TIMEOUT*this.wait));var r=(p.xhr.readyState==4&&(s<1||s>=500));if(h||l||r){if(l){e.error("Request "+this._requests[k].id+" timed out (secondary), restarting")}p.abort=true;p.xhr.abort();p.xhr.onreadystatechange=function(){};this._requests[k]=new e.Request(p.xmlData,p.origFunc,p.rid,p.sends);p=this._requests[k]}if(p.xhr.readyState===0){e.debug("request id "+p.id+"."+p.sends+" posting");try{var g=!("sync" in this&&this.sync===true);p.xhr.open("POST",this.service,g)}catch(o){e.error("XHR open failed.");if(!this.connected){this._changeConnectStatus(e.Status.CONNFAIL,"bad-service")}this.disconnect();return}var q=function(){p.date=new Date();p.xhr.send(p.data)};if(p.sends>1){var m=Math.min(Math.floor(e.TIMEOUT*this.wait),Math.pow(p.sends,3))*1000;setTimeout(q,m)}else{q()}p.sends++;if(this.xmlOutput!==e.Connection.prototype.xmlOutput){this.xmlOutput(p.xmlData)}if(this.rawOutput!==e.Connection.prototype.rawOutput){this.rawOutput(p.data)}}else{e.debug("_processRequest: "+(k===0?"first":"second")+" request has readyState of "+p.xhr.readyState)}},_throttledRequestHandler:function(){if(!this._requests){e.debug("_throttledRequestHandler called with undefined requests")}else{e.debug("_throttledRequestHandler called with "+this._requests.length+" requests")}if(!this._requests||this._requests.length===0){return}if(this._requests.length>0){this._processRequest(0)}if(this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window){this._processRequest(1)}},_onRequestStateChange:function(j,i){e.debug("request id "+i.id+"."+i.sends+" state changed to "+i.xhr.readyState);if(i.abort){i.abort=false;return}var h;if(i.xhr.readyState==4){h=0;try{h=i.xhr.status}catch(k){}if(typeof(h)=="undefined"){h=0}if(this.disconnecting){if(h>=400){this._hitError(h);return}}var g=(this._requests[0]==i);var l=(this._requests[1]==i);if((h>0&&h<500)||i.sends>5){this._removeRequest(i);e.debug("request id "+i.id+" should now be removed")}if(h==200){if(l||(g&&this._requests.length>0&&this._requests[0].age()>Math.floor(e.SECONDARY_TIMEOUT*this.wait))){this._restartRequest(0)}e.debug("request id "+i.id+"."+i.sends+" got 200");j(i);this.errors=0}else{e.error("request id "+i.id+"."+i.sends+" error "+h+" happened");if(h===0||(h>=400&&h<600)||h>=12000){this._hitError(h);if(h>=400&&h<500){this._changeConnectStatus(e.Status.DISCONNECTING,null);this._doDisconnect()}}}if(!((h>0&&h<500)||i.sends>5)){this._throttledRequestHandler()}}},_hitError:function(g){this.errors++;e.warn("request errored, status: "+g+", number of errors: "+this.errors);if(this.errors>4){this._onDisconnectTimeout()}},_doDisconnect:function(){e.info("_doDisconnect was called");this.authenticated=false;this.disconnecting=false;this.sid=null;this.streamId=null;this.rid=Math.floor(Math.random()*4294967295);if(this.connected){this._changeConnectStatus(e.Status.DISCONNECTED,null);this.connected=false}this.handlers=[];this.timedHandlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[]},_dataRecv:function(p){try{var g=p.getResponse()}catch(n){if(n!="parsererror"){throw n}this.disconnect("strophe-parsererror")}if(g===null){return}if(this.xmlInput!==e.Connection.prototype.xmlInput){this.xmlInput(g)}if(this.rawInput!==e.Connection.prototype.rawInput){this.rawInput(e.serialize(g))}var l,j;while(this.removeHandlers.length>0){j=this.removeHandlers.pop();l=this.handlers.indexOf(j);if(l>=0){this.handlers.splice(l,1)}}while(this.addHandlers.length>0){this.handlers.push(this.addHandlers.pop())}if(this.disconnecting&&this._requests.length===0){this.deleteTimedHandler(this._disconnectTimeout);this._disconnectTimeout=null;this._doDisconnect();return}var h=g.getAttribute("type");var o,k;if(h!==null&&h=="terminate"){if(this.disconnecting){return}o=g.getAttribute("condition");k=g.getElementsByTagName("conflict");if(o!==null){if(o=="remote-stream-error"&&k.length>0){o="conflict"}this._changeConnectStatus(e.Status.CONNFAIL,o)}else{this._changeConnectStatus(e.Status.CONNFAIL,"unknown")}this.disconnect();return}var m=this;e.forEachChild(g,null,function(u){var r,s;s=m.handlers;m.handlers=[];for(r=0;r<s.length;r++){var q=s[r];try{if(q.isMatch(u)&&(m.authenticated||!q.user)){if(q.run(u)){m.handlers.push(q)}}else{m.handlers.push(q)}}catch(t){}}})},_sendTerminate:function(){e.info("_sendTerminate was called");var g=this._buildBody().attrs({type:"terminate"});if(this.authenticated){g.c("presence",{xmlns:e.NS.CLIENT,type:"unavailable"})}this.disconnecting=true;var h=new e.Request(g.tree(),this._onRequestStateChange.bind(this,this._dataRecv.bind(this)),g.tree().getAttribute("rid"));this._requests.push(h);this._throttledRequestHandler()},_connect_cb:function(v){e.info("_connect_cb was called");this.connected=true;var h=v.getResponse();if(!h){return}if(this.xmlInput!==e.Connection.prototype.xmlInput){this.xmlInput(h)}if(this.rawInput!==e.Connection.prototype.rawInput){this.rawInput(e.serialize(h))}var m=h.getAttribute("type");var u,o;if(m!==null&&m=="terminate"){u=h.getAttribute("condition");o=h.getElementsByTagName("conflict");if(u!==null){if(u=="remote-stream-error"&&o.length>0){u="conflict"}this._changeConnectStatus(e.Status.CONNFAIL,u)}else{this._changeConnectStatus(e.Status.CONNFAIL,"unknown")}return}if(!this.sid){this.sid=h.getAttribute("sid")}if(!this.stream_id){this.stream_id=h.getAttribute("authid")}var j=h.getAttribute("requests");if(j){this.window=parseInt(j,10)}var g=h.getAttribute("hold");if(g){this.hold=parseInt(g,10)}var q=h.getAttribute("wait");if(q){this.wait=parseInt(q,10)}var w=false;var l=false;var t=false;var x=h.getElementsByTagName("mechanism");var n,s,p,k;if(x.length>0){for(n=0;n<x.length;n++){s=e.getText(x[n]);if(s=="DIGEST-MD5"){l=true}else{if(s=="PLAIN"){w=true}else{if(s=="ANONYMOUS"){t=true}}}}}else{var r=this._buildBody();this._requests.push(new e.Request(r.tree(),this._onRequestStateChange.bind(this,this._connect_cb.bind(this)),r.tree().getAttribute("rid")));this._throttledRequestHandler();return}if(e.getNodeFromJid(this.jid)===null&&t){this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("auth",{xmlns:e.NS.SASL,mechanism:"ANONYMOUS"}).tree())}else{if(e.getNodeFromJid(this.jid)===null){this._changeConnectStatus(e.Status.CONNFAIL,"x-strophe-bad-non-anon-jid");this.disconnect()}else{if(l){this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge1_cb.bind(this),null,"challenge",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("auth",{xmlns:e.NS.SASL,mechanism:"DIGEST-MD5"}).tree())}else{if(w){p=unescape(encodeURIComponent(e.getBareJidFromJid(this.jid)));p=p+"\u0000";p=p+unescape(encodeURIComponent(e.getNodeFromJid(this.jid)));p=p+"\u0000";p=p+this.pass;this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);k=Base64.encode(p);this.send(c("auth",{xmlns:e.NS.SASL,mechanism:"PLAIN"}).t(k).tree())}else{this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1");this.send(d({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:e.NS.AUTH}).c("username",{}).t(e.getNodeFromJid(this.jid)).tree())}}}}},_sasl_challenge1_cb:function(k){var h=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/;var q=Base64.decode(e.getText(k));var r=MD5.hexdigest(""+(Math.random()*1234567890));var n="";var s=null;var o="";var g="";var m;this.deleteHandler(this._sasl_failure_handler);while(q.match(h)){m=q.match(h);q=q.replace(m[0],"");m[2]=m[2].replace(/^"(.+)"$/,"$1");switch(m[1]){case"realm":n=m[2];break;case"nonce":o=m[2];break;case"qop":g=m[2];break;case"host":s=m[2];break}}var l="xmpp/"+this.domain;if(s!==null){l=l+"/"+s}var j=MD5.hash(unescape(encodeURIComponent(e.getNodeFromJid(this.jid)))+":"+n+":"+this.pass)+":"+o+":"+r;var i="AUTHENTICATE:"+l;var p="";p+="username="+this._quote(unescape(encodeURIComponent(e.getNodeFromJid(this.jid))))+",";p+="realm="+this._quote(n)+",";p+="nonce="+this._quote(o)+",";p+="cnonce="+this._quote(r)+",";p+='nc="00000001",';p+='qop="auth",';p+="digest-uri="+this._quote(l)+",";p+="response="+this._quote(MD5.hexdigest(MD5.hexdigest(j)+":"+o+":00000001:"+r+":auth:"+MD5.hexdigest(i)))+",";p+='charset="utf-8"';this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge2_cb.bind(this),null,"challenge",null,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("response",{xmlns:e.NS.SASL}).t(Base64.encode(p)).tree());return false},_quote:function(g){return'"'+g.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},_sasl_challenge2_cb:function(g){this.deleteHandler(this._sasl_success_handler);this.deleteHandler(this._sasl_failure_handler);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("response",{xmlns:e.NS.SASL}).tree());return false},_auth1_cb:function(g){var h=d({type:"set",id:"_auth_2"}).c("query",{xmlns:e.NS.AUTH}).c("username",{}).t(e.getNodeFromJid(this.jid)).up().c("password").t(this.pass);if(!e.getResourceFromJid(this.jid)){this.jid=e.getBareJidFromJid(this.jid)+"/strophe"}h.up().c("resource",{}).t(e.getResourceFromJid(this.jid));this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2");this.send(h.tree());return false},_sasl_success_cb:function(g){e.info("SASL authentication succeeded.");this.deleteHandler(this._sasl_failure_handler);this._sasl_failure_handler=null;if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null}this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null);this._sendRestart();return false},_sasl_auth1_cb:function(h){this.features=h;var g,k;for(g=0;g<h.childNodes.length;g++){k=h.childNodes[g];if(k.nodeName=="bind"){this.do_bind=true}if(k.nodeName=="session"){this.do_session=true}}if(!this.do_bind){this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}else{this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var j=e.getResourceFromJid(this.jid);if(j){this.send(d({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:e.NS.BIND}).c("resource",{}).t(j).tree())}else{this.send(d({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:e.NS.BIND}).tree())}}return false},_sasl_bind_cb:function(g){if(g.getAttribute("type")=="error"){e.info("SASL binding failed.");this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}var i=g.getElementsByTagName("bind");var h;if(i.length>0){h=i[0].getElementsByTagName("jid");if(h.length>0){this.jid=e.getText(h[0]);if(this.do_session){this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2");this.send(d({type:"set",id:"_session_auth_2"}).c("session",{xmlns:e.NS.SESSION}).tree())}else{this.authenticated=true;this._changeConnectStatus(e.Status.CONNECTED,null)}}}else{e.info("SASL binding failed.");this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}},_sasl_session_cb:function(g){if(g.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(e.Status.CONNECTED,null)}else{if(g.getAttribute("type")=="error"){e.info("Session creation failed.");this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}}return false},_sasl_failure_cb:function(g){if(this._sasl_success_handler){this.deleteHandler(this._sasl_success_handler);this._sasl_success_handler=null}if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null}this._changeConnectStatus(e.Status.AUTHFAIL,null);return false},_auth2_cb:function(g){if(g.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(e.Status.CONNECTED,null)}else{if(g.getAttribute("type")=="error"){this._changeConnectStatus(e.Status.AUTHFAIL,null);this.disconnect()}}return false},_addSysTimedHandler:function(i,h){var g=new e.TimedHandler(i,h);g.user=false;this.addTimeds.push(g);return g},_addSysHandler:function(k,j,h,i,l){var g=new e.Handler(k,j,h,i,l);g.user=false;this.addHandlers.push(g);return g},_onDisconnectTimeout:function(){e.info("_onDisconnectTimeout was called");var g;while(this._requests.length>0){g=this._requests.pop();g.abort=true;g.xhr.abort();g.xhr.onreadystatechange=function(){}}this._doDisconnect();return false},_onIdle:function(){var j,l,n,k;while(this.addTimeds.length>0){this.timedHandlers.push(this.addTimeds.pop())}while(this.removeTimeds.length>0){l=this.removeTimeds.pop();j=this.timedHandlers.indexOf(l);if(j>=0){this.timedHandlers.splice(j,1)}}var h=new Date().getTime();k=[];for(j=0;j<this.timedHandlers.length;j++){l=this.timedHandlers[j];if(this.authenticated||!l.user){n=l.lastCalled+l.period;if(n-h<=0){if(l.run()){k.push(l)}}else{k.push(l)}}}this.timedHandlers=k;var g,m;if(this.authenticated&&this._requests.length===0&&this._data.length===0&&!this.disconnecting){e.info("no requests during idle cycle, sending blank request");this._data.push(null)}if(this._requests.length<2&&this._data.length>0&&!this.paused){g=this._buildBody();for(j=0;j<this._data.length;j++){if(this._data[j]!==null){if(this._data[j]==="restart"){g.attrs({to:this.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":e.NS.BOSH})}else{g.cnode(this._data[j]).up()}}}delete this._data;this._data=[];this._requests.push(new e.Request(g.tree(),this._onRequestStateChange.bind(this,this._dataRecv.bind(this)),g.tree().getAttribute("rid")));this._processRequest(this._requests.length-1)}if(this._requests.length>0){m=this._requests[0].age();if(this._requests[0].dead!==null){if(this._requests[0].timeDead()>Math.floor(e.SECONDARY_TIMEOUT*this.wait)){this._throttledRequestHandler()}}if(m>Math.floor(e.TIMEOUT*this.wait)){e.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(e.TIMEOUT*this.wait)+" seconds since last activity");this._throttledRequestHandler()}}clearTimeout(this._idleTimeout);if(this.connected){this._idleTimeout=setTimeout(this._onIdle.bind(this),100)}}};if(f){f(e,c,a,d,b)}})(function(){window.Strophe=arguments[0];window.$build=arguments[1];window.$msg=arguments[2];window.$iq=arguments[3];window.$pres=arguments[4]});Strophe.addConnectionPlugin("muc",{_connection:null,init:function(a){this._connection=a;Strophe.addNamespace("MUC_OWNER",Strophe.NS.MUC+"#owner");Strophe.addNamespace("MUC_ADMIN",Strophe.NS.MUC+"#admin")},join:function(g,a,c,d,b){var f=this.test_append_nick(g,a);var h=$pres({from:this._connection.jid,to:f}).c("x",{xmlns:Strophe.NS.MUC});if(b){var e=Strophe.xmlElement("password",[],b);h.cnode(e)}if(c){this._connection.addHandler(function(j){var k=j.getAttribute("from");var i=k.split("/");if(i[0]==g){return c(j)}else{return true}},null,"message",null,null,null)}if(d){this._connection.addHandler(function(k){var m=k.getElementsByTagName("x");if(m.length>0){for(var j=0;j<m.length;j++){var l=m[j].getAttribute("xmlns");if(l&&l.match(Strophe.NS.MUC)){return d(k)}}}return true},null,"presence",null,null,null)}this._connection.send(h)},leave:function(f,a,c){var e=this.test_append_nick(f,a);var d=this._connection.getUniqueId();var b=$pres({type:"unavailable",id:d,from:this._connection.jid,to:e}).c("x",{xmlns:Strophe.NS.MUC});this._connection.addHandler(c,null,"presence",null,d,null);this._connection.send(b);return d},message:function(f,a,d,b){var e=this.test_append_nick(f,a);b=b||"groupchat";var c=this._connection.getUniqueId();var g=$msg({to:e,from:this._connection.jid,type:b,id:c}).c("body",{xmlns:Strophe.NS.CLIENT}).t(d);g.up().c("x",{xmlns:"jabber:x:event"}).c("composing");this._connection.send(g);return c},configure:function(b){var a=$iq({to:b,type:"get"}).c("query",{xmlns:Strophe.NS.MUC_OWNER});var c=a.tree();return this._connection.sendIQ(c,function(){},function(){})},cancelConfigure:function(b){var a=$iq({to:b,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"cancel"});var c=a.tree();return this._connection.sendIQ(c,function(){},function(){})},saveConfiguration:function(d,c){var a=$iq({to:d,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"submit"});for(var b=0;b<c.length;b++){a.cnode(c[b]);a.up()}var e=a.tree();return this._connection.sendIQ(e,function(){},function(){})},createInstantRoom:function(b){var a=$iq({to:b,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"submit"});return this._connection.sendIQ(a.tree(),function(){},function(){})},setTopic:function(b,a){var c=$msg({to:b,from:this._connection.jid,type:"groupchat"}).c("subject",{xmlns:"jabber:client"}).t(a);this._connection.send(c.tree())},modifyUser:function(g,b,h,d,f){var a={nick:Strophe.escapeNode(b)};if(h!==null){a.role=h}if(d!==null){a.affiliation=d}var e=$build("item",a);if(f!==null){e.cnode(Strophe.xmlElement("reason",f))}var c=$iq({to:g,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).cnode(e.tree());return this._connection.sendIQ(c.tree(),function(){},function(){})},changeNick:function(d,a){var c=this.test_append_nick(d,a);var b=$pres({from:this._connection.jid,to:c}).c("x",{xmlns:Strophe.NS.MUC});this._connection.send(b.tree())},listRooms:function(c,a){var b=$iq({to:c,from:this._connection.jid,type:"get"}).c("query",{xmlns:Strophe.NS.DISCO_ITEMS});this._connection.sendIQ(b,a,function(){})},test_append_nick:function(c,a){var b=c;if(a){b+="/"+Strophe.escapeNode(a)}return b}});var Mustache=function(){var a=function(){};a.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(e,d,c,f){if(!f){this.context=d;this.buffer=[]}if(!this.includes("",e)){if(f){return e}else{this.send(e);return}}e=this.render_pragmas(e);var b=this.render_section(e,d,c);if(f){return this.render_tags(b,d,c,f)}this.render_tags(b,d,c,f)},send:function(b){if(b!==""){this.buffer.push(b)}},render_pragmas:function(b){if(!this.includes("%",b)){return b}var d=this;var c=new RegExp(this.otag+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+this.ctag,"g");return b.replace(c,function(g,e,f){if(!d.pragmas_implemented[e]){throw ({message:"This implementation of mustache doesn't understand the '"+e+"' pragma"})}d.pragmas[e]={};if(f){var h=f.split("=");d.pragmas[e][h[0]]=h[1]}return""})},render_partial:function(b,d,c){b=this.trim(b);if(!c||c[b]===undefined){throw ({message:"unknown_partial '"+b+"'"})}if(typeof(d[b])!="object"){return this.render(c[b],d,c,true)}return this.render(c[b],d[b],c,true)},render_section:function(d,c,b){if(!this.includes("#",d)&&!this.includes("^",d)){return d}var f=this;var e=new RegExp(this.otag+"(\\^|\\#)\\s*(.+)\\s*"+this.ctag+"\n*([\\s\\S]+?)"+this.otag+"\\/\\s*\\2\\s*"+this.ctag+"\\s*","mg");return d.replace(e,function(h,i,g,j){var k=f.find(g,c);if(i=="^"){if(!k||f.is_array(k)&&k.length===0){return f.render(j,c,b,true)}else{return""}}else{if(i=="#"){if(f.is_array(k)){return f.map(k,function(l){return f.render(j,f.create_context(l),b,true)}).join("")}else{if(f.is_object(k)){return f.render(j,f.create_context(k),b,true)}else{if(typeof k==="function"){return k.call(c,j,function(l){return f.render(l,c,b,true)})}else{if(k){return f.render(j,c,b,true)}else{return""}}}}}}})},render_tags:function(k,b,d,f){var e=this;var j=function(){return new RegExp(e.otag+"(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?"+e.ctag+"+","g")};var g=j();var h=function(n,i,m){switch(i){case"!":return"";case"=":e.set_delimiters(m);g=j();return"";case">":return e.render_partial(m,b,d);case"{":return e.find(m,b);default:return e.escape(e.find(m,b))}};var l=k.split("\n");for(var c=0;c<l.length;c++){l[c]=l[c].replace(g,h,this);if(!f){this.send(l[c])}}if(f){return l.join("\n")}},set_delimiters:function(c){var b=c.split(" ");this.otag=this.escape_regex(b[0]);this.ctag=this.escape_regex(b[1])},escape_regex:function(c){if(!arguments.callee.sRE){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+b.join("|\\")+")","g")}return c.replace(arguments.callee.sRE,"\\$1")},find:function(c,d){c=this.trim(c);function b(f){return f===false||f===0||f}var e;if(b(d[c])){e=d[c]}else{if(b(this.context[c])){e=this.context[c]}}if(typeof e==="function"){return e.apply(d)}if(e!==undefined){return e}return""},includes:function(c,b){return b.indexOf(this.otag+c)!=-1},escape:function(b){b=String(b===null?"":b);return b.replace(/&(?!\w+;)|["'<>\\]/g,function(c){switch(c){case"&":return"&amp;";case"\\":return"\\\\";case'"':return"&quot;";case"'":return"&#39;";case"<":return"&lt;";case">":return"&gt;";default:return c}})},create_context:function(c){if(this.is_object(c)){return c}else{var d=".";if(this.pragmas["IMPLICIT-ITERATOR"]){d=this.pragmas["IMPLICIT-ITERATOR"].iterator}var b={};b[d]=c;return b}},is_object:function(b){return b&&typeof b=="object"},is_array:function(b){return Object.prototype.toString.call(b)==="[object Array]"},trim:function(b){return b.replace(/^\s*|\s*$/g,"")},map:function(f,d){if(typeof f.map=="function"){return f.map(d)}else{var e=[];var b=f.length;for(var c=0;c<b;c++){e.push(d(f[c]))}return e}}};return({name:"mustache.js",version:"0.3.1-dev",to_html:function(d,b,c,f){var e=new a();if(f){e.send=f}e.render(d,b,c);if(!f){return e.buffer.join("\n")}}})}();(function(a){a.i18n={dict:null,setDictionary:function(b){this.dict=b},_:function(d,c){var b=d;if(this.dict&&this.dict[d]){b=this.dict[d]}return this.printf(b,c)},toEntity:function(d){var b="";for(var c=0;c<d.length;c++){if(d.charCodeAt(c)>128){b+="&#"+d.charCodeAt(c)+";"}else{b+=d.charAt(c)}}return b},stripStr:function(b){return b.replace(/^\s*/,"").replace(/\s*$/,"")},stripStrML:function(d){var c=d.split("\n");for(var b=0;b<c.length;b++){c[b]=stripStr(c[b])}return stripStr(c.join(" "))},printf:function(e,b){if(!b){return e}var d="";var f=e.split("%s");for(var c=0;c<b.length;c++){if(f[c].lastIndexOf("%")==f[c].length-1&&c!=b.length-1){f[c]+="s"+f.splice(c+1,1)[0]}d+=f[c]+b[c]}return d+f[f.length-1]}}})(jQuery);var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date;if(isNaN(i)){throw SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),yyyy:p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};
+var Base64=(function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var b={encode:function(e){var c="";var m,k,h;var l,j,g,f;var d=0;do{m=e.charCodeAt(d++);k=e.charCodeAt(d++);h=e.charCodeAt(d++);l=m>>2;j=((m&3)<<4)|(k>>4);g=((k&15)<<2)|(h>>6);f=h&63;if(isNaN(k)){g=f=64}else{if(isNaN(h)){f=64}}c=c+a.charAt(l)+a.charAt(j)+a.charAt(g)+a.charAt(f)}while(d<e.length);return c},decode:function(e){var c="";var m,k,h;var l,j,g,f;var d=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{l=a.indexOf(e.charAt(d++));j=a.indexOf(e.charAt(d++));g=a.indexOf(e.charAt(d++));f=a.indexOf(e.charAt(d++));m=(l<<2)|(j>>4);k=((j&15)<<4)|(g>>2);h=((g&3)<<6)|f;c=c+String.fromCharCode(m);if(g!=64){c=c+String.fromCharCode(k)}if(f!=64){c=c+String.fromCharCode(h)}}while(d<e.length);return c}};return b})();var MD5=(function(){var o=0;var a="";var l=8;var j=function(r,u){var t=(r&65535)+(u&65535);var s=(r>>16)+(u>>16)+(t>>16);return(s<<16)|(t&65535)};var n=function(r,s){return(r<<s)|(r>>>(32-s))};var b=function(u){var t=[];var r=(1<<l)-1;for(var s=0;s<u.length*l;s+=l){t[s>>5]|=(u.charCodeAt(s/l)&r)<<(s%32)}return t};var g=function(t){var u="";var r=(1<<l)-1;for(var s=0;s<t.length*32;s+=l){u+=String.fromCharCode((t[s>>5]>>>(s%32))&r)}return u};var q=function(t){var s=o?"0123456789ABCDEF":"0123456789abcdef";var u="";for(var r=0;r<t.length*4;r++){u+=s.charAt((t[r>>2]>>((r%4)*8+4))&15)+s.charAt((t[r>>2]>>((r%4)*8))&15)}return u};var p=function(u){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var w="";var v,r;for(var s=0;s<u.length*4;s+=3){v=(((u[s>>2]>>8*(s%4))&255)<<16)|(((u[s+1>>2]>>8*((s+1)%4))&255)<<8)|((u[s+2>>2]>>8*((s+2)%4))&255);for(r=0;r<4;r++){if(s*8+r*6>u.length*32){w+=a}else{w+=t.charAt((v>>6*(3-r))&63)}}}return w};var d=function(z,v,u,r,y,w){return j(n(j(j(v,z),j(r,w)),y),u)};var k=function(v,u,A,z,r,y,w){return d((u&A)|((~u)&z),v,u,r,y,w)};var c=function(v,u,A,z,r,y,w){return d((u&z)|(A&(~z)),v,u,r,y,w)};var m=function(v,u,A,z,r,y,w){return d(u^A^z,v,u,r,y,w)};var i=function(v,u,A,z,r,y,w){return d(A^(u|(~z)),v,u,r,y,w)};var f=function(C,w){C[w>>5]|=128<<((w)%32);C[(((w+64)>>>9)<<4)+14]=w;var B=1732584193;var A=-271733879;var z=-1732584194;var y=271733878;var v,u,t,r;for(var s=0;s<C.length;s+=16){v=B;u=A;t=z;r=y;B=k(B,A,z,y,C[s+0],7,-680876936);y=k(y,B,A,z,C[s+1],12,-389564586);z=k(z,y,B,A,C[s+2],17,606105819);A=k(A,z,y,B,C[s+3],22,-1044525330);B=k(B,A,z,y,C[s+4],7,-176418897);y=k(y,B,A,z,C[s+5],12,1200080426);z=k(z,y,B,A,C[s+6],17,-1473231341);A=k(A,z,y,B,C[s+7],22,-45705983);B=k(B,A,z,y,C[s+8],7,1770035416);y=k(y,B,A,z,C[s+9],12,-1958414417);z=k(z,y,B,A,C[s+10],17,-42063);A=k(A,z,y,B,C[s+11],22,-1990404162);B=k(B,A,z,y,C[s+12],7,1804603682);y=k(y,B,A,z,C[s+13],12,-40341101);z=k(z,y,B,A,C[s+14],17,-1502002290);A=k(A,z,y,B,C[s+15],22,1236535329);B=c(B,A,z,y,C[s+1],5,-165796510);y=c(y,B,A,z,C[s+6],9,-1069501632);z=c(z,y,B,A,C[s+11],14,643717713);A=c(A,z,y,B,C[s+0],20,-373897302);B=c(B,A,z,y,C[s+5],5,-701558691);y=c(y,B,A,z,C[s+10],9,38016083);z=c(z,y,B,A,C[s+15],14,-660478335);A=c(A,z,y,B,C[s+4],20,-405537848);B=c(B,A,z,y,C[s+9],5,568446438);y=c(y,B,A,z,C[s+14],9,-1019803690);z=c(z,y,B,A,C[s+3],14,-187363961);A=c(A,z,y,B,C[s+8],20,1163531501);B=c(B,A,z,y,C[s+13],5,-1444681467);y=c(y,B,A,z,C[s+2],9,-51403784);z=c(z,y,B,A,C[s+7],14,1735328473);A=c(A,z,y,B,C[s+12],20,-1926607734);B=m(B,A,z,y,C[s+5],4,-378558);y=m(y,B,A,z,C[s+8],11,-2022574463);z=m(z,y,B,A,C[s+11],16,1839030562);A=m(A,z,y,B,C[s+14],23,-35309556);B=m(B,A,z,y,C[s+1],4,-1530992060);y=m(y,B,A,z,C[s+4],11,1272893353);z=m(z,y,B,A,C[s+7],16,-155497632);A=m(A,z,y,B,C[s+10],23,-1094730640);B=m(B,A,z,y,C[s+13],4,681279174);y=m(y,B,A,z,C[s+0],11,-358537222);z=m(z,y,B,A,C[s+3],16,-722521979);A=m(A,z,y,B,C[s+6],23,76029189);B=m(B,A,z,y,C[s+9],4,-640364487);y=m(y,B,A,z,C[s+12],11,-421815835);z=m(z,y,B,A,C[s+15],16,530742520);A=m(A,z,y,B,C[s+2],23,-995338651);B=i(B,A,z,y,C[s+0],6,-198630844);y=i(y,B,A,z,C[s+7],10,1126891415);z=i(z,y,B,A,C[s+14],15,-1416354905);A=i(A,z,y,B,C[s+5],21,-57434055);B=i(B,A,z,y,C[s+12],6,1700485571);y=i(y,B,A,z,C[s+3],10,-1894986606);z=i(z,y,B,A,C[s+10],15,-1051523);A=i(A,z,y,B,C[s+1],21,-2054922799);B=i(B,A,z,y,C[s+8],6,1873313359);y=i(y,B,A,z,C[s+15],10,-30611744);z=i(z,y,B,A,C[s+6],15,-1560198380);A=i(A,z,y,B,C[s+13],21,1309151649);B=i(B,A,z,y,C[s+4],6,-145523070);y=i(y,B,A,z,C[s+11],10,-1120210379);z=i(z,y,B,A,C[s+2],15,718787259);A=i(A,z,y,B,C[s+9],21,-343485551);B=j(B,v);A=j(A,u);z=j(z,t);y=j(y,r)}return[B,A,z,y]};var e=function(t,w){var v=b(t);if(v.length>16){v=f(v,t.length*l)}var r=new Array(16),u=new Array(16);for(var s=0;s<16;s++){r[s]=v[s]^909522486;u[s]=v[s]^1549556828}var x=f(r.concat(b(w)),512+w.length*l);return f(u.concat(x),512+128)};var h={hexdigest:function(r){return q(f(b(r),r.length*l))},b64digest:function(r){return p(f(b(r),r.length*l))},hash:function(r){return g(f(b(r),r.length*l))},hmac_hexdigest:function(r,s){return q(e(r,s))},hmac_b64digest:function(r,s){return p(e(r,s))},hmac_hash:function(r,s){return g(e(r,s))},test:function(){return MD5.hexdigest("abc")==="900150983cd24fb0d6963f7d28e17f72"}};return h})();if(!Function.prototype.bind){Function.prototype.bind=function(e){var d=this;var c=Array.prototype.slice;var b=Array.prototype.concat;var a=c.call(arguments,1);return function(){return d.apply(e?e:this,b.call(a,c.call(arguments,0)))}}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b){var a=this.length;var c=Number(arguments[1])||0;c=(c<0)?Math.ceil(c):Math.floor(c);if(c<0){c+=a}for(;c<a;c++){if(c in this&&this[c]===b){return c}}return -1}}(function(f){var e;function c(h,g){return new e.Builder(h,g)}function a(g){return new e.Builder("message",g)}function d(g){return new e.Builder("iq",g)}function b(g){return new e.Builder("presence",g)}e={VERSION:"8d27954",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas"},addNamespace:function(g,h){e.NS[g]=h},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3,CDATA:4},TIMEOUT:1.1,SECONDARY_TIMEOUT:0.1,forEachChild:function(k,l,j){var h,g;for(h=0;h<k.childNodes.length;h++){g=k.childNodes[h];if(g.nodeType==e.ElementType.NORMAL&&(!l||this.isTagEqual(g,l))){j(g)}}},isTagEqual:function(h,g){return h.tagName.toLowerCase()==g.toLowerCase()},_xmlGenerator:null,_makeGenerator:function(){var g;if(document.implementation.createDocument===undefined){g=this._getIEXmlDom();g.appendChild(g.createElement("strophe"))}else{g=document.implementation.createDocument("jabber:client","strophe",null)}return g},xmlGenerator:function(){if(!e._xmlGenerator){e._xmlGenerator=e._makeGenerator()}return e._xmlGenerator},_getIEXmlDom:function(){var h=null;var j=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(var i=0;i<j.length;i++){if(h===null){try{h=new ActiveXObject(j[i])}catch(g){h=null}}else{break}}return h},xmlElement:function(j){if(!j){return null}var m=e.xmlGenerator().createElement(j);var g,l,h;for(g=1;g<arguments.length;g++){if(!arguments[g]){continue}if(typeof(arguments[g])=="string"||typeof(arguments[g])=="number"){m.appendChild(e.xmlTextNode(arguments[g]))}else{if(typeof(arguments[g])=="object"&&typeof(arguments[g].sort)=="function"){for(l=0;l<arguments[g].length;l++){if(typeof(arguments[g][l])=="object"&&typeof(arguments[g][l].sort)=="function"){m.setAttribute(arguments[g][l][0],arguments[g][l][1])}}}else{if(typeof(arguments[g])=="object"){for(h in arguments[g]){if(arguments[g].hasOwnProperty(h)){m.setAttribute(h,arguments[g][h])}}}}}}return m},xmlescape:function(g){g=g.replace(/\&/g,"&amp;");g=g.replace(/</g,"&lt;");g=g.replace(/>/g,"&gt;");g=g.replace(/'/g,"&apos;");g=g.replace(/"/g,"&quot;");return g},xmlTextNode:function(g){g=e.xmlescape(g);return e.xmlGenerator().createTextNode(g)},getText:function(h){if(!h){return null}var j="";if(h.childNodes.length===0&&h.nodeType==e.ElementType.TEXT){j+=h.nodeValue}for(var g=0;g<h.childNodes.length;g++){if(h.childNodes[g].nodeType==e.ElementType.TEXT){j+=h.childNodes[g].nodeValue}}return j},copyElement:function(j){var g,h;if(j.nodeType==e.ElementType.NORMAL){h=e.xmlElement(j.tagName);for(g=0;g<j.attributes.length;g++){h.setAttribute(j.attributes[g].nodeName.toLowerCase(),j.attributes[g].value)}for(g=0;g<j.childNodes.length;g++){h.appendChild(e.copyElement(j.childNodes[g]))}}else{if(j.nodeType==e.ElementType.TEXT){h=e.xmlGenerator().createTextNode(j.nodeValue)}}return h},escapeNode:function(g){return g.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(g){return g.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(g){if(g.indexOf("@")<0){return null}return g.split("@")[0]},getDomainFromJid:function(g){var h=e.getBareJidFromJid(g);if(h.indexOf("@")<0){return h}else{var i=h.split("@");i.splice(0,1);return i.join("@")}},getResourceFromJid:function(g){var h=g.split("/");if(h.length<2){return null}h.splice(0,1);return h.join("/")},getBareJidFromJid:function(g){return g?g.split("/")[0]:null},log:function(h,g){return},debug:function(g){this.log(this.LogLevel.DEBUG,g)},info:function(g){this.log(this.LogLevel.INFO,g)},warn:function(g){this.log(this.LogLevel.WARN,g)},error:function(g){this.log(this.LogLevel.ERROR,g)},fatal:function(g){this.log(this.LogLevel.FATAL,g)},serialize:function(j){var g;if(!j){return null}if(typeof(j.tree)==="function"){j=j.tree()}var l=j.nodeName;var h,k;if(j.getAttribute("_realname")){l=j.getAttribute("_realname")}g="<"+l;for(h=0;h<j.attributes.length;h++){if(j.attributes[h].nodeName!="_realname"){g+=" "+j.attributes[h].nodeName.toLowerCase()+"='"+j.attributes[h].value.replace(/&/g,"&amp;").replace(/\'/g,"&apos;").replace(/</g,"&lt;")+"'"}}if(j.childNodes.length>0){g+=">";for(h=0;h<j.childNodes.length;h++){k=j.childNodes[h];switch(k.nodeType){case e.ElementType.NORMAL:g+=e.serialize(k);break;case e.ElementType.TEXT:g+=k.nodeValue;break;case e.ElementType.CDATA:g+="<![CDATA["+k.nodeValue+"]]>"}}g+="</"+l+">"}else{g+="/>"}return g},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(g,h){e._connectionPlugins[g]=h}};e.Builder=function(h,g){if(h=="presence"||h=="message"||h=="iq"){if(g&&!g.xmlns){g.xmlns=e.NS.CLIENT}else{if(!g){g={xmlns:e.NS.CLIENT}}}}this.nodeTree=e.xmlElement(h,g);this.node=this.nodeTree};e.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return e.serialize(this.nodeTree)},up:function(){this.node=this.node.parentNode;return this},attrs:function(h){for(var g in h){if(h.hasOwnProperty(g)){this.node.setAttribute(g,h[g])}}return this},c:function(h,g,i){var j=e.xmlElement(h,g,i);this.node.appendChild(j);if(!i){this.node=j}return this},cnode:function(i){var k=e.xmlGenerator();try{var h=(k.importNode!==undefined)}catch(j){var h=false}var g=h?k.importNode(i,true):e.copyElement(i);this.node.appendChild(g);this.node=g;return this},t:function(g){var h=e.xmlTextNode(g);this.node.appendChild(h);return this}};e.Handler=function(k,j,h,i,m,l,g){this.handler=k;this.ns=j;this.name=h;this.type=i;this.id=m;this.options=g||{matchbare:false};if(!this.options.matchBare){this.options.matchBare=false}if(this.options.matchBare){this.from=l?e.getBareJidFromJid(l):null}else{this.from=l}this.user=true};e.Handler.prototype={isMatch:function(h){var j;var i=null;if(this.options.matchBare){i=e.getBareJidFromJid(h.getAttribute("from"))}else{i=h.getAttribute("from")}j=false;if(!this.ns){j=true}else{var g=this;e.forEachChild(h,null,function(k){if(k.getAttribute("xmlns")==g.ns){j=true}});j=j||h.getAttribute("xmlns")==this.ns}if(j&&(!this.name||e.isTagEqual(h,this.name))&&(!this.type||h.getAttribute("type")==this.type)&&(!this.id||h.getAttribute("id")==this.id)&&(!this.from||i==this.from)){return true}return false},run:function(h){var g=null;try{g=this.handler(h)}catch(i){if(i.sourceURL){e.fatal("error: "+this.handler+" "+i.sourceURL+":"+i.line+" - "+i.name+": "+i.message)}else{if(i.fileName){if(typeof(console)!="undefined"){console.trace();console.error(this.handler," - error - ",i,i.message)}e.fatal("error: "+this.handler+" "+i.fileName+":"+i.lineNumber+" - "+i.name+": "+i.message)}else{e.fatal("error: "+this.handler)}}throw i}return g},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}};e.TimedHandler=function(h,g){this.period=h;this.handler=g;this.lastCalled=new Date().getTime();this.user=true};e.TimedHandler.prototype={run:function(){this.lastCalled=new Date().getTime();return this.handler()},reset:function(){this.lastCalled=new Date().getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}};e.Request=function(i,h,g,j){this.id=++e._requestId;this.xmlData=i;this.data=e.serialize(i);this.origFunc=h;this.func=h;this.rid=g;this.date=NaN;this.sends=j||0;this.abort=false;this.dead=null;this.age=function(){if(!this.date){return 0}var k=new Date();return(k-this.date)/1000};this.timeDead=function(){if(!this.dead){return 0}var k=new Date();return(k-this.dead)/1000};this.xhr=this._newXHR()};e.Request.prototype={getResponse:function(){var g=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){g=this.xhr.responseXML.documentElement;if(g.tagName=="parsererror"){e.error("invalid response received");e.error("responseText: "+this.xhr.responseText);e.error("responseXML: "+e.serialize(this.xhr.responseXML));throw"parsererror"}}else{if(this.xhr.responseText){e.error("invalid response received");e.error("responseText: "+this.xhr.responseText);e.error("responseXML: "+e.serialize(this.xhr.responseXML))}}return g},_newXHR:function(){var g=null;if(window.XMLHttpRequest){g=new XMLHttpRequest();if(g.overrideMimeType){g.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){g=new ActiveXObject("Microsoft.XMLHTTP")}}g.onreadystatechange=this.func.bind(null,this);return g}};e.Connection=function(g){this.service=g;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.features=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold=1;this.wait=60;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var h in e._connectionPlugins){if(e._connectionPlugins.hasOwnProperty(h)){var j=e._connectionPlugins[h];var i=function(){};i.prototype=j;this[h]=new i();this[h].init(this)}}};e.Connection.prototype={reset:function(){this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*10000)},pause:function(){this.paused=true},resume:function(){this.paused=false},getUniqueId:function(g){if(typeof(g)=="string"||typeof(g)=="number"){return ++this._uniqueId+":"+g}else{return ++this._uniqueId+""}},connect:function(h,i,l,k,j){this.jid=h;this.pass=i;this.connect_callback=l;this.disconnecting=false;this.connected=false;this.authenticated=false;this.errors=0;this.wait=k||this.wait;this.hold=j||this.hold;this.domain=e.getDomainFromJid(this.jid);var g=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":e.NS.BOSH});this._changeConnectStatus(e.Status.CONNECTING,null);this._requests.push(new e.Request(g.tree(),this._onRequestStateChange.bind(this,this._connect_cb.bind(this)),g.tree().getAttribute("rid")));this._throttledRequestHandler()},attach:function(i,g,j,m,l,k,h){this.jid=i;this.sid=g;this.rid=j;this.connect_callback=m;this.domain=e.getDomainFromJid(this.jid);this.authenticated=true;this.connected=true;this.wait=l||this.wait;this.hold=k||this.hold;this.window=h||this.window;this._changeConnectStatus(e.Status.ATTACHED,null)},xmlInput:function(g){return},xmlOutput:function(g){return},rawInput:function(g){return},rawOutput:function(g){return},send:function(h){if(h===null){return}if(typeof(h.sort)==="function"){for(var g=0;g<h.length;g++){this._queueData(h[g])}}else{if(typeof(h.tree)==="function"){this._queueData(h.tree())}else{this._queueData(h)}}this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},flush:function(){clearTimeout(this._idleTimeout);this._onIdle()},sendIQ:function(j,n,g,k){var l=null;var i=this;if(typeof(j.tree)==="function"){j=j.tree()}var m=j.getAttribute("id");if(!m){m=this.getUniqueId("sendIQ");j.setAttribute("id",m)}var h=this.addHandler(function(p){if(l){i.deleteTimedHandler(l)}var o=p.getAttribute("type");if(o=="result"){if(n){n(p)}}else{if(o=="error"){if(g){g(p)}}else{throw {name:"StropheError",message:"Got bad IQ type of "+o}}}},null,"iq",null,m);if(k){l=this.addTimedHandler(k,function(){i.deleteHandler(h);if(g){g(null)}return false})}this.send(j);return m},_queueData:function(g){if(g===null||!g.tagName||!g.childNodes){throw {name:"StropheError",message:"Cannot queue non-DOMElement."}}this._data.push(g)},_sendRestart:function(){this._data.push("restart");this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},addTimedHandler:function(i,h){var g=new e.TimedHandler(i,h);this.addTimeds.push(g);return g},deleteTimedHandler:function(g){this.removeTimeds.push(g)},addHandler:function(l,k,i,j,n,m,h){var g=new e.Handler(l,k,i,j,n,m,h);this.addHandlers.push(g);return g},deleteHandler:function(g){this.removeHandlers.push(g)},disconnect:function(g){this._changeConnectStatus(e.Status.DISCONNECTING,g);e.info("Disconnect was called because: "+g);if(this.connected){this._disconnectTimeout=this._addSysTimedHandler(3000,this._onDisconnectTimeout.bind(this));this._sendTerminate()}},_changeConnectStatus:function(g,m){for(var h in e._connectionPlugins){if(e._connectionPlugins.hasOwnProperty(h)){var j=this[h];if(j.statusChanged){try{j.statusChanged(g,m)}catch(i){e.error(""+h+" plugin caused an exception changing status: "+i)}}}}if(this.connect_callback){try{this.connect_callback(g,m)}catch(l){e.error("User connection callback caused an exception: "+l)}}},_buildBody:function(){var g=c("body",{rid:this.rid++,xmlns:e.NS.HTTPBIND});if(this.sid!==null){g.attrs({sid:this.sid})}return g},_removeRequest:function(h){e.debug("removing request");var g;for(g=this._requests.length-1;g>=0;g--){if(h==this._requests[g]){this._requests.splice(g,1)}}h.xhr.onreadystatechange=function(){};this._throttledRequestHandler()},_restartRequest:function(g){var h=this._requests[g];if(h.dead===null){h.dead=new Date()}this._processRequest(g)},_processRequest:function(k){var p=this._requests[k];var s=-1;try{if(p.xhr.readyState==4){s=p.xhr.status}}catch(n){e.error("caught an error in _requests["+k+"], reqStatus: "+s)}if(typeof(s)=="undefined"){s=-1}if(p.sends>5){this._onDisconnectTimeout();return}var j=p.age();var h=(!isNaN(j)&&j>Math.floor(e.TIMEOUT*this.wait));var l=(p.dead!==null&&p.timeDead()>Math.floor(e.SECONDARY_TIMEOUT*this.wait));var r=(p.xhr.readyState==4&&(s<1||s>=500));if(h||l||r){if(l){e.error("Request "+this._requests[k].id+" timed out (secondary), restarting")}p.abort=true;p.xhr.abort();p.xhr.onreadystatechange=function(){};this._requests[k]=new e.Request(p.xmlData,p.origFunc,p.rid,p.sends);p=this._requests[k]}if(p.xhr.readyState===0){e.debug("request id "+p.id+"."+p.sends+" posting");try{var g=!("sync" in this&&this.sync===true);p.xhr.open("POST",this.service,g)}catch(o){e.error("XHR open failed.");if(!this.connected){this._changeConnectStatus(e.Status.CONNFAIL,"bad-service")}this.disconnect();return}var q=function(){p.date=new Date();p.xhr.send(p.data)};if(p.sends>1){var m=Math.min(Math.floor(e.TIMEOUT*this.wait),Math.pow(p.sends,3))*1000;setTimeout(q,m)}else{q()}p.sends++;if(this.xmlOutput!==e.Connection.prototype.xmlOutput){this.xmlOutput(p.xmlData)}if(this.rawOutput!==e.Connection.prototype.rawOutput){this.rawOutput(p.data)}}else{e.debug("_processRequest: "+(k===0?"first":"second")+" request has readyState of "+p.xhr.readyState)}},_throttledRequestHandler:function(){if(!this._requests){e.debug("_throttledRequestHandler called with undefined requests")}else{e.debug("_throttledRequestHandler called with "+this._requests.length+" requests")}if(!this._requests||this._requests.length===0){return}if(this._requests.length>0){this._processRequest(0)}if(this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window){this._processRequest(1)}},_onRequestStateChange:function(j,i){e.debug("request id "+i.id+"."+i.sends+" state changed to "+i.xhr.readyState);if(i.abort){i.abort=false;return}var h;if(i.xhr.readyState==4){h=0;try{h=i.xhr.status}catch(k){}if(typeof(h)=="undefined"){h=0}if(this.disconnecting){if(h>=400){this._hitError(h);return}}var g=(this._requests[0]==i);var l=(this._requests[1]==i);if((h>0&&h<500)||i.sends>5){this._removeRequest(i);e.debug("request id "+i.id+" should now be removed")}if(h==200){if(l||(g&&this._requests.length>0&&this._requests[0].age()>Math.floor(e.SECONDARY_TIMEOUT*this.wait))){this._restartRequest(0)}e.debug("request id "+i.id+"."+i.sends+" got 200");j(i);this.errors=0}else{e.error("request id "+i.id+"."+i.sends+" error "+h+" happened");if(h===0||(h>=400&&h<600)||h>=12000){this._hitError(h);if(h>=400&&h<500){this._changeConnectStatus(e.Status.DISCONNECTING,null);this._doDisconnect()}}}if(!((h>0&&h<500)||i.sends>5)){this._throttledRequestHandler()}}},_hitError:function(g){this.errors++;e.warn("request errored, status: "+g+", number of errors: "+this.errors);if(this.errors>4){this._onDisconnectTimeout()}},_doDisconnect:function(){e.info("_doDisconnect was called");this.authenticated=false;this.disconnecting=false;this.sid=null;this.streamId=null;this.rid=Math.floor(Math.random()*4294967295);if(this.connected){this._changeConnectStatus(e.Status.DISCONNECTED,null);this.connected=false}this.handlers=[];this.timedHandlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[]},_dataRecv:function(p){try{var g=p.getResponse()}catch(n){if(n!="parsererror"){throw n}this.disconnect("strophe-parsererror")}if(g===null){return}if(this.xmlInput!==e.Connection.prototype.xmlInput){this.xmlInput(g)}if(this.rawInput!==e.Connection.prototype.rawInput){this.rawInput(e.serialize(g))}var l,j;while(this.removeHandlers.length>0){j=this.removeHandlers.pop();l=this.handlers.indexOf(j);if(l>=0){this.handlers.splice(l,1)}}while(this.addHandlers.length>0){this.handlers.push(this.addHandlers.pop())}if(this.disconnecting&&this._requests.length===0){this.deleteTimedHandler(this._disconnectTimeout);this._disconnectTimeout=null;this._doDisconnect();return}var h=g.getAttribute("type");var o,k;if(h!==null&&h=="terminate"){if(this.disconnecting){return}o=g.getAttribute("condition");k=g.getElementsByTagName("conflict");if(o!==null){if(o=="remote-stream-error"&&k.length>0){o="conflict"}this._changeConnectStatus(e.Status.CONNFAIL,o)}else{this._changeConnectStatus(e.Status.CONNFAIL,"unknown")}this.disconnect();return}var m=this;e.forEachChild(g,null,function(u){var r,s;s=m.handlers;m.handlers=[];for(r=0;r<s.length;r++){var q=s[r];try{if(q.isMatch(u)&&(m.authenticated||!q.user)){if(q.run(u)){m.handlers.push(q)}}else{m.handlers.push(q)}}catch(t){}}})},_sendTerminate:function(){e.info("_sendTerminate was called");var g=this._buildBody().attrs({type:"terminate"});if(this.authenticated){g.c("presence",{xmlns:e.NS.CLIENT,type:"unavailable"})}this.disconnecting=true;var h=new e.Request(g.tree(),this._onRequestStateChange.bind(this,this._dataRecv.bind(this)),g.tree().getAttribute("rid"));this._requests.push(h);this._throttledRequestHandler()},_connect_cb:function(v){e.info("_connect_cb was called");this.connected=true;var h=v.getResponse();if(!h){return}if(this.xmlInput!==e.Connection.prototype.xmlInput){this.xmlInput(h)}if(this.rawInput!==e.Connection.prototype.rawInput){this.rawInput(e.serialize(h))}var m=h.getAttribute("type");var u,o;if(m!==null&&m=="terminate"){u=h.getAttribute("condition");o=h.getElementsByTagName("conflict");if(u!==null){if(u=="remote-stream-error"&&o.length>0){u="conflict"}this._changeConnectStatus(e.Status.CONNFAIL,u)}else{this._changeConnectStatus(e.Status.CONNFAIL,"unknown")}return}if(!this.sid){this.sid=h.getAttribute("sid")}if(!this.stream_id){this.stream_id=h.getAttribute("authid")}var j=h.getAttribute("requests");if(j){this.window=parseInt(j,10)}var g=h.getAttribute("hold");if(g){this.hold=parseInt(g,10)}var q=h.getAttribute("wait");if(q){this.wait=parseInt(q,10)}var w=false;var l=false;var t=false;var x=h.getElementsByTagName("mechanism");var n,s,p,k;if(x.length>0){for(n=0;n<x.length;n++){s=e.getText(x[n]);if(s=="DIGEST-MD5"){l=true}else{if(s=="PLAIN"){w=true}else{if(s=="ANONYMOUS"){t=true}}}}}else{var r=this._buildBody();this._requests.push(new e.Request(r.tree(),this._onRequestStateChange.bind(this,this._connect_cb.bind(this)),r.tree().getAttribute("rid")));this._throttledRequestHandler();return}if(e.getNodeFromJid(this.jid)===null&&t){this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("auth",{xmlns:e.NS.SASL,mechanism:"ANONYMOUS"}).tree())}else{if(e.getNodeFromJid(this.jid)===null){this._changeConnectStatus(e.Status.CONNFAIL,"x-strophe-bad-non-anon-jid");this.disconnect()}else{if(l){this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge1_cb.bind(this),null,"challenge",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("auth",{xmlns:e.NS.SASL,mechanism:"DIGEST-MD5"}).tree())}else{if(w){p=unescape(encodeURIComponent(e.getBareJidFromJid(this.jid)));p=p+"\u0000";p=p+unescape(encodeURIComponent(e.getNodeFromJid(this.jid)));p=p+"\u0000";p=p+this.pass;this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);k=Base64.encode(p);this.send(c("auth",{xmlns:e.NS.SASL,mechanism:"PLAIN"}).t(k).tree())}else{this._changeConnectStatus(e.Status.AUTHENTICATING,null);this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1");this.send(d({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:e.NS.AUTH}).c("username",{}).t(e.getNodeFromJid(this.jid)).tree())}}}}},_sasl_challenge1_cb:function(k){var h=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/;var q=Base64.decode(e.getText(k));var r=MD5.hexdigest(""+(Math.random()*1234567890));var n="";var s=null;var o="";var g="";var m;this.deleteHandler(this._sasl_failure_handler);while(q.match(h)){m=q.match(h);q=q.replace(m[0],"");m[2]=m[2].replace(/^"(.+)"$/,"$1");switch(m[1]){case"realm":n=m[2];break;case"nonce":o=m[2];break;case"qop":g=m[2];break;case"host":s=m[2];break}}var l="xmpp/"+this.domain;if(s!==null){l=l+"/"+s}var j=MD5.hash(unescape(encodeURIComponent(e.getNodeFromJid(this.jid)))+":"+n+":"+this.pass)+":"+o+":"+r;var i="AUTHENTICATE:"+l;var p="";p+="username="+this._quote(unescape(encodeURIComponent(e.getNodeFromJid(this.jid))))+",";p+="realm="+this._quote(n)+",";p+="nonce="+this._quote(o)+",";p+="cnonce="+this._quote(r)+",";p+='nc="00000001",';p+='qop="auth",';p+="digest-uri="+this._quote(l)+",";p+="response="+this._quote(MD5.hexdigest(MD5.hexdigest(j)+":"+o+":00000001:"+r+":auth:"+MD5.hexdigest(i)))+",";p+='charset="utf-8"';this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge2_cb.bind(this),null,"challenge",null,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("response",{xmlns:e.NS.SASL}).t(Base64.encode(p)).tree());return false},_quote:function(g){return'"'+g.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},_sasl_challenge2_cb:function(g){this.deleteHandler(this._sasl_success_handler);this.deleteHandler(this._sasl_failure_handler);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send(c("response",{xmlns:e.NS.SASL}).tree());return false},_auth1_cb:function(g){var h=d({type:"set",id:"_auth_2"}).c("query",{xmlns:e.NS.AUTH}).c("username",{}).t(e.getNodeFromJid(this.jid)).up().c("password").t(this.pass);if(!e.getResourceFromJid(this.jid)){this.jid=e.getBareJidFromJid(this.jid)+"/strophe"}h.up().c("resource",{}).t(e.getResourceFromJid(this.jid));this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2");this.send(h.tree());return false},_sasl_success_cb:function(g){e.info("SASL authentication succeeded.");this.deleteHandler(this._sasl_failure_handler);this._sasl_failure_handler=null;if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null}this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null);this._sendRestart();return false},_sasl_auth1_cb:function(h){this.features=h;var g,k;for(g=0;g<h.childNodes.length;g++){k=h.childNodes[g];if(k.nodeName=="bind"){this.do_bind=true}if(k.nodeName=="session"){this.do_session=true}}if(!this.do_bind){this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}else{this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var j=e.getResourceFromJid(this.jid);if(j){this.send(d({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:e.NS.BIND}).c("resource",{}).t(j).tree())}else{this.send(d({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:e.NS.BIND}).tree())}}return false},_sasl_bind_cb:function(g){if(g.getAttribute("type")=="error"){e.info("SASL binding failed.");this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}var i=g.getElementsByTagName("bind");var h;if(i.length>0){h=i[0].getElementsByTagName("jid");if(h.length>0){this.jid=e.getText(h[0]);if(this.do_session){this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2");this.send(d({type:"set",id:"_session_auth_2"}).c("session",{xmlns:e.NS.SESSION}).tree())}else{this.authenticated=true;this._changeConnectStatus(e.Status.CONNECTED,null)}}}else{e.info("SASL binding failed.");this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}},_sasl_session_cb:function(g){if(g.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(e.Status.CONNECTED,null)}else{if(g.getAttribute("type")=="error"){e.info("Session creation failed.");this._changeConnectStatus(e.Status.AUTHFAIL,null);return false}}return false},_sasl_failure_cb:function(g){if(this._sasl_success_handler){this.deleteHandler(this._sasl_success_handler);this._sasl_success_handler=null}if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null}this._changeConnectStatus(e.Status.AUTHFAIL,null);return false},_auth2_cb:function(g){if(g.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(e.Status.CONNECTED,null)}else{if(g.getAttribute("type")=="error"){this._changeConnectStatus(e.Status.AUTHFAIL,null);this.disconnect()}}return false},_addSysTimedHandler:function(i,h){var g=new e.TimedHandler(i,h);g.user=false;this.addTimeds.push(g);return g},_addSysHandler:function(k,j,h,i,l){var g=new e.Handler(k,j,h,i,l);g.user=false;this.addHandlers.push(g);return g},_onDisconnectTimeout:function(){e.info("_onDisconnectTimeout was called");var g;while(this._requests.length>0){g=this._requests.pop();g.abort=true;g.xhr.abort();g.xhr.onreadystatechange=function(){}}this._doDisconnect();return false},_onIdle:function(){var j,l,n,k;while(this.addTimeds.length>0){this.timedHandlers.push(this.addTimeds.pop())}while(this.removeTimeds.length>0){l=this.removeTimeds.pop();j=this.timedHandlers.indexOf(l);if(j>=0){this.timedHandlers.splice(j,1)}}var h=new Date().getTime();k=[];for(j=0;j<this.timedHandlers.length;j++){l=this.timedHandlers[j];if(this.authenticated||!l.user){n=l.lastCalled+l.period;if(n-h<=0){if(l.run()){k.push(l)}}else{k.push(l)}}}this.timedHandlers=k;var g,m;if(this.authenticated&&this._requests.length===0&&this._data.length===0&&!this.disconnecting){e.info("no requests during idle cycle, sending blank request");this._data.push(null)}if(this._requests.length<2&&this._data.length>0&&!this.paused){g=this._buildBody();for(j=0;j<this._data.length;j++){if(this._data[j]!==null){if(this._data[j]==="restart"){g.attrs({to:this.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":e.NS.BOSH})}else{g.cnode(this._data[j]).up()}}}delete this._data;this._data=[];this._requests.push(new e.Request(g.tree(),this._onRequestStateChange.bind(this,this._dataRecv.bind(this)),g.tree().getAttribute("rid")));this._processRequest(this._requests.length-1)}if(this._requests.length>0){m=this._requests[0].age();if(this._requests[0].dead!==null){if(this._requests[0].timeDead()>Math.floor(e.SECONDARY_TIMEOUT*this.wait)){this._throttledRequestHandler()}}if(m>Math.floor(e.TIMEOUT*this.wait)){e.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(e.TIMEOUT*this.wait)+" seconds since last activity");this._throttledRequestHandler()}}clearTimeout(this._idleTimeout);if(this.connected){this._idleTimeout=setTimeout(this._onIdle.bind(this),100)}}};if(f){f(e,c,a,d,b)}})(function(){window.Strophe=arguments[0];window.$build=arguments[1];window.$msg=arguments[2];window.$iq=arguments[3];window.$pres=arguments[4]});Strophe.addConnectionPlugin("muc",{_connection:null,init:function(a){this._connection=a;Strophe.addNamespace("MUC_OWNER",Strophe.NS.MUC+"#owner");Strophe.addNamespace("MUC_ADMIN",Strophe.NS.MUC+"#admin")},join:function(g,a,c,d,b){var f=this.test_append_nick(g,a);var h=$pres({from:this._connection.jid,to:f}).c("x",{xmlns:Strophe.NS.MUC});if(b){var e=Strophe.xmlElement("password",[],b);h.cnode(e)}if(c){this._connection.addHandler(function(j){var k=j.getAttribute("from");var i=k.split("/");if(i[0]==g){return c(j)}else{return true}},null,"message",null,null,null)}if(d){this._connection.addHandler(function(k){var m=k.getElementsByTagName("x");if(m.length>0){for(var j=0;j<m.length;j++){var l=m[j].getAttribute("xmlns");if(l&&l.match(Strophe.NS.MUC)){return d(k)}}}return true},null,"presence",null,null,null)}this._connection.send(h)},leave:function(f,a,c){var e=this.test_append_nick(f,a);var d=this._connection.getUniqueId();var b=$pres({type:"unavailable",id:d,from:this._connection.jid,to:e}).c("x",{xmlns:Strophe.NS.MUC});this._connection.addHandler(c,null,"presence",null,d,null);this._connection.send(b);return d},message:function(f,a,d,b){var e=this.test_append_nick(f,a);b=b||"groupchat";var c=this._connection.getUniqueId();var g=$msg({to:e,from:this._connection.jid,type:b,id:c}).c("body",{xmlns:Strophe.NS.CLIENT}).t(d);g.up().c("x",{xmlns:"jabber:x:event"}).c("composing");this._connection.send(g);return c},configure:function(b){var a=$iq({to:b,type:"get"}).c("query",{xmlns:Strophe.NS.MUC_OWNER});var c=a.tree();return this._connection.sendIQ(c,function(){},function(){})},cancelConfigure:function(b){var a=$iq({to:b,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"cancel"});var c=a.tree();return this._connection.sendIQ(c,function(){},function(){})},saveConfiguration:function(d,c){var a=$iq({to:d,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"submit"});for(var b=0;b<c.length;b++){a.cnode(c[b]);a.up()}var e=a.tree();return this._connection.sendIQ(e,function(){},function(){})},createInstantRoom:function(b){var a=$iq({to:b,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"submit"});return this._connection.sendIQ(a.tree(),function(){},function(){})},setTopic:function(b,a){var c=$msg({to:b,from:this._connection.jid,type:"groupchat"}).c("subject",{xmlns:"jabber:client"}).t(a);this._connection.send(c.tree())},modifyUser:function(g,b,h,d,f){var a={nick:Strophe.escapeNode(b)};if(h!==null){a.role=h}if(d!==null){a.affiliation=d}var e=$build("item",a);if(f!==null){e.cnode(Strophe.xmlElement("reason",f))}var c=$iq({to:g,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).cnode(e.tree());return this._connection.sendIQ(c.tree(),function(){},function(){})},changeNick:function(d,a){var c=this.test_append_nick(d,a);var b=$pres({from:this._connection.jid,to:c}).c("x",{xmlns:Strophe.NS.MUC});this._connection.send(b.tree())},listRooms:function(c,a){var b=$iq({to:c,from:this._connection.jid,type:"get"}).c("query",{xmlns:Strophe.NS.DISCO_ITEMS});this._connection.sendIQ(b,a,function(){})},test_append_nick:function(c,a){var b=c;if(a){b+="/"+Strophe.escapeNode(a)}return b}});var Mustache=function(){var a=function(){};a.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(e,d,c,f){if(!f){this.context=d;this.buffer=[]}if(!this.includes("",e)){if(f){return e}else{this.send(e);return}}e=this.render_pragmas(e);var b=this.render_section(e,d,c);if(f){return this.render_tags(b,d,c,f)}this.render_tags(b,d,c,f)},send:function(b){if(b!==""){this.buffer.push(b)}},render_pragmas:function(b){if(!this.includes("%",b)){return b}var d=this;var c=new RegExp(this.otag+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+this.ctag,"g");return b.replace(c,function(g,e,f){if(!d.pragmas_implemented[e]){throw ({message:"This implementation of mustache doesn't understand the '"+e+"' pragma"})}d.pragmas[e]={};if(f){var h=f.split("=");d.pragmas[e][h[0]]=h[1]}return""})},render_partial:function(b,d,c){b=this.trim(b);if(!c||c[b]===undefined){throw ({message:"unknown_partial '"+b+"'"})}if(typeof(d[b])!="object"){return this.render(c[b],d,c,true)}return this.render(c[b],d[b],c,true)},render_section:function(d,c,b){if(!this.includes("#",d)&&!this.includes("^",d)){return d}var f=this;var e=new RegExp(this.otag+"(\\^|\\#)\\s*(.+)\\s*"+this.ctag+"\n*([\\s\\S]+?)"+this.otag+"\\/\\s*\\2\\s*"+this.ctag+"\\s*","mg");return d.replace(e,function(h,i,g,j){var k=f.find(g,c);if(i=="^"){if(!k||f.is_array(k)&&k.length===0){return f.render(j,c,b,true)}else{return""}}else{if(i=="#"){if(f.is_array(k)){return f.map(k,function(l){return f.render(j,f.create_context(l),b,true)}).join("")}else{if(f.is_object(k)){return f.render(j,f.create_context(k),b,true)}else{if(typeof k==="function"){return k.call(c,j,function(l){return f.render(l,c,b,true)})}else{if(k){return f.render(j,c,b,true)}else{return""}}}}}}})},render_tags:function(k,b,d,f){var e=this;var j=function(){return new RegExp(e.otag+"(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?"+e.ctag+"+","g")};var g=j();var h=function(n,i,m){switch(i){case"!":return"";case"=":e.set_delimiters(m);g=j();return"";case">":return e.render_partial(m,b,d);case"{":return e.find(m,b);default:return e.escape(e.find(m,b))}};var l=k.split("\n");for(var c=0;c<l.length;c++){l[c]=l[c].replace(g,h,this);if(!f){this.send(l[c])}}if(f){return l.join("\n")}},set_delimiters:function(c){var b=c.split(" ");this.otag=this.escape_regex(b[0]);this.ctag=this.escape_regex(b[1])},escape_regex:function(c){if(!arguments.callee.sRE){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+b.join("|\\")+")","g")}return c.replace(arguments.callee.sRE,"\\$1")},find:function(c,d){c=this.trim(c);function b(f){return f===false||f===0||f}var e;if(b(d[c])){e=d[c]}else{if(b(this.context[c])){e=this.context[c]}}if(typeof e==="function"){return e.apply(d)}if(e!==undefined){return e}return""},includes:function(c,b){return b.indexOf(this.otag+c)!=-1},escape:function(b){b=String(b===null?"":b);return b.replace(/&(?!\w+;)|["'<>\\]/g,function(c){switch(c){case"&":return"&amp;";case"\\":return"\\\\";case'"':return"&quot;";case"'":return"&#39;";case"<":return"&lt;";case">":return"&gt;";default:return c}})},create_context:function(c){if(this.is_object(c)){return c}else{var d=".";if(this.pragmas["IMPLICIT-ITERATOR"]){d=this.pragmas["IMPLICIT-ITERATOR"].iterator}var b={};b[d]=c;return b}},is_object:function(b){return b&&typeof b=="object"},is_array:function(b){return Object.prototype.toString.call(b)==="[object Array]"},trim:function(b){return b.replace(/^\s*|\s*$/g,"")},map:function(f,d){if(typeof f.map=="function"){return f.map(d)}else{var e=[];var b=f.length;for(var c=0;c<b;c++){e.push(d(f[c]))}return e}}};return({name:"mustache.js",version:"0.3.1-dev",to_html:function(d,b,c,f){var e=new a();if(f){e.send=f}e.render(d,b,c);if(!f){return e.buffer.join("\n")}}})}();(function(a){a.i18n={dict:null,setDictionary:function(b){this.dict=b},_:function(d,c){var b=d;if(this.dict&&this.dict[d]){b=this.dict[d]}return this.printf(b,c)},toEntity:function(d){var b="";for(var c=0;c<d.length;c++){if(d.charCodeAt(c)>128){b+="&#"+d.charCodeAt(c)+";"}else{b+=d.charAt(c)}}return b},stripStr:function(b){return b.replace(/^\s*/,"").replace(/\s*$/,"")},stripStrML:function(d){var c=d.split("\n");for(var b=0;b<c.length;b++){c[b]=stripStr(c[b])}return stripStr(c.join(" "))},printf:function(g,b){if(!b){return g}var f="",e=/%(\d+)\$s/g;while(result=e.exec(g)){var c=parseInt(result[1],10)-1;g=g.replace("%"+result[1]+"$s",(b[c]));b.splice(c,1)}var h=g.split("%s");if(h.length>1){for(var d=0;d<b.length;d++){if(h[d].lastIndexOf("%")==h[d].length-1&&d!=b.length-1){h[d]+="s"+h.splice(d+1,1)[0]}f+=h[d]+b[d]}}return f+h[h.length-1]}};a.fn._t=function(c,b){return a(this).text(a.i18n._(c,b))}})(jQuery);var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date;if(isNaN(i)){throw SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),yyyy:p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};
View
14 src/view/observer.js
@@ -94,14 +94,20 @@ Candy.View.Observer = (function(self, $) {
self.Presence.notifyPrivateChats(user, args.type);
// Client has been kicked or banned
} else if (args.type === 'kick' || args.type === 'ban') {
- var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : args.roomName,
- actionLabel;
+ var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : null,
+ actionLabel,
+ translationParams = [args.roomName];
+
+ if (actorName) {
+ translationParams.push(actorName);
+ }
+
switch(args.type) {
case 'kick':
- actionLabel = $.i18n._('youHaveBeenKickedBy', [args.roomName, actorName]);
+ actionLabel = $.i18n._((actorName ? 'youHaveBeenKickedBy' : 'youHaveBeenKicked'), translationParams);
break;
case 'ban':
- actionLabel = $.i18n._('youHaveBeenBannedBy', [args.roomName, actorName]);
+ actionLabel = $.i18n._((actorName ? 'youHaveBeenBannedBy' : 'youHaveBeenBanned'), translationParams);
break;
}
Candy.View.Pane.Chat.Modal.show(Mustache.to_html(Candy.View.Template.Chat.Context.adminMessageReason, {
View
109 src/view/translation.js
@@ -33,9 +33,11 @@ Candy.View.Translation = {
'subject' : 'Subject:',
'reasonWas' : 'Reason was: %s.',
'kickActionLabel' : 'Kick',
- 'youHaveBeenKickedBy' : 'You have been kicked from %s by %s',
+ 'youHaveBeenKickedBy' : 'You have been kicked from %2$s by %1$s',
+ 'youHaveBeenKicked' : 'You have been kicked from %s',
'banActionLabel' : 'Ban',
- 'youHaveBeenBannedBy' : 'You have been banned from %s by %s',
+ 'youHaveBeenBannedBy' : 'You have been banned from %1$s by %2$s',
+ 'youHaveBeenBanned' : 'You have been banned from %s',
'privateActionLabel' : 'Private chat',
'ignoreActionLabel' : 'Ignore',
@@ -97,9 +99,11 @@ Candy.View.Translation = {
'subject' : 'Titel:',
'reasonWas' : 'Begründung: %s.',
'kickActionLabel' : 'Kick',
- 'youHaveBeenKickedBy' : 'Du wurdest soeben aus dem Raum %s gekickt (%s)',
+ 'youHaveBeenKickedBy' : 'Du wurdest soeben aus dem Raum %1$s gekickt (%2$s)',
+ 'youHaveBeenKicked' : 'Du wurdest soeben aus dem Raum %s gekickt',
'banActionLabel' : 'Ban',
- 'youHaveBeenBannedBy' : 'Du wurdest soeben aus dem Raum %s verbannt (%s)',
+ 'youHaveBeenBannedBy' : 'Du wurdest soeben aus dem Raum %1$s verbannt (%2$s)',
+ 'youHaveBeenBanned' : 'Du wurdest soeben aus dem Raum %s verbannt',
'privateActionLabel' : 'Privater Chat',
'ignoreActionLabel' : 'Ignorieren',
@@ -161,9 +165,11 @@ Candy.View.Translation = {
'subject' : 'Titre:',
'reasonWas' : 'Justification: %s.',
'kickActionLabel' : 'Kick',
- 'youHaveBeenKickedBy' : 'Tu as été expulsé (%s)',
+ 'youHaveBeenKickedBy' : 'Tu as été expulsé de le salon %1$s (%2$s)',
+ 'youHaveBeenKicked' : 'Tu as été expulsé de le salon %s',
'banActionLabel' : 'Ban',
- 'youHaveBeenBannedBy' : 'Tu as été banni (%s)',
+ 'youHaveBeenBannedBy' : 'Tu as été banni de le salon %1$s (%2$s)',
+ 'youHaveBeenBanned' : 'Tu as été banni de le salon %s',
'privateActionLabel' : 'Chat privé',
'ignoreActionLabel' : 'Ignorer',
@@ -193,6 +199,15 @@ Candy.View.Translation = {
'tooltipAdministration' : 'Administrer le salon',
'tooltipUsercount' : 'Nombre d\'utilisateurs dans le salon',
+ 'enterRoomPassword' : 'Le salon "%s" est protégé par un mot de passe.',
+ 'enterRoomPasswordSubmit' : 'Entrer dans le salon',
+ 'passwordEnteredInvalid' : 'Le mot de passe four le salon "%s" est invalide.',
+
+ 'nicknameConflict': 'Le nom d\'utilisateur est déjà utilisé. Choisi un autre.',
+
+ 'errorMembersOnly': 'Tu ne peut pas entrer de le salon "%s": droits insuffisants.',
+ 'errorMaxOccupantsReached': 'Tu ne peut pas entrer de le salon "%s": Limite d\'utilisateur atteint.',
+
'antiSpamMessage' : 'S\'il te plaît, pas de spam. Tu as été bloqué pendant une courte période..'
},
@@ -216,9 +231,11 @@ Candy.View.Translation = {
'subject' : 'Onderwerp:',
'reasonWas' : 'De reden was: %s.',
'kickActionLabel' : 'Verwijderen',
- 'youHaveBeenKickedBy' : 'Je bent verwijderd van %s door %s',
+ 'youHaveBeenKickedBy' : 'Je bent verwijderd van %1$s door %2$s',
+ 'youHaveBeenKicked' : 'Je bent verwijderd van %s',
'banActionLabel' : 'Blokkeren',
- 'youHaveBeenBannedBy' : 'Je bent geblokkeerd van %s door %s',
+ 'youHaveBeenBannedBy' : 'Je bent geblokkeerd van %1$s door %2$s',
+ 'youHaveBeenBanned' : 'Je bent geblokkeerd van %s',
'privateActionLabel' : 'Prive gesprek',
'ignoreActionLabel' : 'Negeren',
@@ -280,9 +297,11 @@ Candy.View.Translation = {
'subject' : 'Asunto:',
'reasonWas' : 'La razón fue: %s.',
'kickActionLabel' : 'Expulsar',
- 'youHaveBeenKickedBy' : 'Has sido expulsado de %s por %s',
+ 'youHaveBeenKickedBy' : 'Has sido expulsado de %1$s por %2$s',
+ 'youHaveBeenKicked' : 'Has sido expulsado de %s',
'banActionLabel' : 'Prohibir',
- 'youHaveBeenBannedBy' : 'Has sido expulsado permanentemente de %s por %s',
+ 'youHaveBeenBannedBy' : 'Has sido expulsado permanentemente de %1$s por %2$s',
+ 'youHaveBeenBanned' : 'Has sido expulsado permanentemente de %s',
'privateActionLabel' : 'Chat privado',
'ignoreActionLabel' : 'Ignorar',
@@ -344,9 +363,9 @@ Candy.View.Translation = {
'subject': '主题:',
'reasonWas': '原因是: %s.',
'kickActionLabel': '踢除',
- 'youHaveBeenKickedBy': '你在 %s 被管理者 %s 请出房间',
+ 'youHaveBeenKickedBy': '你在 %1$s 被管理者 %2$s 请出房间',
'banActionLabel': '禁言',
- 'youHaveBeenBannedBy': '你在 %s 被管理者 %s 禁言',
+ 'youHaveBeenBannedBy': '你在 %1$s 被管理者 %2$s 禁言',
'privateActionLabel': '单独对话',
'ignoreActionLabel': '忽略',
@@ -385,6 +404,70 @@ Candy.View.Translation = {
'errorMembersOnly': '您的权限不够,不能登录房间 "%s" ',
'errorMaxOccupantsReached': '房间 "%s" 的人数已达上限,您不能登录',
- 'raptorMessageBlocked': '因为您在短时间内发送过多的消息 服务器要阻止您一小段时间。'
+ 'antiSpamMessage': '因为您在短时间内发送过多的消息 服务器要阻止您一小段时间。'
+ },
+
+ 'ja' : {
+ 'status' : 'ステータス: %s',
+ 'statusConnecting' : '接続中…',
+ 'statusConnected' : '接続されました',
+ 'statusDisconnecting' : 'ディスコネクト中…',
+ 'statusDisconnected' : 'ディスコネクトされました',
+ 'statusAuthfail' : '認証に失敗しました',
+
+ 'roomSubject' : 'トピック:',
+ 'messageSubmit' : '送信',
+
+ 'labelUsername' : 'ユーザーネーム:',
+ 'labelPassword' : 'パスワード:',
+ 'loginSubmit' : 'ログイン',
+ 'loginInvalid' : 'ユーザーネームが正しくありません',
+
+ 'reason' : '理由:',
+ 'subject' : 'トピック:',
+ 'reasonWas' : '理由: %s。',
+ 'kickActionLabel' : 'キック',
+ 'youHaveBeenKickedBy' : 'あなたは%2$sにより%1$sからキックされました。',
+ 'banActionLabel' : 'アカウントバン',
+ 'youHaveBeenBannedBy' : 'あなたは%2$sにより%1$sからアカウントバンされました。',
+
+ 'privateActionLabel' : 'プライベートメッセージ',
+ 'ignoreActionLabel' : '無視する',
+ 'unignoreActionLabel' : '無視をやめる',
+
+ 'setSubjectActionLabel' : 'トピックを変える',
+
+ 'administratorMessageSubject' : '管理者',
+
+ 'userJoinedRoom' : '%sは入室しました。',
+ 'userLeftRoom' : '%sは退室しました。',
+ 'userHasBeenKickedFromRoom' : '%sは部屋からキックされました。',
+ 'userHasBeenBannedFromRoom' : '%sは部屋からアカウントバンされました。',
+
+ 'presenceUnknownWarningSubject' : '忠告:',
+ 'presenceUnknownWarning' : 'このユーザーのステータスは不明です。',
+
+ 'dateFormat' : 'dd.mm.yyyy',
+ 'timeFormat' : 'HH:MM:ss',
+
+ 'tooltipRole' : 'モデレーター',
+ 'tooltipIgnored' : 'このユーザーを無視設定にしている',
+ 'tooltipEmoticons' : '絵文字',
+ 'tooltipSound' : '新しいメッセージが届くたびに音を鳴らす',
+ 'tooltipAutoscroll' : 'オートスクロール',
+ 'tooltipStatusmessage' : 'ステータスメッセージを表示',
+ 'tooltipAdministration' : '部屋の管理',
+ 'tooltipUsercount' : 'この部屋の参加者の数',
+
+ 'enterRoomPassword' : '"%s"の部屋に入るにはパスワードが必要です。',
+ 'enterRoomPasswordSubmit' : '部屋に入る',
+ 'passwordEnteredInvalid' : '"%s"のパスワードと異なるパスワードを入力しました。',
+
+ 'nicknameConflict' : 'このユーザーネームはすでに利用されているため、別のユーザーネームを選んでください。',
+
+ 'errorMembersOnly' : '"%s"の部屋に入ることができません: 利用権限を満たしていません。',
+ 'errorMaxOccupantsReached' : '"%s"の部屋に入ることができません: 参加者の数はすでに上限に達しました。',
+
+ 'antiSpamMessage' : 'スパムなどの行為はやめてください。あなたは一時的にブロックされました。'
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.