DJabberd

 view release on metacpan or  search on metacpan

doc/rfc3921-notes.txt  view on Meta::CPAN

   their defined attributes and child elements, refer to [XMPP-CORE].

5.1.  Client and Server Presence Responsibilities

5.1.1.  Initial Presence

   After establishing a session, a client SHOULD send initial presence
   to the server in order to signal its availability for communications.
   As defined herein, the initial presence stanza (1) MUST possess no
   'to' address (signalling that it is meant to be broadcasted by the
   server on behalf of the client) and (2) MUST possess no 'type'
   attribute (signalling the user's availability).  After sending
   initial presence, an active resource is said to be an "available
   resource".

   Upon receiving initial presence from a client, the user's server MUST
   do the following if there is not already one or more available
   resources for the user (if there is already one or more available
   resources for the user, the server obviously does not need to send
   the presence probes, since it already possesses the requisite
   information):

   1.  Send presence probes (i.e., presence stanzas whose 'type'
       attribute is set to a value of "probe") from the full JID (e.g.,
       <user@example.com/resource>) of the user to all contacts to which
       the user is subscribed in order to determine if they are
       available; such contacts are those for which a JID is present in
       the user's roster with the 'subscription' attribute set to a
       value of "to" or "both".  (Note: The user's server MUST NOT send
       presence probes to contacts from which the user is blocking



Saint-Andre                 Standards Track                    [Page 16]

RFC 3921                        XMPP IM                     October 2004


       inbound presence notifications, as described under Blocking
       Inbound Presence Notifications (Section 10.10).)

   2.  Broadcast initial presence from the full JID (e.g.,
       <user@example.com/resource>) of the user to all contacts that are
       subscribed to the user's presence information; such contacts are
       those for which a JID is present in the user's roster with the
       'subscription' attribute set to a value of "from" or "both".
       (Note: The user's server MUST NOT broadcast initial presence to
       contacts to which the user is blocking outbound presence
       notifications, as described under Blocking Outbound Presence
       Notifications (Section 10.11).)

   In addition, the user's server MUST broadcast initial presence from
   the user's new available resource to any of the user's existing
   available resources (if any).

   Upon receiving initial presence from the user, the contact's server
   MUST deliver the user's presence stanza to the full JIDs
   (<contact@example.org/resource>) associated with all of the contact's
   available resources, but only if the user is in the contact's roster
   with a subscription state of "to" or "both" and the contact has not
   blocked inbound presence notifications from the user's bare or full
   JID (as defined under Blocking Inbound Presence Notifications
   (Section 10.10)).

   If the user's server receives a presence stanza of type "error" in
   response to the initial presence that it sent to a contact on behalf
   of the user, it SHOULD NOT send further presence updates to that
   contact (until and unless it receives a presence stanza from the
   contact).

5.1.2.  Presence Broadcast

   After sending initial presence, the user MAY update its presence
   information for broadcasting at any time during its session by
   sending a presence stanza with no 'to' address and either no 'type'
   attribute or a 'type' attribute with a value of "unavailable". (Note:
   A user's client SHOULD NOT send a presence update to broadcast
   information that changes independently of the user's presence and
   availability.)

   If the presence stanza lacks a 'type' attribute (i.e., expresses
   availability), the user's server MUST broadcast the full XML of that
   presence stanza to all contacts (1) that are in the user's roster
   with a subscription type of "from" or "both", (2) to whom the user





Saint-Andre                 Standards Track                    [Page 17]

RFC 3921                        XMPP IM                     October 2004


   has not blocked outbound presence notifications, and (3) from whom
   the server has not received a presence error during the user's
   session (as well as to any of the user's other available resources).

   If the presence stanza has a 'type' attribute set to a value of
   "unavailable", the user's server MUST broadcast the full XML of that
   presence stanza to all entities that fit the above description, as
   well as to any entities to which the user has sent directed available
   presence during the user's session (if the user has not yet sent
   directed unavailable presence to that entity).

5.1.3.  Presence Probes

   Upon receiving a presence probe from the user, the contact's server
   SHOULD reply as follows:

   1.  If the user is not in the contact's roster with a subscription
       state of "From", "From + Pending Out", or "Both" (as defined
       under Subscription States (Section 9)), the contact's server MUST
       return a presence stanza of type "error" in response to the
       presence probe (however, if a server receives a presence probe
       from a subdomain of the server's hostname or another such trusted
       service, it MAY provide presence information about the user to
       that entity).  Specifically:

       *  if the user is in the contact's roster with a subscription
          state of "None", "None + Pending Out", or "To" (or is not in
          the contact's roster at all), the contact's server MUST return
          a <forbidden/> stanza error in response to the presence probe.

       *  if the user is in the contact's roster with a subscription
          state of "None + Pending In", "None + Pending Out/In", or "To
          + Pending In", the contact's server MUST return a
          <not-authorized/> stanza error in response to the presence
          probe.

   2.  Else, if the contact is blocking presence notifications to the
       user's bare JID or full JID (using either a default list or
       active list as defined under Blocking Outbound Presence
       Notifications (Section 10.11)), the server MUST NOT reply to the
       presence probe.

   3.  Else, if the contact has no available resources, the server MUST
       either (1) reply to the presence probe by sending to the user the
       full XML of the last presence stanza of type "unavailable"
       received by the server from the contact, or (2) not reply at all.





Saint-Andre                 Standards Track                    [Page 18]

RFC 3921                        XMPP IM                     October 2004


   4.  Else, if the contact has at least one available resource, the
       server MUST reply to the presence probe by sending to the user
       the full XML of the last presence stanza with no 'to' attribute
       received by the server from each of the contact's available
       resources (again, subject to privacy lists in force for each

doc/rfc3921-notes.txt  view on Meta::CPAN

   stanza with a 'to' attribute whose value is the JID of the other
   entity and with either no 'type' attribute or a 'type' attribute
   whose value is "unavailable").  There are three possible cases:

   1.  If the user sends directed presence to a contact that is in the
       user's roster with a subscription type of "from" or "both" after
       having sent initial presence and before sending unavailable
       presence broadcast, the user's server MUST route or deliver the
       full XML of that presence stanza (subject to privacy lists) but
       SHOULD NOT otherwise modify the contact's status regarding
       presence broadcast (i.e., it SHOULD include the contact's JID in
       any subsequent presence broadcasts initiated by the user).

   2.  If the user sends directed presence to an entity that is not in
       the user's roster with a subscription type of "from" or "both"
       after having sent initial presence and before sending unavailable
       presence broadcast, the user's server MUST route or deliver the
       full XML of that presence stanza to the entity but MUST NOT
       modify the contact's status regarding available presence
       broadcast (i.e., it MUST NOT include the entity's JID in any
       subsequent broadcasts of available presence initiated by the
       user); however, if the available resource from which the user
       sent the directed presence become unavailable, the user's server
       MUST broadcast that unavailable presence to the entity (if the
       user has not yet sent directed unavailable presence to that
       entity).

   3.  If the user sends directed presence without first sending initial
       presence or after having sent unavailable presence broadcast
       (i.e., the resource is active but not available), the user's
       server MUST treat the entities to which the user sends directed
       presence in the same way that it treats the entities listed in
       case #2 above.








Saint-Andre                 Standards Track                    [Page 19]

RFC 3921                        XMPP IM                     October 2004


5.1.5.  Unavailable Presence

   Before ending its session with a server, a client SHOULD gracefully
   become unavailable by sending a final presence stanza that possesses
   no 'to' attribute and that possesses a 'type' attribute whose value
   is "unavailable" (optionally, the final presence stanza MAY contain
   one or more <status/> elements specifying the reason why the user is
   no longer available).  However, the user's server MUST NOT depend on
   receiving final presence from an available resource, since the
   resource may become unavailable unexpectedly or may be timed out by
   the server.  If one of the user's resources becomes unavailable for
   any reason (either gracefully or ungracefully), the user's server
   MUST broadcast unavailable presence to all contacts (1) that are in
   the user's roster with a subscription type of "from" or "both", (2)
   to whom the user has not blocked outbound presence, and (3) from whom
   the server has not received a presence error during the user's
   session; the user's server MUST also send that unavailable presence
   stanza to any of the user's other available resources, as well as to
   any entities to which the user has sent directed presence during the
   user's session for that resource (if the user has not yet sent
   directed unavailable presence to that entity).  Any presence stanza
   with no 'type' attribute and no 'to' attribute that is sent after
   sending directed unavailable presence or broadcasted unavailable
   presence MUST be broadcasted by the server to all subscribers.

