xmpp4r 0.3.2 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. data/{ChangeLog → CHANGELOG} +33 -0
  2. data/LICENSE +9 -9
  3. data/README.rdoc +110 -0
  4. data/README_ruby19.txt +43 -0
  5. data/Rakefile +235 -74
  6. data/data/doc/xmpp4r/examples/advanced/adventure/README +0 -1
  7. data/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +1 -1
  8. data/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +12 -12
  9. data/data/doc/xmpp4r/examples/advanced/adventure/world.rb +10 -11
  10. data/data/doc/xmpp4r/examples/advanced/fileserve.rb +11 -11
  11. data/data/doc/xmpp4r/examples/advanced/getonline.rb +7 -7
  12. data/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +3 -3
  13. data/data/doc/xmpp4r/examples/advanced/migrate.rb +21 -22
  14. data/data/doc/xmpp4r/examples/advanced/minimuc.rb +22 -22
  15. data/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
  16. data/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
  17. data/data/doc/xmpp4r/examples/advanced/recvfile.rb +0 -1
  18. data/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +2 -3
  19. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +3 -3
  20. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +10 -10
  21. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +2 -2
  22. data/data/doc/xmpp4r/examples/advanced/versionpoll.rb +12 -12
  23. data/data/doc/xmpp4r/examples/advanced/xmpping.rb +2 -3
  24. data/data/doc/xmpp4r/examples/basic/change_password.rb +3 -3
  25. data/data/doc/xmpp4r/examples/basic/client.rb +5 -3
  26. data/data/doc/xmpp4r/examples/basic/component.rb +1 -1
  27. data/data/doc/xmpp4r/examples/basic/{echo_threaded.rb → echo.rb} +8 -7
  28. data/data/doc/xmpp4r/examples/basic/jabbersend.rb +5 -5
  29. data/data/doc/xmpp4r/examples/basic/mass_sender.rb +11 -11
  30. data/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +0 -1
  31. data/data/doc/xmpp4r/examples/basic/mucinfo.rb +3 -1
  32. data/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +0 -1
  33. data/data/doc/xmpp4r/examples/basic/register.rb +21 -4
  34. data/data/doc/xmpp4r/examples/basic/roster.rb +7 -5
  35. data/data/doc/xmpp4r/examples/basic/rosterprint.rb +0 -0
  36. data/data/doc/xmpp4r/examples/basic/rosterrename.rb +2 -2
  37. data/data/doc/xmpp4r/examples/basic/rosterwatch.rb +6 -7
  38. data/data/doc/xmpp4r/examples/basic/send_vcard.rb +3 -4
  39. data/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
  40. data/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
  41. data/data/doc/xmpp4r/examples/basic/versionbot.rb +1 -1
  42. data/lib/xmpp4r.rb +4 -4
  43. data/lib/xmpp4r/base64.rb +32 -0
  44. data/lib/xmpp4r/bytestreams/helper/filetransfer.rb +10 -11
  45. data/lib/xmpp4r/bytestreams/helper/ibb/base.rb +6 -8
  46. data/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +3 -6
  47. data/lib/xmpp4r/bytestreams/helper/ibb/target.rb +0 -1
  48. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +8 -11
  49. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +4 -7
  50. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +7 -3
  51. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +10 -5
  52. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +14 -4
  53. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
  54. data/lib/xmpp4r/bytestreams/iq/bytestreams.rb +0 -1
  55. data/lib/xmpp4r/callbacks.rb +5 -5
  56. data/lib/xmpp4r/caps.rb +1 -0
  57. data/lib/xmpp4r/caps/c.rb +53 -0
  58. data/lib/xmpp4r/caps/helper/generator.rb +160 -0
  59. data/lib/xmpp4r/caps/helper/helper.rb +87 -0
  60. data/lib/xmpp4r/client.rb +111 -40
  61. data/lib/xmpp4r/command/iq/command.rb +1 -1
  62. data/lib/xmpp4r/component.rb +8 -8
  63. data/lib/xmpp4r/connection.rb +25 -9
  64. data/lib/xmpp4r/dataforms/x/data.rb +17 -5
  65. data/lib/xmpp4r/debuglog.rb +13 -5
  66. data/lib/xmpp4r/delay/x/delay.rb +1 -1
  67. data/lib/xmpp4r/discovery.rb +3 -2
  68. data/lib/xmpp4r/discovery/helper/responder.rb +165 -0
  69. data/lib/xmpp4r/discovery/iq/discoinfo.rb +11 -12
  70. data/lib/xmpp4r/discovery/iq/discoitems.rb +12 -4
  71. data/lib/xmpp4r/{error.rb → errors.rb} +66 -10
  72. data/lib/xmpp4r/framework/base.rb +55 -0
  73. data/lib/xmpp4r/framework/bot.rb +148 -0
  74. data/lib/xmpp4r/httpbinding/client.rb +1 -1
  75. data/lib/xmpp4r/idgenerator.rb +1 -1
  76. data/lib/xmpp4r/iq.rb +34 -23
  77. data/lib/xmpp4r/jid.rb +2 -2
  78. data/lib/xmpp4r/message.rb +1 -1
  79. data/lib/xmpp4r/muc.rb +2 -0
  80. data/lib/xmpp4r/muc/helper/mucbrowser.rb +4 -19
  81. data/lib/xmpp4r/muc/helper/mucclient.rb +54 -23
  82. data/lib/xmpp4r/muc/helper/simplemucclient.rb +107 -1
  83. data/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
  84. data/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
  85. data/lib/xmpp4r/muc/iq/mucowner.rb +5 -1
  86. data/lib/xmpp4r/muc/item.rb +143 -0
  87. data/lib/xmpp4r/muc/x/mucuserinvite.rb +2 -2
  88. data/lib/xmpp4r/muc/x/mucuseritem.rb +3 -117
  89. data/lib/xmpp4r/presence.rb +2 -1
  90. data/lib/xmpp4r/pubsub.rb +7 -0
  91. data/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
  92. data/lib/xmpp4r/pubsub/{stanzas → children}/event.rb +13 -13
  93. data/lib/xmpp4r/pubsub/{stanzas → children}/item.rb +9 -1
  94. data/lib/xmpp4r/pubsub/{stanzas → children}/items.rb +10 -1
  95. data/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
  96. data/lib/xmpp4r/pubsub/children/publish.rb +24 -0
  97. data/lib/xmpp4r/pubsub/{stanzas → children}/subscription.rb +16 -12
  98. data/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
  99. data/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
  100. data/lib/xmpp4r/pubsub/helper/nodebrowser.rb +49 -93
  101. data/lib/xmpp4r/pubsub/helper/nodehelper.rb +39 -36
  102. data/lib/xmpp4r/pubsub/helper/servicehelper.rb +253 -162
  103. data/lib/xmpp4r/pubsub/iq/pubsub.rb +1 -1
  104. data/lib/xmpp4r/rexmladdons.rb +56 -28
  105. data/lib/xmpp4r/roster.rb +0 -1
  106. data/lib/xmpp4r/roster/helper/roster.rb +26 -15
  107. data/lib/xmpp4r/roster/iq/roster.rb +19 -19
  108. data/lib/xmpp4r/roster/x/roster.rb +10 -10
  109. data/lib/xmpp4r/rpc/helper/client.rb +17 -8
  110. data/lib/xmpp4r/rpc/helper/server.rb +1 -2
  111. data/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +14 -4
  112. data/lib/xmpp4r/rpc/iq/rpc.rb +0 -1
  113. data/lib/xmpp4r/sasl.rb +27 -6
  114. data/lib/xmpp4r/stream.rb +39 -44
  115. data/lib/xmpp4r/streamparser.rb +4 -4
  116. data/lib/xmpp4r/tune.rb +2 -0
  117. data/lib/xmpp4r/tune/helper/helper.rb +58 -0
  118. data/lib/xmpp4r/tune/tune.rb +113 -0
  119. data/lib/xmpp4r/vcard.rb +0 -1
  120. data/lib/xmpp4r/vcard/helper/vcard.rb +1 -3
  121. data/lib/xmpp4r/vcard/iq/vcard.rb +14 -0
  122. data/lib/xmpp4r/version/iq/version.rb +0 -1
  123. data/lib/xmpp4r/x.rb +1 -1
  124. data/lib/xmpp4r/xhtml.rb +1 -0
  125. data/lib/xmpp4r/xhtml/html.rb +115 -0
  126. data/lib/xmpp4r/xmpp4r.rb +7 -5
  127. data/lib/xmpp4r/xmppelement.rb +21 -5
  128. data/lib/xmpp4r/xmppstanza.rb +6 -6
  129. data/setup.rb +4 -4
  130. data/test/bytestreams/tc_ibb.rb +2 -2
  131. data/test/bytestreams/tc_socks5bytestreams.rb +12 -2
  132. data/test/caps/tc_helper.rb +156 -0
  133. data/test/dataforms/tc_data.rb +0 -0
  134. data/test/delay/tc_xdelay.rb +2 -2
  135. data/test/discovery/tc_responder.rb +91 -0
  136. data/test/lib/assert_equal_xml.rb +14 -0
  137. data/test/lib/clienttester.rb +31 -24
  138. data/test/muc/tc_muc_mucclient.rb +249 -13
  139. data/test/muc/tc_muc_simplemucclient.rb +41 -2
  140. data/test/muc/tc_mucowner.rb +0 -0
  141. data/test/pubsub/tc_helper.rb +486 -51
  142. data/test/pubsub/tc_nodeconfig.rb +54 -0
  143. data/test/pubsub/tc_subscriptionconfig.rb +41 -0
  144. data/test/roster/tc_helper.rb +6 -7
  145. data/test/roster/tc_iqqueryroster.rb +16 -16
  146. data/test/roster/tc_xroster.rb +1 -1
  147. data/test/rpc/tc_helper.rb +15 -3
  148. data/test/tc_callbacks.rb +7 -7
  149. data/test/tc_class_names.rb +15 -6
  150. data/test/tc_client.rb +3 -3
  151. data/test/{tc_error.rb → tc_errors.rb} +54 -12
  152. data/test/tc_idgenerator.rb +0 -0
  153. data/test/tc_iq.rb +32 -29
  154. data/test/tc_iqquery.rb +2 -2
  155. data/test/tc_jid.rb +44 -42
  156. data/test/tc_message.rb +13 -12
  157. data/test/tc_presence.rb +25 -24
  158. data/test/tc_rexml.rb +81 -2
  159. data/test/tc_stream.rb +15 -13
  160. data/test/tc_streamComponent.rb +6 -5
  161. data/test/tc_streamError.rb +21 -15
  162. data/test/tc_streamSend.rb +9 -9
  163. data/test/tc_streamparser.rb +112 -0
  164. data/test/tc_xmppstanza.rb +19 -9
  165. data/test/ts_xmpp4r.rb +10 -1
  166. data/test/tune/tc_helper_recv.rb +84 -0
  167. data/test/tune/tc_helper_send.rb +74 -0
  168. data/test/tune/tc_tune.rb +79 -0
  169. data/test/vcard/tc_helper.rb +2 -2
  170. data/test/vcard/tc_iqvcard.rb +13 -3
  171. data/test/version/tc_helper.rb +2 -2
  172. data/test/version/tc_iqqueryversion.rb +10 -10
  173. data/test/xhtml/tc_html.rb +41 -0
  174. data/tools/gen_requires.bash +29 -8
  175. data/tools/xmpp4r-gemspec-test.rb +11 -0
  176. data/xmpp4r.gemspec +291 -0
  177. metadata +277 -218
  178. data/README +0 -28
  179. data/UPDATING +0 -40
  180. data/data/doc/xmpp4r/examples/buggy/jabber2jabber/jabber2jabber.rb +0 -18
  181. data/data/doc/xmpp4r/examples/buggy/miniedgarr_cgi.rb +0 -192
  182. data/data/doc/xmpp4r/examples/buggy/miniedgarr_watch.rb +0 -82
  183. data/lib/xmpp4r/authenticationfailure.rb +0 -13
  184. data/lib/xmpp4r/errorexception.rb +0 -32
  185. data/tools/doctoweb.bash +0 -30
@@ -14,6 +14,6 @@ module Jabber
14
14
  class IqPubSubOwner < XMPPElement
15
15
  name_xmlns 'pubsub', NS_PUBSUB + '#owner'
16
16
  force_xmlns true
17
- end
17
+ end
18
18
  end
19
19
  end
@@ -10,32 +10,19 @@ require 'rexml/source'
10
10
  oldverbose = $VERBOSE
11
11
  $VERBOSE = false
12
12
 
13
- # REXML module. This file only adds the following methods to the REXML module, to
14
- # ease the coding:
15
- # * replace_element_text
16
- # * first_element
17
- # * first_element_text
18
- # * typed_add
19
- # * import
20
- # * self.import
21
- # * delete_elements
13
+ # REXML : Adds custom helper methods to the REXML module.
22
14
  #
23
- # Further definitions are just copied from REXML out of Ruby-1.8.4 to solve issues
24
- # with REXML in Ruby-1.8.2.
25
- #
26
- # The redefinitions of Text::normalize and Attribute#initialize address an issue
27
- # where entities in element texts and attributes were not escaped. This modifies
28
- # the behavious of REXML a bit but Sean Russell intends a similar behaviour for
29
- # the future of REXML.
30
15
  module REXML
16
+
31
17
  # this class adds a few helper methods to REXML::Element
32
18
  class Element
19
+
33
20
  ##
34
- # Replaces or add a child element of name <tt>e</tt> with text <tt>t</tt>.
21
+ # Replaces or adds a child element of name <tt>e</tt> with text <tt>t</tt>.
35
22
  def replace_element_text(e, t)
36
23
  el = first_element(e)
37
24
  if el.nil?
38
- el = REXML::Element::new(e)
25
+ el = REXML::Element.new(e)
39
26
  add_element(el)
40
27
  end
41
28
  if t
@@ -82,7 +69,9 @@ module REXML
82
69
  xmlelement.each do |e|
83
70
  if e.kind_of? REXML::Element
84
71
  typed_add(e.deep_clone)
85
- else # text element, probably.
72
+ elsif e.kind_of? REXML::Text
73
+ add_text(e.value)
74
+ else
86
75
  add(e.clone)
87
76
  end
88
77
  end
@@ -99,14 +88,52 @@ module REXML
99
88
  def delete_elements(element)
100
89
  while(delete_element(element)) do end
101
90
  end
102
- end
103
- end
104
91
 
105
- # very dirty fix for the :progress problem in REXML from Ruby 1.8.3
106
- # http://www.germane-software.com/projects/rexml/ticket/34
107
- # the fix proposed in REXML changeset 1145 only fixes this for pipes, not for
108
- # TCP sockets, so we have to keep this.
109
- module REXML
92
+ ##
93
+ # Test for equality of two elements, useful for assert_equal in
94
+ # test cases. Tries to parse String o as XML.
95
+ #
96
+ # See Test::Unit::Assertions
97
+ def ==(o)
98
+ return false unless self.kind_of? REXML::Element
99
+ if o.kind_of? REXML::Element
100
+ # Ok
101
+ elsif o.kind_of? String
102
+ # Parse o
103
+ begin
104
+ o = REXML::Document.new(o).root
105
+ rescue REXML::ParseException
106
+ return false
107
+ end
108
+ else
109
+ # Cannot compare with anything other than Elements or Strings
110
+ return false
111
+ end
112
+
113
+ return false unless name == o.name
114
+
115
+ attributes.each_attribute do |attr|
116
+ return false unless attr.value == o.attributes[attr.name]
117
+ end
118
+
119
+ o.attributes.each_attribute do |attr|
120
+ return false unless attributes[attr.name] == attr.value
121
+ end
122
+
123
+ children.each_with_index do |child,i|
124
+ return false unless child == o.children[i]
125
+ end
126
+
127
+ return true
128
+ end
129
+
130
+ end # class Element
131
+
132
+ # FIXME : Is this still needed now that we're a bit past Ruby 1.8.3??
133
+ # Very dirty fix for the :progress problem in REXML from Ruby 1.8.3
134
+ # http://www.germane-software.com/projects/rexml/ticket/34
135
+ # the fix proposed in REXML changeset 1145 only fixes this for pipes, not for
136
+ # TCP sockets, so we have to keep this.
110
137
  class IOSource
111
138
  def position
112
139
  0
@@ -115,8 +142,9 @@ module REXML
115
142
  def current_line
116
143
  [0, 0, ""]
117
144
  end
118
- end
119
- end
145
+ end # class IOSource
146
+
147
+ end # module REXML
120
148
 
121
149
  # Restore the old $VERBOSE setting
122
150
  $VERBOSE = oldverbose
@@ -5,4 +5,3 @@
5
5
  require 'xmpp4r/roster/iq/roster.rb'
6
6
  require 'xmpp4r/roster/helper/roster.rb'
7
7
  require 'xmpp4r/roster/x/roster.rb'
8
-
@@ -31,12 +31,16 @@ module Jabber
31
31
  # (Remember to send initial presence afterwards!)
32
32
  #
33
33
  # The initialization will not wait for the roster being received,
34
- # use add_query_callback to get notifyed when Roster::Helper#items
35
- # has been filled.
34
+ # use wait_for_roster.
35
+ #
36
+ # <b>Attention:</b> If you send presence and receive presences
37
+ # before the roster has arrived, the Roster helper will let them
38
+ # pass through and does *not* keep them!
36
39
  def initialize(stream)
37
40
  @stream = stream
38
41
  @items = {}
39
42
  @items_lock = Mutex.new
43
+ @roster_wait = Semaphore.new
40
44
  @query_cbs = CallbackList.new
