a:41:{s:9:"#provides";s:26:"dojox.xmpp.PresenceService";s:9:"#resource";s:23:"xmpp/PresenceService.js";s:26:"dojox.xmpp.PresenceService";a:5:{s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:11:"xmppService";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:141:" this.session= xmppService; this.isInvisible = false; this.avatarHash = null; this.presence = null; this.restrictedContactjids = {};";s:9:"classlike";b:1;s:7:"summary";s:0:"";}s:34:"dojox.xmpp.PresenceService.publish";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:8:"presence";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:954:"dojo.provide("dojox.xmpp.PresenceService"); dojox.xmpp.presence = { UPDATE: 201, SUBSCRIPTION_REQUEST: 202, // SUBSCRIPTION_REQUEST_PENDING: 203, /* used when 'ask' attribute is absent on a roster item */ SUBSCRIPTION_SUBSTATUS_NONE: 204, SUBSCRIPTION_NONE: 'none', SUBSCRIPTION_FROM: 'from', SUBSCRIPTION_TO: 'to', SUBSCRIPTION_BOTH: 'both', SUBSCRIPTION_REQUEST_PENDING: 'pending', STATUS_ONLINE: 'online', STATUS_AWAY: 'away', STATUS_CHAT: 'chat', STATUS_DND: 'dnd', STATUS_EXTENDED_AWAY: 'xa', STATUS_OFFLINE: 'offline', STATUS_INVISIBLE: 'invisible' } dojo.declare("dojox.xmpp.PresenceService", null, { constructor: function(xmppService){ this.session= xmppService; this.isInvisible = false; this.avatarHash = null; this.presence = null; this.restrictedContactjids = {}; }, publish: function(presence){ ////console.log("Presence::publish() ", presence); this.presence = presence; this._setPresence();";s:7:"summary";s:0:"";}s:41:"dojox.xmpp.PresenceService.sendAvatarHash";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"avatarHash";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:56:" this.avatarHash = avatarHash; this._setPresence();";s:7:"summary";s:0:"";}s:39:"dojox.xmpp.PresenceService._setPresence";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:6:"source";s:1641:" var presence = this.presence; var p = {xmlns: 'jabber:client'}; if (presence && presence.to){ p.to = presence.to; } if (presence.show && presence.show==dojox.xmpp.presence.STATUS_OFFLINE){ p.type = 'unavailable'; } if (presence.show && presence.show==dojox.xmpp.presence.STATUS_INVISIBLE) { this._setInvisible(); this.isInvisible = true; return; }; if(this.isInvisible) { //console.log("was invisible, making visible"); this._setVisible(); } var req = new dojox.string.Builder(dojox.xmpp.util.createElement("presence",p, false)); if (presence.show && presence.show!=dojox.xmpp.presence.STATUS_OFFLINE ) { req.append(dojox.xmpp.util.createElement("show",{},false)); req.append(presence.show); req.append(""); } if(presence.status) { req.append(dojox.xmpp.util.createElement("status",{},false)); req.append(presence.status); req.append(""); } if(this.avatarHash) { req.append(dojox.xmpp.util.createElement("x",{xmlns: 'vcard-temp:x:update'},false)); req.append(dojox.xmpp.util.createElement("photo",{},false)); req.append(this.avatarHash); req.append(""); req.append(""); } if (presence.priority && presence.show!=dojox.xmpp.presence.STATUS_OFFLINE){ if(presence.priority > 127 || presence.priority < -128){ presence.priority = 5; } req.append(dojox.xmpp.util.createElement("priority",{},false)); req.append(presence.priority); req.append(""); } req.append(""); this.session.dispatchPacket(req.toString());";s:7:"private";b:1;s:7:"summary";s:0:"";}s:45:"dojox.xmpp.PresenceService.toggleBlockContact";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:3:"jid";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:351:" if(!this.restrictedContactjids[jid]) { this.restrictedContactjids[jid] = this._createRestrictedJid(); } this.restrictedContactjids[jid].blocked = !this.restrictedContactjids[jid].blocked; //console.log("setting outbound block for ", jid, this.restrictedContactjids[jid]); this._updateRestricted(); return this.restrictedContactjids;";s:7:"summary";s:0:"";}s:51:"dojox.xmpp.PresenceService.toggleContactInvisiblity";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:3:"jid";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:358:" if(!this.restrictedContactjids[jid]) { this.restrictedContactjids[jid] = this._createRestrictedJid(); } this.restrictedContactjids[jid].invisible = !this.restrictedContactjids[jid].invisible; //console.log("setting outbound presence for ", jid, this.restrictedContactjids[jid]); this._updateRestricted(); return this.restrictedContactjids;";s:7:"summary";s:0:"";}s:47:"dojox.xmpp.PresenceService._createRestrictedJid";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:6:"source";s:43:" return {invisible: false, blocked:false};";s:7:"private";b:1;s:7:"summary";s:0:"";}s:44:"dojox.xmpp.PresenceService._updateRestricted";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:6:"source";s:1656:" var props={ id: this.session.getNextIqId(), from: this.session.jid + "/" + this.session.resource, type: "set" }; var req = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req.append(dojox.xmpp.util.createElement("list",{name: "iwcRestrictedContacts"},false)) var count = 1; for(var jid in this.restrictedContactjids) { var item = this.restrictedContactjids[jid]; //console.log("restricted ", jid, item); if(item.blocked || item.invisible) { req.append(dojox.xmpp.util.createElement("item",{value: dojox.xmpp.util.encodeJid(jid), action: "deny", order: count++},false)); if(item.blocked) { req.append(dojox.xmpp.util.createElement("message",{},true)); } if(item.invisible) { req.append(dojox.xmpp.util.createElement("presence-out",{},true)); } req.append(""); } else { delete this.restrictedContactjids[jid]; } } req.append(""); req.append(""); req.append(""); //console.log("Restricted list: ", req.toString()); var req2 = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req2.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req2.append(dojox.xmpp.util.createElement("active",{name:"iwcRestrictedContacts"},true)); req2.append(""); req2.append(""); //console.log("Activate list: ", req2.toString()); this.session.dispatchPacket(req.toString()); this.session.dispatchPacket(req2.toString());";s:7:"private";b:1;s:7:"summary";s:0:"";}s:38:"dojox.xmpp.PresenceService._setVisible";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:6:"source";s:509:" var props={ id: this.session.getNextIqId(), from: this.session.jid + "/" + this.session.resource, type: "set" }; var req = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req.append(dojox.xmpp.util.createElement("active",{},true)); req.append(""); req.append(""); //console.log(req.toString()); this.session.dispatchPacket(req.toString());";s:7:"private";b:1;s:7:"summary";s:0:"";}s:40:"dojox.xmpp.PresenceService._setInvisible";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:6:"source";s:8015:"dojo.provide("dojox.xmpp.PresenceService"); dojox.xmpp.presence = { UPDATE: 201, SUBSCRIPTION_REQUEST: 202, // SUBSCRIPTION_REQUEST_PENDING: 203, /* used when 'ask' attribute is absent on a roster item */ SUBSCRIPTION_SUBSTATUS_NONE: 204, SUBSCRIPTION_NONE: 'none', SUBSCRIPTION_FROM: 'from', SUBSCRIPTION_TO: 'to', SUBSCRIPTION_BOTH: 'both', SUBSCRIPTION_REQUEST_PENDING: 'pending', STATUS_ONLINE: 'online', STATUS_AWAY: 'away', STATUS_CHAT: 'chat', STATUS_DND: 'dnd', STATUS_EXTENDED_AWAY: 'xa', STATUS_OFFLINE: 'offline', STATUS_INVISIBLE: 'invisible' } dojo.declare("dojox.xmpp.PresenceService", null, { constructor: function(xmppService){ this.session= xmppService; this.isInvisible = false; this.avatarHash = null; this.presence = null; this.restrictedContactjids = {}; }, publish: function(presence){ ////console.log("Presence::publish() ", presence); this.presence = presence; this._setPresence(); }, /** sha1-hash-of-image */ sendAvatarHash: function(avatarHash) { this.avatarHash = avatarHash; this._setPresence(); }, _setPresence: function() { var presence = this.presence; var p = {xmlns: 'jabber:client'}; if (presence && presence.to){ p.to = presence.to; } if (presence.show && presence.show==dojox.xmpp.presence.STATUS_OFFLINE){ p.type = 'unavailable'; } if (presence.show && presence.show==dojox.xmpp.presence.STATUS_INVISIBLE) { this._setInvisible(); this.isInvisible = true; return; }; if(this.isInvisible) { //console.log("was invisible, making visible"); this._setVisible(); } var req = new dojox.string.Builder(dojox.xmpp.util.createElement("presence",p, false)); if (presence.show && presence.show!=dojox.xmpp.presence.STATUS_OFFLINE ) { req.append(dojox.xmpp.util.createElement("show",{},false)); req.append(presence.show); req.append(""); } if(presence.status) { req.append(dojox.xmpp.util.createElement("status",{},false)); req.append(presence.status); req.append(""); } if(this.avatarHash) { req.append(dojox.xmpp.util.createElement("x",{xmlns: 'vcard-temp:x:update'},false)); req.append(dojox.xmpp.util.createElement("photo",{},false)); req.append(this.avatarHash); req.append(""); req.append(""); } if (presence.priority && presence.show!=dojox.xmpp.presence.STATUS_OFFLINE){ if(presence.priority > 127 || presence.priority < -128){ presence.priority = 5; } req.append(dojox.xmpp.util.createElement("priority",{},false)); req.append(presence.priority); req.append(""); } req.append(""); this.session.dispatchPacket(req.toString()); }, /* Make visible: */ toggleBlockContact: function(jid) { if(!this.restrictedContactjids[jid]) { this.restrictedContactjids[jid] = this._createRestrictedJid(); } this.restrictedContactjids[jid].blocked = !this.restrictedContactjids[jid].blocked; //console.log("setting outbound block for ", jid, this.restrictedContactjids[jid]); this._updateRestricted(); return this.restrictedContactjids; }, toggleContactInvisiblity: function(jid) { if(!this.restrictedContactjids[jid]) { this.restrictedContactjids[jid] = this._createRestrictedJid(); } this.restrictedContactjids[jid].invisible = !this.restrictedContactjids[jid].invisible; //console.log("setting outbound presence for ", jid, this.restrictedContactjids[jid]); this._updateRestricted(); return this.restrictedContactjids; }, _createRestrictedJid: function() { return {invisible: false, blocked:false}; }, _updateRestricted: function() { var props={ id: this.session.getNextIqId(), from: this.session.jid + "/" + this.session.resource, type: "set" }; var req = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req.append(dojox.xmpp.util.createElement("list",{name: "iwcRestrictedContacts"},false)) var count = 1; for(var jid in this.restrictedContactjids) { var item = this.restrictedContactjids[jid]; //console.log("restricted ", jid, item); if(item.blocked || item.invisible) { req.append(dojox.xmpp.util.createElement("item",{value: dojox.xmpp.util.encodeJid(jid), action: "deny", order: count++},false)); if(item.blocked) { req.append(dojox.xmpp.util.createElement("message",{},true)); } if(item.invisible) { req.append(dojox.xmpp.util.createElement("presence-out",{},true)); } req.append(""); } else { delete this.restrictedContactjids[jid]; } } req.append(""); req.append(""); req.append(""); //console.log("Restricted list: ", req.toString()); var req2 = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req2.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req2.append(dojox.xmpp.util.createElement("active",{name:"iwcRestrictedContacts"},true)); req2.append(""); req2.append(""); //console.log("Activate list: ", req2.toString()); this.session.dispatchPacket(req.toString()); this.session.dispatchPacket(req2.toString()); }, _setVisible: function() { var props={ id: this.session.getNextIqId(), from: this.session.jid + "/" + this.session.resource, type: "set" }; var req = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req.append(dojox.xmpp.util.createElement("active",{},true)); req.append(""); req.append(""); //console.log(req.toString()); this.session.dispatchPacket(req.toString()); }, _setInvisible: function() { //console.log("Setting user as invisible"); var props={ id: this.session.getNextIqId(), from: this.session.jid + "/" + this.session.resource, type: "set" }; var req = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req.append(dojox.xmpp.util.createElement("list",{name: "invisible"},false)) req.append(dojox.xmpp.util.createElement("item",{action: "deny", order: "1"},false)) req.append(dojox.xmpp.util.createElement("presence-out",{},true)); req.append(""); req.append(""); req.append(""); req.append(""); props={ id: this.session.getNextIqId(), from: this.session.jid + "/" + this.session.resource, type: "set" }; var req2 = new dojox.string.Builder(dojox.xmpp.util.createElement("iq",props,false)); req2.append(dojox.xmpp.util.createElement("query",{xmlns: "jabber:iq:privacy"},false)); req2.append(dojox.xmpp.util.createElement("active",{name:"invisible"},true)); req2.append(""); req2.append(""); //console.log(req.toString()); //console.log(req2.toString()); this.session.dispatchPacket(req.toString()); this.session.dispatchPacket(req2.toString());";s:7:"private";b:1;s:7:"summary";s:0:"";}s:47:"dojox.xmpp.PresenceService._manageSubscriptions";a:6:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:7:"contact";a:1:{s:4:"type";s:0:"";}s:4:"type";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:227:" if (!contact){return;} if (contact.indexOf('@')==-1){ contact += '@' + this.session.domain; } var req = dojox.xmpp.util.createElement("presence",{to:contact,type:type},true); this.session.dispatchPacket(req);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:36:"dojox.xmpp.PresenceService.subscribe";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"contact";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:50:" this._manageSubscriptions(contact, "subscribe");";s:7:"summary";s:0:"";}s:46:"dojox.xmpp.PresenceService.approveSubscription";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"contact";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:51:" this._manageSubscriptions(contact, "subscribed");";s:7:"summary";s:0:"";}s:38:"dojox.xmpp.PresenceService.unsubscribe";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"contact";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:52:" this._manageSubscriptions(contact, "unsubscribe");";s:7:"summary";s:0:"";}s:46:"dojox.xmpp.PresenceService.declineSubscription";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"contact";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:53:" this._manageSubscriptions(contact, "unsubscribed");";s:7:"summary";s:0:"";}s:45:"dojox.xmpp.PresenceService.cancelSubscription";a:5:{s:9:"prototype";s:26:"dojox.xmpp.PresenceService";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"contact";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:53:" this._manageSubscriptions(contact, "unsubscribed");";s:7:"summary";s:0:"";}s:35:"dojox.xmpp.PresenceService.presence";a:2:{s:8:"instance";s:26:"dojox.xmpp.PresenceService";s:7:"summary";s:0:"";}s:37:"dojox.xmpp.PresenceService.avatarHash";a:2:{s:8:"instance";s:26:"dojox.xmpp.PresenceService";s:7:"summary";s:0:"";}s:38:"dojox.xmpp.PresenceService.isInvisible";a:2:{s:8:"instance";s:26:"dojox.xmpp.PresenceService";s:7:"summary";s:0:"";}s:34:"dojox.xmpp.PresenceService.session";a:2:{s:8:"instance";s:26:"dojox.xmpp.PresenceService";s:7:"summary";s:0:"";}s:48:"dojox.xmpp.PresenceService.restrictedContactjids";a:2:{s:8:"instance";s:26:"dojox.xmpp.PresenceService";s:7:"summary";s:0:"";}s:19:"dojox.xmpp.presence";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:26:"dojox.xmpp.presence.UPDATE";a:1:{s:7:"summary";s:0:"";}s:40:"dojox.xmpp.presence.SUBSCRIPTION_REQUEST";a:1:{s:7:"summary";s:0:"";}s:47:"dojox.xmpp.presence.SUBSCRIPTION_SUBSTATUS_NONE";a:1:{s:7:"summary";s:0:"";}s:37:"dojox.xmpp.presence.SUBSCRIPTION_NONE";a:1:{s:7:"summary";s:0:"";}s:37:"dojox.xmpp.presence.SUBSCRIPTION_FROM";a:1:{s:7:"summary";s:0:"";}s:35:"dojox.xmpp.presence.SUBSCRIPTION_TO";a:1:{s:7:"summary";s:0:"";}s:37:"dojox.xmpp.presence.SUBSCRIPTION_BOTH";a:1:{s:7:"summary";s:0:"";}s:48:"dojox.xmpp.presence.SUBSCRIPTION_REQUEST_PENDING";a:1:{s:7:"summary";s:0:"";}s:33:"dojox.xmpp.presence.STATUS_ONLINE";a:1:{s:7:"summary";s:0:"";}s:31:"dojox.xmpp.presence.STATUS_AWAY";a:1:{s:7:"summary";s:0:"";}s:31:"dojox.xmpp.presence.STATUS_CHAT";a:1:{s:7:"summary";s:0:"";}s:30:"dojox.xmpp.presence.STATUS_DND";a:1:{s:7:"summary";s:0:"";}s:40:"dojox.xmpp.presence.STATUS_EXTENDED_AWAY";a:1:{s:7:"summary";s:0:"";}s:34:"dojox.xmpp.presence.STATUS_OFFLINE";a:1:{s:7:"summary";s:0:"";}s:36:"dojox.xmpp.presence.STATUS_INVISIBLE";a:1:{s:7:"summary";s:0:"";}s:10:"dojox.xmpp";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}