blather 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/README.rdoc +7 -4
  2. data/Rakefile +3 -1
  3. data/examples/print_heirarchy.rb +76 -0
  4. data/lib/blather.rb +3 -3
  5. data/lib/blather/client.rb +4 -247
  6. data/lib/blather/client/client.rb +168 -0
  7. data/lib/blather/client/dsl.rb +99 -0
  8. data/lib/blather/errors.rb +5 -0
  9. data/lib/blather/errors/sasl_error.rb +6 -70
  10. data/lib/blather/errors/stanza_error.rb +12 -176
  11. data/lib/blather/errors/stream_error.rb +8 -186
  12. data/lib/blather/stanza.rb +2 -3
  13. data/lib/blather/stanza/{iq/disco.rb → disco.rb} +1 -3
  14. data/lib/blather/stanza/{iq/discos → disco}/disco_info.rb +3 -5
  15. data/lib/blather/stanza/{iq/discos → disco}/disco_items.rb +0 -2
  16. data/lib/blather/stanza/iq/query.rb +1 -1
  17. data/lib/blather/stanza/iq/roster.rb +2 -2
  18. data/lib/blather/stanza/pubsub/subscriber.rb +64 -0
  19. data/lib/blather/stream.rb +13 -7
  20. data/lib/blather/stream/component.rb +1 -1
  21. data/lib/blather/stream/parser.rb +11 -4
  22. data/lib/blather/stream/resource.rb +1 -1
  23. data/lib/blather/stream/sasl.rb +15 -9
  24. data/lib/blather/xmpp_node.rb +10 -4
  25. data/spec/blather/client/client_spec.rb +4 -0
  26. data/spec/blather/client/dsl_spec.rb +4 -0
  27. data/spec/blather/client_spec.rb +0 -0
  28. data/spec/blather/errors/sasl_error_spec.rb +2 -25
  29. data/spec/blather/errors/stanza_error_spec.rb +7 -18
  30. data/spec/blather/errors/stream_error_spec.rb +4 -15
  31. data/spec/blather/stanza/{iq/discos → discos}/disco_info_spec.rb +12 -12
  32. data/spec/blather/stanza/{iq/discos → discos}/disco_items_spec.rb +1 -1
  33. data/spec/blather/stanza/iq/query_spec.rb +7 -0
  34. data/spec/blather/stanza/iq/roster_spec.rb +21 -21
  35. data/spec/blather/stanza/pubsub/subscriber_spec.rb +70 -0
  36. data/spec/blather/stanza_spec.rb +1 -7
  37. data/spec/blather/stream/client_spec.rb +36 -7
  38. data/spec/spec_helper.rb +1 -1
  39. metadata +16 -18
  40. data/ext/Makefile +0 -149
  41. data/ext/mkmf.log +0 -30
  42. data/ext/push_parser.bundle +0 -0
  43. data/ext/push_parser.o +0 -0
  44. data/lib/autotest/discover.rb +0 -1
  45. data/lib/autotest/spec.rb +0 -60
  46. data/spec/blather/stanza/pubsub/event_spec.rb +0 -13
  47. data/spec/build_safe.rb +0 -20
@@ -0,0 +1,99 @@
1
+ require File.join(File.dirname(__FILE__), 'client')
2
+
3
+ module Blather
4
+ module DSL
5
+ def client
6
+ @client ||= Client.new
7
+ end
8
+ module_function :client
9
+
10
+ ##
11
+ # Prepare server settings
12
+ # setup [node@domain/resource], [password], [host], [port]
13
+ # host and port are optional defaulting to the domain in the JID and 5222 respectively
14
+ def setup(jid, password, host = nil, port = nil)
15
+ client.setup(jid, password, host, port)
16
+ at_exit { client.run }
17
+ end
18
+
19
+ ##
20
+ # Shutdown the connection.
21
+ # Flushes the write buffer then stops EventMachine
22
+ def shutdown
23
+ client.stop
24
+ end
25
+
26
+ ##
27
+ # Set handler for a stanza type
28
+ def handle(stanza_type, *guards, &block)
29
+ client.register_handler stanza_type, *guards, &block
30
+ end
31
+
32
+ ##
33
+ # Wrapper for "handle :ready" (just a bit of syntactic sugar)
34
+ def when_ready(&block)
35
+ handle :ready, &block
36
+ end
37
+
38
+ ##
39
+ # Set current status
40
+ def status(state = nil, msg = nil)
41
+ client.status = state, msg
42
+ end
43
+
44
+ ##
45
+ # Direct access to the roster
46
+ def roster
47
+ client.roster
48
+ end
49
+
50
+ ##
51
+ # Write data to the stream
52
+ # Anything that resonds to #to_s can be paseed to the stream
53
+ def write(stanza)
54
+ client.write(stanza)
55
+ end
56
+
57
+ ##
58
+ # Helper method to make sending basic messages easier
59
+ # say [jid], [msg]
60
+ def say(to, msg)
61
+ client.write Blather::Stanza::Message.new(to, msg)
62
+ end
63
+
64
+ ##
65
+ # Wrapper to grab the current JID
66
+ def jid
67
+ client.jid
68
+ end
69
+
70
+ ##
71
+ #
72
+ def discover(what, who, where, &callback)
73
+ stanza = Blather::Stanza.class_from_registration(:query, "http://jabber.org/protocol/disco##{what}").new
74
+ stanza.to = who
75
+ stanza.node = where
76
+
77
+ client.temporary_handler stanza.id, &callback
78
+ write stanza
79
+ end
80
+
81
+ ##
82
+ # PubSub proxy
83
+ def pubsub
84
+ client.pubsub
85
+ end
86
+
87
+ ##
88
+ # Checks to see if the method is part of the handlers list.
89
+ # If so it creates a handler, otherwise it'll pass it back
90
+ # to Ruby's method_missing handler
91
+ def method_missing(method, *args, &block)
92
+ if Blather::Stanza.handler_list.include?(method)
93
+ handle method, *args, &block
94
+ else
95
+ super
96
+ end
97
+ end
98
+ end #DSL
99
+ end #Blather
@@ -9,6 +9,11 @@ module Blather
9
9
  def self.register(handler)
10
10
  self.handler_heirarchy.unshift handler
11
11
  end
12
+
13
+ # HACK!! until I can refactor the entire Error object model
14
+ def id
15
+ nil
16
+ end
12
17
  end
13
18
 
14
19
  ##
@@ -6,81 +6,17 @@ class SASLError < BlatherError
6
6
 
7
7
  register :sasl_error
8
8
 
9
- ##
10
- # Register the handler and type to simplify importing
11
- def self.register(handler, err_name)
12
- super handler
13
- self.err_name = err_name
14
- @@registrations[err_name] = self
15
- end
16
-
17
- ##
18
- # Retreive an error class from a given name
19
- def self.class_from_registration(err_name)
20
- @@registrations[err_name.to_s] || self
21
- end
22
-
23
- ##
24
- # Factory to create the proper error object from an error node
25
9
  def self.import(node)
26
- err_name = node.children.first.element_name
27
- class_from_registration(err_name).new
28
- end
29
-
30
- ##
31
- # XMPP defined error name
32
- def err_name
33
- self.class.err_name
10
+ self.new node
34
11
  end
35
12
 
36
- ##
37
- # The receiving entity acknowledges an <abort/> element sent by the initiating entity; sent in reply to the <abort/> element.
38
- class Aborted < SASLError
39
- register :sasl_aborted_error, 'aborted'
13
+ def initialize(node)
14
+ super()
15
+ @node = node
40
16
  end
41
17
 
42
- ##
43
- # The data provided by the initiating entity could not be processed because the [BASE64] encoding is incorrect
44
- # (e.g., because the encoding does not adhere to the definition in Section 3 of [BASE64]); sent in reply to a <response/>
45
- # element or an <auth/> element with initial response data.
46
- class IncorrectEncoding < SASLError
47
- register :sasl_incorrect_encoding_error, 'incorrect-encoding'
48
- end
49
-
50
- ##
51
- # The authzid provided by the initiating entity is invalid, either because it is incorrectly formatted or because the
52
- # initiating entity does not have permissions to authorize that ID; sent in reply to a <response/> element or an <auth/>
53
- # element with initial response data.
54
- class InvalidAuthzid < SASLError
55
- register :sasl_invalid_authzid_error, 'invalid-authzid'
56
- end
57
-
58
- ##
59
- # The initiating entity did not provide a mechanism or requested a mechanism that is not supported by the receiving entity;
60
- # sent in reply to an <auth/> element.
61
- class InvalidMechanism < SASLError
62
- register :sasl_invalid_mechanism_error, 'invalid-mechanism'
63
- end
64
-
65
- ##
66
- # The mechanism requested by the initiating entity is weaker than server policy permits for that initiating entity; sent in
67
- # reply to a <response/> element or an <auth/> element with initial response data.
68
- class MechanismTooWeak < SASLError
69
- register :sasl_mechanism_too_weak_error, 'mechanism-too-weak'
70
- end
71
-
72
- ##
73
- # The authentication failed because the initiating entity did not provide valid credentials (this includes but is not limited
74
- # to the case of an unknown username); sent in reply to a <response/> element or an <auth/> element with initial response data.
75
- class NotAuthorized < SASLError
76
- register :sasl_not_authorized_error, 'not-authorized'
77
- end
78
-
79
- ##
80
- # The authentication failed because of a temporary error condition within the receiving entity; sent in reply to an <auth/>
81
- # element or <response/> element.
82
- class TemporaryAuthFailure < SASLError
83
- register :sasl_temporary_auth_failure_error, 'temporary-auth-failure'
18
+ def name
19
+ @node.children.first.element_name.gsub('-', '_').to_sym if @node
84
20
  end
85
21
  end #SASLError
86
22
 
@@ -6,26 +6,9 @@ module Blather
6
6
  class StanzaError < BlatherError
7
7
  VALID_TYPES = [:cancel, :continue, :modify, :auth, :wait]
8
8
 
9
- class_inheritable_accessor :err_name
10
- @@registrations = {}
11
-
12
9
  register :stanza_error
13
10
 
14
- attr_reader :original, :type, :text, :extras
15
-
16
- ##
17
- # Register the handler and type to simplify importing
18
- def self.register(handler, err_name)
19
- super handler
20
- self.err_name = err_name
21
- @@registrations[err_name] = self
22
- end
23
-
24
- ##
25
- # Retreive an error class from a given name
26
- def self.class_from_registration(err_name)
27
- @@registrations[err_name.to_s] || self
28
- end
11
+ attr_reader :original, :name, :type, :text, :extras
29
12
 
30
13
  ##
31
14
  # Factory method for instantiating the proper class
@@ -34,16 +17,16 @@ class StanzaError < BlatherError
34
17
  original = node.copy
35
18
  original.remove_child 'error'
36
19
 
37
- error_node = node.find_first 'child::error'
20
+ error_node = node.find_first '//*[local-name()="error"]'
38
21
 
39
22
  name = error_node.find_first('child::*[name()!="text"]', 'urn:ietf:params:xml:ns:xmpp-stanzas').element_name
40
23
  type = error_node['type']
41
- text = node.find_first 'descendant::text', 'urn:ietf:params:xml:ns:xmpp-stanzas'
24
+ text = node.find_first '//err_ns:text', :err_ns => 'urn:ietf:params:xml:ns:xmpp-stanzas'
42
25
  text = text.content if text
43
26
 
44
27
  extras = error_node.find("descendant::*[name()!='text' and name()!='#{name}']").map { |n| n }
45
28
 
46
- class_from_registration(name).new original, type, text, extras
29
+ self.new original, name, type, text, extras
47
30
  end
48
31
 
49
32
  ##
@@ -52,19 +35,14 @@ class StanzaError < BlatherError
52
35
  # <tt>type</tt> is the error type specified in RFC3920 (http://xmpp.org/rfcs/rfc3920.html#rfc.section.9.3.2)
53
36
  # <tt>text</tt> is an option error description
54
37
  # <tt>extras</tt> an array of application specific nodes to add to the error. These should be properly namespaced.
55
- def initialize(original, type, text = nil, extras = [])
38
+ def initialize(original, name, type, text = nil, extras = [])
56
39
  @original = original
40
+ @name = name
57
41
  self.type = type
58
42
  @text = text
59
43
  @extras = extras
60
44
  end
61
45
 
62
- ##
63
- # XMPP defined error name
64
- def err_name
65
- self.class.err_name
66
- end
67
-
68
46
  ##
69
47
  # Set the error type (see RFC3920 Section 9.3.2 (http://xmpp.org/rfcs/rfc3920.html#rfc.section.9.3.2))
70
48
  def type=(type)
@@ -73,13 +51,17 @@ class StanzaError < BlatherError
73
51
  @type = type
74
52
  end
75
53
 
54
+ def name
55
+ @name.gsub('-','_').to_sym
56
+ end
57
+
76
58
  ##
77
59
  # Creates an XML node from the error
78
60
  def to_node
79
61
  node = self.original.reply
80
62
 
81
63
  error_node = XMPPNode.new 'error'
82
- err = XMPPNode.new(self.err_name)
64
+ err = XMPPNode.new(@name)
83
65
  err.namespace = 'urn:ietf:params:xml:ns:xmpp-stanzas'
84
66
  error_node << err
85
67
 
@@ -108,155 +90,9 @@ class StanzaError < BlatherError
108
90
  end
109
91
 
110
92
  def inspect # :nodoc:
111
- "Stanza Error (#{self.err_name}): #{self.text}"
93
+ "Stanza Error (#{@name}): #{self.text}"
112
94
  end
113
95
  alias_method :to_s, :inspect # :nodoc:
114
-
115
- ##
116
- # The sender has sent XML that is malformed or that cannot be processed (e.g., an IQ stanza that includes
117
- # an unrecognized value of the 'type' attribute); the associated error type SHOULD be "modify"
118
- class BadRequest < StanzaError
119
- register :stanza_bad_request_error, 'bad-request'
120
- end
121
-
122
- ##
123
- # Access cannot be granted because an existing resource or session exists with the same name or address;
124
- # the associated error type SHOULD be "cancel"
125
- class Conflict < StanzaError
126
- register :stanza_conflict_error, 'conflict'
127
- end
128
-
129
- ##
130
- # the feature requested is not implemented by the recipient or server and therefore cannot be processed;
131
- # the associated error type SHOULD be "cancel".
132
- class FeatureNotImplemented < StanzaError
133
- register :stanza_feature_not_implemented_error, 'feature-not-implemented'
134
- end
135
-
136
- ##
137
- # the requesting entity does not possess the required permissions to perform the action;
138
- # the associated error type SHOULD be "auth".
139
- class Forbidden < StanzaError
140
- register :stanza_forbidden_error, 'forbidden'
141
- end
142
-
143
- ##
144
- # the recipient or server can no longer be contacted at this address (the error stanza MAY contain a new address
145
- # in the XML character data of the <gone/> element); the associated error type SHOULD be "modify".
146
- class Gone < StanzaError
147
- register :stanza_gone_error, 'gone'
148
- end
149
-
150
- ##
151
- # the server could not process the stanza because of a misconfiguration or an otherwise-undefined internal server error;
152
- # the associated error type SHOULD be "wait".
153
- class InternalServerError < StanzaError
154
- register :stanza_internal_server_error, 'internal-server-error'
155
- end
156
-
157
- ##
158
- # the addressed JID or item requested cannot be found; the associated error type SHOULD be "cancel".
159
- class ItemNotFound < StanzaError
160
- register :stanza_item_not_found_error, 'item-not-found'
161
- end
162
-
163
- ##
164
- # the addressed JID or item requested cannot be found; the associated error type SHOULD be "cancel".
165
- class JidMalformed < StanzaError
166
- register :stanza_jid_malformed_error, 'jid-malformed'
167
- end
168
-
169
- ##
170
- # the recipient or server understands the request but is refusing to process it because it does not meet criteria defined
171
- # by the recipient or server (e.g., a local policy regarding acceptable words in messages); the associated error type SHOULD be "modify".
172
- class NotAcceptable < StanzaError
173
- register :stanza_not_acceptable_error, 'not-acceptable'
174
- end
175
-
176
- ##
177
- # The recipient or server does not allow any entity to perform the action; the associated error type SHOULD be "cancel".
178
- class NotAllowed < StanzaError
179
- register :stanza_not_allowed_error, 'not-allowed'
180
- end
181
-
182
- ##
183
- # the sender must provide proper credentials before being allowed to perform the action, or has provided improper credentials;
184
- # the associated error type SHOULD be "auth".
185
- class NotAuthorized < StanzaError
186
- register :stanza_not_authorized_error, 'not-authorized'
187
- end
188
-
189
- ##
190
- # the requesting entity is not authorized to access the requested service because payment is required; the associated error type SHOULD be "auth".
191
- class PaymentRequired < StanzaError
192
- register :stanza_payment_required_error, 'payment-required'
193
- end
194
-
195
- ##
196
- # the intended recipient is temporarily unavailable; the associated error type SHOULD be "wait" (note: an application MUST NOT
197
- # return this error if doing so would provide information about the intended recipient's network availability to an entity that
198
- # is not authorized to know such information).
199
- class RecipientUnavailable < StanzaError
200
- register :stanza_recipient_unavailable_error, 'recipient-unavailable'
201
- end
202
-
203
- ##
204
- # the recipient or server is redirecting requests for this information to another entity, usually temporarily (the error stanza SHOULD contain
205
- # the alternate address, which MUST be a valid JID, in the XML character data of the <redirect/> element); the associated error type SHOULD be "modify".
206
- class Redirect < StanzaError
207
- register :stanza_redirect_error, 'redirect'
208
- end
209
-
210
- ##
211
- # the requesting entity is not authorized to access the requested service because registration is required; the associated error type SHOULD be "auth".
212
- class RegistrationRequired < StanzaError
213
- register :stanza_registration_required_error, 'registration-required'
214
- end
215
-
216
- ##
217
- # a remote server or service specified as part or all of the JID of the intended recipient does not exist; the associated error type SHOULD be "cancel".
218
- class RemoteServerNotFound < StanzaError
219
- register :stanza_remote_server_not_found_error, 'remote-server-not-found'
220
- end
221
-
222
- ##
223
- # a remote server or service specified as part or all of the JID of the intended recipient (or required to fulfill a request) could not be
224
- # contacted within a reasonable amount of time; the associated error type SHOULD be "wait".
225
- class RemoteServerTimeout < StanzaError
226
- register :stanza_remote_server_timeout_error, 'remote-server-timeout'
227
- end
228
-
229
- ##
230
- # the server or recipient lacks the system resources necessary to service the request; the associated error type SHOULD be "wait".
231
- class ResourceConstraint < StanzaError
232
- register :stanza_resource_constraint_error, 'resource-constraint'
233
- end
234
-
235
- ##
236
- # the server or recipient does not currently provide the requested service; the associated error type SHOULD be "cancel".
237
- class ServiceUnavailable < StanzaError
238
- register :stanza_service_unavailable_error, 'service-unavailable'
239
- end
240
-
241
- ##
242
- # the requesting entity is not authorized to access the requested service because a subscription is required; the associated error type SHOULD be "auth".
243
- class SubscriptionRequired < StanzaError
244
- register :stanza_subscription_required_error, 'subscription-required'
245
- end
246
-
247
- ##
248
- # the error condition is not one of those defined by the other conditions in this list; any error type may be associated with this condition,
249
- # and it SHOULD be used only in conjunction with an application-specific condition.
250
- class UndefinedCondition < StanzaError
251
- register :stanza_undefined_condition_error, 'undefined-condition'
252
- end
253
-
254
- ##
255
- # the recipient or server understood the request but was not expecting it at this time (e.g., the request was out of order);
256
- # the associated error type SHOULD be "wait".
257
- class UnexpectedRequest < StanzaError
258
- register :stanza_unexpected_request_error, 'unexpected-request'
259
- end
260
96
  end #StanzaError
