xmppify 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/xmpp/index.js +0 -0
- data/app/assets/javascripts/xmpp/scripts/checkplayer.js +12 -0
- data/app/assets/javascripts/xmpp/scripts/crossdomain.xml +7 -0
- data/app/assets/javascripts/xmpp/scripts/flXHR.js +2 -0
- data/app/assets/javascripts/xmpp/scripts/flXHR.swf +0 -0
- data/app/assets/javascripts/xmpp/scripts/flXHR.vbs +44 -0
- data/app/assets/javascripts/xmpp/scripts/flensed.js +12 -0
- data/app/assets/javascripts/xmpp/scripts/strophe.flxhr.js +31 -0
- data/app/assets/javascripts/xmpp/scripts/strophe.js +3538 -0
- data/app/assets/javascripts/xmpp/scripts/swfobject.js +5 -0
- data/app/assets/javascripts/xmpp/scripts/updateplayer.swf +0 -0
- data/app/assets/javascripts/xmpp/scripts/xmpp.js.coffee +386 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/LICENSE.txt +19 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/README.markdown +95 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/archive/README.markdown +14 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/archive/iso8601_support.js +32 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/archive/strophe.archive.js +88 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/README.markdown +53 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/sha1.js +202 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.coffee +153 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.js +88 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.caps.jsonly.js +240 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/chatstates/strophe.chatstates.js +80 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/README.markdown +47 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/GetUrlComamndSpec.js +66 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/strophe.cmds.spec.coffee +145 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/support/jasmine.json +16 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.coffee +265 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.js +403 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/README.markdown +82 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/spec/strophe.x.coffee +715 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.coffee +443 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.js +854 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/.gitignore +1 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/README.markdown +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/convert.js +13 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/jasmine.json +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/lib/strophe.disco.js +137 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/public/javascript/strophe.disco.js +137 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/01_querying_information.xml +6 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/02_result_set_for_information_request.xml +22 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/03_target_entity_does_not_exist.xml +10 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/04_service_unavailable.xml +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/09_querying_specific_jid_and_node_combination.xml +7 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/10_jid_and_node_result.xml +12 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/11_requesting_all_items.xml +6 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/12_result_set_for_all_items.xml +23 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/13_empty_result_set.xml +7 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/17_service_returns_nodes.xml +16 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/18_requesting_further_nodes.xml +7 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/24_jid_and_node_error.xml +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/DiscoNodeSpec.js +50 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/SpecHelper.js +51 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/Stanzas.js +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.helper.js +54 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.js +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/support/jasmine.json +13 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/strophe.disco.js +232 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/public/javascript/jquery.epic.js +61 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/SpecHelper.js +9 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/jquery.epic.js +39 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/support/jasmine.json +22 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/iexdomain/iexdomain.js +36 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/README.markdown +117 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/buster.js +23 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.coffee +64 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.js +92 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/browserSetup.coffee +1 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/jid.spec.coffee +96 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/strophe.joap.spec.coffee +461 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.coffee +304 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.js +522 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/mam/LICENSE.txt +19 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/mam/README.markdown +52 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/mam/strophe.mam.js +62 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/muc/LICENSE.txt +20 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/muc/strophe.muc.js +1003 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/ping/README.markdown +28 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/ping/strophe.ping.js +68 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/private/README.markdown +16 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/private/strophe.private.js +192 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/pubsub/strophe.pubsub.js +555 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/receipts/strophe.receipts.js +155 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/register/README.markdown +44 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/register/strophe.register.js +431 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/public/javascript/strophe.roster.js +40 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/strophe.roster.spec.js +65 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/support/jasmine.json +15 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/strophe.roster.js +438 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/.gitignore +6 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/README.md +113 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/buster.js +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/lib/strophe.js +4198 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.helper.js +38 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.js +262 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/strophe.rpc.js +464 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rsm/strophe.rsm.js +52 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/serverdate/strophe.serverdate.js +58 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/index.html +17 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/strophevcard.js +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.coffee +44 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.js +66 -0
- data/app/assets/stylesheets/xmpp/index.css +0 -0
- data/app/controllers/omniauth_callbacks_controller.rb +15 -0
- data/app/controllers/ruby_bosh.rb +221 -0
- data/app/models/identity.rb +3 -0
- data/app/models/user.rb +40 -0
- data/bin/rails +8 -0
- data/db/migrate/20140329065635_create_users.rb +10 -0
- data/db/migrate/20140329070238_create_identities.rb +11 -0
- data/lib/xmppify/version.rb +3 -0
- data/lib/xmppify.rb +6 -0
- data/xmppify.gemspec +23 -0
- metadata +197 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
|
2
|
+
Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
|
3
|
+
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
4
|
+
*/
|
5
|
+
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
|
Binary file
|
@@ -0,0 +1,386 @@
|
|
1
|
+
|
2
|
+
app = angular.module("idlecampus", ["ngResource", "$strap.directives"])
|
3
|
+
@xmpp = ["$scope","Data",($scope, Data) ->
|
4
|
+
group_name = undefined
|
5
|
+
group_code = undefined
|
6
|
+
$scope.$watch "spin", (newValue, oldValue) ->
|
7
|
+
|
8
|
+
|
9
|
+
$scope.changeEmail = ->
|
10
|
+
console.log $scope.email
|
11
|
+
$.ajax
|
12
|
+
type: "GET"
|
13
|
+
url: "/users/checkEmail"
|
14
|
+
data:
|
15
|
+
email: $scope.email
|
16
|
+
|
17
|
+
success: (data) ->
|
18
|
+
console.log parseInt(data)
|
19
|
+
$("#emailicon").attr "class", "icon-check" if parseInt(data) is 0
|
20
|
+
$("#emailicon").attr "class", "icon-remove" if parseInt(data) > 0
|
21
|
+
console.log $("#emailicon")
|
22
|
+
|
23
|
+
dataType: ""
|
24
|
+
|
25
|
+
|
26
|
+
$scope.changeName = ->
|
27
|
+
console.log "name"
|
28
|
+
console.log $scope.user
|
29
|
+
$.ajax
|
30
|
+
type: "GET"
|
31
|
+
url: "/users/checkName"
|
32
|
+
data:
|
33
|
+
name: $scope.user
|
34
|
+
|
35
|
+
success: (data) ->
|
36
|
+
$("#nameicon").attr "class", "icon-check" if parseInt(data) is 0
|
37
|
+
$("#nameicon").attr "class", "icon-remove" if parseInt(data) > 0
|
38
|
+
|
39
|
+
dataType: ""
|
40
|
+
|
41
|
+
|
42
|
+
$scope.connected = ->
|
43
|
+
iq = undefined
|
44
|
+
# $scope.XMPP.connection.pubsub.createNode $scope.XMPP.connection.jid.split("/")[0] + "/groups", "", (data) ->
|
45
|
+
# console.log data
|
46
|
+
|
47
|
+
iq = $iq(type: "get").c("query",
|
48
|
+
xmlns: "jabber:iq:roster"
|
49
|
+
)
|
50
|
+
$scope.XMPP.connection.sendIQ iq, $scope.XMPP.on_roster
|
51
|
+
$scope.XMPP.connection.addHandler $scope.XMPP.on_roster_changed, "jabber:iq:roster", "iq", "set"
|
52
|
+
$scope.XMPP.connection.addHandler $scope.XMPP.on_message, null, "message", "chat"
|
53
|
+
$scope.XMPP.connection.addHandler $scope.XMPP.on_message, null, "message", "headline"
|
54
|
+
|
55
|
+
$scope.spin = ""
|
56
|
+
$scope.disconnected = ->
|
57
|
+
|
58
|
+
unless localStorage.getItem("sid") is ""
|
59
|
+
bootbox.alert "Session Expired...Please login again", ->
|
60
|
+
window.location = "/signin"
|
61
|
+
|
62
|
+
eraseCookie("remember_token")
|
63
|
+
localStorage.clear()
|
64
|
+
XMPP.connection = null
|
65
|
+
|
66
|
+
|
67
|
+
$scope.XMPP =
|
68
|
+
NS_DATA_FORMS: "jabber:x:data"
|
69
|
+
NS_PUBSUB: "http://jabber.org/protocol/pubsub"
|
70
|
+
NS_PUBSUB_OWNER: "http://jabber.org/protocol/pubsub#owner"
|
71
|
+
NS_PUBSUB_ERRORS: "http://jabber.org/protocol/pubsub#errors"
|
72
|
+
NS_PUBSUB_NODE_CONFIG: "http://jabber.org/protocol/pubsub#node_config"
|
73
|
+
connection: null
|
74
|
+
start_time: null
|
75
|
+
jid_to_id: (jid) ->
|
76
|
+
Strophe.getBareJidFromJid(jid).replace(/@/g, "-").replace /\./g, "-"
|
77
|
+
|
78
|
+
on_roster: (iq) ->
|
79
|
+
$(iq).find("item").each ->
|
80
|
+
contact = undefined
|
81
|
+
jid = undefined
|
82
|
+
jid_id = undefined
|
83
|
+
name = undefined
|
84
|
+
jid = $(this).attr("jid")
|
85
|
+
name = $(this).attr("name") or jid
|
86
|
+
jid_id = $scope.XMPP.jid_to_id(jid)
|
87
|
+
contact = $("<li id='" + jid_id + "'>" + "<div class='roster-contact offline'>" + "<a href=#chat><img class='ui-li-icon ui-li-thumb' alt='' src=''><div class='roster-name'>" + name + "</div><div class='roster-jid'>" + jid + "</div></a></div></li>")
|
88
|
+
$scope.XMPP.insert_contact contact
|
89
|
+
|
90
|
+
$scope.XMPP.connection.addHandler $scope.XMPP.on_presence, null, "presence"
|
91
|
+
$scope.XMPP.connection.send $pres()
|
92
|
+
|
93
|
+
pending_subscriber: null
|
94
|
+
on_presence: (presence) ->
|
95
|
+
contact = undefined
|
96
|
+
from = undefined
|
97
|
+
jid_id = undefined
|
98
|
+
li = undefined
|
99
|
+
ptype = undefined
|
100
|
+
show = undefined
|
101
|
+
ptype = $(presence).attr("type")
|
102
|
+
from = $(presence).attr("from")
|
103
|
+
jid_id = $scope.XMPP.jid_to_id(from)
|
104
|
+
if ptype is "subscribe"
|
105
|
+
$scope.XMPP.pending_subscriber = from
|
106
|
+
$("#approve-jid").text Strophe.getBareJidFromJid(from)
|
107
|
+
$.mobile.changePage "#approve_dialog",
|
108
|
+
transition: "slideup"
|
109
|
+
|
110
|
+
else if ptype isnt "error"
|
111
|
+
contact = $("li#" + jid_id + " .roster-contact").removeClass("online").removeClass("away").removeClass("offline")
|
112
|
+
if ptype is "unavailable"
|
113
|
+
contact.addClass "offline"
|
114
|
+
else
|
115
|
+
show = $(presence).find("show").text()
|
116
|
+
if show is "" or show is "chat"
|
117
|
+
contact.addClass "online"
|
118
|
+
$("li#" + jid_id + " a img").attr "src", "green.jpg"
|
119
|
+
else
|
120
|
+
contact.addClass "away"
|
121
|
+
$("li#" + jid_id + " a img").attr "src", "red.png"
|
122
|
+
li = contact.parent().parent().parent()
|
123
|
+
li.remove()
|
124
|
+
$scope.XMPP.insert_contact li
|
125
|
+
jid_id = $scope.XMPP.jid_to_id(from)
|
126
|
+
$("#chat-" + jid_id).data "jid", Strophe.getBareJidFromJid(from)
|
127
|
+
true
|
128
|
+
|
129
|
+
on_roster_changed: (iq) ->
|
130
|
+
console.log "roster changed"
|
131
|
+
$(iq).find("item").each ->
|
132
|
+
contact = undefined
|
133
|
+
jid = undefined
|
134
|
+
jid_id = undefined
|
135
|
+
name = undefined
|
136
|
+
sub = undefined
|
137
|
+
sub = $(this).attr("subscription")
|
138
|
+
jid = $(this).attr("jid")
|
139
|
+
name = $(this).attr("name") or jid
|
140
|
+
jid_id = $scope.XMPP.jid_to_id(jid)
|
141
|
+
if sub is "remove"
|
142
|
+
$("#" + jid_id).remove()
|
143
|
+
else
|
144
|
+
contact = $("<li id='" + jid_id + "'>" + "<div class=" + ($("#" + jid_id).attr("class") or "roster-contact offline") + ">" + "<a href=#chat><img class='ui-li-icon ui-li-thumb' alt='' src=''><div class='roster-name'>" + name + "</div><div class='roster-jid'>" + jid + "</div></a></div></li>")
|
145
|
+
if $("#" + jid_id).length > 0
|
146
|
+
console.log 2
|
147
|
+
$("#" + jid_id).replaceWith contact
|
148
|
+
else
|
149
|
+
console.log "1"
|
150
|
+
$scope.XMPP.insert_contact contact
|
151
|
+
|
152
|
+
true
|
153
|
+
|
154
|
+
on_message: (message) ->
|
155
|
+
body = undefined
|
156
|
+
from = undefined
|
157
|
+
mess = undefined
|
158
|
+
messagetodisplay = undefined
|
159
|
+
type = undefined
|
160
|
+
console.log message
|
161
|
+
type = $(message).attr("type")
|
162
|
+
console.log type
|
163
|
+
if type is "chat"
|
164
|
+
body = $(message).children("body").text()
|
165
|
+
from = ""
|
166
|
+
console.log body
|
167
|
+
messagetodisplay = from + " : " + body
|
168
|
+
mess = "<li style='background-color:#ECEFF5; list-style:none;border:1px solid black;margin:5px'>" + messagetodisplay + "</li>"
|
169
|
+
$("ul#posts").append $(mess)
|
170
|
+
else if type = "headline"
|
171
|
+
if $(message).find("value").text()
|
172
|
+
body = $(message).find("value").text()
|
173
|
+
from = $(message).find("items").attr("node")
|
174
|
+
$scope.data.user = from
|
175
|
+
console.log body
|
176
|
+
messagetodisplay = body
|
177
|
+
$scope.data.groupMessages.push messagetodisplay
|
178
|
+
$scope.$digest()
|
179
|
+
true
|
180
|
+
|
181
|
+
scroll_chat: (jid_id) ->
|
182
|
+
div = undefined
|
183
|
+
div = $("#chat-" + jid_id + " .chat-messages").get(0)
|
184
|
+
div.scrollTop = div.scrollHeight
|
185
|
+
|
186
|
+
presence_value: (elem) ->
|
187
|
+
if elem.hasClass("online")
|
188
|
+
return 2
|
189
|
+
else
|
190
|
+
return 1 if elem.hasClass("away")
|
191
|
+
0
|
192
|
+
|
193
|
+
insert_contact: (elem) ->
|
194
|
+
contacts = undefined
|
195
|
+
inserted = undefined
|
196
|
+
jid = undefined
|
197
|
+
pres = undefined
|
198
|
+
jid = elem.find(".roster-jid").text()
|
199
|
+
pres = $scope.XMPP.presence_value(elem.find(".roster-contact"))
|
200
|
+
contacts = $("ul#myfriends li")
|
201
|
+
if contacts.length > 0
|
202
|
+
inserted = false
|
203
|
+
contacts.each ->
|
204
|
+
cmp_jid = undefined
|
205
|
+
cmp_pres = undefined
|
206
|
+
cmp_pres = $scope.XMPP.presence_value($(this).find(".roster-contact"))
|
207
|
+
cmp_jid = $(this).find(".roster-jid").text()
|
208
|
+
if pres > cmp_pres
|
209
|
+
$(this).before elem
|
210
|
+
inserted = true
|
211
|
+
false
|
212
|
+
else if pres is cmp_pres
|
213
|
+
if jid < cmp_jid
|
214
|
+
$(this).before elem
|
215
|
+
inserted = true
|
216
|
+
false
|
217
|
+
|
218
|
+
$("ul#myfriends").append elem unless inserted
|
219
|
+
else
|
220
|
+
$("ul#myfriends").append elem
|
221
|
+
|
222
|
+
callback: (status) ->
|
223
|
+
alert connection
|
224
|
+
if status is Strophe.Status.REGISTER
|
225
|
+
alert 10
|
226
|
+
alert connection
|
227
|
+
connection.register.fields.username = "juliet"
|
228
|
+
alert "100"
|
229
|
+
connection.register.fields.password = "R0m30"
|
230
|
+
lert "100"
|
231
|
+
alert "before"
|
232
|
+
connection.register.submit()
|
233
|
+
alert "after"
|
234
|
+
else if status is Strophe.Status.REGISTERED
|
235
|
+
alert 101
|
236
|
+
console.log "registered!"
|
237
|
+
connection.authenticate()
|
238
|
+
else if status is Strophe.Status.CONNECTED
|
239
|
+
alert 102
|
240
|
+
console.log "logged in!"
|
241
|
+
else
|
242
|
+
alert "con"
|
243
|
+
alert "con" + connection
|
244
|
+
|
245
|
+
$scope.getNodeSubscriptions = (group) ->
|
246
|
+
$scope.XMPP.connection.pubsub.getNodeSubscriptions group, (data) ->
|
247
|
+
console.log "Subscribers"
|
248
|
+
console.log data
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
$scope.connect = (user, password) ->
|
253
|
+
connection = undefined
|
254
|
+
connection = new Strophe.Connection("http://idlecampus.com/http-bind")
|
255
|
+
connection.connect user, password, (status) ->
|
256
|
+
$scope.XMPP.connection = connection
|
257
|
+
console.log status
|
258
|
+
|
259
|
+
connection.xmlInput = (body) ->
|
260
|
+
console.log body
|
261
|
+
|
262
|
+
connection.xmlOutput = (body) ->
|
263
|
+
console.log "XMPP OUTPUT"
|
264
|
+
console.log body
|
265
|
+
localStorage.setItem "rid", $(body).attr("rid")
|
266
|
+
localStorage.setItem "sid", $(body).attr("sid")
|
267
|
+
|
268
|
+
$scope.getGroupsCreated = ->
|
269
|
+
$.get "/groups", (data) ->
|
270
|
+
console.log "groups created"
|
271
|
+
console.log data
|
272
|
+
for d in data
|
273
|
+
Data.groupscreated.push d
|
274
|
+
|
275
|
+
|
276
|
+
$scope.checkIfGroupsToCreate = ->
|
277
|
+
if (typeof gon isnt "undefined" and gon isnt null) and (gon.group?)
|
278
|
+
grouo_name = gon.group.group_name
|
279
|
+
group_code = gon.group.grup_code
|
280
|
+
$scope.XMPP.connection.pubsub.publish $scope.XMPP.connection.jid.split("/")[0] + "/groups", group_code, (data) ->
|
281
|
+
|
282
|
+
$scope.register1 = ->
|
283
|
+
console.log gon.attacher
|
284
|
+
form = $scope.signupform
|
285
|
+
connection = new Strophe.Connection("http://idlecampus.com//http-bind")
|
286
|
+
sid = localStorage.getItem("sid")
|
287
|
+
rid = localStorage.getItem("rid")
|
288
|
+
jid = localStorage.getItem("jid")
|
289
|
+
console.log "CREDENTIALS"
|
290
|
+
console.log sid
|
291
|
+
console.log rid
|
292
|
+
console.log jid
|
293
|
+
console.log connection
|
294
|
+
callback = (status) ->
|
295
|
+
console.log status
|
296
|
+
if status is Strophe.Status.REGISTER
|
297
|
+
connection.register.fields.username = user
|
298
|
+
connection.register.fields.password = password
|
299
|
+
connection.register.submit()
|
300
|
+
else if status is Strophe.Status.REGISTERED
|
301
|
+
localStorage.setItem "jid", user + "@idlecampus.com"
|
302
|
+
$scope.connect user + "@idlecampus.com", password
|
303
|
+
$scope.$digest()
|
304
|
+
else if status is Strophe.Status.CONNECTED
|
305
|
+
console.log "logged in!"
|
306
|
+
else
|
307
|
+
|
308
|
+
if (typeof gon isnt "undefined" and gon isnt null) and (gon.register?)
|
309
|
+
user = gon.register.name
|
310
|
+
email = gon.register.email
|
311
|
+
password = gon.register.password
|
312
|
+
connection.register.connect "idlecampus.com", callback, 60, 1
|
313
|
+
if (typeof gon isnt "undefined" and gon isnt null) and (gon.attacher?)
|
314
|
+
user = gon.attacher.user
|
315
|
+
password = gon.attacher.password
|
316
|
+
localStorage.setItem "jid", user + "@idlecampus.com"
|
317
|
+
return $scope.connect(user + "@idlecampus.com", password)
|
318
|
+
|
319
|
+
if (typeof jid isnt "undefined" and jid isnt null) and (typeof sid isnt "undefined" and sid isnt null) and (typeof rid isnt "undefined" and rid isnt null) and jid isnt "" and sid isnt "" and rid isnt ""
|
320
|
+
console.log connection
|
321
|
+
connection.xmlInput = (body) ->
|
322
|
+
console.log body
|
323
|
+
|
324
|
+
connection.xmlOutput = (body) ->
|
325
|
+
console.log "XMPP OUTPUT"
|
326
|
+
console.log body
|
327
|
+
localStorage.setItem "rid", $(body).attr("rid")
|
328
|
+
localStorage.setItem "sid", $(body).attr("sid")
|
329
|
+
|
330
|
+
connection.attach jid, sid, rid, (status) ->
|
331
|
+
console.log status
|
332
|
+
if status is Strophe.Status.CONNECTED or status is Strophe.Status.ATTACHED
|
333
|
+
$scope.XMPP.connection = connection
|
334
|
+
$scope.XMPP.connection.jid = jid
|
335
|
+
console.log "attached"
|
336
|
+
$scope.connected()
|
337
|
+
$scope.getGroupsCreated()
|
338
|
+
$scope.checkIfGroupsToCreate()
|
339
|
+
else
|
340
|
+
$(document).trigger "disconnected" if status is Strophe.Status.DISCONNECTED
|
341
|
+
|
342
|
+
$scope.XMPP.connection = connection
|
343
|
+
|
344
|
+
$scope.signout = ->
|
345
|
+
|
346
|
+
$scope.XMPP.connection.disconnect()
|
347
|
+
localStorage.clear()
|
348
|
+
|
349
|
+
|
350
|
+
$scope.attach = ->
|
351
|
+
|
352
|
+
|
353
|
+
conn = new Strophe.Connection(gon.global.xmpp_url)
|
354
|
+
conn.xmlInput = (body) ->
|
355
|
+
console.log body if gon.global.debug
|
356
|
+
|
357
|
+
conn.xmlOutput = (body) ->
|
358
|
+
console.log body if gon.global.debug
|
359
|
+
localStorage.setItem "rid", $(body).attr("rid")
|
360
|
+
localStorage.setItem "sid", $(body).attr("sid")
|
361
|
+
|
362
|
+
sid = localStorage.getItem("sid")
|
363
|
+
rid = localStorage.getItem("rid")
|
364
|
+
jid = localStorage.getItem("jid")
|
365
|
+
|
366
|
+
if typeof gon.attacher isnt "undefined" and gon.attacher isnt null
|
367
|
+
sid = gon.attacher.id
|
368
|
+
rid = gon.attacher.rid
|
369
|
+
jid = gon.attacher.jid
|
370
|
+
group = gon.attacher.group
|
371
|
+
localStorage.setItem "jid", jid
|
372
|
+
if jid and sid and rid
|
373
|
+
conn.attach jid, sid, rid, (status) ->
|
374
|
+
console.log status if gon.global.env != "test"
|
375
|
+
if status is Strophe.Status.CONNECTED or status is Strophe.Status.ATTACHED
|
376
|
+
$scope.XMPP.connection = conn
|
377
|
+
$scope.XMPP.connection.jid = jid
|
378
|
+
$scope.connected()
|
379
|
+
$scope.XMPP.connection.pubsub.subscribe group, "", ((data) ->
|
380
|
+
), ((data) ->
|
381
|
+
|
382
|
+
|
383
|
+
), ((data) ->
|
384
|
+
), true if group
|
385
|
+
else
|
386
|
+
$scope.disconnected() if status is Strophe.Status.DISCONNECTED]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2006-2010 Collecta, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Strophe.js Plugins
|
2
|
+
|
3
|
+
[Strophe.js](http://code.stanziq.com/strophe) is a JavaScript library for
|
4
|
+
speaking XMPP in web applications. It supports extension via a plugin system.
|
5
|
+
|
6
|
+
This is a collection of Strophe.js plugins created and maintained by the
|
7
|
+
community. The homepage for this collection is
|
8
|
+
https://github.com/metajack/strophejs-plugins .
|
9
|
+
|
10
|
+
## Available Plugins
|
11
|
+
|
12
|
+
### XMPP Extensions
|
13
|
+
|
14
|
+
- [Data Forms](strophejs-plugins/tree/master/dataforms/)
|
15
|
+
([XEP 0004](http://xmpp.org/extensions/xep-0004.html))
|
16
|
+
|
17
|
+
- [Jabber-RPC](strophejs-plugins/tree/master/rpc/)
|
18
|
+
([XEP 0009](http://xmpp.org/extensions/xep-0009.html))
|
19
|
+
|
20
|
+
- [Service Discovery](strophejs-plugins/tree/master/disco/)
|
21
|
+
([XEP 0030](http://xmpp.org/extensions/xep-0030.html))
|
22
|
+
|
23
|
+
- [Multi-User Chat](strophejs-plugins/tree/master/muc/)
|
24
|
+
([XEP 0045](http://xmpp.org/extensions/xep-0045.html))
|
25
|
+
|
26
|
+
- [Private XML Storage](strophejs-plugins/tree/master/private/)
|
27
|
+
([XEP 0049](http://xmpp.org/extensions/xep-0049.html))
|
28
|
+
|
29
|
+
- [Ad-Hoc Commands](strophejs-plugins/tree/master/cmds/)
|
30
|
+
([XEP 0050](http://xmpp.org/extensions/xep-0050.html))
|
31
|
+
|
32
|
+
- [vcard-temp](strophejs-plugins/tree/master/vcard/)
|
33
|
+
([XEP 0054](http://xmpp.org/extensions/xep-0054.html))
|
34
|
+
|
35
|
+
- [Result Set Management](strophejs-plugins/tree/master/rsm/)
|
36
|
+
([XEP 0059](http://xmpp.org/extensions/xep-0059.html))
|
37
|
+
|
38
|
+
- [Publish-Subscribe](strophejs-plugins/tree/master/pubsub/)
|
39
|
+
([XEP 0060](http://xmpp.org/extensions/xep-0060.html))
|
40
|
+
|
41
|
+
- [Jabber Object Access Protocol](strophejs-plugins/tree/master/joap/)
|
42
|
+
([XEP 0075](http://xmpp.org/extensions/xep-0075.html))
|
43
|
+
|
44
|
+
- [In-Band Registration](strophejs-plugins/tree/master/register/)
|
45
|
+
([XEP 0077](http://xmpp.org/extensions/xep-0077.html))
|
46
|
+
|
47
|
+
- [Chat State Notifications](strophejs-plugins/tree/master/chatstates/)
|
48
|
+
([XEP 0085](http://xmpp.org/extensions/xep-0085.html))
|
49
|
+
|
50
|
+
- [Entity Capabilities](strophejs-plugins/tree/master/caps/)
|
51
|
+
([XEP 0115](http://xmpp.org/extensions/xep-0115.html))
|
52
|
+
|
53
|
+
- [Message Archiving](strophejs-plugins/tree/master/archive/)
|
54
|
+
([XEP 0136](http://xmpp.org/extensions/xep-0136.html))
|
55
|
+
|
56
|
+
- [Personal Eventing Protocol](strophejs-plugins/tree/master/pep/)
|
57
|
+
([XEP 0163](http://xmpp.org/extensions/xep-0163.html))
|
58
|
+
|
59
|
+
- [Message Delivery Receipts](strophejs-plugins/tree/master/receipts/)
|
60
|
+
([XEP 0184](http://xmpp.org/extensions/xep-0184.html))
|
61
|
+
|
62
|
+
- [XMPP Ping](strophejs-plugins/tree/master/ping/)
|
63
|
+
([XEP 0199](http://xmpp.org/extensions/xep-0199.html))
|
64
|
+
|
65
|
+
- [Roster Versioning](strophejs-plugins/tree/master/roster/)
|
66
|
+
([XEP 0237](http://xmpp.org/extensions/xep-0237.html))
|
67
|
+
|
68
|
+
- [Message Archive Management](strophejs-plugins/tree/master/mam/)
|
69
|
+
([XEP 0313](http://xmpp.org/extensions/xep-0313.html))
|
70
|
+
|
71
|
+
### Other Plugins
|
72
|
+
|
73
|
+
- [Serverdate](strophejs-plugins/tree/master/serverdate/) - Syncs a local clock
|
74
|
+
to the servers
|
75
|
+
|
76
|
+
- [epic](strophejs-plugins/tree/master/epic/)
|
77
|
+
|
78
|
+
- [iexdomain](strophejs-plugins/tree/master/iexdomain/) - Support for IE
|
79
|
+
XDomainRequest
|
80
|
+
|
81
|
+
## Contribute
|
82
|
+
|
83
|
+
If you would like to make your plugin available here, simply fork this
|
84
|
+
repository, commit your plugin and issue a pull request.
|
85
|
+
The same instructions also work for any changes you wish to make to existing
|
86
|
+
plugins.
|
87
|
+
|
88
|
+
## Literature
|
89
|
+
|
90
|
+
The book Professional XMPP Programming with JavaScript and
|
91
|
+
[jQuery](http://jquery.com/) is also available, which covers Strophe in detail
|
92
|
+
in the context of web applications.
|
93
|
+
You can find more information and two free chapters ( including one specifically
|
94
|
+
on writing Strophe.js plugins ) at the [homepage](http://professionalxmpp.com)
|
95
|
+
of the book.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# strophe.archive.js
|
2
|
+
|
3
|
+
strophe.archive.js is a plugin to provide Message Archiving
|
4
|
+
( [XEP-0136](http://xmpp.org/extensions/xep-0136.html) ).
|
5
|
+
|
6
|
+
## Notes on Browser support
|
7
|
+
If you want to support Browsers which do not support setISO8601 on a Date-Object (like e.g. FF 11), include iso8601_support.js, too.
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
## ToDo
|
12
|
+
|
13
|
+
- describe usage
|
14
|
+
- write specs
|
@@ -0,0 +1,32 @@
|
|
1
|
+
if (!Date.prototype.setISO6801) {
|
2
|
+
// from http://stackoverflow.com/questions/5249216/javascript-timestamp-from-iso8061
|
3
|
+
Date.prototype.setISO8601 = function(dString){
|
4
|
+
var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;
|
5
|
+
if (dString.toString().match(new RegExp(regexp))) {
|
6
|
+
var d = dString.match(new RegExp(regexp));
|
7
|
+
var offset = 0;
|
8
|
+
this.setUTCDate(1);
|
9
|
+
this.setUTCFullYear(parseInt(d[1],10));
|
10
|
+
this.setUTCMonth(parseInt(d[3],10) - 1);
|
11
|
+
this.setUTCDate(parseInt(d[5],10));
|
12
|
+
this.setUTCHours(parseInt(d[7],10));
|
13
|
+
this.setUTCMinutes(parseInt(d[9],10));
|
14
|
+
this.setUTCSeconds(parseInt(d[11],10));
|
15
|
+
if (d[12]) {
|
16
|
+
this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
|
17
|
+
}
|
18
|
+
else {
|
19
|
+
this.setUTCMilliseconds(0);
|
20
|
+
}
|
21
|
+
if (d[13] != 'Z') {
|
22
|
+
offset = (d[15] * 60) + parseInt(d[17],10);
|
23
|
+
offset *= ((d[14] == '-') ? -1 : 1);
|
24
|
+
this.setTime(this.getTime() - offset * 60 * 1000);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
this.setTime(Date.parse(dString));
|
29
|
+
}
|
30
|
+
return this;
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
// http://xmpp.org/extensions/xep-0136.html
|
2
|
+
Strophe.addConnectionPlugin('archive', {
|
3
|
+
_connection: null,
|
4
|
+
|
5
|
+
init: function(connection) {
|
6
|
+
this._connection = connection;
|
7
|
+
Strophe.addNamespace('DELAY', 'jabber:x:delay');
|
8
|
+
Strophe.addNamespace('ARCHIVE', 'http://www.xmpp.org/extensions/xep-0136.html#ns');
|
9
|
+
},
|
10
|
+
|
11
|
+
listCollections: function(jid, rsm, callback) {
|
12
|
+
var xml = $iq({type: 'get', id: this._connection.getUniqueId('list')}).c('list', {xmlns: Strophe.NS.ARCHIVE, 'with': jid});
|
13
|
+
if (rsm) { xml = xml.cnode(rsm.toXML()); }
|
14
|
+
this._connection.sendIQ(xml, this._handleListConnectionResponse.bind(this, callback));
|
15
|
+
},
|
16
|
+
|
17
|
+
_handleListConnectionResponse: function(callback, stanza) {
|
18
|
+
var collections = [];
|
19
|
+
var chats = stanza.getElementsByTagName('chat');
|
20
|
+
for (var ii = 0; ii < chats.length; ii++) {
|
21
|
+
var jid = chats[ii].getAttribute('with');
|
22
|
+
var start = chats[ii].getAttribute('start');
|
23
|
+
collections.push(new Strophe.ArchivedCollection(this._connection, jid, start));
|
24
|
+
}
|
25
|
+
var responseRsm = new Strophe.RSM({xml: stanza.getElementsByTagName('set')[0]});
|
26
|
+
callback(collections, responseRsm);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
|
30
|
+
Strophe.ArchivedCollection = function(connection, jid, start) {
|
31
|
+
this.connection = connection;
|
32
|
+
this.jid = jid;
|
33
|
+
this.start = start;
|
34
|
+
this.startDate = (new Date()).setISO8601(start);
|
35
|
+
};
|
36
|
+
|
37
|
+
Strophe.ArchivedCollection.prototype = {
|
38
|
+
retrieveMessages: function(rsm, callback) {
|
39
|
+
var builder = $iq({type: 'get', id: this.connection.getUniqueId('retrieve')}).c('retrieve', {xmlns: Strophe.NS.ARCHIVE, 'with': this.jid, start: this.start});
|
40
|
+
if (rsm) { builder = builder.cnode(rsm.toXML()); }
|
41
|
+
this.connection.sendIQ(builder, function(stanza) {
|
42
|
+
var messages = [];
|
43
|
+
var myJid = Strophe.getBareJidFromJid(this.connection.jid);
|
44
|
+
var responseRsm;
|
45
|
+
var timestamp = this.startDate;
|
46
|
+
var msgTimestamp;
|
47
|
+
var chat = stanza.getElementsByTagName('chat')[0];
|
48
|
+
var element = chat.firstChild;
|
49
|
+
while (element) {
|
50
|
+
switch (element.tagName) {
|
51
|
+
case 'to':
|
52
|
+
msgTimestamp = this._incrementTimestampForMessage(timestamp, element);
|
53
|
+
messages.push(new Strophe.ArchivedMessage(msgTimestamp, myJid, this.jid, Strophe.getText(element.getElementsByTagName('body')[0])));
|
54
|
+
break;
|
55
|
+
case 'from':
|
56
|
+
msgTimestamp = this._incrementTimestampForMessage(timestamp, element);
|
57
|
+
messages.push(new Strophe.ArchivedMessage(msgTimestamp, this.jid, myJid, Strophe.getText(element.getElementsByTagName('body')[0])));
|
58
|
+
break;
|
59
|
+
case 'set':
|
60
|
+
responseRsm = new Strophe.RSM({xml: element});
|
61
|
+
break;
|
62
|
+
default:
|
63
|
+
break;
|
64
|
+
}
|
65
|
+
element = element.nextSibling;
|
66
|
+
}
|
67
|
+
callback(messages, responseRsm);
|
68
|
+
}.bind(this));
|
69
|
+
},
|
70
|
+
|
71
|
+
_incrementTimestampForMessage: function(timestamp, element) {
|
72
|
+
var secs = element.getAttribute('secs');
|
73
|
+
var newTimestamp = new Date();
|
74
|
+
newTimestamp.setTime(timestamp.getTime() + Number(secs) * 1000);
|
75
|
+
return newTimestamp;
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
Strophe.ArchivedMessage = function(timestamp, from, to, body) {
|
80
|
+
this.timestamp = timestamp;
|
81
|
+
this.from = from;
|
82
|
+
this.to = to;
|
83
|
+
this.body = body;
|
84
|
+
};
|
85
|
+
|
86
|
+
Strophe.ArchivedMessage.prototype = {
|
87
|
+
};
|
88
|
+
|