/** * Constructs a new AgentRoster. * * @param connection an XMPP connection. * @throws NotConnectedException */ AgentRoster(XMPPConnection connection, String workgroupJID) throws NotConnectedException { this.connection = connection; this.workgroupJID = workgroupJID; entries = new ArrayList<String>(); listeners = new ArrayList<AgentRosterListener>(); presenceMap = new HashMap<String, Map<String, Presence>>(); // Listen for any roster packets. StanzaFilter rosterFilter = new StanzaTypeFilter(AgentStatusRequest.class); connection.addAsyncStanzaListener(new AgentStatusListener(), rosterFilter); // Listen for any presence packets. connection.addAsyncStanzaListener(new PresencePacketListener(), new StanzaTypeFilter(Presence.class)); // Send request for roster. AgentStatusRequest request = new AgentStatusRequest(); request.setTo(workgroupJID); connection.sendStanza(request); }
/** * Constructs a new AgentRoster. * * @param connection an XMPP connection. */ AgentRoster(Connection connection, String workgroupJID) { this.connection = connection; this.workgroupJID = workgroupJID; entries = new ArrayList<String>(); listeners = new ArrayList<AgentRosterListener>(); presenceMap = new HashMap<String, Map<String, Presence>>(); // Listen for any roster packets. PacketFilter rosterFilter = new PacketTypeFilter(AgentStatusRequest.class); connection.addPacketListener(new AgentStatusListener(), rosterFilter); // Listen for any presence packets. connection.addPacketListener(new PresencePacketListener(), new PacketTypeFilter(Presence.class)); // Send request for roster. AgentStatusRequest request = new AgentStatusRequest(); request.setTo(workgroupJID); connection.sendPacket(request); }
/** * Constructs a new AgentRoster. * * @param connection * an XMPP connection. */ AgentRoster(Connection connection, String workgroupJID) { this.connection = connection; this.workgroupJID = workgroupJID; entries = new ArrayList<String>(); listeners = new ArrayList<AgentRosterListener>(); presenceMap = new HashMap<String, Map<String, Presence>>(); // Listen for any roster packets. PacketFilter rosterFilter = new PacketTypeFilter( AgentStatusRequest.class); connection.addPacketListener(new AgentStatusListener(), rosterFilter); // Listen for any presence packets. connection.addPacketListener(new PresencePacketListener(), new PacketTypeFilter(Presence.class)); // Send request for roster. AgentStatusRequest request = new AgentStatusRequest(); request.setTo(workgroupJID); connection.sendPacket(request); }
public void processPacket(Stanza packet) { if (packet instanceof AgentStatusRequest) { AgentStatusRequest statusRequest = (AgentStatusRequest)packet; for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) { AgentStatusRequest.Item item = i.next(); String agentJID = item.getJID(); if ("remove".equals(item.getType())) { // Removing the user from the roster, so remove any presence information // about them. String key = XmppStringUtils.parseLocalpart(XmppStringUtils.parseLocalpart(agentJID) + "@" + XmppStringUtils.parseDomain(agentJID)); presenceMap.remove(key); // Fire event for roster listeners. fireEvent(EVENT_AGENT_REMOVED, agentJID); } else { entries.add(agentJID); // Fire event for roster listeners. fireEvent(EVENT_AGENT_ADDED, agentJID); } } // Mark the roster as initialized. rosterInitialized = true; } }
public void processPacket(Packet packet) { if (packet instanceof AgentStatusRequest) { AgentStatusRequest statusRequest = (AgentStatusRequest)packet; for (Iterator i = statusRequest.getAgents().iterator(); i.hasNext();) { AgentStatusRequest.Item item = (AgentStatusRequest.Item)i.next(); String agentJID = item.getJID(); if ("remove".equals(item.getType())) { // Removing the user from the roster, so remove any presence information // about them. String key = StringUtils.parseName(StringUtils.parseName(agentJID) + "@" + StringUtils.parseServer(agentJID)); presenceMap.remove(key); // Fire event for roster listeners. fireEvent(EVENT_AGENT_REMOVED, agentJID); } else { entries.add(agentJID); // Fire event for roster listeners. fireEvent(EVENT_AGENT_ADDED, agentJID); } } // Mark the roster as initialized. rosterInitialized = true; } }
public void processPacket(Packet packet) { if (packet instanceof AgentStatusRequest) { AgentStatusRequest statusRequest = (AgentStatusRequest)packet; for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) { AgentStatusRequest.Item item = i.next(); String agentJID = item.getJID(); if ("remove".equals(item.getType())) { // Removing the user from the roster, so remove any presence information // about them. String key = StringUtils.parseName(StringUtils.parseName(agentJID) + "@" + StringUtils.parseServer(agentJID)); presenceMap.remove(key); // Fire event for roster listeners. fireEvent(EVENT_AGENT_REMOVED, agentJID); } else { entries.add(agentJID); // Fire event for roster listeners. fireEvent(EVENT_AGENT_ADDED, agentJID); } } // Mark the roster as initialized. rosterInitialized = true; } }
public void processPacket(Packet packet) { if (packet instanceof AgentStatusRequest) { AgentStatusRequest statusRequest = (AgentStatusRequest) packet; for (Iterator i = statusRequest.getAgents().iterator(); i .hasNext();) { AgentStatusRequest.Item item = (AgentStatusRequest.Item) i .next(); String agentJID = item.getJID(); if ("remove".equals(item.getType())) { // Removing the user from the roster, so remove any // presence information // about them. String key = StringUtils.parseName(StringUtils .parseName(agentJID) + "@" + StringUtils.parseServer(agentJID)); presenceMap.remove(key); // Fire event for roster listeners. fireEvent(EVENT_AGENT_REMOVED, agentJID); } else { entries.add(agentJID); // Fire event for roster listeners. fireEvent(EVENT_AGENT_ADDED, agentJID); } } // Mark the roster as initialized. rosterInitialized = true; } }
/** * Reloads the entire roster from the server. This is an asynchronous operation, * which means the method will return immediately, and the roster will be * reloaded at a later point when the server responds to the reload request. */ public void reload() { AgentStatusRequest request = new AgentStatusRequest(); request.setTo(workgroupJID); connection.sendPacket(request); }
/** * Reloads the entire roster from the server. This is an asynchronous operation, * which means the method will return immediately, and the roster will be * reloaded at a later point when the server responds to the reload request. * @throws NotConnectedException */ public void reload() throws NotConnectedException { AgentStatusRequest request = new AgentStatusRequest(); request.setTo(workgroupJID); connection.sendStanza(request); }
/** * Reloads the entire roster from the server. This is an asynchronous * operation, which means the method will return immediately, and the roster * will be reloaded at a later point when the server responds to the reload * request. */ public void reload() { AgentStatusRequest request = new AgentStatusRequest(); request.setTo(workgroupJID); connection.sendPacket(request); }