41
45
  @update_cbs = CallbackList.new
42
46
  @presence_cbs = CallbackList.new
@@ -68,6 +72,13 @@ module Jabber
68
72
  stream.send(rosterget)
69
73
  end
70
74
 
75
+ ##
76
+ # Wait for first roster query result to arrive
77
+ def wait_for_roster
78
+ @roster_wait.wait
79
+ @roster_wait.run
80
+ end
81
+
71
82
  ##
72
83
  # Add a callback to be called when a query has been processed
73
84
  #
@@ -167,10 +178,11 @@ module Jabber
167
178
  }
168
179
  @update_cbs.process(olditem, newitem)
169
180
  end
170
-
181
+
182
+ @roster_wait.run
171
183
  @query_cbs.process(iq)
172
184
  end
173
-
185
+
174
186
  ##
175
187
  # Handle received <tt><presence/></tt> stanzas,
176
188
  # used internally
@@ -245,7 +257,7 @@ module Jabber
245
257
 
246
258
  ##
247
259
  # Returns the list of RosterItems which, stripped, are equal to the
248
- # one you are looking for.
260
+ # one you are looking for.
249
261
  def find(jid)
250
262
  jid = JID.new(jid) unless jid.kind_of? JID
251
263
 
@@ -297,7 +309,7 @@ module Jabber
297
309
  # Add a user to your roster
298
310
  #
299
311
  # Threading is encouraged as the function waits for
300
- # a result. ErrorException is thrown upon error.
312
+ # a result. ServerError is thrown upon error.
301
313
  #
302
314
  # See Jabber::Roster::Helper::RosterItem#subscribe for details
303
315
  # about subscribing. (This method isn't used here but the
@@ -314,7 +326,7 @@ module Jabber
314
326
  else
315
327
  request = Iq.new_rosterset
316
328
  request.query.add(Jabber::Roster::RosterItem.new(jid, iname))
317
- @stream.send_with_id(request) { true }
329
+ @stream.send_with_id(request)
318
330
  # Adding to list is handled by handle_iq_query_roster
319
331
  end
320
332
 
@@ -339,7 +351,7 @@ module Jabber
339
351
  unless self[jid.strip]
340
352
  request = Iq.new_rosterset
341
353
  request.query.add(Jabber::Roster::RosterItem.new(jid.strip, iname))
342
- @stream.send_with_id(request) { true }
354
+ @stream.send_with_id(request)
343
355
  end
344
356
  end
345
357
 
@@ -376,7 +388,7 @@ module Jabber
376
388
  request.query.add(self)
377
389
  @stream.send(request)
378
390
  end
379
-
391
+
380
392
  ##
381
393
  # Remove item
382
394
  #
@@ -384,11 +396,11 @@ module Jabber
384
396
  # and from you *to* the contact.
385
397
  #
386
398
  # The methods waits for a roster push from the server (success)
387
- # or throws ErrorException upon failure.
399
+ # or throws ServerError upon failure.
388
400
  def remove
389
401
  request = Iq.new_rosterset
390
402
  request.query.add(Jabber::Roster::RosterItem.new(jid, nil, :remove))
391
- @stream.send_with_id(request) { true }
403
+ @stream.send_with_id(request)
392
404
  # Removing from list is handled by Roster#handle_iq_query_roster
393
405
  end
394
406
 
@@ -404,7 +416,7 @@ module Jabber
404
416
  }.size > 0
405
417
  }
406
418
  end
407
-
419
+
408
420
  ##
409
421
  # Iterate through all received <tt><presence/></tt> stanzas
410
422
  def each_presence(&block)
@@ -413,7 +425,7 @@ module Jabber
413
425
  yield(pres)
414
426
  }
415
427
  end
416
-
428
+
417
429
  ##
418
430
  # Get specific presence
419
431
  # jid:: [JID] Full JID
@@ -475,7 +487,7 @@ module Jabber
475
487
  # Unsubscribe from a contact's presence
476
488
  #
477
489
  # This method waits for a presence with type='unsubscribed'
478
- # from the contact. It may throw ErrorException upon failure.
490
+ # from the contact. It may throw ServerError upon failure.
479
491
  #
480
492
  # subscription attribute of the item is *from* or *none*
481
493
  # afterwards. As long as you don't remove that item and
@@ -505,4 +517,3 @@ module Jabber
505
517
  end #Class Roster
506
518
  end #Module Roster
507
519
  end #Module Jabber
508
-
@@ -20,7 +20,7 @@ module Jabber
20
20
  # This <query/> contains multiple <item/> children. See RosterItem.
21
21
  class IqQueryRoster < IqQuery
22
22
  name_xmlns 'query', 'jabber:iq:roster'
23
-
23
+
24
24
  ##
25
25
  # Iterate through all items
26
26
  # &block:: Yield for every [RosterItem]
@@ -30,7 +30,7 @@ module Jabber
30
30
  yield(item) if item.kind_of?(RosterItem)
31
31
  }
32
32
  end
33
-
33
+
34
34
  ##
35
35
  # Get roster item by JID
36
36
  # jid:: [JID] or [Nil]
@@ -41,7 +41,7 @@ module Jabber
41
41
  }
42
42
  nil
43
43
  end
44
-
44
+
45
45
  ##
46
46
  # Get all items
47
47
  # result:: [Array] of [RosterItem]
@@ -52,7 +52,7 @@ module Jabber
52
52
  }
53
53
  a
54
54
  end
55
-
55
+
56
56
  ##
57
57
  # Update roster by <iq/> stanza
58
58
  # (to be fed by an iq_callback)
@@ -62,10 +62,10 @@ module Jabber
62
62
  if filter && (((iq.type != :set) && (iq.type != :result)) || (iq.queryns != 'jabber:iq:roster'))
63
63
  return
64
64
  end
65
-
65
+
66
66
  import(iq.query)
67
67
  end
68
-
68
+
69
69
  ##
70
70
  # Output for "p"
71
71
  #
@@ -76,7 +76,7 @@ module Jabber
76
76
  jids.join(', ')
77
77
  end
78
78
  end
79
-
79
+
80
80
  ##
81
81
  # Class containing the <item/> elements of the roster
82
82
  #
@@ -99,7 +99,7 @@ module Jabber
99
99
  self.subscription = subscription
100
100
  self.ask = ask
101
101
  end
102
-
102
+
103
103
  ##
104
104
  # Get name of roster item
105
105
  #
@@ -108,29 +108,29 @@ module Jabber
108
108
  def iname
109
109
  attributes['name']
110
110
  end
111
-
111
+
112
112
  ##
113
113
  # Set name of roster item
114
114
  # val:: [String] Name for this item
115
115
  def iname=(val)
116
116
  attributes['name'] = val
117
117
  end
118
-
118
+
119
119
  ##
120
120
  # Get JID of roster item
121
121
  # Resource of the JID will _not_ be stripped
122
122
  # return:: [JID]
123
123
  def jid
124
- (a = attributes['jid']) ? JID::new(a) : nil
124
+ (a = attributes['jid']) ? JID.new(a) : nil
125
125
  end
126
-
126
+
127
127
  ##
128
128
  # Set JID of roster item
