/** * Asks the workgroup for information about the occupants of the specified room. The returned * information will include the real JID of the occupants, the nickname of the user in the * room as well as the date when the user joined the room. * * @param roomID the room to get information about its occupants. * @return information about the occupants of the specified room. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { OccupantsInfo request = new OccupantsInfo(roomID); request.setType(IQ.Type.get); request.setTo(workgroupJID); OccupantsInfo response = (OccupantsInfo) connection.createStanzaCollectorAndSend(request).nextResultOrThrow(); return response; }
/** * Asks the workgroup for information about the occupants of the specified room. The returned * information will include the real JID of the occupants, the nickname of the user in the * room as well as the date when the user joined the room. * * @param roomID the room to get information about its occupants. * @return information about the occupants of the specified room. * @throws XMPPException if an error occurs while getting information from the server. */ public OccupantsInfo getOccupantsInfo(String roomID) throws XMPPException { OccupantsInfo request = new OccupantsInfo(roomID); request.setType(IQ.Type.GET); request.setTo(workgroupJID); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID())); connection.sendPacket(request); OccupantsInfo response = (OccupantsInfo)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response; }
@Override public OccupantsInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID")); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG && "occupant".equals(parser.getName())) { occupantsInfo.occupants.add(parseOccupantInfo(parser)); } else if (eventType == XmlPullParser.END_TAG && ELEMENT_NAME.equals(parser.getName())) { done = true; } } return occupantsInfo; }
/** * Asks the workgroup for information about the occupants of the specified room. The returned * information will include the real JID of the occupants, the nickname of the user in the * room as well as the date when the user joined the room. * * @param roomID the room to get information about its occupants. * @return information about the occupants of the specified room. * @throws XMPPException if an error occurs while getting information from the server. */ public OccupantsInfo getOccupantsInfo(String roomID) throws XMPPException { OccupantsInfo request = new OccupantsInfo(roomID); request.setType(IQ.Type.GET); request.setTo(workgroupJID); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID())); connection.sendPacket(request); OccupantsInfo response = (OccupantsInfo)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response; }
public IQ parseIQ(XmlPullParser parser) throws Exception { if (parser.getEventType() != XmlPullParser.START_TAG) { throw new IllegalStateException("Parser not in proper position, or bad XML."); } OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID")); boolean done = false; while (!done) { int eventType = parser.next(); if ((eventType == XmlPullParser.START_TAG) && ("occupant".equals(parser.getName()))) { occupantsInfo.occupants.add(parseOccupantInfo(parser)); } else if (eventType == XmlPullParser.END_TAG && ELEMENT_NAME.equals(parser.getName())) { done = true; } } return occupantsInfo; }
/** * Asks the workgroup for information about the occupants of the specified room. The returned * information will include the real JID of the occupants, the nickname of the user in the * room as well as the date when the user joined the room. * * @param roomID the room to get information about its occupants. * @return information about the occupants of the specified room. * @throws XMPPException if an error occurs while getting information from the server. */ public OccupantsInfo getOccupantsInfo(String roomID) throws XMPPException { OccupantsInfo request = new OccupantsInfo(roomID); request.setType(IQ.Type.GET); request.setTo(workgroupJID); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID())); connection.sendPacket(request); OccupantsInfo response = (OccupantsInfo)collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return response; }
public IQ parseIQ(XmlPullParser parser) throws Exception { if (parser.getEventType() != XmlPullParser.START_TAG) { throw new IllegalStateException("Parser not in proper position, or bad XML."); } OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID")); boolean done = false; while (!done) { int eventType = parser.next(); if ((eventType == XmlPullParser.START_TAG) && ("occupant".equals(parser.getName()))) { occupantsInfo.occupants.add(parseOccupantInfo(parser)); } else if (eventType == XmlPullParser.END_TAG && ELEMENT_NAME.equals(parser.getName())) { done = true; } } return occupantsInfo; }
public IQ parseIQ(XmlPullParser parser) throws Exception { if (parser.getEventType() != XmlPullParser.START_TAG) { throw new IllegalStateException("Parser not in proper position, or bad XML."); } OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID")); boolean done = false; while (!done) { int eventType = parser.next(); if ((eventType == XmlPullParser.START_TAG) && ("occupant".equals(parser.getName()))) { occupantsInfo.occupants.add(parseOccupantInfo(parser)); } else if (eventType == XmlPullParser.END_TAG && ELEMENT_NAME.equals(parser.getName())) { done = true; } } return occupantsInfo; }