261
97
 
262
98
  end #Blather
@@ -4,38 +4,21 @@ module Blather
4
4
  # Stream Errors
5
5
  # RFC3920 Section 9.3 (http://xmpp.org/rfcs/rfc3920.html#streams-error-rules)
6
6
  class StreamError < BlatherError
7
- class_inheritable_accessor :err_name
8
- @@registrations = {}
9
-
10
7
  register :stream_error
11
8
 
12
9
  attr_reader :text, :extras
13
10
 
14
- ##
15
- # Register the handler and type to simplify importing
16
- def self.register(handler, err_name)
17
- super handler
18
- self.err_name = err_name
19
- @@registrations[err_name] = self
20
- end
21
-
22
- ##
23
- # Retreive an error class from a given name
24
- def self.class_from_registration(err_name)
25
- @@registrations[err_name.to_s] || self
26
- end
27
-
28
11
  ##
29
12
  # Factory method for instantiating the proper class
30
13
  # for the error
31
14
  def self.import(node)
32
15
  name = node.find_first('descendant::*[name()!="text"]', 'urn:ietf:params:xml:ns:xmpp-streams').element_name
33
- text = node.find_first 'descendant::text', 'urn:ietf:params:xml:ns:xmpp-streams'
16
+ text = node.find_first '//err_ns:text', :err_ns => 'urn:ietf:params:xml:ns:xmpp-streams'
34
17
  text = text.content if text