5.1.6.  Presence Subscriptions

   A subscription request is a presence stanza whose 'type' attribute
   has a value of "subscribe".  If the subscription request is being
   sent to an instant messaging contact, the JID supplied in the 'to'
   attribute SHOULD be of the form <contact@example.org> rather than
   <contact@example.org/resource>, since the desired result is normally
   for the user to receive presence from all of the contact's resources,
   not merely the particular resource specified in the 'to' attribute.

   A user's server MUST NOT automatically approve subscription requests
   on the user's behalf.  All subscription requests MUST be directed to
   the user's client, specifically to one or more available resources
   associated with the user.  If there is no available resource
   associated with the user when the subscription request is received by
   the user's server, the user's server MUST keep a record of the
   subscription request and deliver the request when the user next
   creates an available resource, until the user either approves or
   denies the request.  If there is more than one available resource
   associated with the user when the subscription request is received by
   the user's server, the user's server MUST broadcast that subscription
   request to all available resources in accordance with Server Rules
   for Handling XML Stanzas (Section 11).  (Note: If an active resource



Saint-Andre                 Standards Track                    [Page 20]

RFC 3921                        XMPP IM                     October 2004


   has not provided initial presence, the server MUST NOT consider it to
   be available and therefore MUST NOT send subscription requests to
   it.)   However, if the user receives a presence stanza of type
   "subscribe" from a contact to whom the user has already granted
   permission to see the user's presence information (e.g., in cases
   when the contact is seeking to resynchronize subscription states),
   the user's server SHOULD auto-reply on behalf of the user.  In
   addition, the user's server MAY choose to re-send an unapproved
   pending subscription request to the contact based on an
   implementation-specific algorithm (e.g., whenever a new resource
   becomes available for the user, or after a certain amount of time has
   elapsed); this helps to recover from transient, silent errors that
   may have occurred in relation to the original subscription request.

