Package org.jivesoftware.smackx.packet

Examples of org.jivesoftware.smackx.packet.DiscoverInfo$Identity


     *
     * @return the reserved room nickname or <tt>null</tt> if none.
     */
    public String getReservedNickname() {
        try {
            DiscoverInfo result =
                ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(
                    room,
                    "x-roomuser-item");
            // Look for an Identity that holds the reserved nickname and return its name
            for (Iterator<DiscoverInfo.Identity> identities = result.getIdentities();
                 identities.hasNext();) {
                DiscoverInfo.Identity identity = identities.next();
                return identity.getName();
            }
            // If no Identity was found then the user does not have a reserved room nickname
View Full Code Here


  {
    Node node = nodeMap.get(id);
   
    if (node == null)
    {
      DiscoverInfo info = new DiscoverInfo();
      info.setTo(to);
      info.setNode(id);
     
      DiscoverInfo infoReply = (DiscoverInfo)SyncPacketSend.getReply(con, info);
     
      if (infoReply.getIdentities().next().getType().equals(NodeType.leaf.toString()))
        node = new LeafNode(con, id);
      else
        node = new CollectionNode(con, id);
      node.setTo(to);
      nodeMap.put(id, node);
View Full Code Here

            DiscoverItems items = disco.discoverItems(connection.getServiceName());

            Iterator iter = items.getItems();
            while (iter.hasNext()) {
                DiscoverItems.Item item = (DiscoverItems.Item) iter.next();
                DiscoverInfo info = disco.discoverInfo(item.getEntityID());

                Iterator<DiscoverInfo.Identity> iter2 = info.getIdentities();
                while (iter2.hasNext()) {
                    DiscoverInfo.Identity identity = iter2.next();
                    if (identity.getCategory().equals("proxy") && identity.getType().equals("stun"))
                        if (info.containsFeature(NAMESPACE))
                            return true;
                }

                LOGGER.debug(item.getName()+"-"+info.getType());

            }
        }
        catch (XMPPException e) {
            e.printStackTrace();
View Full Code Here

    @Test
    public void validateRoomWithEmptyForm()
    {
  DataForm dataForm = new DataForm("result");
 
  DiscoverInfo discoInfo = new DiscoverInfo();
  discoInfo.addExtension(dataForm);
  RoomInfo roomInfo = new RoomInfo(discoInfo);
  assertTrue(roomInfo.getDescription().isEmpty());
  assertTrue(roomInfo.getSubject().isEmpty());
  assertEquals(-1, roomInfo.getOccupantsCount());
    }
View Full Code Here

public class EntityUseCases extends SingleUserTestCase
{
  public void testDiscoverPubsubInfo() throws Exception
  {
    DiscoverInfo supportedFeatures = getManager().getSupportedFeatures();
    assertNotNull(supportedFeatures);
  }
View Full Code Here

  }

  public void testDiscoverNodeInfo() throws Exception
  {
    LeafNode myNode = getManager().createNode("DiscoNode" + System.currentTimeMillis());
    DiscoverInfo info = myNode.discoverInfo();
    assertTrue(info.getIdentities().hasNext());
    Identity ident = info.getIdentities().next();
   
    assertEquals("leaf", ident.getType());
  }
View Full Code Here

  FormField occupants = new FormField("muc#roominfo_occupants");
  occupants.addValue("3");
  dataForm.addField(occupants);

  DiscoverInfo discoInfo = new DiscoverInfo();
  discoInfo.addExtension(dataForm);
  RoomInfo roomInfo = new RoomInfo(discoInfo);
  assertEquals("The place for all good witches!", roomInfo.getDescription());
  assertEquals("Spells", roomInfo.getSubject());
  assertEquals(3, roomInfo.getOccupantsCount());
    }
View Full Code Here

            // User2 joins the new room
            MultiUserChat muc2 = new MultiUserChat(getConnection(1), room);
            muc2.join("testbot2");

            // User2 discovers information about User1
            DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(getConnection(1))
                    .discoverInfo(room + "/testbot", null);

            assertNotNull("No info was discovered from room occupant", info);
            assertEquals("Wrong IQ type", IQ.Type.RESULT, info.getType());
            assertEquals("Wrong IQ sender", room + "/testbot", info.getFrom());

            // User2 leaves the room
            muc2.leave();
        }
        catch (Exception e) {
View Full Code Here

     * @return a boolean indicating whether the specified user handles Jingle
     *         messages
     */
    public static boolean isServiceEnabled(Connection connection, String userID) {
        try {
            DiscoverInfo result = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(userID);
            return result.containsFeature(Jingle.NAMESPACE);
        } catch (XMPPException e) {
            e.printStackTrace();
            return false;
        }
    }
View Full Code Here

//                if (item.getEntityID().startsWith("rtpbridge.")) {
//                    return true;
//                }
//            }
           
            DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName());
            Iterator iter = discoInfo.getIdentities();
            while (iter.hasNext()) {
                DiscoverInfo.Identity identity = (DiscoverInfo.Identity) iter.next();
                if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) {
          return true;
        }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.packet.DiscoverInfo$Identity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.