35
18
 
36
19
  extras = node.find("descendant::*[name()!='text' and name()!='#{name}']").map { |n| n }
37
20
 
38
- class_from_registration(name).new text, extras
21
+ self.new name, text, extras
39
22
  end
40
23
 
41
24
  ##
@@ -43,15 +26,14 @@ class StreamError < BlatherError
43
26
  # <tt>extras</tt> should be an array of nodes to attach to the error
44
27
  # each extra should be in an application specific namespace
45
28
  # see RFC3920 Section 4.7.2 (http://xmpp.org/rfcs/rfc3920.html#rfc.section.4.7.2)
46
- def initialize(text = nil, extras = [])
29
+ def initialize(name, text = nil, extras = [])
30
+ @name = name
47
31
  @text = text
48
32
  @extras = extras
49
33
  end
50
34
 
51
- ##
52
- # XMPP defined error name
53
- def err_name
54
- self.class.err_name
35
+ def name
36
+ @name.gsub('-','_').to_sym
55
37
  end
56
38
 
57
39
  ##
@@ -59,7 +41,7 @@ class StreamError < BlatherError
59
41
  def to_node
60
42
  node = XMPPNode.new('stream:error')
61
43
 
62
- err = XMPPNode.new(self.err_name)
44
+ err = XMPPNode.new(@name)
63
45
  err.namespace = 'urn:ietf:params:xml:ns:xmpp-streams'
64
46
  node << err
65
47
 
@@ -85,169 +67,9 @@ class StreamError < BlatherError
85
67
  end
86
68
 
87
69
  def inspect # :nodoc:
88
- "Stream Error (#{self.err_name}): #{self.text}"
70
+ "Stream Error (#{@name}): #{self.text}"
89
71
  end
90
72
  alias_method :to_s, :inspect # :nodoc:
91
-
92
- ##
93
- # The entity has sent XML that cannot be processed; this error MAY be used instead of the more specific XML-related errors,
94
- # such as <bad-namespace-prefix/>, <invalid-xml/>, <restricted-xml/>, <unsupported-encoding/>, and <xml-not-well-formed/>,
95
- # although the more specific errors are preferred.
96
- class BadFormat < StreamError
97
- register :stream_bad_format_error, 'bad-format'
98
- end
99
-
100
- ##
101
- # The entity has sent a namespace prefix that is unsupported, or has sent no namespace prefix on an element that requires
102
- # such a prefix (see XML Namespace Names and Prefixes).
103
- class BadNamespacePrefix < StreamError
104
- register :stream_bad_namespace_prefix_error, 'bad-namespace-prefix'
105
- end
106
-
107
- ##
108
- # The server is closing the active stream for this entity because a new stream has been initiated that conflicts with the
109
- # existing stream.
110
- class Conflict < StreamError
111
- register :stream_conflict_error, 'conflict'
112
- end
113
-
114
- ##
115
- # The entity has not generated any traffic over the stream for some period of time (configurable according to a local service policy).
116
- class ConnectionTimeout < StreamError
117
- register :stream_connection_timeout_error, 'connection-timeout'
118
- end
119
-
120
- ##
121
- # The value of the 'to' attribute provided by the initiating entity in the stream header corresponds to a hostname that is no
122
- # longer hosted by the server.
123
- class HostGone < StreamError
124
- register :stream_host_gone_error, 'host-gone'
125
- end
126
-
127
- ##
128
- # The value of the 'to' attribute provided by the initiating entity in the stream header does not correspond to a hostname that
129
- # is hosted by the server.
130
- class HostUnknown < StreamError
131
- register :stream_host_unknown_error, 'host-unknown'
132
- end
133
-
134
- ##
135
- # a stanza sent between two servers lacks a 'to' or 'from' attribute (or the attribute has no value).
136
- class ImproperAddressing < StreamError
137
- register :stream_improper_addressing_error, 'improper-addressing'
138
- end
139
-
140
- ##
141
- # The server has experienced a misconfiguration or an otherwise-undefined internal error that prevents it from servicing the stream.
142
- class InternalServerError < StreamError
143
- register :stream_internal_server_error, 'internal-server-error'
144
- end
145
-
146
- ##
147
- # The JID or hostname provided in a 'from' address does not match an authorized JID or validated domain negotiated between
148
- # servers via SASL or dialback, or between a client and a server via authentication and resource binding.
149
- class InvalidFrom < StreamError
150
- register :stream_invalid_from_error, 'invalid-from'
151
- end
152
-
153
- ##
154
- # The stream ID or dialback ID is invalid or does not match an ID previously provided.
155
- class InvalidId < StreamError
156
- register :stream_invalid_id_error, 'invalid-id'
157
- end
158
-
159
- ##
160
- # The streams namespace name is something other than "http://etherx.jabber.org/streams" or the dialback namespace name is something
161
- # other than "jabber:server:dialback" (see XML Namespace Names and Prefixes).
162
- class InvalidNamespace < StreamError
163
- register :stream_invalid_namespace_error, 'invalid-namespace'
164
- end
165
-
166
- ##
167
- # The entity has sent invalid XML over the stream to a server that performs validation (see Validation).
168
- class InvalidXml < StreamError
169
- register :stream_invalid_xml_error, 'invalid-xml'
170
- end
171
-
172
- ##
173
- # The entity has attempted to send data before the stream has been authenticated, or otherwise is not authorized to perform an action
174
- # related to stream negotiation; the receiving entity MUST NOT process the offending stanza before sending the stream error.
175
- class NotAuthorized < StreamError
176
- register :stream_not_authorized_error, 'not-authorized'
177
- end
178
-
179
- ##
180
- # The entity has violated some local service policy; the server MAY choose to specify the policy in the <text/> element or an
181
- # application-specific condition element.
182
- class PolicyViolation < StreamError
183
- register :stream_policy_violation_error, 'policy-violation'
184
- end
185
-
186
- ##
187
- # The server is unable to properly connect to a remote entity that is required for authentication or authorization.
188
- class RemoteConnectionFailed < StreamError
189
- register :stream_remote_connection_failed_error, 'remote-connection-failed'
190
- end
191
-
192
- ##
193
- # The server lacks the system resources necessary to service the stream.
194
- class ResourceConstraint < StreamError
195
- register :stream_resource_constraint_error, 'resource-constraint'
196
- end
197
-
198
- ##
199
- # The entity has attempted to send restricted XML features such as a comment, processing instruction, DTD, entity reference,
200
- # or unescaped character (see Restrictions).
201
- class RestrictedXml < StreamError
202
- register :stream_restricted_xml_error, 'restricted-xml'
203
- end
204
-
205
- ##
206
- # The server will not provide service to the initiating entity but is redirecting traffic to another host; the server SHOULD
207
- # specify the alternate hostname or IP address (which MUST be a valid domain identifier) as the XML character data of the
208
- # <see-other-host/> element.
209
- class SeeOtherHost < StreamError
210
- register :stream_see_other_host_error, 'see-other-host'
211
- end
212
-
213
- ##
214
- # The server is being shut down and all active streams are being closed.
215
- class SystemShutdown < StreamError
216
- register :stream_system_shutdown_error, 'system-shutdown'
217
- end
218
-
219
- ##
220
- # The error condition is not one of those defined by the other conditions in this list; this error condition SHOULD be used
221
- # only in conjunction with an application-specific condition.
222
- class UndefinedCondition < StreamError
223
- register :stream_undefined_condition_error, 'undefined-condition'
224
- end
225
-
226
- ##
227
- # The initiating entity has encoded the stream in an encoding that is not supported by the server (see Character Encoding).
228
- class UnsupportedEncoding < StreamError
229
- register :stream_unsupported_encoding_error, 'unsupported-encoding'
230
- end
231
-
232
- ##
233
- # The initiating entity has sent a first-level child of the stream that is not supported by the server.
234
- class UnsupportedStanzaType < StreamError
235
- register :stream_unsupported_stanza_type_error, 'unsupported-stanza-type'
236
- end
237
-
238
- ##
239
- # The value of the 'version' attribute provided by the initiating entity in the stream header specifies a version of XMPP
240
- # That is not supported by the server; the server MAY specify the version(s) it supports in the <text/> element.
241
- class UnsupportedVersion < StreamError
242
- register :stream_unsupported_version_error, 'unsupported-version'
243
- end
244
-
245
- ##
246
- # The initiating entity has sent XML that is not well-formed as defined by [XML].
247
- class XmlNotWellFormed < StreamError
248
- register :stream_xml_not_well_formed_error, 'xml-not-well-formed'
249
- end
250
-
251
73
  end #StreamError
252
74
 
253
75
  end #Blather