129
129
  # val:: [JID] or nil
130
130
  def jid=(val)
131
131
  attributes['jid'] = val.nil? ? nil : val.to_s
132
132
  end
133
-
133
+
134
134
  ##
135
135
  # Get subscription type of roster item
136
136
  # result:: [Symbol] or [Nil] The following values are valid according to RFC3921:
@@ -149,7 +149,7 @@ module Jabber
149
149
  else nil
150
150
  end
151
151
  end
152
-
152
+
153
153
  ##
154
154
  # Set subscription type of roster item
155
155
  # val:: [Symbol] or [Nil] See subscription for possible Symbols
@@ -163,7 +163,7 @@ module Jabber
163
163
  else attributes['subscription'] = nil
164
164
  end
165
165
  end
166
-
166
+
167
167
  ##
168
168
  # Get if asking for subscription
169
169
  # result:: [Symbol] nil or :subscribe
@@ -173,7 +173,7 @@ module Jabber
173
173
  else nil
174
174
  end
175
175
  end
176
-
176
+
177
177
  ##
178
178
  # Set if asking for subscription
179
179
  # val:: [Symbol] nil or :subscribe
@@ -183,7 +183,7 @@ module Jabber
183
183
  else attributes['ask'] = nil
184
184
  end
185
185
  end
186
-
186
+
187
187
  ##
188
188
  # Get groups the item belongs to
189
189
  # result:: [Array] of [String] The groups
@@ -194,7 +194,7 @@ module Jabber
194
194
  }
195
195
  result.uniq
196
196
  end
197
-
197
+
198
198
  ##
199
199
  # Set groups the item belongs to,
200
200
  # deletes old groups first.
@@ -204,7 +204,7 @@ module Jabber
204
204
  def groups=(ary)
205
205
  # Delete old group elements
206
206
  delete_elements('group')
207
-
207
+
208
208
  # Add new group elements
209
209
  ary.uniq.each { |group|
210
210
  add_element('group').text = group
@@ -23,7 +23,7 @@ module Jabber
23
23
  class RosterX < XRoster
24
24
  name_xmlns 'x', 'http://jabber.org/protocol/rosterx'
25
25
  end
26
-
26
+
27
27
  ##
28
28
  # Class containing an <item/> element
29
29
  #
@@ -46,7 +46,7 @@ module Jabber
46
46
  self.jid = jid
47
47
  self.iname = iname
48
48
  end
49
-
49
+
50
50
  ##
51
51
  # Get name of roster item
52
52
  #
@@ -55,29 +55,29 @@ module Jabber
55
55
  def iname
56
56
  attributes['name']
57
57
  end
58
-
58
+
59
59
  ##
60
60
  # Set name of roster item
61
61
  # val:: [String] Name for this item
62
62
  def iname=(val)
63
63
  attributes['name'] = val
64
64
  end
65
-
65
+
66
66
  ##
67
67
  # Get JID of roster item
68
68
  # Resource of the JID will _not_ be stripped
69
69
  # return:: [JID]
70
70
  def jid
71
- JID::new(attributes['jid'])
71
+ JID.new(attributes['jid'])
72
72
  end
73
-
73
+
74
74
  ##
75
75
  # Set JID of roster item
76
76
  # val:: [JID] or nil
77
77
  def jid=(val)
78
78
  attributes['jid'] = val.nil? ? nil : val.to_s
79
79
  end
80
-
80
+
81
81
  ##
82
82
  # Get action for this roster item
83
83
  # * :add
@@ -91,7 +91,7 @@ module Jabber
91
91
  else :add
92
92
  end
93
93
  end
94
-
94
+
95
95
  ##
96
96
  # Set action for this roster item
97
97
  # (see action)
@@ -113,7 +113,7 @@ module Jabber
113
113
  }
114
114
  result
115
115
  end
116
-
116
+
117
117
  ##
118
118
  # Set groups the item belongs to,
119
119
  # deletes old groups first.
@@ -123,7 +123,7 @@ module Jabber
123
123
  def groups=(ary)
124
124
  # Delete old group elements
125
125
  delete_elements('group')
126
-
126
+
127
127
  # Add new group elements
128
128
  ary.uniq.each { |group|
129
129
  add_element('group').text = group