Examples of Privacy


Examples of org.jivesoftware.smack.packet.Privacy

   * Client declines the use of default lists.
   */
  public void declineDefaultList() throws XMPPException {
   
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setDeclineDefaultList(true);
   
    // Send the package to the server
    setRequest(request);
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

     * @param privacyItems a List with every {@link PrivacyItem} in the list.
     */
    public void updatePrivacyList(String listName, List privacyItems) throws XMPPException {

        // Build the privacy package to add or update the new list
        Privacy request = new Privacy();
        request.setPrivacyList(listName, privacyItems);

        // Send the package to the server
        setRequest(request);
    }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

     * @param listName the list that has changed its content.
   */
  public void deletePrivacyList(String listName) throws XMPPException {
   
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setPrivacyList(listName, new ArrayList());

    // Send the package to the server
    setRequest(request);
  }
View Full Code Here

Examples of rocks.xmpp.extensions.privacy.model.Privacy

    }


    @Test
    public void marshalPrivacyListsRequest() throws XMLStreamException, JAXBException {
        IQ iq = new IQ(IQ.Type.GET, new Privacy());
        iq.setFrom(Jid.valueOf("romeo@example.net/orchard"));
        iq.setId("getlist1");
        String xml = marshal(iq);
        Assert.assertEquals(xml, "<iq from=\"romeo@example.net/orchard\" id=\"getlist1\" type=\"get\"><query xmlns=\"jabber:iq:privacy\"></query></iq>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.privacy.model.Privacy

                "  <list name='private'/>\n" +
                "  <list name='special'/>\n" +
                "</query>\n" +
                "</iq>";
        IQ iq = unmarshal(xml, IQ.class);
        Privacy privacy = iq.getExtension(Privacy.class);
        Assert.assertNotNull(privacy);
        Assert.assertEquals(privacy.getActiveName(), "private");
        Assert.assertEquals(privacy.getDefaultName(), "public");
        Assert.assertEquals(privacy.getPrivacyLists().size(), 3);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getName(), "public");
        Assert.assertEquals(privacy.getPrivacyLists().get(1).getName(), "private");
        Assert.assertEquals(privacy.getPrivacyLists().get(2).getName(), "special");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.privacy.model.Privacy

        Assert.assertEquals(privacy.getPrivacyLists().get(2).getName(), "special");
    }

    @Test
    public void marshalPrivacyListRequest() throws XMLStreamException, JAXBException {
        IQ iq = new IQ(IQ.Type.GET, new Privacy(new PrivacyList("public")));
        iq.setFrom(Jid.valueOf("romeo@example.net/orchard"));
        iq.setId("getlist1");
        String xml = marshal(iq);
        Assert.assertEquals(xml, "<iq from=\"romeo@example.net/orchard\" id=\"getlist1\" type=\"get\"><query xmlns=\"jabber:iq:privacy\"><list name=\"public\"></list></query></iq>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.privacy.model.Privacy

                "  </list>\n" +
                "</query>\n" +
                "</iq>";

        IQ iq = unmarshal(xml, IQ.class);
        Privacy privacy = iq.getExtension(Privacy.class);
        Assert.assertNotNull(privacy);
        Assert.assertEquals(privacy.getPrivacyLists().size(), 1);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getName(), "public");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().size(), 2);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getType(), PrivacyRule.Type.JID);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getValue(), "tybalt@example.com");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getAction(), PrivacyRule.Action.DENY);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getOrder(), 1);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(1).getAction(), PrivacyRule.Action.ALLOW);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(1).getOrder(), 2);
    }
View Full Code Here

Examples of rocks.xmpp.extensions.privacy.model.Privacy

                "    <item action='deny' order='15'/>\n" +
                "  </list>\n" +
                "</query>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Privacy privacy = iq.getExtension(Privacy.class);
        Assert.assertNotNull(privacy);
        Assert.assertEquals(privacy.getPrivacyLists().size(), 1);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getName(), "private");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().size(), 2);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getType(), PrivacyRule.Type.SUBSCRIPTION);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getValue(), "both");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getAction(), PrivacyRule.Action.ALLOW);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getOrder(), 10);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(1).getAction(), PrivacyRule.Action.DENY);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(1).getOrder(), 15);
    }
View Full Code Here

Examples of rocks.xmpp.extensions.privacy.model.Privacy

                "    </item>\n" +
                "  </list>\n" +
                "</query>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Privacy privacy = iq.getExtension(Privacy.class);
        Assert.assertNotNull(privacy);
        Assert.assertEquals(privacy.getPrivacyLists().size(), 1);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getName(), "message-group-example");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().size(), 1);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getType(), PrivacyRule.Type.GROUP);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getValue(), "Enemies");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getAction(), PrivacyRule.Action.DENY);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getOrder(), 4);
    }
View Full Code Here

Examples of rocks.xmpp.extensions.privacy.model.Privacy

                "  </list>\n" +
                "</query>\n" +
                "</iq>\n";

        IQ iq = unmarshal(xml, IQ.class);
        Privacy privacy = iq.getExtension(Privacy.class);
        Assert.assertNotNull(privacy);
        Assert.assertEquals(privacy.getPrivacyLists().size(), 1);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getName(), "message-jid-example");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().size(), 1);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getType(), PrivacyRule.Type.JID);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getValue(), "tybalt@example.com");
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getAction(), PrivacyRule.Action.DENY);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getOrder(), 3);
        Assert.assertEquals(privacy.getPrivacyLists().get(0).getPrivacyRules().get(0).getOrder(), 3);
    }
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.