Tabnine Logo
Subscription.getJid
Code IndexAdd Tabnine to your IDE (free)

How to use
getJid
method
in
org.jivesoftware.smackx.pubsub.Subscription

Best Java code snippets using org.jivesoftware.smackx.pubsub.Subscription.getJid (Showing top 4 results out of 315)

origin: igniterealtime/Smack

  @Test
  public void subscriptionsOwnerResultTest() throws Exception {
    // @formatter:off
    final String resultStanza =
     "<iq from='pubsub.example.org' to='julia@example.org/Smack' id='HaT4m-13' type='result'>" +
      "<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>" +
       "<subscriptions node='test'>" +
        "<subscription jid='foo@example.org/Smack' subscription='subscribed' subid='58C1A6F99F2A7'/>" +
        "<subscription jid='julia@example.org/Smack' subscription='subscribed' subid='58C18F8917321'/>" +
       "</subscriptions>" +
      "</pubsub>" +
     "</iq>";
    // @formatter:on
    XmlPullParser parser = TestUtils.getIQParser(resultStanza);
    PubSub pubsubResult = (PubSub) PacketParserUtils.parseIQ(parser);
    SubscriptionsExtension subElem = pubsubResult.getExtension(PubSubElementType.SUBSCRIPTIONS_OWNER);
    List<Subscription> subscriptions = subElem.getSubscriptions();
    assertEquals(2, subscriptions.size());

    Subscription sub1 = subscriptions.get(0);
    assertThat("foo@example.org/Smack", equalsCharSequence(sub1.getJid()));
    assertEquals(Subscription.State.subscribed, sub1.getState());
    assertEquals("58C1A6F99F2A7", sub1.getId());

    Subscription sub2 = subscriptions.get(1);
    assertThat("julia@example.org/Smack", equalsCharSequence(sub2.getJid()));
    assertEquals(Subscription.State.subscribed, sub2.getState());
    assertEquals("58C18F8917321", sub2.getId());
  }
}
origin: igniterealtime/Smack

@Test
public void modifySubscriptionsAsOwnerTest() throws InterruptedException, SmackException, IOException, XMPPException, Exception {
  ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
  PubSubManager mgr = new PubSubManager(con, JidTestUtil.PUBSUB_EXAMPLE_ORG);
  Node testNode = new LeafNode(mgr, "princely_musings");
  List<Subscription> ChangeSubs = Arrays.asList(
    new Subscription(JidCreate.from("romeo@montague.org"), Subscription.State.subscribed),
    new Subscription(JidCreate.from("juliet@capulet.org"), Subscription.State.none)
  );
  testNode.modifySubscriptionsAsOwner(ChangeSubs);
  PubSub request = con.getSentPacket();
  assertEquals("http://jabber.org/protocol/pubsub#owner", request.getChildElementNamespace());
  assertEquals("pubsub", request.getChildElementName());
  XmlPullParser parser = TestUtils.getIQParser(request.toXML(null).toString());
  PubSub pubsubResult = (PubSub) PacketParserUtils.parseIQ(parser);
  SubscriptionsExtension subElem = pubsubResult.getExtension(PubSubElementType.SUBSCRIPTIONS_OWNER);
  List<Subscription> subscriptions = subElem.getSubscriptions();
  assertEquals(2, subscriptions.size());
  Subscription sub1 = subscriptions.get(0);
  assertEquals("romeo@montague.org", sub1.getJid().toString());
  assertEquals(Subscription.State.subscribed, sub1.getState());
  Subscription sub2 = subscriptions.get(1);
  assertEquals("juliet@capulet.org", sub2.getJid().toString());
  assertEquals(Subscription.State.none, sub2.getState());
}
origin: jitsi/jicofo

/**
 * Checks if given <tt>jid</tt> is registered for PubSub updates on given
 * <tt>node</tt>.
 */
private boolean isSubscribed(EntityFullJid jid, Node node)
    throws XMPPException.XMPPErrorException,
    NotConnectedException,
    InterruptedException,
    NoResponseException
{
  // FIXME: consider using local flag rather than getting the list
  // of subscriptions
  for (org.jivesoftware.smackx.pubsub.Subscription subscription
        : node.getSubscriptions())
  {
    if (subscription.getJid().equals(jid.toString()))
    {
      return true;
    }
  }
  return false;
}
origin: org.renci/xmpp-pubsub

/**
 * 
 * @param nodeName - node name
 * @param s - subscription
 */
public synchronized void unsubscribeFromNode(String nodeName, Subscription s) {
  try {
    LeafNode node = (LeafNode)manager.getNode(nodeName);
    node.unsubscribe(s.getJid(), s.getId());
  } catch (XMPPException e) {
    logger.error("XMPP Error unsubscribing from XMPP pubsub node: " + e);
  } catch (Exception e) {
    logger.error("Error unsubscribing from XMPP pubsub node: " + e);
  }
}
org.jivesoftware.smackx.pubsubSubscriptiongetJid

Javadoc

Gets the JID the subscription is created for

Popular methods of Subscription

  • <init>
    Construct a subscription change request to the specified state.
  • getNode
  • toXML
  • appendAttribute
  • getId
    Gets the subscription id
  • getState
    Gets the current subscription state.

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • JPanel (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now