summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2013-02-20 08:38:53 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2013-02-20 09:18:52 +0000
commit7ca0eac40f543bdd75eb18a29cf2d0cbaed40ff6 (patch)
treedc28134290e1e3279ca9e688aaa5903397758938
parentb2e1a6d147a3931190e2d328feb1f5c62e6ac7d8 (diff)
WockyXmppError: update to RFC 6120
The changes are: * payment-required is removed; * not-authorized is added to the schema (it was already defined in Wocky); * policy-violation is added. XEP-0086 doesn't define an error code mapping for it, so I chose 406 "Not Acceptable".
-rw-r--r--wocky/wocky-xmpp-error.c10
-rw-r--r--wocky/wocky-xmpp-error.h20
2 files changed, 26 insertions, 4 deletions
diff --git a/wocky/wocky-xmpp-error.c b/wocky/wocky-xmpp-error.c
index 75cd7a7..485bfbf 100644
--- a/wocky/wocky-xmpp-error.c
+++ b/wocky/wocky-xmpp-error.c
@@ -215,6 +215,16 @@ static const XmppErrorSpec xmpp_errors[NUM_WOCKY_XMPP_ERRORS] =
WOCKY_XMPP_ERROR_TYPE_CANCEL,
{ 503, 502, 510, },
},
+
+ /* policy-violation */
+ {
+ "the entity has violated some local service policy (e.g., a message "
+ "contains words that are prohibited by the service)",
+ /* TODO: should support either MODIFY or WAIT depending on the policy
+ * being violated */
+ WOCKY_XMPP_ERROR_TYPE_MODIFY,
+ { 406, 0, },
+ },
};
GQuark
diff --git a/wocky/wocky-xmpp-error.h b/wocky/wocky-xmpp-error.h
index 4dfc61a..b30a304 100644
--- a/wocky/wocky-xmpp-error.h
+++ b/wocky/wocky-xmpp-error.h
@@ -55,7 +55,7 @@ typedef enum
/**
* WockyXmppError:
- * @WOCKY_XMPP_ERROR_UNDEFINED_CONDITION: he error condition is not one
+ * @WOCKY_XMPP_ERROR_UNDEFINED_CONDITION: the error condition is not one
* of those defined by the other conditions in this list
* @WOCKY_XMPP_ERROR_REDIRECT: the recipient or server is redirecting
* requests for this information to another entity
@@ -72,10 +72,12 @@ typedef enum
* provided improper credentials
* @WOCKY_XMPP_ERROR_PAYMENT_REQUIRED: the requesting entity is not
* authorized to access the requested service because payment is
- * required
+ * required. This code is no longer defined in RFC 6120, the current version
+ * of XMPP Core. It's preserved here for interoperability, but new
+ * applications should not send it.
* @WOCKY_XMPP_ERROR_FORBIDDEN: the requesting entity does not possess
* the required permissions to perform the action
- * @WOCKY_XMPP_ERROR_ITEM_NOT_FOUND: he addressed JID or item requested
+ * @WOCKY_XMPP_ERROR_ITEM_NOT_FOUND: the addressed JID or item requested
* cannot be found
* @WOCKY_XMPP_ERROR_RECIPIENT_UNAVAILABLE: the intended recipient is
* temporarily unavailable
@@ -109,8 +111,16 @@ typedef enum
* be processed
* @WOCKY_XMPP_ERROR_SERVICE_UNAVAILABLE: the server or recipient does
* not currently provide the requested service
+ * @WOCKY_XMPP_ERROR_POLICY_VIOLATION: the entity has violated some local
+ * service policy (e.g., a message contains words that are prohibited by the
+ * service) and the server MAY choose to specify the policy as the text of
+ * the error or in an application-specific condition element; the associated
+ * error type SHOULD be %WOCKY_XMPP_ERROR_TYPE_MODIFY or
+ * %WOCKY_XMPP_ERROR_TYPE_WAIT depending on the policy being violated.
*
- * Possible XMPP stream errors, as defined by RFC 3920 §9.3.3.
+ * Possible stanza-level errors, as defined by <ulink
+ * url='http://xmpp.org/rfcs/rfc6120.html#stanzas-error-conditions'>RFC 6210
+ * §8.3.3</ulink>.
*/
/*< prefix=WOCKY_XMPP_ERROR >*/
@@ -152,6 +162,8 @@ typedef enum {
WOCKY_XMPP_ERROR_SERVICE_UNAVAILABLE, /* 502, 503, 510 */
+ WOCKY_XMPP_ERROR_POLICY_VIOLATION,
+
/*< private >*/
NUM_WOCKY_XMPP_ERRORS /*< skip >*/ /* don't want this in the GEnum */
} WockyXmppError;