5.2.  Specifying Availability Status

   A client MAY provide further information about its availability
   status by using the <show/> element (see Show (Section 2.2.2.1)).

doc/rfc3921-notes.txt  view on Meta::CPAN

             value='bar'
             action='[allow|deny]'
             order='unsignedInt'>
           [<message/>]
           [<presence-in/>]
           [<presence-out/>]
           [<iq/>]
         </item>
       </list>
     </query>
   </iq>






Saint-Andre                 Standards Track                    [Page 63]

RFC 3921                        XMPP IM                     October 2004


   If the type is "jid", then the 'value' attribute MUST contain a valid
   Jabber ID.  JIDs SHOULD be matched in the following order:

   1.  <user@domain/resource> (only that resource matches)

   2.  <user@domain> (any resource matches)

   3.  <domain/resource> (only that resource matches)

   4.  <domain> (the domain itself matches, as does any user@domain,
       domain/resource, or address containing a subdomain)

   If the type is "group", then the 'value' attribute SHOULD contain the
   name of a group in the user's roster.  (If a client attempts to
   update, create, or delete a list item with a group that is not in the
   user's roster, the server SHOULD return to the client an
   <item-not-found/> stanza error.)

   If the type is "subscription", then the 'value' attribute MUST be one
   of "both", "to", "from", or "none" as defined under Roster Syntax and
   Semantics (Section 7.1), where "none" includes entities that are
   totally unknown to the user and therefore not in the user's roster at
   all.

   If no 'type' attribute is included, the rule provides the
   "fall-through" case.

   The 'action' attribute MUST be included and its value MUST be either
   "allow" or "deny".

   The 'order' attribute MUST be included and its value MUST be a
   non-negative integer that is unique among all items in the list.  (If
   a client attempts to create or update a list with non-unique order
   values, the server MUST return to the client a <bad-request/> stanza
   error.)

   The <item/> element MAY contain one or more child elements that
   enable an entity to specify more granular control over which kinds of
   stanzas are to be blocked (i.e., rather than blocking all stanzas).
   The allowable child elements are:

   o  <message/> -- blocks incoming message stanzas
   o  <iq/> -- blocks incoming IQ stanzas
   o  <presence-in/> -- blocks incoming presence notifications
   o  <presence-out/> -- blocks outgoing presence notifications






Saint-Andre                 Standards Track                    [Page 64]

RFC 3921                        XMPP IM                     October 2004


   Within the 'jabber:iq:privacy' namespace, the <query/> child of an IQ
   stanza of type "set" MUST NOT include more than one child element
   (i.e., the stanza MUST contain only one <active/> element, one
   <default/> element, or one <list/> element); if a sending entity
   violates this rule, the receiving entity MUST return a <bad-request/>
   stanza error.

   When a client adds or updates a privacy list, the <list/> element
   SHOULD contain at least one <item/> child element; when a client
   removes a privacy list, the <list/> element MUST NOT contain any
   <item/> child elements.

   When a client updates a privacy list, it must include all of the
   desired items (i.e., not a "delta").

10.2.  Business Rules

   1.  If there is an active list set for a session, it affects only the
       session(s) for which it is activated, and only for the duration
       of the session(s); the server MUST apply the active list only and
       MUST NOT apply the default list (i.e., there is no "layering" of
       lists).

   2.  The default list applies to the user as a whole, and is processed
       if there is no active list set for the target session/resource to
       which a stanza is addressed, or if there are no current sessions
       for the user.

   3.  If there is no active list set for a session (or there are no
       current sessions for the user), and there is no default list,
       then all stanzas SHOULD BE accepted or appropriately processed by
       the server on behalf of the user in accordance with the Server
       Rules for Handling XML Stanzas (Section 11).

   4.  Privacy lists MUST be the first delivery rule applied by a
       server, superseding (1) the routing and delivery rules specified
       in Server Rules for Handling XML Stanzas (Section 11), and (2)
       the handling of subscription-related presence stanzas (and
       corresponding generation of roster pushes) specified in
       Integration of Roster Items and Presence Subscriptions (Section
       8).

   5.  The order in which privacy list items are processed by the server

doc/rfc3921-notes.txt  view on Meta::CPAN

   As a result of creating and applying the foregoing list, the user
   will not receive any communications from, nor send any stanzas to,
   the entity with the specified JID.

   Example: User blocks based on roster group:

   <iq from='romeo@example.net/orchard' type='set' id='all2'>
     <query xmlns='jabber:iq:privacy'>
       <list name='all-group-example'>
         <item type='group'
               value='Enemies'



Saint-Andre                 Standards Track                    [Page 82]

RFC 3921                        XMPP IM                     October 2004


               action='deny'
               order='13'/>
       </list>
     </query>
   </iq>

   As a result of creating and applying the foregoing list, the user
   will not receive any communications from, nor send any stanzas to,
   any entities in the specified roster group.

   Example: User blocks based on subscription type:

   <iq from='romeo@example.net/orchard' type='set' id='all3'>
     <query xmlns='jabber:iq:privacy'>
       <list name='all-sub-example'>
         <item type='subscription'
               value='none'
               action='deny'
               order='11'/>
       </list>
     </query>
   </iq>

   As a result of creating and applying the foregoing list, the user
   will not receive any communications from, nor send any stanzas to,
   any entities with the specified subscription type.

   Example: User blocks globally:

   <iq from='romeo@example.net/orchard' type='set' id='all4'>
     <query xmlns='jabber:iq:privacy'>
       <list name='all-global-example'>
         <item action='deny' order='7'/>
       </list>
     </query>
   </iq>

   As a result of creating and applying the foregoing list, the user
   will not receive any communications from, nor send any stanzas to,
   any other users.

10.14.  Blocked Entity Attempts to Communicate with User

   If a blocked entity attempts to send message or presence stanzas to
   the user, the user's server SHOULD silently drop the stanza and MUST
   NOT return an error to the sending entity.





Saint-Andre                 Standards Track                    [Page 83]

RFC 3921                        XMPP IM                     October 2004


   If a blocked entity attempts to send an IQ stanza of type "get" or
   "set" to the user, the user's server MUST return to the sending
   entity a <service-unavailable/> stanza error, since this is the
   standard error code sent from a client that does not understand the
   namespace of an IQ get or set.  IQ stanzas of other types SHOULD be
   silently dropped by the server.

   Example: Blocked entity attempts to send IQ get:

   <iq type='get'
       to='romeo@example.net'
       from='tybalt@example.com/pda'
       id='probing1'>
     <query xmlns='jabber:iq:version'/>
   </iq>

   Example: Server returns error to blocked entity:

   <iq type='error'
       from='romeo@example.net'
       to='tybalt@example.com/pda'
       id='probing1'>
     <query xmlns='jabber:iq:version'/>
     <error type='cancel'>
       <service-unavailable
           xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
     </error>
   </iq>

10.15.  Higher-Level Heuristics

   When building a representation of a higher-level privacy heuristic, a
   client SHOULD use the simplest possible representation.

   For example, the heuristic "block all communications with any user
   not in my roster" could be constructed in any of the following ways:

   o  allow communications from all JIDs in my roster (i.e., listing
      each JID as a separate list item), but block communications with
      everyone else

   o  allow communications from any user who is in one of the groups
      that make up my roster (i.e., listing each group as a separate
      list item), but block communications from everyone else

   o  allow communications from any user with whom I have a subscription
      of 'both' or 'to' or 'from' (i.e., listing each subscription value
      separately), but block communications from everyone else



Saint-Andre                 Standards Track                    [Page 84]

RFC 3921                        XMPP IM                     October 2004


   o  block communications from anyone whose subscription state is
      'none'

   The final representation is the simplest and SHOULD be used; here is
   the XML that would be sent in this case:

   <iq type='set' id='heuristic1'>
     <query xmlns='jabber:iq:privacy'>
       <list name='heuristic-example'>
         <item type='subscription'
               value='none'
               action='deny'
               order='437'/>
       </list>
     </query>
   </iq>

11.  Server Rules for Handling XML Stanzas

   Basic routing and delivery rules for servers are defined in
   [XMPP-CORE].  This section defines additional rules for



( run in 0.871 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )