06-15-2015 02:26 AM
Hello,
Is there any way using Jabber sdk/api to search all people who has a specific presence.
For example the list of all people who have the "away" custom status "eating"
Thank you
06-15-2015 02:30 PM
Try something like this (the groups part probably isn't necessary - you can try to remove it):
var groups = this.client.entitySet.getAllGroups(); var arrayLength = groups.length; for (i = 0; i < arrayLength; i++) { var thisGroup = groups[i]; this.client.entitySet.each(function(entity) { if (entity instanceof jabberwerx.RosterContact && ($.inArray(thisGroup, groups) != -1)) { try { presence = entity.getPrimaryPresence(); if (presence != null) { var show = presence.getType() || presence.getShow() || "available"; var status = presence.getStatus(); var priority = presence.getPriority(); switch (show) { case "available": break; case "away": break; case "xa": break; default: break; } } } catch (ex) { log("JWA", "execption in presence " + ex); } } }); }
06-16-2015 12:49 AM
Thank you Nicholas, it looks promising
What SDK this script use ?
Can it be integrated on a non web-based jabber? (at my work we use Cisco Jabber software)
Thanks again !
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide