agent = new Agent(connection, workgroupJID);
/** * Return the agents name. * * @return - the agents name. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public String getName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { AgentInfo agentInfo = new AgentInfo(); agentInfo.setType(IQ.Type.get); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); AgentInfo response = connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow(); return response.getName(); }
/** * Changes the name of the agent in the server. The server may have this functionality * disabled for all the agents or for this agent in particular. If the agent is not * allowed to change his name then an exception will be thrown with a service_unavailable * error code. * * @param newName the new name of the agent. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public void setName(String newName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { AgentInfo agentInfo = new AgentInfo(); agentInfo.setType(IQ.Type.set); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); agentInfo.setName(newName); connection.createStanzaCollectorAndSend(agentInfo).nextResultOrThrow(); } }
connection.addPacketListener(packetListener, filter); agent = new Agent(connection, workgroupJID);
/** * Return the agents name. * * @return - the agents name. */ public String getName() throws XMPPException { AgentInfo agentInfo = new AgentInfo(); agentInfo.setType(IQ.Type.GET); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID())); // Send the request connection.sendPacket(agentInfo); AgentInfo response = (AgentInfo)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response.getName(); }
connection.addPacketListener(packetListener, filter); agent = new Agent(connection, workgroupJID);
/** * Return the agents name. * * @return - the agents name. */ public String getName() throws XMPPException { AgentInfo agentInfo = new AgentInfo(); agentInfo.setType(IQ.Type.GET); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID())); // Send the request connection.sendPacket(agentInfo); AgentInfo response = (AgentInfo)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response.getName(); }
connection.addPacketListener(packetListener, filter); agent = new Agent(connection, workgroupJID);
/** * Return the agents name. * * @return - the agents name. */ public String getName() throws XMPPException { AgentInfo agentInfo = new AgentInfo(); agentInfo.setType(IQ.Type.GET); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID())); // Send the request connection.sendPacket(agentInfo); AgentInfo response = (AgentInfo)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response.getName(); }
agentInfo.setType(IQ.Type.SET); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); agentInfo.setName(newName); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
agentInfo.setType(IQ.Type.SET); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); agentInfo.setName(newName); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
agentInfo.setType(IQ.Type.SET); agentInfo.setTo(workgroupJID); agentInfo.setFrom(getUser()); agentInfo.setName(newName); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));