Lines Matching refs:Presence
29 import org.jivesoftware.smack.packet.Presence;
42 * Manges information about the agents in a workgroup and their presence.
57 private Map<String, Map<String, Presence>> presenceMap;
72 presenceMap = new HashMap<String, Map<String, Presence>>();
76 // Listen for any presence packets.
78 new PacketTypeFilter(Presence.class));
116 Map<String,Presence> userPresences = presenceMap.get(jid);
118 Iterator<Presence> presences = userPresences.values().iterator();
120 // Fire the presence changed event
190 * Returns the presence info for a particular agent, or <tt>null</tt> if the agent
191 * is unavailable (offline) or if no presence information is available.<p>
195 * @return the agent's current presence, or <tt>null</tt> if the agent is unavailable
196 * or if no presence information is available..
198 public Presence getPresence(String user) {
200 Map<String, Presence> userPresences = presenceMap.get(key);
202 Presence presence = new Presence(Presence.Type.unavailable);
203 presence.setFrom(user);
204 return presence;
210 Presence p;
211 Presence presence = null;
214 p = (Presence)userPresences.get(it.next());
215 if (presence == null){
216 presence = p;
219 if (p.getPriority() > presence.getPriority()) {
220 presence = p;
224 if (presence == null) {
225 presence = new Presence(Presence.Type.unavailable);
226 presence.setFrom(user);
227 return presence;
230 return presence;
272 listeners[i].presenceChanged((Presence)eventObject);
279 * Listens for all presence packets and processes them.
283 Presence presence = (Presence)packet;
284 String from = presence.getFrom();
287 System.out.println("Presence with no FROM: " + presence.toXML());
292 // If an "available" packet, add it to the presence map. Each presence map will hold
293 // for a particular user a map with the presence packets saved for each resource.
294 if (presence.getType() == Presence.Type.available) {
295 // Ignore the presence packet unless it has an agent status extension.
296 AgentStatus agentStatus = (AgentStatus)presence.getExtension(
301 // Ensure that this presence is coming from an Agent of the same workgroup
306 Map<String, Presence> userPresences;
307 // Get the user presence map
309 userPresences = new HashMap<String, Presence>();
315 // Add the new presence, using the resources as a key.
317 userPresences.put(StringUtils.parseResource(from), presence);
329 // If an "unavailable" packet, remove any entries in the presence map.
330 else if (presence.getType() == Presence.Type.unavailable) {
332 Map<String,Presence> userPresences = presenceMap.get(key);
366 // Removing the user from the roster, so remove any presence information