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
data/README DELETED
@@ -1,28 +0,0 @@
1
- XMPP4R
2
- ----------
3
- by:
4
- Lucas Nussbaum <lucas@lucas-nussbaum.net>
5
- Stephan Maka <stephan@spaceboyz.net>
6
- Kirill A. Shutemov <k.shutemov@gmail.com>
7
- Yuki Mitsui
8
- Peter Schrammel
9
- Olli
10
- Vojtech Vobr
11
- Andreas Wiese
12
-
13
- Currently, all the information is provided on
14
-
15
- http://home.gna.org/xmpp4r/
16
-
17
- The integrated HTML documentation can be built with
18
-
19
- rake rdoc
20
-
21
- If you need to ask questions, feel free to ask them on the
22
- xmpp4r-devel@gna.org mailing list. When reporting problems,
23
- please include a protocol dump which can be enabled with:
24
- Jabber::debug = true
25
-
26
- XMPP4R is released under the Ruby license (see the LICENSE file), which is
27
- compatible with the GNU GPL (see the COPYING file) via an explicit
28
- dual-licensing clause.
data/UPDATING DELETED
@@ -1,40 +0,0 @@
1
- Updating from XMPP4R 0.2 to 0.3
2
- ===============================
3
-
4
-
5
- There has been a redesign process in the development of XMPP4R 0.3. If
6
- you encounter any problems, read the following instructions.
7
-
8
-
9
- 1) All extension libraries have different paths and namespaces:
10
-
11
- Roster:
12
- require 'xmpp4r/roster'
13
- Jabber::Helpers::Roster -> Jabber::Roster::Helper
14
-
15
- Multi-User Chat:
16
- require 'xmpp4r/muc'
17
- Jabber::Helpers::MUCBrowser -> Jabber::MUC::MUCBrowser
18
- Jabber::Helpers::MUCClient -> Jabber::MUC::MUCClient
19
- Jabber::Helpers::SimpleMUCClient -> Jabber::MUC::SimpleMUCClient
20
-
21
- Software Version:
22
- require 'xmpp4r/version'
23
- Jabber::Helpers::Version -> Jabber::Version::SimpleResponder
24
-
25
- vCard:
26
- require 'xmpp4r/vcard'
27
- Jabber::Helpers::Vcard -> Jabber::Vcard::Helper
28
-
29
- Bytestreams:
30
- require 'xmpp4r/bytestreams'
31
- Jabber::Helpers::FileTransfer -> Jabber::FileTransfer::Helper
32
-
33
- For a complete list of new class names see test/tc_class_names.rb
34
-
35
-
36
- 2) add_*_callback methods do not accept procs anymore. procs maybe
37
- instead passed with the & sign.
38
-
39
- Example: client.add_message_callback(&my_message_handler)
40
-
@@ -1,18 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- $:.unshift '../lib'
4
-
5
- require 'xmpp4r'
6
- include Jabber
7
-
8
- c = Component::new('example.blop.info', 'linux.ensimag.fr', 2609)
9
- c.connect
10
- c.auth('BenEuh')
11
- c.add_iq_callback { |i|
12
- puts i.to_s
13
- }
14
-
15
- c.add_message_callback { |m|
16
- puts m.to_s
17
- }
18
- Thread.stop
@@ -1,192 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # cp /usr/local/share/psi/iconsets/roster/lightbulb/{away,online,offline,xa,chat,dnd}.png .
4
-
5
- $:.unshift '../lib'
6
-
7
- require 'GD'
8
- require 'cgi'
9
- require 'digest/md5'
10
-
11
- require 'rexml/document'
12
-
13
- require 'xmpp4r'
14
- require 'xmpp4r/iqqueryroster'
15
-
16
- # Handle CGI parameters
17
- cgi = CGI.new
18
- jid = Jabber::JID.new(cgi['jid']).strip
19
- jidhash = cgi['hash']
20
- transparency = (cgi['transparency'] == 'true')
21
-
22
- # Create data
23
-
24
- roster = Jabber::IqQueryRoster.new
25
- presences = {}
26
-
27
- # Load state
28
-
29
- doc = REXML::Document.new(File.new('edgarrstate.xml'))
30
-
31
- doc.root.each_element { |e|
32
- if (e.name == 'query') && (e.namespace == 'jabber:iq:roster')
33
- roster.import(e)
34
- elsif e.name == 'presence'
35
- pres = Jabber::Presence.new.import(e)
36
-
37
- if (pres.from.strip == jid) || (Digest::MD5.hexdigest(pres.from.strip.to_s) == jidhash)
38
- if (jid == '') && !jidhash.nil?
39
- jid = pres.from.strip
40
- end
41
- presences[pres.from] = pres
42
- end
43
- end
44
- }
45
-
46
- resources = (presences.size < 1) ? 1 : presences.size
47
-
48
-
49
- class BannerTable
50
- def initialize
51
- @lines = []
52
- end
53
-
54
- def last
55
- @lines[@lines.size - 1]
56
- end
57
-
58
- def add_line
59
- @lines.push(BannerLine.new)
60
- end
61
-
62
- def paint
63
- width = 0
64
- height = 0
65
- @lines.each do |line|
66
- if width < line.w
67
- width = line.w
68
- end
69
- height += line.h
70
- end
71
-
72
- gd = GD::Image.new(width + 6, height + 6)
73
- white = gd.colorAllocate(255,255,255)
74
- black = gd.colorAllocate(0,0,0)
75
-
76
- gd.fill(0, 0, black)
77
- gd.interlace = true
78
- gd.rectangle(0,0,width + 5,height + 5,white)
79
- y = 2
80
-
81
- @lines.each do |line|
82
- line.paint(gd, 3, y + (line.h / 2))
83
- y += line.h
84
- end
85
-
86
- gd
87
- end
88
- end
89
-
90
- class BannerLine
91
- def initialize
92
- @items = []
93
- end
94
-
95
- def add(type, text)
96
- @items.push(BannerItem.new(type, text))
97
- end
98
-
99
- def w
100
- w = 1
101
- @items.each do |item|
102
- w += item.w
103
- end
104
- w
105
- end
106
-
107
- def h
108
- h = 0
109
- @items.each do |item|
110
- if h < item.h
111
- h = item.h
112
- end
113
- end
114
- h
115
- end
116
-
117
- def paint(gd, x_start, y_center)
118
- x = x_start
119
- @items.each do |item|
120
- item.paint(gd, x, y_center - (item.h / 2))
121
- x += item.w
122
- end
123
- end
124
- end
125
-
126
- class BannerItem
127
- def initialize(type, text)
128
- @type = type
129
- @text = text
130
- end
131
-
132
- def w
133
- if @type.kind_of?(GD::Font)
134
- (@type.width * @text.size) + 2
135
- elsif @type.kind_of?(GD::Image)
136
- @type.width + 2
137
- end
138
- end
139
-
140
- def h
141
- if @type.kind_of?(GD::Font) || @type.kind_of?(GD::Image)
142
- @type.height + 2
143
- end
144
- end
145
-
146
- def paint(gd, x, y)
147
- if @type.kind_of?(GD::Font) && (@text.size > 0)
148
- gd.string(@type, x + 1, y + 1, @text, gd.colorAllocate(255,255,255))
149
- elsif @type.kind_of?(GD::Image)
150
- type = @type.to_paletteImage(false, 256)
151
- type.copy(gd, x + 1, y + 1, 0, 0, type.height, type.height)
152
- end
153
- end
154
- end
155
-
156
- # Paint the image
157
-
158
- table = BannerTable.new
159
- table.add_line
160
-
161
- # Put JID at top
162
- if roster[jid.strip].nil?
163
- iname = 'Unknown'
164
- else
165
- iname = roster[jid.strip].iname.to_s
166
- end
167
- table.last.add(GD::Font::MediumFont, iname == '' ? jid.to_s : iname)
168
-
169
- if (presences.size < 1)
170
- table.add_line
171
- table.last.add(GD::Font::SmallFont, 'Unavailable')
172
- else
173
- presences.each { |jid,pres|
174
- show = pres.show.to_s
175
- if pres.type == :unavailable
176
- show = 'offline'
177
- elsif pres.show.nil?
178
- show = 'online'
179
- end
180
-
181
- table.add_line
182
- table.last.add(GD::Image.newFromPng(File.new("miniedgarr_bulbs/#{show}.png")), nil)
183
- prio = pres.priority.nil? ? 0 : pres.priority
184
- table.last.add(GD::Font::SmallFont, "#{pres.from.resource} (#{prio})")
185
- table.add_line
186
- table.last.add(GD::Font::TinyFont, pres.status.to_s.strip)
187
- }
188
- end
189
-
190
- # Convert the image to PNG and print it on standard output
191
- print "Content-type: image/png\r\n\r\n"
192
- table.paint.png STDOUT
@@ -1,82 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- $:.unshift '../lib'
4
-
5
- require 'rexml/document'
6
-
7
- require 'xmpp4r'
8
- require 'xmpp4r/iqqueryroster'
9
-
10
- # Command line argument checking
11
-
12
- if ARGV.size != 3
13
- puts("Usage: ./rosterwatch.rb <jid> <password> <statefile>")
14
- exit
15
- end
16
-
17
-
18
- def write_state(statefile, roster, presences)
19
- doc = REXML::Document.new
20
- state = doc.add(REXML::Element.new('state'))
21
- state.add(roster)
22
- presences.each { |jid,pres| state.add(pres) }
23
-
24
- file = File.new(statefile, "w")
25
- doc.write(file, 0)
26
- file.close
27
- end
28
-
29
-
30
- # Building up the connection
31
-
32
- Jabber::debug = true
33
-
34
- jid = Jabber::JID.new(ARGV[0])
35
-
36
- cl = Jabber::Client.new(jid, false)
37
- cl.connect
38
- cl.auth(ARGV[1])
39
-
40
-
41
- roster = Jabber::IqQueryRoster.new
42
- presences = {}
43
-
44
- cl.add_iq_callback { |iq|
45
- if (iq.type == :result) && iq.query.kind_of?(Jabber::IqQueryRoster)
46
- roster.import(iq.query)
47
- write_state(ARGV[2], roster, presences)
48
- end
49
- }
50
-
51
- # TODO: <presence><x xmlns='jabber:x:delay'>...</x></presence>
52
- cl.add_presence_callback { |pres|
53
- # Handle subscription request
54
- if pres.type == :subscribe
55
- # Accept subscription
56
- cl.send(Jabber::Presence.new.set_to(pres.from).set_type(:subscribed))
57
- # Subscribe to sender
58
- cl.send(Jabber::Presence.new.set_to(pres.from).set_type(:subscribe))
59
- # Add to roster
60
- # TODO: Resolve Nickname from vCard
61
- roster_set_iq = Jabber::Iq.new(:set)
62
- roster_set_iq.add(Jabber::IqQueryRoster.new).add(Jabber::RosterItem.new(pres.from.strip))
63
- cl.send(roster_set_iq)
64
- end
65
-
66
- presences[pres.from] = pres
67
- write_state(ARGV[2], roster, presences)
68
- }
69
-
70
- # Send request for roster
71
- cl.send(Jabber::Iq.new_rosterget)
72
- # Send initial presence
73
- # This is important as it ensures reception of
74
- # further <presence/> stanzas
75
- cl.send(Jabber::Presence.new.set_show(:dnd).set_status('Watching my roster change...'))
76
-
77
- loop do
78
- cl.process
79
- sleep(1)
80
- end
81
-
82
- cl.close
@@ -1,13 +0,0 @@
1
- # =XMPP4R - XMPP Library for Ruby
2
- # License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
3
- # Website::http://home.gna.org/xmpp4r/
4
-
5
- module Jabber
6
- ##
7
- # The AuthenticationFailure is an Exception to be raised
8
- # when Client or Component authentication fails
9
- #
10
- # There are no special arguments
11
- class AuthenticationFailure < RuntimeError
12
- end
13
- end
@@ -1,32 +0,0 @@
1
- # =XMPP4R - XMPP Library for Ruby
2
- # License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
3
- # Website::http://home.gna.org/xmpp4r/
4
-
5
- module Jabber
6
- ##
7
- # This exception can be raised by Helpers when they
8
- # receive answers with <tt>type='error'</tt>
9
- #
10
- # The ErrorException carries a Jabber::Error element
11
- class ErrorException < RuntimeError
12
- ##
13
- # The error element which caused this exception
14
- attr_reader :error
15
-
16
- ##
17
- # Initialize an ErrorException
18
- # error:: [Error]
19
- def initialize(error)
20
- @error = error
21
- end
22
-
23
- ##
24
- # Textual output
25
- #
26
- # Sample:
27
- # subscription-required: Please subscribe first
28
- def to_s
29
- "#{@error.error}: #{@error.text}"
30
- end
31
- end
32
- end
@@ -1,30 +0,0 @@
1
- #!/bin/bash
2
-
3
- if [ -z $CVSDIR ]; then
4
- CVSDIR=$HOME/dev/xmpp4r-web
5
- fi
6
-
7
- TARGET=$CVSDIR/rdoc
8
-
9
- echo "Copying rdoc documentation to $TARGET."
10
-
11
- if [ ! -d $TARGET ]; then
12
- echo "$TARGET doesn't exist, exiting."
13
- exit 1
14
- fi
15
- rsync -a rdoc/ $TARGET/
16
-
17
- echo "###########################################################"
18
- echo "CVS status :"
19
- cd $TARGET
20
- cvs -q up
21
- echo "CVS Adding files."
22
- while [ $(cvs -q up | grep "^? " | wc -l) -gt 0 ]; do
23
- cvs add $(cvs -q up | grep "^? " | awk '{print $2}')
24
- done
25
- echo "###########################################################"
26
- echo "CVS status after adding missing files:"
27
- cvs -q up
28
- echo "Commit changes now with"
29
- echo "# (cd $TARGET && cvs commit -m \"rdoc update\")"
30
- exit 0