blob: be4633e98b94a5adb39e672000b84779d4730ac3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
using Gee;
using Xmpp.Core;
namespace Xmpp {
public class ErrorStanza {
public const string CONDITION_BAD_REQUEST = "bad-request";
public const string CONDITION_CONFLICT = "conflict";
public const string CONDITION_FEATURE_NOT_IMPLEMENTED = "feature-not-implemented";
public const string CONDITION_FORBIDDEN = "forbidden";
public const string CONDITION_GONE = "gone";
public const string CONDITION_INTERNAL_SERVER_ERROR = "internal-server-error";
public const string CONDITION_ITEM_NOT_FOUND = "item-not-found";
public const string CONDITION_JID_MALFORMED = "jid-malformed";
public const string CONDITION_NOT_ACCEPTABLE = "not-acceptable";
public const string CONDITION_NOT_ALLOWED = "not-allowed";
public const string CONDITION_NOT_AUTHORIZED = "not-authorized";
public const string CONDITION_POLICY_VIOLATION = "policy-violation";
public const string CONDITION_RECIPIENT_UNAVAILABLE = "recipient-unavailable";
public const string CONDITION_REDIRECT = "redirect";
public const string CONDITION_REGISTRATION_REQUIRED = "registration-required";
public const string CONDITION_REMOTE_SERVER_NOT_FOUND = "remote-server-not-found";
public const string CONDITION_REMOTE_SERVER_TIMEOUT = "remote-server-timeout";
public const string CONDITION_RESOURCE_CONSTRAINT = "resource-constraint";
public const string CONDITION_SERVICE_UNAVAILABLE = "service-unavailable";
public const string CONDITION_SUBSCRIPTION_REQUIRED = "subscription-required";
public const string CONDITION_UNDEFINED_CONDITION = "undefined-condition";
public const string CONDITION_UNEXPECTED_REQUEST = "unexpected-request";
public const string TYPE_AUTH = "auth";
public const string TYPE_CANCEL = "cancel";
public const string TYPE_CONTINUE = "continue";
public const string TYPE_MODIFY = "modify";
public const string TYPE_WAIT = "wait";
public string? by {
get { return error_node.get_attribute("by"); }
}
public string condition {
get {
ArrayList<StanzaNode> subnodes = error_node.sub_nodes;
foreach (StanzaNode subnode in subnodes) { // TODO get subnode by ns
if (subnode.ns_uri == "urn:ietf:params:xml:ns:xmpp-stanzas") {
return subnode.name;
}
}
return CONDITION_UNDEFINED_CONDITION; // TODO hm!
}
}
public string? original_id {
get { return stanza.get_attribute("id"); }
}
public string type_ {
get { return stanza.get_attribute("type"); }
}
public StanzaNode stanza;
private StanzaNode error_node;
public ErrorStanza.from_stanza(StanzaNode stanza) {
this.stanza = stanza;
error_node = stanza.get_subnode("error");
}
}
}
|