mad-p-xmpp4r 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/CHANGELOG +91 -0
  2. data/COPYING +340 -0
  3. data/LICENSE +59 -0
  4. data/README.rdoc +113 -0
  5. data/README_ruby19.txt +43 -0
  6. data/Rakefile +252 -0
  7. data/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
  8. data/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
  9. data/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
  10. data/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
  11. data/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
  12. data/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
  13. data/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
  14. data/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
  15. data/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
  16. data/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
  17. data/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
  18. data/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
  19. data/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
  20. data/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
  21. data/data/doc/xmpp4r/examples/advanced/recvfile.rb +85 -0
  22. data/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
  23. data/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
  24. data/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
  25. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
  26. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
  27. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
  28. data/data/doc/xmpp4r/examples/advanced/versionpoll.rb +109 -0
  29. data/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
  30. data/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
  31. data/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
  32. data/data/doc/xmpp4r/examples/basic/client.rb +70 -0
  33. data/data/doc/xmpp4r/examples/basic/component.rb +11 -0
  34. data/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
  35. data/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
  36. data/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
  37. data/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
  38. data/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
  39. data/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
  40. data/data/doc/xmpp4r/examples/basic/register.rb +42 -0
  41. data/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
  42. data/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
  43. data/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
  44. data/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
  45. data/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
  46. data/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
  47. data/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
  48. data/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
  49. data/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
  50. data/lib/xmpp4r.rb +116 -0
  51. data/lib/xmpp4r/base64.rb +32 -0
  52. data/lib/xmpp4r/bytestreams.rb +15 -0
  53. data/lib/xmpp4r/bytestreams/helper/filetransfer.rb +321 -0
  54. data/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
  55. data/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
  56. data/lib/xmpp4r/bytestreams/helper/ibb/target.rb +54 -0
  57. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +153 -0
  58. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
  59. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
  60. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
  61. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +82 -0
  62. data/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
  63. data/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
  64. data/lib/xmpp4r/callbacks.rb +133 -0
  65. data/lib/xmpp4r/caps.rb +1 -0
  66. data/lib/xmpp4r/caps/c.rb +67 -0
  67. data/lib/xmpp4r/caps/helper/generator.rb +160 -0
  68. data/lib/xmpp4r/caps/helper/helper.rb +84 -0
  69. data/lib/xmpp4r/client.rb +358 -0
  70. data/lib/xmpp4r/command/helper/responder.rb +53 -0
  71. data/lib/xmpp4r/command/iq/command.rb +154 -0
  72. data/lib/xmpp4r/component.rb +103 -0
  73. data/lib/xmpp4r/connection.rb +226 -0
  74. data/lib/xmpp4r/dataforms.rb +5 -0
  75. data/lib/xmpp4r/dataforms/x/data.rb +297 -0
  76. data/lib/xmpp4r/debuglog.rb +63 -0
  77. data/lib/xmpp4r/delay.rb +5 -0
  78. data/lib/xmpp4r/delay/x/delay.rb +99 -0
  79. data/lib/xmpp4r/discovery.rb +8 -0
  80. data/lib/xmpp4r/discovery/helper/helper.rb +58 -0
  81. data/lib/xmpp4r/discovery/helper/responder.rb +165 -0
  82. data/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
  83. data/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
  84. data/lib/xmpp4r/entity_time.rb +6 -0
  85. data/lib/xmpp4r/entity_time/iq.rb +45 -0
  86. data/lib/xmpp4r/entity_time/responder.rb +57 -0
  87. data/lib/xmpp4r/errors.rb +284 -0
  88. data/lib/xmpp4r/feature_negotiation.rb +5 -0
  89. data/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
  90. data/lib/xmpp4r/framework/base.rb +55 -0
  91. data/lib/xmpp4r/framework/bot.rb +148 -0
  92. data/lib/xmpp4r/httpbinding.rb +5 -0
  93. data/lib/xmpp4r/httpbinding/client.rb +384 -0
  94. data/lib/xmpp4r/idgenerator.rb +37 -0
  95. data/lib/xmpp4r/iq.rb +221 -0
  96. data/lib/xmpp4r/jid.rb +167 -0
  97. data/lib/xmpp4r/last.rb +2 -0
  98. data/lib/xmpp4r/last/helper/helper.rb +37 -0
  99. data/lib/xmpp4r/last/iq/last.rb +67 -0
  100. data/lib/xmpp4r/location.rb +2 -0
  101. data/lib/xmpp4r/location/helper/helper.rb +56 -0
  102. data/lib/xmpp4r/location/location.rb +179 -0
  103. data/lib/xmpp4r/message.rb +226 -0
  104. data/lib/xmpp4r/muc.rb +14 -0
  105. data/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
  106. data/lib/xmpp4r/muc/helper/mucclient.rb +469 -0
  107. data/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
  108. data/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
  109. data/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
  110. data/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
  111. data/lib/xmpp4r/muc/item.rb +143 -0
  112. data/lib/xmpp4r/muc/x/muc.rb +70 -0
  113. data/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
  114. data/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
  115. data/lib/xmpp4r/observable.rb +9 -0
  116. data/lib/xmpp4r/observable/contact.rb +61 -0
  117. data/lib/xmpp4r/observable/helper.rb +389 -0
  118. data/lib/xmpp4r/observable/observable_thing.rb +191 -0
  119. data/lib/xmpp4r/observable/pubsub.rb +211 -0
  120. data/lib/xmpp4r/observable/subscription.rb +57 -0
  121. data/lib/xmpp4r/observable/thread_store.rb +65 -0
  122. data/lib/xmpp4r/presence.rb +232 -0
  123. data/lib/xmpp4r/pubsub.rb +8 -0
  124. data/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
  125. data/lib/xmpp4r/pubsub/children/event.rb +49 -0
  126. data/lib/xmpp4r/pubsub/children/item.rb +35 -0
  127. data/lib/xmpp4r/pubsub/children/items.rb +53 -0
  128. data/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
  129. data/lib/xmpp4r/pubsub/children/publish.rb +38 -0
  130. data/lib/xmpp4r/pubsub/children/retract.rb +41 -0
  131. data/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
  132. data/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
  133. data/lib/xmpp4r/pubsub/children/unsubscribe.rb +63 -0
  134. data/lib/xmpp4r/pubsub/helper/nodebrowser.rb +129 -0
  135. data/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
  136. data/lib/xmpp4r/pubsub/helper/oauth_service_helper.rb +90 -0
  137. data/lib/xmpp4r/pubsub/helper/servicehelper.rb +490 -0
  138. data/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
  139. data/lib/xmpp4r/query.rb +15 -0
  140. data/lib/xmpp4r/reliable.rb +168 -0
  141. data/lib/xmpp4r/rexmladdons.rb +197 -0
  142. data/lib/xmpp4r/roster.rb +7 -0
  143. data/lib/xmpp4r/roster/helper/roster.rb +532 -0
  144. data/lib/xmpp4r/roster/iq/roster.rb +215 -0
  145. data/lib/xmpp4r/roster/x/roster.rb +138 -0
  146. data/lib/xmpp4r/rpc.rb +2 -0
  147. data/lib/xmpp4r/rpc/helper/client.rb +123 -0
  148. data/lib/xmpp4r/rpc/helper/server.rb +74 -0
  149. data/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
  150. data/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
  151. data/lib/xmpp4r/sasl.rb +248 -0
  152. data/lib/xmpp4r/semaphore.rb +38 -0
  153. data/lib/xmpp4r/stream.rb +599 -0
  154. data/lib/xmpp4r/streamparser.rb +85 -0
  155. data/lib/xmpp4r/test/listener_mocker.rb +118 -0
  156. data/lib/xmpp4r/tune.rb +2 -0
  157. data/lib/xmpp4r/tune/helper/helper.rb +58 -0
  158. data/lib/xmpp4r/tune/tune.rb +113 -0
  159. data/lib/xmpp4r/vcard.rb +6 -0
  160. data/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
  161. data/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
  162. data/lib/xmpp4r/version.rb +7 -0
  163. data/lib/xmpp4r/version/helper/responder.rb +72 -0
  164. data/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
  165. data/lib/xmpp4r/version/iq/version.rb +105 -0
  166. data/lib/xmpp4r/x.rb +37 -0
  167. data/lib/xmpp4r/xhtml.rb +1 -0
  168. data/lib/xmpp4r/xhtml/html.rb +115 -0
  169. data/lib/xmpp4r/xmpp4r.rb +20 -0
  170. data/lib/xmpp4r/xmppelement.rb +168 -0
  171. data/lib/xmpp4r/xmppstanza.rb +162 -0
  172. data/mad-p-xmpp4r.gemspec +249 -0
  173. data/setup.rb +1586 -0
  174. data/test/bytestreams/tc_ibb.rb +188 -0
  175. data/test/bytestreams/tc_socks5bytestreams.rb +114 -0
  176. data/test/caps/tc_helper.rb +158 -0
  177. data/test/dataforms/tc_data.rb +81 -0
  178. data/test/delay/tc_xdelay.rb +51 -0
  179. data/test/discovery/tc_responder.rb +91 -0
  180. data/test/entity_time/tc_responder.rb +65 -0
  181. data/test/last/tc_helper.rb +75 -0
  182. data/test/lib/assert_equal_xml.rb +14 -0
  183. data/test/lib/clienttester.rb +149 -0
  184. data/test/muc/tc_muc_mucclient.rb +834 -0
  185. data/test/muc/tc_muc_simplemucclient.rb +114 -0
  186. data/test/muc/tc_mucowner.rb +50 -0
  187. data/test/pubsub/tc_helper.rb +785 -0
  188. data/test/pubsub/tc_nodeconfig.rb +61 -0
  189. data/test/pubsub/tc_subscriptionconfig.rb +41 -0
  190. data/test/reliable/tc_disconnect_cleanup.rb +334 -0
  191. data/test/reliable/tc_disconnect_exception.rb +37 -0
  192. data/test/reliable/tc_listener_mocked_test.rb +68 -0
  193. data/test/reliable/tc_reliable_connection.rb +31 -0
  194. data/test/roster/tc_helper.rb +523 -0
  195. data/test/roster/tc_iqqueryroster.rb +173 -0
  196. data/test/roster/tc_xroster.rb +73 -0
  197. data/test/rpc/tc_helper.rb +96 -0
  198. data/test/tc_callbacks.rb +129 -0
  199. data/test/tc_class_names.rb +146 -0
  200. data/test/tc_client.rb +30 -0
  201. data/test/tc_errors.rb +146 -0
  202. data/test/tc_idgenerator.rb +30 -0
  203. data/test/tc_iq.rb +113 -0
  204. data/test/tc_iqquery.rb +31 -0
  205. data/test/tc_jid.rb +204 -0
  206. data/test/tc_message.rb +182 -0
  207. data/test/tc_presence.rb +150 -0
  208. data/test/tc_rexml.rb +139 -0
  209. data/test/tc_stream.rb +167 -0
  210. data/test/tc_streamComponent.rb +105 -0
  211. data/test/tc_streamError.rb +129 -0
  212. data/test/tc_streamSend.rb +59 -0
  213. data/test/tc_streamparser.rb +125 -0
  214. data/test/tc_xmppstanza.rb +135 -0
  215. data/test/ts_xmpp4r.rb +44 -0
  216. data/test/tune/tc_helper_recv.rb +82 -0
  217. data/test/tune/tc_helper_send.rb +74 -0
  218. data/test/tune/tc_tune.rb +79 -0
  219. data/test/vcard/tc_helper.rb +49 -0
  220. data/test/vcard/tc_iqvcard.rb +62 -0
  221. data/test/version/tc_helper.rb +60 -0
  222. data/test/version/tc_iqqueryversion.rb +97 -0
  223. data/test/xhtml/tc_html.rb +41 -0
  224. data/tools/gen_requires.bash +31 -0
  225. data/tools/xmpp4r-gemspec-test.rb +11 -0
  226. metadata +286 -0
data/README.rdoc ADDED
@@ -0,0 +1,113 @@
1
+ = XMPP4R
2
+
3
+ == Project Home
4
+
5
+ You can find info about the xmpp4r project and how to contribute
6
+ at the project home page:
7
+
8
+ http://home.gna.org/xmpp4r/
9
+
10
+ If you need to ask questions, or want feedback on proposed changes
11
+ please feel free to ask them on the 'xmpp4r-devel@gna.org' mailing
12
+ list. You can join or view archives of the mailing list at:
13
+
14
+ https://gna.org/mail/?group=xmpp4r
15
+
16
+ If you are having a problem and would like to report it
17
+ to the mailing list please include a protocol dump
18
+ which can be enabled in your code with:
19
+
20
+ Jabber::debug = true
21
+
22
+
23
+ == Contributors
24
+
25
+ Lucas Nussbaum <lucas@lucas-nussbaum.net>
26
+ Stephan Maka <stephan@spaceboyz.net>
27
+ Kirill A. Shutemov <k.shutemov@gmail.com>
28
+ Glenn Rempe <glenn@rempe.us>
29
+ Jacob Burkhart <jacob@brontes3d.com>
30
+ Yuki Mitsui
31
+ Peter Schrammel
32
+ Olli
33
+ Vojtech Vobr
34
+ Andreas Wiese
35
+ Chris Zelenak
36
+ Matthew Wood
37
+ Sam Ruby
38
+ Tim Carey-Smith
39
+ Scott Lillibridge
40
+ Joshua Sierles
41
+ Ripta Pasay <github@r8y.org>
42
+ Seth Fitzsimmons
43
+
44
+
45
+ == Source Code
46
+
47
+ The source for xmpp4r is managed using the Git SCM and can be
48
+ found in our GitHub.com project page:
49
+
50
+ http://github.com/ln/xmpp4r/tree/master
51
+
52
+
53
+ == Installation
54
+
55
+ There are a number of ways that you can install xmpp4r depending
56
+ on your needs and the methods you prefer.
57
+
58
+ === Install over the network using RubyGems
59
+
60
+ You can install the current release of the xmpp4r library from a stable
61
+ release gem on RubyForge using RubyGems:
62
+
63
+ sudo gem install xmpp4r
64
+
65
+ === Install over the network using a Debian package
66
+
67
+ You can install the current release of the xmpp4r library from a stable release copy
68
+ on your .deb friendly linux system (e.g. Debian or Ubuntu) using apt:
69
+
70
+ sudo apt-get install libxmpp4r-ruby
71
+
72
+ === Install from local source code (Developers Only)
73
+
74
+ If you have a local Git clone of the source repository or a tarball
75
+ you can install xmpp4r using several methods. First you'll
76
+ need to get a local copy.
77
+
78
+ Clone the Git repository (recommended):
79
+
80
+ git clone git://github.com/ln/xmpp4r.git
81
+
82
+ OR download a stable release tarball from:
83
+
84
+ http://download.gna.org/xmpp4r/xmpp4r-0.3.2.tgz
85
+
86
+ OR download a snapshot of the latest source in .tar.gz format from:
87
+
88
+ http://github.com/ln/xmpp4r/tarball/master
89
+
90
+ ==== Install : Using Rake
91
+
92
+ # Show all available rake tasks
93
+ cd xmpp4r/
94
+ rake -T
95
+
96
+ # Package up the gem file and install it
97
+ rake gem:install
98
+
99
+ ==== Install : Using setup.rb
100
+
101
+ This will install a copy of the library in your Ruby path and does not
102
+ require RubyGems to be installed.
103
+
104
+ cd xmpp4r/
105
+ ./setup.rb
106
+
107
+
108
+ == License
109
+
110
+ XMPP4R is released under the Ruby license (see the LICENSE file), which is
111
+ compatible with the GNU GPL (see the COPYING file) via an explicit
112
+ dual-licensing clause.
113
+
data/README_ruby19.txt ADDED
@@ -0,0 +1,43 @@
1
+ Ruby 1.9 is a development release in anticipation of Ruby 2.0, which has
2
+ overall better performance, real threading, and character encoding support.
3
+ Note: Ruby 1.9 is a development release, meaning that everything is
4
+ subject to change without prior notice. Among other things, this means
5
+ that xmpp4r could stop working on Ruby 1.9 at any time.
6
+
7
+ This version of xmpp4r has made a number of internal changes (nothing visible
8
+ at the API) to remove depency on deprecated Ruby Kernel APIs, support the new
9
+ encoding APIs, etc.
10
+
11
+ At the present time, all tests pass except tc_helper.rb and tc_stream.rb.
12
+ These tests themselves make assumptions about timinings of events,
13
+ assumptions that are not guaranteed with true multi-tasking. Initial
14
+ analysis indicates that xmpp4r is operating correctly, it is the tests
15
+ themselves that need to be corrected, but this could turn out to be
16
+ incorrect.
17
+
18
+ The executing of these two tests are disabled by a check in ts_xmpp4r.rb,
19
+ which is marked as a TODO.
20
+
21
+ A specific example: test_bidi in test/tc_stream.rb defines two threads,
22
+ one pumps out requests, the other echoes them. The receiver then verifies
23
+ that it gets back what it sent. With Ruby 1.8, these threads tend to
24
+ alternate in lock step, and the test usually passes. What happens in Ruby 1.9
25
+ is that the first thread waits for a message, and the second one creates a
26
+ callback block, generates a message, and then proceeds on to create a second
27
+ callback block -- even before the first message has been responded to.
28
+ The way xmpp4r works is that callbacks are saved on a pushdown stack.
29
+
30
+ The net result is that the first response typically is processed first by
31
+ the second callback, which decides that the ids don't match, and the test fails.
32
+
33
+ The way it is supposed to work is that the reply callback is supposed to
34
+ only process requests destined for it (and return true) and ignore
35
+ everything else (returning false).
36
+
37
+ This is but one test. Many of the tests in these two files are of this
38
+ nature.
39
+
40
+ The current status of the tests that are expected to pass on Ruby 1.9
41
+ can generally be found here:
42
+
43
+ http://intertwingly.net/projects/ruby19/logs/xmpp4r.html
data/Rakefile ADDED
@@ -0,0 +1,252 @@
1
+ require 'rake'
2
+ require "rake/clean"
3
+ require 'rake/testtask'
4
+ require 'rdoc/task'
5
+
6
+ $:.unshift 'lib'
7
+ require "xmpp4r"
8
+
9
+ ##############################################################################
10
+ # OPTIONS
11
+ ##############################################################################
12
+
13
+ PKG_NAME = 'mad-p-xmpp4r'
14
+ PKG_VERSION = Jabber::XMPP4R_VERSION
15
+ AUTHORS = ['Lucas Nussbaum', 'Stephan Maka', 'Glenn Rempe', 'Kaoru Maeda']
16
+ EMAIL = "kaoru.maeda@gmail.com"
17
+ HOMEPAGE = "https://github.com/mad-p/xmpp4r"
18
+ SUMMARY = "This is a fork from XMPP4R (https://github.com/ln/xmpp4r), fixing BOSH"
19
+
20
+ # These are the common rdoc options that are shared between generation of
21
+ # rdoc files using BOTH 'rake rdoc' and the installation by users of a
22
+ # RubyGem version which builds rdoc's along with its installation. Any
23
+ # rdoc options that are ONLY for developers running 'rake rdoc' should be
24
+ # added in the 'RDoc::Task' block below.
25
+ RDOC_OPTIONS = [
26
+ "--quiet",
27
+ "--title", SUMMARY,
28
+ "--opname", "index.html",
29
+ "--main", "lib/xmpp4r.rb",
30
+ "--line-numbers",
31
+ "--inline-source"
32
+ ]
33
+
34
+ # Extra files outside of the lib dir that should be included with the rdocs.
35
+ RDOC_FILES = (%w( README.rdoc README_ruby19.txt CHANGELOG LICENSE COPYING )).sort
36
+
37
+ # The full file list used for rdocs, tarballs, gems, and for generating the mad-p-xmpp4r.gemspec.
38
+ PKG_FILES = (%w( Rakefile setup.rb mad-p-xmpp4r.gemspec ) + RDOC_FILES + Dir["{lib,test,data,tools}/**/*"]).sort
39
+
40
+ ##############################################################################
41
+ # DEFAULT TASK
42
+ ##############################################################################
43
+
44
+ # The task that will run when a simple 'rake' command is issued.
45
+ # Default to running the test suite as that's a nice safe command
46
+ # we should run frequently.
47
+ task :default => [:test]
48
+
49
+ ##############################################################################
50
+ # TESTING TASKS
51
+ ##############################################################################
52
+
53
+ Rake::TestTask.new do |t|
54
+ t.libs << "test"
55
+ t.test_files = ['test/ts_xmpp4r.rb']
56
+ end
57
+
58
+ ##############################################################################
59
+ # DOCUMENTATION TASKS
60
+ ##############################################################################
61
+
62
+ # RDOC
63
+ #######
64
+ RDoc::Task.new do |rd|
65
+
66
+ # which dir should rdoc files be installed in?
67
+ rd.rdoc_dir = 'rdoc'
68
+
69
+ # the full list of files to be included
70
+ rd.rdoc_files.include(RDOC_FILES, "lib/**/*.rb")
71
+
72
+ # the full list of options that are common between gem build
73
+ # and 'rake rdoc' build of docs.
74
+ rd.options = RDOC_OPTIONS
75
+
76
+ # Devs Only : Uncomment to also document private methods in the rdocs
77
+ # Please don't check this change in to the source repo.
78
+ #rd.options << '--all'
79
+
80
+ # Devs Only : Uncomment to generate dot (graphviz) diagrams along with rdocs.
81
+ # This requires that graphiz (dot) be installed as a local binary and on your path.
82
+ # See : http://www.graphviz.org/
83
+ # Please don't check this change in to the source repo as it introduces a binary dependency.
84
+ #rd.options << '--diagram'
85
+ #rd.options << '--fileboxes'
86
+
87
+ end
88
+
89
+
90
+ # RCOV
91
+ #######
92
+
93
+ # Conditional require rcov/rcovtask if present
94
+ begin
95
+ require 'rcov/rcovtask'
96
+
97
+ Rcov::RcovTask.new do |t|
98
+ t.test_files = ['test/ts_xmpp4r.rb']
99
+ t.output_dir = "coverage"
100
+ end
101
+ rescue LoadError
102
+ end
103
+
104
+ # DOT GRAPH
105
+ ############
106
+ desc "Generate requires graph"
107
+ task :gen_requires_graph do
108
+ sh %{cd tools; ./gen_requires.bash}
109
+ end
110
+
111
+ # UPDATE WEBSITE (for Lucas only)
112
+ #################################
113
+ desc "Update website (for Lucas only)"
114
+ task :update_website do
115
+ sh %{cp website/* ~/dev/xmpp4r/website/ && cd ~/dev/xmpp4r/website/ && svn commit -m "website update"}
116
+ end
117
+
118
+
119
+ ##############################################################################
120
+ # SYNTAX CHECKING
121
+ ##############################################################################
122
+
123
+ desc "Check syntax of all Ruby files."
124
+ task :check_syntax do
125
+ `find . -name "*.rb" |xargs -n1 ruby -c |grep -v "Syntax OK"`
126
+ puts "* Done"
127
+ end
128
+
129
+ ##############################################################################
130
+ # PACKAGING & INSTALLATION
131
+ ##############################################################################
132
+
133
+ # What files/dirs should 'rake clean' remove?
134
+ CLEAN.include ["*.gem", "pkg", "rdoc", "coverage", "tools/*.png"]
135
+
136
+ begin
137
+ require 'rubygems/package_task'
138
+
139
+ spec = Gem::Specification.new do |s|
140
+ s.name = PKG_NAME
141
+ s.version = PKG_VERSION
142
+ s.authors = AUTHORS
143
+ s.email = EMAIL
144
+ s.homepage = HOMEPAGE
145
+ s.rubyforge_project = PKG_NAME
146
+ s.summary = SUMMARY
147
+ s.description = s.summary
148
+ s.platform = Gem::Platform::RUBY
149
+ s.require_path = 'lib'
150
+ s.executables = []
151
+ s.files = PKG_FILES
152
+ s.test_files = []
153
+ s.has_rdoc = true
154
+ s.extra_rdoc_files = RDOC_FILES
155
+ s.rdoc_options = RDOC_OPTIONS
156
+ s.required_ruby_version = ">= 1.8.4"
157
+ end
158
+
159
+ Gem::PackageTask.new(spec) do |pkg|
160
+ pkg.gem_spec = spec
161
+ pkg.need_tar = true
162
+ pkg.need_zip = true
163
+ end
164
+
165
+ namespace :gem do
166
+
167
+ desc "Run :package and install the .gem locally"
168
+ task :install => [:update_gemspec, :package] do
169
+ sh %{sudo gem install --local pkg/#{PKG_NAME}-#{PKG_VERSION}.gem}
170
+ end
171
+
172
+ desc "Like gem:install but without ri or rdocs"
173
+ task :install_fast => [:update_gemspec, :package] do
174
+ sh %{sudo gem install --local pkg/#{PKG_NAME}-#{PKG_VERSION}.gem --no-rdoc --no-ri}
175
+ end
176
+
177
+ desc "Run :clean and uninstall the .gem"
178
+ task :uninstall => :clean do
179
+ sh %{sudo gem uninstall #{PKG_NAME}}
180
+ end
181
+
182
+ # Thanks to the Merb project for this code.
183
+ desc "Update Github Gemspec"
184
+ task :update_gemspec do
185
+ skip_fields = %w(new_platform original_platform date cache_dir cache_file loaded)
186
+
187
+ result = "# WARNING : RAKE AUTO-GENERATED FILE. DO NOT MANUALLY EDIT!\n"
188
+ result << "# RUN : 'rake gem:update_gemspec'\n\n"
189
+ result << "Gem::Specification.new do |s|\n"
190
+ spec.instance_variables.sort.each do |ivar|
191
+ value = spec.instance_variable_get(ivar)
192
+ name = ivar.to_s.split("@").last
193
+ next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
194
+ if name == "dependencies"
195
+ value.each do |d|
196
+ dep, *ver = d.to_s.split(" ")
197
+ result << " s.add_dependency #{dep.inspect}, #{ver.join(" ").inspect.gsub(/[()]/, "")}\n"
198
+ end
199
+ else
200
+ case value
201
+ when Array
202
+ value = name != "files" ? value.inspect : value.sort.uniq.inspect.split(",").join(",\n")
203
+ when String, Fixnum, true, false
204
+ value = value.inspect
205
+ else
206
+ value = value.to_s.inspect
207
+ end
208
+ result << " s.#{name} = #{value}\n"
209
+ end
210
+ end
211
+ result << "end"
212
+ File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
213
+ end
214
+
215
+ end # namespace :gem
216
+
217
+ # also keep the gemspec up to date each time we package a tarball or gem
218
+ task :package => ['gem:update_gemspec']
219
+ task :gem => ['gem:update_gemspec']
220
+
221
+ rescue LoadError
222
+ puts <<EOF
223
+ ###
224
+ Packaging Warning : RubyGems is apparently not installed on this
225
+ system and any file add/remove/rename will not
226
+ be auto-updated in the 'mad-p-xmpp4r.gemspec' when you run any
227
+ package tasks. All such file changes are recommended
228
+ to be packaged on a system with RubyGems installed
229
+ if you intend to push commits to the Git repo so the
230
+ gemspec will also stay in sync for others.
231
+ ###
232
+ EOF
233
+ end
234
+
235
+ # we are apparently on a system that does not have RubyGems installed.
236
+ # Lets try to provide only the basic tarball package tasks as a fallback.
237
+ unless defined? Gem
238
+ begin
239
+ require 'rake/packagetask'
240
+ Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |p|
241
+ p.package_files = PKG_FILES
242
+ p.need_tar = true
243
+ p.need_zip = true
244
+ end
245
+ rescue LoadError
246
+ puts <<EOF
247
+ ###
248
+ Warning : Unable to require the 'rake/packagetask'. Is Rake installed?
249
+ ###
250
+ EOF
251
+ end
252
+ end
@@ -0,0 +1,56 @@
1
+ What is this?
2
+
3
+ This is an example of what you can do with XMPP4R. It is a conferencing
4
+ component in which you can walk around, travel to various places, look
5
+ at things and talk to other visitors on the same places. If you like
6
+ Multi-User Dungeons (MUDs) this is for you!
7
+
8
+ ---
9
+
10
+ How does it work?
11
+
12
+ The component loads a few worlds from a few XML files. Each world is a
13
+ component. Once joined the chat will tell you what you can do. Remember
14
+ that you can get a command listing anytime by saying '?'.
15
+
16
+ Reading 'You can go north, west' you may say 'go north' to go in the
17
+ northern direction and 'go west' to go in the western direction. You'll
18
+ then find yourself at some other place but still in the same MUC
19
+ conference. Your groupchat roster will change as you'll notice different
20
+ people and things that are just in the same place, not other places.
21
+
22
+ Before starting to hack the scripts you may want to take a look at
23
+ tower.xml. Note that users are <thing/>s, too and the whole world could
24
+ be serialized back to XML by just issuing "world.to_s".
25
+
26
+ Please note that the code, especially the error handling, is of extreme
27
+ poor quality and was mostly written in one afternoon. If I'm going to
28
+ develop this further everything should be rewritten...
29
+
30
+ ---
31
+
32
+ How to try?
33
+
34
+ Because this is a component you are going to need your own Jabber
35
+ Daemon - which you'll need anyways if you're going to experiment with
36
+ XMPP4R. ;-)
37
+
38
+ Syntax:
39
+ ./adventure.rb <JID> <Password> <Host>
40
+
41
+ Example:
42
+ ./adventure.rb mud.example.com geheimnis localhost
43
+
44
+ ---
45
+
46
+ Messages seem to have random order?
47
+
48
+ I don't know any solution for this. One may add short delays between
49
+ messages, but that would only be a very dirty hack.
50
+
51
+ RFC3920:
52
+
53
+ "10. Server Rules for Handling XML Stanzas
54
+
55
+ Compliant server implementations MUST ensure in-order processing of
56
+ XML stanzas between any two entities."