Examples of Privacy


Examples of org.jivesoftware.smack.packet.Privacy

                if (packet == null || packet.getError() != null) {
                    return;
                }
                // The packet is correct.
                Privacy privacy = (Privacy) packet;
               
                // Prepare the information before starting the notification
                int listNameSize = privacy.getItemLists().size();
                Object[] listItemsPairs = privacy.getItemLists().entrySet().toArray();
              
                // Notifies the event to the listeners.
                synchronized (listeners) {
                    for (Iterator i = listeners.iterator(); i.hasNext();) {
                        PrivacyListListener listener = (PrivacyListListener) i.next();
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

       
        // Send create & join packet.
        connection.sendPacket(requestPrivacy);
       
        // Wait up to a certain number of seconds for a reply.
        Privacy privacyAnswer =
            (Privacy) response.nextResult(SmackConfiguration.getPacketReplyTimeout());
       
        // Stop queuing results
        response.cancel();

        // Interprete the result and answer the privacy only if it is valid
        if (privacyAnswer == null) {
            throw new XMPPException("No response from server.");
        }
        else if (privacyAnswer.getError() != null) {
            throw new XMPPException(privacyAnswer.getError());
        }
        return privacyAnswer;
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

   * @return a Privacy with the list names.
   */
  private Privacy getPrivacyWithListNames() throws XMPPException {
   
    // The request of the list is an empty privacy message
    Privacy request = new Privacy();
   
    // Send the package to the server and get the answer
    return getRequest(request);
  }
View Full Code Here

Examples of org.jivesoftware.smack.packet.Privacy

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

Examples of org.jivesoftware.smack.packet.Privacy

     * Answer the default privacy list.
     *
     * @return the {@see PrivacyList} of the default list.
     */
    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

     * @return a list of {@link PrivacyItem} under the list listName.
     */
    private List 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());
       
        // 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

     * Answer every privacy list with the allowed and blocked permissions.
     *
     * @return a List of {@link PrivacyList}.
     */
    public PrivacyList[] getPrivacyLists() throws XMPPException {
        Privacy privacyAnswer = this.getPrivacyWithListNames();
        Set names = privacyAnswer.getPrivacyListNames();
        PrivacyList[] lists = new PrivacyList[names.size()];
        String listName;
        boolean isActiveList;
        boolean isDefaultList;
        int index=0;
        for (Iterator iter = names.iterator(); iter.hasNext();) {
            listName = (String) iter.next();
            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

   * Client declines the use of active lists.
   */
  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
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.