Examples of Privacy


Examples of org.jivesoftware.smack.packet.Privacy

     *
     * @return the privacy list of the default list.
     * @throws XMPPException if an error occurs.
     */
    public PrivacyList getDefaultList() throws XMPPException {
        Privacy privacyAnswer = this.getPrivacyWithListNames();
        String listName = privacyAnswer.getDefaultName();
        boolean isDefaultAndActive = privacyAnswer.getActiveName() != null
                && privacyAnswer.getDefaultName() != null
                && privacyAnswer.getActiveName().equals(
                privacyAnswer.getDefaultName());
        return new PrivacyList(isDefaultAndActive, true, listName, getPrivacyListItems(listName));
    }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

     * @throws XMPPException if an error occurs.
     */
    private List<PrivacyItem> getPrivacyListItems(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<PrivacyItem>());
       
        // Send the package to the server and get the answer
        Privacy privacyAnswer = getRequest(request);
       
        return privacyAnswer.getPrivacyList(listName);
    }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

     *
     * @return an array of privacy lists.
     * @throws XMPPException if an error occurs.
     */
    public PrivacyList[] getPrivacyLists() throws XMPPException {
        Privacy privacyAnswer = this.getPrivacyWithListNames();
        Set<String> names = privacyAnswer.getPrivacyListNames();
        PrivacyList[] lists = new PrivacyList[names.size()];
        boolean isActiveList;
        boolean isDefaultList;
        int index=0;
        for (String listName : names) {
            isActiveList = listName.equals(privacyAnswer.getActiveName());
            isDefaultList = listName.equals(privacyAnswer.getDefaultName());
            lists[index] = new PrivacyList(isActiveList, isDefaultList,
                    listName, getPrivacyListItems(listName));
            index = index + 1;
        }
        return lists;
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

   * @exception XMPPException if the request or the answer failed, it raises an exception.
   */
  public void setActiveListName(String listName) throws XMPPException {
   
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setActiveName(listName);
   
    // Send the package to the server
    setRequest(request);
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

     * @throws XMPPException if an error occurs.
   */
  public void declineActiveList() throws XMPPException {
   
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setDeclineActiveList(true);
   
    // Send the package to the server
    setRequest(request);
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

   * @exception XMPPException if the request or the answer failed, it raises an exception.
   */
  public void setDefaultListName(String listName) throws XMPPException {
   
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setDefaultName(listName);
   
    // Send the package to the server
    setRequest(request);
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

     * @throws XMPPException if an error occurs.
   */
  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

     * @throws XMPPException if an error occurs.
     */
    public void updatePrivacyList(String listName, List<PrivacyItem> 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

     * @throws XMPPException if an error occurs.
   */
  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<PrivacyItem>());

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

Examples of org.jivesoftware.smack.packet.Privacy

  public PrivacyProvider() {
  }

  public IQ parseIQ(XmlPullParser parser) throws Exception {
        Privacy privacy = new Privacy();
        /* privacy.addExtension(PacketParserUtils.parsePacketExtension(parser
                .getName(), parser.getNamespace(), parser)); */
        privacy.addExtension(new DefaultPacketExtension(parser.getName(), parser.getNamespace()));
        boolean done = false;
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG) {
                if (parser.getName().equals("active")) {
                  String activeName = parser.getAttributeValue("", "name");
                  if (activeName == null) {
                    privacy.setDeclineActiveList(true);
                  } else {
                    privacy.setActiveName(activeName);
                  }
                }
                else if (parser.getName().equals("default")) {
                  String defaultName = parser.getAttributeValue("", "name");
                  if (defaultName == null) {
                    privacy.setDeclineDefaultList(true);
                  } else {
                    privacy.setDefaultName(defaultName);
                  }
                }
                else if (parser.getName().equals("list")) {
                    parseList(parser, privacy);
                }
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.