Commit 92a18780 authored by JC Brand's avatar JC Brand

Override jarnxmpp.Presence.onlineCount to use the ChatPartners storage.

parent e10256a7
......@@ -7,7 +7,8 @@ var helpers = (function (helpers) {
}
return o;
};
helpers.hash =function (str) {
helpers.hash = function (str) {
// FIXME
if (str == 'online-users-container') {
return str;
......@@ -15,6 +16,17 @@ var helpers = (function (helpers) {
var shaobj = new jsSHA(str);
return shaobj.getHash("HEX");
};
helpers.size = function (obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
size++;
}
}
return size;
};
return helpers;
})(helpers || {});
......@@ -51,6 +63,10 @@ var xmppchat = (function (jarnxmpp, $, console) {
}
}
};
methods.getTotal = function () {
return helpers.size(storage);
};
return methods;
})();
......@@ -121,6 +137,10 @@ var xmppchat = (function (jarnxmpp, $, console) {
xmppchat.connection.sendIQ(iq, this.handleCollectionRetrieval, this.handleError);
};
ob.Presence.onlineCount = function () {
return xmppchat.ChatPartners.getTotal();
};
ob.Presence.sendPresence = function (type) {
if (type === undefined) {
type = xmppchat.Storage.get(xmppchat.username+'-xmpp-status') || 'online';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment