Smack

org.jivesoftware.smack.packet
Class PrivacyItem

java.lang.Object
  extended by org.jivesoftware.smack.packet.PrivacyItem

public class PrivacyItem
extends Object

A privacy item acts a rule that when matched defines if a packet should be blocked or not. Privacy Items can handle different kind of blocking communications based on JID, group, subscription type or globally by:

Author:
Francisco Vives

Nested Class Summary
static class PrivacyItem.PrivacyRule
          Privacy Rule represents the kind of action to apply.
static class PrivacyItem.Type
          Type defines if the rule is based on JIDs, roster groups or presence subscription types.
 
Constructor Summary
PrivacyItem(String type, boolean allow, int order)
          Creates a new privacy item.
 
Method Summary
 int getOrder()
          Returns the order where the receiver is processed.
 PrivacyItem.Type getType()
          Returns the type hold the kind of communication it will allow or block.
 String getValue()
          Returns the element identifier to apply the action.
 boolean isAllow()
          Returns the action associated with the item, it MUST be filled and will allow or deny the communication.
 boolean isFilterEverything()
          Returns whether the receiver allows or denies every kind of communication.
 boolean isFilterIQ()
          Returns whether the receiver allow or deny incoming IQ stanzas or not.
 boolean isFilterMessage()
          Returns whether the receiver allows or denies incoming messages or not.
 boolean isFilterPresence_in()
          Returns whether the receiver allows or denies incoming presence or not.
 boolean isFilterPresence_out()
          Returns whether the receiver allows or denies incoming presence or not.
 void setFilterIQ(boolean filterIQ)
          Sets whether the receiver allows or denies incoming IQ stanzas or not.
 void setFilterMessage(boolean filterMessage)
          Sets wheather the receiver allows or denies incoming messages or not.
 void setFilterPresence_in(boolean filterPresence_in)
          Sets whether the receiver allows or denies incoming presence or not.
 void setFilterPresence_out(boolean filterPresence_out)
          Sets whether the receiver allows or denies outgoing presence or not.
 void setValue(String value)
          Sets the element identifier to apply the action.
 String toXML()
          Answer an xml representation of the receiver according to the RFC 3921.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrivacyItem

public PrivacyItem(String type,
                   boolean allow,
                   int order)
Creates a new privacy item.

Parameters:
type - the type.
Method Detail

isAllow

public boolean isAllow()
Returns the action associated with the item, it MUST be filled and will allow or deny the communication.

Returns:
the allow communication status.

isFilterIQ

public boolean isFilterIQ()
Returns whether the receiver allow or deny incoming IQ stanzas or not.

Returns:
the iq filtering status.

setFilterIQ

public void setFilterIQ(boolean filterIQ)
Sets whether the receiver allows or denies incoming IQ stanzas or not.

Parameters:
filterIQ - indicates if the receiver allows or denies incoming IQ stanzas.

isFilterMessage

public boolean isFilterMessage()
Returns whether the receiver allows or denies incoming messages or not.

Returns:
the message filtering status.

setFilterMessage

public void setFilterMessage(boolean filterMessage)
Sets wheather the receiver allows or denies incoming messages or not.

Parameters:
filterMessage - indicates if the receiver allows or denies incoming messages or not.

isFilterPresence_in

public boolean isFilterPresence_in()
Returns whether the receiver allows or denies incoming presence or not.

Returns:
the iq filtering incoming presence status.

setFilterPresence_in

public void setFilterPresence_in(boolean filterPresence_in)
Sets whether the receiver allows or denies incoming presence or not.

Parameters:
filterPresence_in - indicates if the receiver allows or denies filtering incoming presence.

isFilterPresence_out

public boolean isFilterPresence_out()
Returns whether the receiver allows or denies incoming presence or not.

Returns:
the iq filtering incoming presence status.

setFilterPresence_out

public void setFilterPresence_out(boolean filterPresence_out)
Sets whether the receiver allows or denies outgoing presence or not.

Parameters:
filterPresence_out - indicates if the receiver allows or denies filtering outgoing presence

getOrder

public int getOrder()
Returns the order where the receiver is processed. List items are processed in ascending order. The order MUST be filled and its value MUST be a non-negative integer that is unique among all items in the list.

Returns:
the order number.

setValue

public void setValue(String value)
Sets the element identifier to apply the action. If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID. If the type is "group", then the 'value' attribute SHOULD contain the name of a group in the user's roster. If the type is "subscription", then the 'value' attribute MUST be one of "both", "to", "from", or "none".

Parameters:
value - is the identifier to apply the action.

getType

public PrivacyItem.Type getType()
Returns the type hold the kind of communication it will allow or block. It MUST be filled with one of these values: jid, group or subscription.

Returns:
the type of communication it represent.

getValue

public String getValue()
Returns the element identifier to apply the action. If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID. If the type is "group", then the 'value' attribute SHOULD contain the name of a group in the user's roster. If the type is "subscription", then the 'value' attribute MUST be one of "both", "to", "from", or "none".

Returns:
the identifier to apply the action.

isFilterEverything

public boolean isFilterEverything()
Returns whether the receiver allows or denies every kind of communication. When filterIQ, filterMessage, filterPresence_in and filterPresence_out are not set the receiver will block all communications.

Returns:
the all communications status.

toXML

public String toXML()
Answer an xml representation of the receiver according to the RFC 3921.

Returns:
the text xml representation.

Smack

Copyright © 2003-2007 Jive Software.