Examples of XMPPSession


Examples of com.anzsoft.client.XMPP.mandioca.XmppSession

   {
     String newStatus = statusEditor.getText();
     if(!newStatus.equalsIgnoreCase(status.status()))
     {
       String show = status.show();
       XmppSession session = JabberApp.instance().getSession();
       if(show == null||show.isEmpty())
       {
        
         session.getUser().sendPresence(PresenceShow.emptyShow(), newStatus);
       }
       else
       {
         session.getUser().sendPresence(PresenceShow.get(show), newStatus);
       }
     }
     statusLabel.setVisible(true);
     statusEditor.setVisible(false);
   }
View Full Code Here

Examples of com.anzsoft.client.XMPP.mandioca.XmppSession

   private void changeShow(final String show)
   {
     if(!show.equals(status.show()))
     {

       XmppSession session = JabberApp.instance().getSession();
       if(show == null||show.isEmpty())
         session.getUser().sendPresence(PresenceShow.emptyShow(),status.status());
       else
         session.getUser().sendPresence(PresenceShow.get(show),status.status());
     }
   }
View Full Code Here

Examples of com.anzsoft.client.XMPP.mandioca.XmppSession

    setButtonBar(bar);
  }
 
  private void getRooms(final String jid)
  {
    XmppSession session = JabberApp.instance().getSession();
    XmppQuery query = session.getFactory().createQuery();
    query.setIQ(jid, XmppQuery.TYPE_GET, TextUtils.genUniqueId());
    query.setQuery("http://jabber.org/protocol/disco#items");
    session.send(query,new XmppPacketListener()
    {
      public void onPacketReceived(XmppPacket packet)
      {
        onRooms(packet);
      }
View Full Code Here

Examples of com.anzsoft.client.XMPP.mandioca.XmppSession

  public void onLogin(final String user,final String pass,XmppEventAdapter eventAdapter)
  {
    initConnection();
    if(eventAdapter != null)
      connection.addEventListener(eventAdapter);
    session = new XmppSession(connection, true);
    disco = new ServiceDiscovery(session);
    new XmppPushRoster(session);
    XmppUserSettings userSetting = new XmppUserSettings(host,port,domain, user, pass, AuthType.fromString(authType));
    session.login(userSetting);
    session.getUser().getRoster().addRosterListener(createRosterListener());
View Full Code Here

Examples of com.anzsoft.client.XMPP.mandioca.XmppSession

  {
    this.domain = domain;
    initConnection();
    if(eventAdapter != null)
      connection.addEventListener(eventAdapter);
    session = new XmppSession(connection, true);
    disco = new ServiceDiscovery(session);
    new XmppPushRoster(session);
    XmppUserSettings userSetting;
    if(sasl)
      userSetting = new XmppUserSettings(host,port,domain, user, pass, XmppUserSettings.SASL);
View Full Code Here

Examples of rocks.xmpp.core.session.XmppSession

    @Test
    public void testAttentionManager() {

        MockServer mockServer = new MockServer();

        XmppSession xmppSession1 = new TestXmppSession(ROMEO, mockServer);
        XmppSession xmppSession2 = new TestXmppSession(JULIET, mockServer);

        final boolean[] attentionReceived = {false};
        xmppSession2.addMessageListener(new MessageListener() {
            @Override
            public void handle(MessageEvent e) {
                if (e.isIncoming() && e.getMessage().getExtension(Attention.class) != null && e.getMessage().getType() == AbstractMessage.Type.HEADLINE) {
                    attentionReceived[0] = true;
                    Assert.assertEquals(e.getMessage().getType(), AbstractMessage.Type.HEADLINE);
View Full Code Here

Examples of rocks.xmpp.core.session.XmppSession

    @Test
    public void testReachabilityManager() {

        MockServer mockServer = new MockServer();

        XmppSession xmppSession1 = new TestXmppSession(ROMEO, mockServer);
        XmppSession xmppSession2 = new TestXmppSession(JULIET, mockServer);

        final boolean[] attentionReceived = {false};
        xmppSession2.addMessageListener(new MessageListener() {
            @Override
            public void handle(MessageEvent e) {
                if (e.isIncoming() && e.getMessage().getExtension(Attention.class) != null && e.getMessage().getType() == AbstractMessage.Type.HEADLINE) {
                    attentionReceived[0] = true;
                    Assert.assertEquals(e.getMessage().getType(), AbstractMessage.Type.HEADLINE);
View Full Code Here

Examples of rocks.xmpp.core.session.XmppSession

    @Test
    public void testManager() {
        MockServer mockServer = new MockServer();

        XmppSession xmppSession1 = new TestXmppSession(ROMEO, mockServer);
        XmppSession xmppSession2 = new TestXmppSession(JULIET, mockServer);

        MessageDeliveryReceiptsManager messageDeliveryReceiptsManager1 = xmppSession1.getExtensionManager(MessageDeliveryReceiptsManager.class);
        // Test if the manager is disabled by default.
        Assert.assertFalse(messageDeliveryReceiptsManager1.isEnabled());

        messageDeliveryReceiptsManager1.setEnabled(true);
        MessageDeliveryReceiptsManager messageDeliveryReceiptsManager2 = xmppSession2.getExtensionManager(MessageDeliveryReceiptsManager.class);
        messageDeliveryReceiptsManager2.setEnabled(true);

        final boolean[] messageReceived = {false};
        final String[] receivedId = {null};
        messageDeliveryReceiptsManager1.setEnabled(true);
View Full Code Here

Examples of rocks.xmpp.core.session.XmppSession

    @Test
    public void testManagerIfContactDoesNotSupportReceipts() {
        MockServer mockServer = new MockServer();

        XmppSession xmppSession1 = new TestXmppSession(ROMEO, mockServer);
        XmppSession xmppSession2 = new TestXmppSession(JULIET, mockServer);

        MessageDeliveryReceiptsManager messageDeliveryReceiptsManager1 = xmppSession1.getExtensionManager(MessageDeliveryReceiptsManager.class);
        messageDeliveryReceiptsManager1.setEnabled(true);
        MessageDeliveryReceiptsManager messageDeliveryReceiptsManager2 = xmppSession2.getExtensionManager(MessageDeliveryReceiptsManager.class);
        messageDeliveryReceiptsManager2.setEnabled(false);

        final boolean[] messageReceived = {false};
        messageDeliveryReceiptsManager1.setEnabled(true);
        messageDeliveryReceiptsManager1.addMessageDeliveredListener(new MessageDeliveredListener() {
View Full Code Here

Examples of rocks.xmpp.core.session.XmppSession

    @Test
    public void testManagerIfNoMessageId() {
        MockServer mockServer = new MockServer();

        XmppSession xmppSession1 = new TestXmppSession(ROMEO, mockServer);
        MessageDeliveryReceiptsManager messageDeliveryReceiptsManager1 = xmppSession1.getExtensionManager(MessageDeliveryReceiptsManager.class);
        messageDeliveryReceiptsManager1.setEnabled(true);
        xmppSession1.addMessageListener(new MessageListener() {
            @Override
            public void handle(MessageEvent e) {
                Assert.assertNull(e.getMessage().getExtension(Request.class));
            }
        });

        Message message = new Message(JULIET);
        xmppSession1.send(message);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.