Added language field; replaced secure field with security field; changed otr field to list-single; several clarifications.
In order to initiate a negotiated chat session, the initiating party ("user") sends a &MESSAGE; stanza to the receiving party ("contact") containing a <feature/> child qualified by the 'http://jabber.org/protocol/feature-neg' namespace. The &MESSAGE; stanza MUST NOT contain a &BODY; child element (as specified in &rfc3921;). The &MESSAGE; stanza is used because the user does not necessarily know which of the contact's resources is most available (or indeed if the contact is online). The &MESSAGE; stanza type SHOULD be "normal" (either explicitly or by non-inclusion of the 'type' attribute). The stanza SHOULD include an 'id' attribute and MUST contain a &THREAD; element for tracking purposes (where the newly-generated ThreadID is unique to the proposed session). The data form MUST contain a hidden FORM_TYPE field whose value is "http://jabber.org/protocol/chatneg" and MUST contain a boolean field named "accept". &BOOLEANNOTE;
-The following is an example of a negotiation request:
+In order to initiate a negotiated chat session, the initiating party ("user") sends a &MESSAGE;
In the following example of a negotiation request, Romeo requests a chat with Juliet and also queries her regarding whether she wants to enable all message logging (see &xep0136;)
In the foregoing example, Romeo requests a chat with Juliet and also queries her regarding whether she wants to disable all message logging (see &xep0136;)
Juliet's server delivers Romeo's request to her most available resource (which happens to be "balcony").
-In any response to the request, the contact's client MUST mirror the 'id' attribute and &THREAD;value so that the user's client can correctly track the response.
-We assume that Juliet accepts the chat and specifies that she does not want to log messages or use XHTML formatting but that she does want to use Chat State Notifications:
+The contact's server delivers the request to the contact's most available resource (which in the examples below happens to be "balcony").
+In any response to the request, the contact's client MUST mirror any 'id' attribute and &THREAD; value so that the user's client can correctly track the response.
+If the contact's client does not support one of the default values or if the contact has disabled its support (as for Chat State Notifications and XHTML formatting in the example below), and the client can still accept the request, then it MUST set that field to a value that it can support.
+In the example below we assume that Juliet accepts the chat and specifies that she prefers to speak Italian with Romeo:
However, it could be that Juliet is busy so she declines the invitation.
+If the contact does not want to reveal presence to the user for whatever reason then the contact's client SHOULD return no response or error (see Security Considerations). Also, if the contact is using a legacy client then it MAY not support returning any response or error. In both these cases the user MAY, proceed to send stanzas to the contact outside the context of a negotiated chat session.
+However, if the contact simply prefers not to chat then the client SHOULD decline the invitation:
If Juliet's client does not support feature negotiation or does not support the "http://jabber.org/protocol/chatneg" FORM_TYPE, it SHOULD return a &unavailable; error. However, if Juliet does not want to reveal her presence to Romeo for whatever reason, or she is using a legacy client that does not support returning a &unavailable; error, then her client MAY return no error. In this case Romeo MAY, proceed to send stanzas to Juliet outside the context of a negotiated chat session.
+If the contact's client does not support feature negotiation or does not support the "http://jabber.org/protocol/chatneg" FORM_TYPE, it SHOULD return a &unavailable; error:
If Juliet's client does not support one of the required features, it SHOULD return a &feature; error (but MAY return no error if, for example, Juliet does not want to reveal her presence to Romeo for whatever reason):
+If the contact's client does not support one or more of the required features, it SHOULD return a &feature; error and SHOULD specify the field(s) not implemented in a comma-separated list in the XMPP <text/> element:
If the contact's client supports none of the options for one or more fields, it SHOULD return a ¬acceptable; error and SHOULD specify the field(s) with unsupported options in a comma-separated list in the XMPP <text/> element:
+If Juliet's client does not support one of the optional features (e.g., Chat State Notifications) but it accepts the request, it MUST set the value of that boolean variable to "0" or "false".
At any time during an existing chat session, either party MAY attempt to renegotiate the parameters of the session. The requesting party does this by sending a new &MESSAGE; stanza containing a feature negotiation form and a &THREAD; element with the same value as that of the existing chat session.
@@ -312,30 +282,18 @@If the other party's client does not support one of the required features, it SHOULD return a &feature; error instead. In that case the existing negotiated chat session parameters are maintained. Either party MAY then terminate the chat session as specified in the section Terminating a Chat.
+If the other party's client does not support one or more of the required features, it SHOULD return a &feature; error instead, while if it supports none of the options for one or more fields, it SHOULD return a ¬acceptable; error instead (see Initiating a Chat). In either of these cases the existing negotiated chat session parameters are maintained. Either party MAY then terminate the chat session as specified in the section Terminating a Chat.
Either party MAY use chat renegotiation to attempt to continue the session using another of its resources. The requesting party does this by sending a feature renegotiation form with a "continue" field containing the value of the new resource:
@@ -379,7 +328,7 @@