mack-notifier 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. data/lib/gems.rb +13 -0
  2. data/lib/gems/tmail-1.2.3.1/ext/Makefile +20 -0
  3. data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/MANIFEST +4 -0
  4. data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/depend +1 -0
  5. data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/extconf.rb +33 -0
  6. data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/tmailscanner.c +583 -0
  7. data/lib/gems/tmail-1.2.3.1/lib/tmail.rb +5 -0
  8. data/lib/gems/tmail-1.2.3.1/lib/tmail/Makefile +18 -0
  9. data/lib/gems/tmail-1.2.3.1/lib/tmail/address.rb +426 -0
  10. data/lib/gems/tmail-1.2.3.1/lib/tmail/attachments.rb +46 -0
  11. data/lib/gems/tmail-1.2.3.1/lib/tmail/base64.rb +46 -0
  12. data/lib/gems/tmail-1.2.3.1/lib/tmail/compat.rb +41 -0
  13. data/lib/gems/tmail-1.2.3.1/lib/tmail/config.rb +67 -0
  14. data/lib/gems/tmail-1.2.3.1/lib/tmail/core_extensions.rb +63 -0
  15. data/lib/gems/tmail-1.2.3.1/lib/tmail/encode.rb +581 -0
  16. data/lib/gems/tmail-1.2.3.1/lib/tmail/header.rb +960 -0
  17. data/lib/gems/tmail-1.2.3.1/lib/tmail/index.rb +9 -0
  18. data/lib/gems/tmail-1.2.3.1/lib/tmail/interface.rb +1125 -0
  19. data/lib/gems/tmail-1.2.3.1/lib/tmail/loader.rb +3 -0
  20. data/lib/gems/tmail-1.2.3.1/lib/tmail/mail.rb +578 -0
  21. data/lib/gems/tmail-1.2.3.1/lib/tmail/mailbox.rb +495 -0
  22. data/lib/gems/tmail-1.2.3.1/lib/tmail/main.rb +6 -0
  23. data/lib/gems/tmail-1.2.3.1/lib/tmail/mbox.rb +3 -0
  24. data/lib/gems/tmail-1.2.3.1/lib/tmail/net.rb +248 -0
  25. data/lib/gems/tmail-1.2.3.1/lib/tmail/obsolete.rb +132 -0
  26. data/lib/gems/tmail-1.2.3.1/lib/tmail/parser.rb +1476 -0
  27. data/lib/gems/tmail-1.2.3.1/lib/tmail/parser.y +381 -0
  28. data/lib/gems/tmail-1.2.3.1/lib/tmail/port.rb +379 -0
  29. data/lib/gems/tmail-1.2.3.1/lib/tmail/quoting.rb +118 -0
  30. data/lib/gems/tmail-1.2.3.1/lib/tmail/require_arch.rb +58 -0
  31. data/lib/gems/tmail-1.2.3.1/lib/tmail/scanner.rb +49 -0
  32. data/lib/gems/tmail-1.2.3.1/lib/tmail/scanner_r.rb +261 -0
  33. data/lib/gems/tmail-1.2.3.1/lib/tmail/stringio.rb +280 -0
  34. data/lib/gems/tmail-1.2.3.1/lib/tmail/utils.rb +337 -0
  35. data/lib/gems/tmail-1.2.3.1/lib/tmail/version.rb +39 -0
  36. data/lib/gems/tmail-1.2.3.1/meta/MANIFEST +128 -0
  37. data/lib/gems/tmail-1.2.3.1/meta/VERSION +1 -0
  38. data/lib/gems/tmail-1.2.3.1/meta/project.yaml +30 -0
  39. data/lib/gems/tmail-1.2.3.1/meta/unixname +1 -0
  40. data/lib/gems/validatable-1.6.7/README +118 -0
  41. data/lib/gems/validatable-1.6.7/lib/child_validation.rb +15 -0
  42. data/lib/gems/validatable-1.6.7/lib/errors.rb +74 -0
  43. data/lib/gems/validatable-1.6.7/lib/included_validation.rb +9 -0
  44. data/lib/gems/validatable-1.6.7/lib/macros.rb +283 -0
  45. data/lib/gems/validatable-1.6.7/lib/object_extension.rb +21 -0
  46. data/lib/gems/validatable-1.6.7/lib/requireable.rb +26 -0
  47. data/lib/gems/validatable-1.6.7/lib/understandable.rb +31 -0
  48. data/lib/gems/validatable-1.6.7/lib/validatable.rb +19 -0
  49. data/lib/gems/validatable-1.6.7/lib/validatable_class_methods.rb +85 -0
  50. data/lib/gems/validatable-1.6.7/lib/validatable_instance_methods.rb +106 -0
  51. data/lib/gems/validatable-1.6.7/lib/validations/validates_acceptance_of.rb +11 -0
  52. data/lib/gems/validatable-1.6.7/lib/validations/validates_confirmation_of.rb +15 -0
  53. data/lib/gems/validatable-1.6.7/lib/validations/validates_each.rb +14 -0
  54. data/lib/gems/validatable-1.6.7/lib/validations/validates_format_of.rb +13 -0
  55. data/lib/gems/validatable-1.6.7/lib/validations/validates_length_of.rb +25 -0
  56. data/lib/gems/validatable-1.6.7/lib/validations/validates_numericality_of.rb +16 -0
  57. data/lib/gems/validatable-1.6.7/lib/validations/validates_presence_of.rb +13 -0
  58. data/lib/gems/validatable-1.6.7/lib/validations/validates_true_for.rb +13 -0
  59. data/lib/gems/validatable-1.6.7/lib/validations/validation_base.rb +88 -0
  60. data/lib/gems/validatable-1.6.7/rakefile.rb +50 -0
  61. data/lib/gems/validatable-1.6.7/test/all_tests.rb +1 -0
  62. data/lib/gems/validatable-1.6.7/test/functional/validatable_test.rb +437 -0
  63. data/lib/gems/validatable-1.6.7/test/functional/validates_acceptance_of_test.rb +16 -0
  64. data/lib/gems/validatable-1.6.7/test/functional/validates_confirmation_of_test.rb +56 -0
  65. data/lib/gems/validatable-1.6.7/test/functional/validates_each_test.rb +14 -0
  66. data/lib/gems/validatable-1.6.7/test/functional/validates_format_of_test.rb +34 -0
  67. data/lib/gems/validatable-1.6.7/test/functional/validates_length_of_test.rb +64 -0
  68. data/lib/gems/validatable-1.6.7/test/functional/validates_numericality_of_test.rb +57 -0
  69. data/lib/gems/validatable-1.6.7/test/functional/validates_presence_of_test.rb +16 -0
  70. data/lib/gems/validatable-1.6.7/test/functional/validates_true_for_test.rb +27 -0
  71. data/lib/gems/validatable-1.6.7/test/test_helper.rb +33 -0
  72. data/lib/gems/validatable-1.6.7/test/unit/errors_test.rb +64 -0
  73. data/lib/gems/validatable-1.6.7/test/unit/understandable_test.rb +19 -0
  74. data/lib/gems/validatable-1.6.7/test/unit/validatable_test.rb +38 -0
  75. data/lib/gems/validatable-1.6.7/test/unit/validates_acceptance_of_test.rb +21 -0
  76. data/lib/gems/validatable-1.6.7/test/unit/validates_confirmation_of_test.rb +64 -0
  77. data/lib/gems/validatable-1.6.7/test/unit/validates_format_of_test.rb +34 -0
  78. data/lib/gems/validatable-1.6.7/test/unit/validates_length_of_test.rb +75 -0
  79. data/lib/gems/validatable-1.6.7/test/unit/validates_numericality_of_test.rb +52 -0
  80. data/lib/gems/validatable-1.6.7/test/unit/validates_presence_of_test.rb +25 -0
  81. data/lib/gems/validatable-1.6.7/test/unit/validates_true_for_test.rb +29 -0
  82. data/lib/gems/validatable-1.6.7/test/unit/validation_base_test.rb +52 -0
  83. data/lib/gems/xmpp4r-0.4/CHANGELOG +83 -0
  84. data/lib/gems/xmpp4r-0.4/COPYING +340 -0
  85. data/lib/gems/xmpp4r-0.4/LICENSE +59 -0
  86. data/lib/gems/xmpp4r-0.4/README.rdoc +110 -0
  87. data/lib/gems/xmpp4r-0.4/README_ruby19.txt +43 -0
  88. data/lib/gems/xmpp4r-0.4/Rakefile +262 -0
  89. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
  90. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
  91. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
  92. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
  93. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
  94. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
  95. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
  96. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
  97. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
  98. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
  99. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
  100. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
  101. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
  102. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
  103. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
  104. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
  105. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
  106. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
  107. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
  108. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
  109. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
  110. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
  111. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
  112. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
  113. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
  114. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/client.rb +70 -0
  115. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/component.rb +11 -0
  116. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
  117. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
  118. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
  119. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
  120. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
  121. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
  122. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/register.rb +42 -0
  123. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
  124. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
  125. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
  126. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
  127. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
  128. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
  129. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
  130. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
  131. data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
  132. data/lib/gems/xmpp4r-0.4/lib/xmpp4r.rb +116 -0
  133. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/base64.rb +32 -0
  134. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams.rb +15 -0
  135. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
  136. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
  137. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
  138. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
  139. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
  140. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
  141. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
  142. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
  143. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
  144. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
  145. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
  146. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
  147. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/callbacks.rb +124 -0
  148. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps.rb +1 -0
  149. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/c.rb +53 -0
  150. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/helper/generator.rb +160 -0
  151. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/helper/helper.rb +87 -0
  152. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/client.rb +317 -0
  153. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/command/helper/responder.rb +53 -0
  154. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/command/iq/command.rb +154 -0
  155. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/component.rb +103 -0
  156. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/connection.rb +219 -0
  157. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/dataforms.rb +5 -0
  158. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/dataforms/x/data.rb +297 -0
  159. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/debuglog.rb +42 -0
  160. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/delay.rb +5 -0
  161. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/delay/x/delay.rb +99 -0
  162. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery.rb +7 -0
  163. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/helper/responder.rb +165 -0
  164. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
  165. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
  166. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/errors.rb +281 -0
  167. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/feature_negotiation.rb +5 -0
  168. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
  169. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/framework/base.rb +55 -0
  170. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/framework/bot.rb +148 -0
  171. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/httpbinding.rb +5 -0
  172. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/httpbinding/client.rb +285 -0
  173. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/idgenerator.rb +37 -0
  174. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/iq.rb +221 -0
  175. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/jid.rb +167 -0
  176. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/message.rb +148 -0
  177. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc.rb +14 -0
  178. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
  179. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
  180. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
  181. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
  182. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
  183. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
  184. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/item.rb +143 -0
  185. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/muc.rb +70 -0
  186. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
  187. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
  188. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/presence.rb +232 -0
  189. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub.rb +8 -0
  190. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
  191. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/event.rb +49 -0
  192. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/item.rb +35 -0
  193. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/items.rb +44 -0
  194. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
  195. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/publish.rb +24 -0
  196. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
  197. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
  198. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
  199. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
  200. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
  201. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
  202. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
  203. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/query.rb +15 -0
  204. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rexmladdons.rb +151 -0
  205. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster.rb +7 -0
  206. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/helper/roster.rb +519 -0
  207. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/iq/roster.rb +215 -0
  208. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/x/roster.rb +138 -0
  209. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc.rb +2 -0
  210. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/client.rb +123 -0
  211. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/server.rb +74 -0
  212. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
  213. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
  214. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/sasl.rb +237 -0
  215. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/semaphore.rb +38 -0
  216. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/stream.rb +497 -0
  217. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/streamparser.rb +77 -0
  218. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune.rb +2 -0
  219. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune/helper/helper.rb +58 -0
  220. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune/tune.rb +113 -0
  221. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard.rb +6 -0
  222. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
  223. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
  224. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version.rb +7 -0
  225. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/helper/responder.rb +72 -0
  226. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
  227. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/iq/version.rb +105 -0
  228. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/x.rb +37 -0
  229. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xhtml.rb +1 -0
  230. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xhtml/html.rb +115 -0
  231. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmpp4r.rb +18 -0
  232. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmppelement.rb +168 -0
  233. data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmppstanza.rb +162 -0
  234. data/lib/gems/xmpp4r-0.4/setup.rb +1586 -0
  235. data/lib/gems/xmpp4r-0.4/test/bytestreams/tc_ibb.rb +186 -0
  236. data/lib/gems/xmpp4r-0.4/test/bytestreams/tc_socks5bytestreams.rb +113 -0
  237. data/lib/gems/xmpp4r-0.4/test/caps/tc_helper.rb +156 -0
  238. data/lib/gems/xmpp4r-0.4/test/dataforms/tc_data.rb +81 -0
  239. data/lib/gems/xmpp4r-0.4/test/delay/tc_xdelay.rb +51 -0
  240. data/lib/gems/xmpp4r-0.4/test/discovery/tc_responder.rb +91 -0
  241. data/lib/gems/xmpp4r-0.4/test/lib/assert_equal_xml.rb +14 -0
  242. data/lib/gems/xmpp4r-0.4/test/lib/clienttester.rb +120 -0
  243. data/lib/gems/xmpp4r-0.4/test/muc/tc_muc_mucclient.rb +830 -0
  244. data/lib/gems/xmpp4r-0.4/test/muc/tc_muc_simplemucclient.rb +114 -0
  245. data/lib/gems/xmpp4r-0.4/test/muc/tc_mucowner.rb +50 -0
  246. data/lib/gems/xmpp4r-0.4/test/pubsub/tc_helper.rb +662 -0
  247. data/lib/gems/xmpp4r-0.4/test/pubsub/tc_nodeconfig.rb +54 -0
  248. data/lib/gems/xmpp4r-0.4/test/pubsub/tc_subscriptionconfig.rb +41 -0
  249. data/lib/gems/xmpp4r-0.4/test/roster/tc_helper.rb +514 -0
  250. data/lib/gems/xmpp4r-0.4/test/roster/tc_iqqueryroster.rb +173 -0
  251. data/lib/gems/xmpp4r-0.4/test/roster/tc_xroster.rb +73 -0
  252. data/lib/gems/xmpp4r-0.4/test/rpc/tc_helper.rb +96 -0
  253. data/lib/gems/xmpp4r-0.4/test/tc_callbacks.rb +129 -0
  254. data/lib/gems/xmpp4r-0.4/test/tc_class_names.rb +146 -0
  255. data/lib/gems/xmpp4r-0.4/test/tc_client.rb +30 -0
  256. data/lib/gems/xmpp4r-0.4/test/tc_errors.rb +146 -0
  257. data/lib/gems/xmpp4r-0.4/test/tc_idgenerator.rb +30 -0
  258. data/lib/gems/xmpp4r-0.4/test/tc_iq.rb +113 -0
  259. data/lib/gems/xmpp4r-0.4/test/tc_iqquery.rb +31 -0
  260. data/lib/gems/xmpp4r-0.4/test/tc_jid.rb +204 -0
  261. data/lib/gems/xmpp4r-0.4/test/tc_message.rb +116 -0
  262. data/lib/gems/xmpp4r-0.4/test/tc_presence.rb +150 -0
  263. data/lib/gems/xmpp4r-0.4/test/tc_rexml.rb +139 -0
  264. data/lib/gems/xmpp4r-0.4/test/tc_stream.rb +229 -0
  265. data/lib/gems/xmpp4r-0.4/test/tc_streamComponent.rb +95 -0
  266. data/lib/gems/xmpp4r-0.4/test/tc_streamError.rb +131 -0
  267. data/lib/gems/xmpp4r-0.4/test/tc_streamSend.rb +59 -0
  268. data/lib/gems/xmpp4r-0.4/test/tc_streamparser.rb +112 -0
  269. data/lib/gems/xmpp4r-0.4/test/tc_xmppstanza.rb +135 -0
  270. data/lib/gems/xmpp4r-0.4/test/ts_xmpp4r.rb +53 -0
  271. data/lib/gems/xmpp4r-0.4/test/tune/tc_helper_recv.rb +84 -0
  272. data/lib/gems/xmpp4r-0.4/test/tune/tc_helper_send.rb +74 -0
  273. data/lib/gems/xmpp4r-0.4/test/tune/tc_tune.rb +79 -0
  274. data/lib/gems/xmpp4r-0.4/test/vcard/tc_helper.rb +49 -0
  275. data/lib/gems/xmpp4r-0.4/test/vcard/tc_iqvcard.rb +62 -0
  276. data/lib/gems/xmpp4r-0.4/test/version/tc_helper.rb +60 -0
  277. data/lib/gems/xmpp4r-0.4/test/version/tc_iqqueryversion.rb +97 -0
  278. data/lib/gems/xmpp4r-0.4/test/xhtml/tc_html.rb +41 -0
  279. data/lib/gems/xmpp4r-0.4/tools/gen_requires.bash +31 -0
  280. data/lib/gems/xmpp4r-0.4/tools/xmpp4r-gemspec-test.rb +11 -0
  281. data/lib/gems/xmpp4r-0.4/xmpp4r.gemspec +291 -0
  282. data/lib/gems/xmpp4r-simple-0.8.8/CHANGELOG +73 -0
  283. data/lib/gems/xmpp4r-simple-0.8.8/COPYING +281 -0
  284. data/lib/gems/xmpp4r-simple-0.8.8/README +59 -0
  285. data/lib/gems/xmpp4r-simple-0.8.8/lib/xmpp4r-simple.rb +492 -0
  286. data/lib/gems/xmpp4r-simple-0.8.8/test/test_xmpp4r_simple.rb +242 -0
  287. data/lib/mack-notifier.rb +1 -3
  288. metadata +398 -46
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/ruby
2
+
3
+
4
+ $:.unshift File::dirname(__FILE__) + '/../../lib'
5
+
6
+ require 'test/unit'
7
+ require File::dirname(__FILE__) + '/../lib/clienttester'
8
+ require 'xmpp4r/muc'
9
+ require 'xmpp4r/semaphore'
10
+ include Jabber
11
+
12
+ class SimpleMUCClientTest < Test::Unit::TestCase
13
+ include ClientTester
14
+
15
+ def test_new1
16
+ m = MUC::SimpleMUCClient.new(@client)
17
+ assert_equal(nil, m.jid)
18
+ assert_equal(nil, m.my_jid)
19
+ assert_equal({}, m.roster)
20
+ assert(!m.active?)
21
+ end
22
+
23
+ def test_complex
24
+ m = MUC::SimpleMUCClient.new(@client)
25
+
26
+ block_args = []
27
+ wait = Semaphore.new
28
+ block = lambda { |*a| block_args = a; wait.run }
29
+ m.on_room_message(&block)
30
+ m.on_message(&block)
31
+ m.on_private_message(&block)
32
+ m.on_subject(&block)
33
+ m.on_join(&block)
34
+ m.on_leave(&block)
35
+ m.on_self_leave(&block)
36
+
37
+ state { |pres|
38
+ assert_kind_of(Presence, pres)
39
+ assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
40
+ assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/thirdwitch'), pres.to)
41
+ send("<presence from='darkcave@macbeth.shakespeare.lit/firstwitch' to='hag66@shakespeare.lit/pda'>" +
42
+ "<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='owner' role='moderator'/></x>" +
43
+ "</presence>" +
44
+ "<presence from='darkcave@macbeth.shakespeare.lit/secondwitch' to='hag66@shakespeare.lit/pda'>" +
45
+ "<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='admin' role='moderator'/></x>" +
46
+ "</presence>" +
47
+ "<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
48
+ "<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
49
+ "</presence>")
50
+ }
51
+ m.my_jid = 'hag66@shakespeare.lit/pda'
52
+ assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
53
+ wait_state
54
+ assert(m.active?)
55
+ assert_equal(3, m.roster.size)
56
+
57
+ state { |msg|
58
+ assert_kind_of(Message, msg)
59
+ assert_equal(:groupchat, msg.type)
60
+ assert_equal(JID.new('hag66@shakespeare.lit/pda'), msg.from)
61
+ assert_equal(JID.new('darkcave@macbeth.shakespeare.lit'), msg.to)
62
+ assert_equal('TestCasing room', msg.subject)
63
+ assert_nil(msg.body)
64
+ send(msg.set_from('darkcave@macbeth.shakespeare.lit/thirdwitch').set_to('hag66@shakespeare.lit/pda'))
65
+ }
66
+ assert_nil(m.subject)
67
+ wait.wait
68
+ m.subject = 'TestCasing room'
69
+ wait_state
70
+ wait.wait
71
+
72
+ # FIXME : **Intermittently** failing (especially during RCOV run) at this line with:
73
+ # 1) Failure:
74
+ # test_complex(SimpleMUCClientTest) [./test/muc/tc_muc_simplemucclient.rb:71]:
75
+ # <[nil, "thirdwitch", "TestCasing room"]> expected but was
76
+ # <[nil, "secondwitch"]>.
77
+ #
78
+ #assert_equal([nil, 'thirdwitch', 'TestCasing room'], block_args)
79
+
80
+ # FIXME : **Intermittently** failing (especially during RCOV run) at this line with:
81
+ # 1) Failure:
82
+ # test_complex(SimpleMUCClientTest) [./test/muc/tc_muc_simplemucclient.rb:80]:
83
+ # <"TestCasing room"> expected but was
84
+ # <nil>.
85
+ #
86
+ #assert_equal('TestCasing room', m.subject)
87
+
88
+ end
89
+
90
+ def test_kick
91
+ m = MUC::SimpleMUCClient.new(@client)
92
+
93
+ state { |presence|
94
+ send("<presence from='test@test/test'/>")
95
+ }
96
+ m.join('test@test/test')
97
+ wait_state
98
+
99
+ state { |iq|
100
+ assert_kind_of(Iq, iq)
101
+ assert_equal('http://jabber.org/protocol/muc#admin', iq.queryns)
102
+ assert_kind_of(MUC::IqQueryMUCAdmin, iq.query)
103
+ assert_equal(1, iq.query.items.size)
104
+ assert_equal('pistol', iq.query.items[0].nick)
105
+ assert_equal(:none, iq.query.items[0].role)
106
+ assert_equal('Avaunt, you cullion!', iq.query.items[0].reason)
107
+ a = iq.answer(false)
108
+ a.type = :result
109
+ send(a)
110
+ }
111
+ m.kick('pistol', 'Avaunt, you cullion!')
112
+ wait_state
113
+ end
114
+ end
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift '../lib'
4
+
5
+ require 'test/unit'
6
+ require 'xmpp4r'
7
+ require 'xmpp4r/muc'
8
+ include Jabber
9
+
10
+ class MUCOwnerTest < Test::Unit::TestCase
11
+ def test_parse
12
+ s = <<EOF
13
+ <iq from='darkcave@macbeth.shakespeare.lit'
14
+ id='config1'
15
+ to='crone1@shakespeare.lit/desktop'
16
+ type='result'>
17
+ <query xmlns='http://jabber.org/protocol/muc#owner'>
18
+ <x xmlns='jabber:x:data' type='form'>
19
+ <title>Configuration for "darkcave" Room</title>
20
+ <instructions>
21
+ Complete this form to make changes to
22
+ the configuration of your room.
23
+ </instructions>
24
+ <field
25
+ type='hidden'
26
+ var='FORM_TYPE'>
27
+ <value>http://jabber.org/protocol/muc#roomconfig</value>
28
+ </field>
29
+ <field
30
+ label='Natural-Language Room Name'
31
+ type='text-single'
32
+ var='muc#roomconfig_roomname'>
33
+ <value>A Dark Cave</value>
34
+ </field>
35
+ </x>
36
+ </query>
37
+ </iq>
38
+ EOF
39
+ iq = Iq::import(REXML::Document.new(s).root)
40
+
41
+ assert_kind_of(Iq, iq)
42
+ assert_kind_of(MUC::IqQueryMUCOwner, iq.query)
43
+ assert_kind_of(Dataforms::XData, iq.query.x)
44
+ assert_kind_of(Dataforms::XData, iq.query.x('jabber:x:data'))
45
+ assert_kind_of(Dataforms::XData, iq.query.x(Dataforms::XData))
46
+
47
+ assert_equal(1, iq.query.x.fields.size)
48
+ assert_equal('Natural-Language Room Name', iq.query.x.fields[0].label)
49
+ end
50
+ end
@@ -0,0 +1,662 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift File::dirname(__FILE__) + '/../../lib'
4
+
5
+ require 'test/unit'
6
+ require File::dirname(__FILE__) + '/../lib/clienttester'
7
+
8
+ require 'xmpp4r'
9
+ require 'xmpp4r/pubsub/helper/servicehelper'
10
+ include Jabber
11
+
12
+ # Jabber.debug = true
13
+
14
+ class PubSub::ServiceHelperTest < Test::Unit::TestCase
15
+ include ClientTester
16
+
17
+ ##
18
+ # subscribe_to
19
+ # examples 30 and 31 from
20
+ # http://www.xmpp.org/extensions/xep-0060.html#subscriber-subscribe
21
+ def test_subscribe
22
+ pubsub = 'pubsub.example.org'
23
+ h = PubSub::ServiceHelper.new(@client,pubsub)
24
+ assert_kind_of(Jabber::PubSub::ServiceHelper,h)
25
+ state { |iq|
26
+ assert_kind_of(Jabber::Iq,iq)
27
+ assert_equal(:set,iq.type)
28
+ assert_equal(pubsub, iq.to.to_s)
29
+ assert_equal(@client.jid, iq.from)
30
+ assert_equal(1, iq.children.size)
31
+ assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
32
+ assert_equal(1, iq.pubsub.children.size)
33
+ assert_equal('subscribe',iq.pubsub.children.first.name)
34
+ assert_equal('princely_musings',iq.pubsub.children.first.attributes['node'])
35
+ assert_equal(@client.jid.strip.to_s,iq.pubsub.children.first.attributes['jid'])
36
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
37
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
38
+ <subscription node='#{iq.pubsub.children.first.attributes['node']}' jid='#{iq.from.strip}'
39
+ subid='ba49252aaa4f5d320c24d3766f0bdcade78c78d3'
40
+ subscription='subscribed'/>
41
+ </pubsub>
42
+ </iq>")
43
+ }
44
+ subscription = h.subscribe_to('princely_musings')
45
+ assert_kind_of(Jabber::PubSub::Subscription,subscription)
46
+ assert_equal(@client.jid.strip,subscription.jid)
47
+ assert_equal('princely_musings',subscription.node)
48
+ assert_equal('ba49252aaa4f5d320c24d3766f0bdcade78c78d3',subscription.subid)
49
+ assert_equal(:subscribed,subscription.subscription)
50
+ wait_state
51
+ end
52
+
53
+ ##
54
+ # subscribe error condition
55
+ # example 44 from
56
+ # http://www.xmpp.org/extensions/xep-0060.html#subscriber-subscribe-configure
57
+ def test_subscribe_configuration_required
58
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
59
+ assert_kind_of(PubSub::ServiceHelper,h)
60
+ state { |iq|
61
+ assert_kind_of(Jabber::Iq,iq)
62
+ assert_equal(:set,iq.type)
63
+ assert_equal(1, iq.children.size)
64
+ assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
65
+ assert_equal(1, iq.pubsub.children.size)
66
+ assert_equal('subscribe',iq.pubsub.children.first.name)
67
+ assert_equal('princely_musings',iq.pubsub.children.first.attributes['node'])
68
+ assert_equal(@client.jid.strip.to_s,iq.pubsub.children.first.attributes['jid'])
69
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
70
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
71
+ <subscription node='#{iq.pubsub.children.first.attributes['node']}' jid='#{iq.from.strip}'
72
+ subid='ba49252aaa4f5d320c24d3766f0bdcade78c78d3'
73
+ subscription='unconfigured'/>
74
+ <subscribe-options>
75
+ <required/>
76
+ </subscribe-options>
77
+ </pubsub>
78
+ </iq>")
79
+ }
80
+ subscription = h.subscribe_to('princely_musings')
81
+ assert_kind_of(Jabber::PubSub::Subscription,subscription)
82
+ assert_equal(@client.jid.strip,subscription.jid)
83
+ assert_equal('princely_musings',subscription.node)
84
+ assert_equal('ba49252aaa4f5d320c24d3766f0bdcade78c78d3',subscription.subid)
85
+ assert_equal(:unconfigured,subscription.subscription)
86
+ wait_state
87
+ end
88
+
89
+ ##
90
+ # subscribe error condition
91
+ # example 43 from
92
+ # http://www.xmpp.org/extensions/xep-0060.html#subscriber-subscribe-approval
93
+ def test_subscribe_approval_required
94
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
95
+ assert_kind_of(PubSub::ServiceHelper,h)
96
+ state { |iq|
97
+ assert_kind_of(Jabber::Iq,iq)
98
+ assert_equal(:set,iq.type)
99
+ assert_equal(1, iq.children.size)
100
+ assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
101
+ assert_equal(1, iq.pubsub.children.size)
102
+ assert_equal('subscribe',iq.pubsub.children.first.name)
103
+ assert_equal('princely_musings',iq.pubsub.children.first.attributes['node'])
104
+ assert_equal(@client.jid.strip.to_s,iq.pubsub.children.first.attributes['jid'])
105
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
106
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
107
+ <subscription node='#{iq.pubsub.children.first.attributes['node']}' jid='#{iq.from.strip}'
108
+ subid='ba49252aaa4f5d320c24d3766f0bdcade78c78d3'
109
+ subscription='pending'/>
110
+
111
+ </pubsub>
112
+ </iq>")
113
+ }
114
+ subscription = h.subscribe_to('princely_musings')
115
+ assert_kind_of(Jabber::PubSub::Subscription,subscription)
116
+ assert_equal(@client.jid.strip,subscription.jid)
117
+ assert_equal('princely_musings',subscription.node)
118
+ assert_equal('ba49252aaa4f5d320c24d3766f0bdcade78c78d3',subscription.subid)
119
+ assert_equal(:pending,subscription.subscription)
120
+ assert_equal(true,subscription.need_approval?)
121
+ wait_state
122
+ end
123
+
124
+ ##
125
+ # unsubscribe from
126
+ # examples 48 and 49 from
127
+ # http://www.xmpp.org/extensions/xep-0060.html#subscriber-unsubscribe-request
128
+ def test_unsubscribe
129
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
130
+ assert_kind_of(PubSub::ServiceHelper,h)
131
+ state { |iq|
132
+ assert_kind_of(Jabber::Iq,iq)
133
+ assert_equal(:set,iq.type)
134
+ assert_equal(1, iq.children.size)
135
+ assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
136
+ assert_equal(1, iq.pubsub.children.size)
137
+ assert_equal('unsubscribe',iq.pubsub.children.first.name)
138
+ assert_equal('princely_musings',iq.pubsub.children.first.attributes['node'])
139
+ assert_equal(@client.jid.strip.to_s,iq.pubsub.children.first.attributes['jid'])
140
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
141
+ }
142
+ unsubscribe = h.unsubscribe_from('princely_musings')
143
+ assert_equal(true, unsubscribe)
144
+ wait_state
145
+ end
146
+
147
+ ##
148
+ # get subscription options
149
+ # examples 56 and 57 from
150
+ # http://www.xmpp.org/extensions/xep-0060.html#subscriber-configure-request
151
+ def test_get_subscription_options
152
+ pubsub = Jabber::JID.new('pubsub.example.org')
153
+ node = 'princely_musings'
154
+ jid = Jabber::JID.new('test@test.com/test')
155
+ h = PubSub::ServiceHelper.new(@client, pubsub)
156
+
157
+ state { |iq|
158
+ assert_kind_of(Jabber::Iq, iq)
159
+ assert_equal(:get, iq.type)
160
+ assert_equal(pubsub, iq.to)
161
+ assert_kind_of(Jabber::PubSub::SubscriptionConfig, iq.pubsub.first_element('options'))
162
+ assert_equal(node, iq.pubsub.first_element('options').node)
163
+ assert_equal(jid.strip, iq.pubsub.first_element('options').jid)
164
+
165
+ send( "<iq type='result'
166
+ from='#{iq.to}'
167
+ to='#{iq.from}'
168
+ id='#{iq.id}'>
169
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
170
+ <options node='#{iq.pubsub.first_element('options').node}' jid='#{iq.pubsub.first_element('options').jid}'>
171
+ <x xmlns='jabber:x:data' type='form'>
172
+ <field var='FORM_TYPE' type='hidden'>
173
+ <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
174
+ </field>
175
+ <field var='pubsub#deliver' type='boolean'
176
+ label='Enable delivery?'>
177
+ <value>1</value>
178
+ </field>
179
+ </x>
180
+ </options>
181
+ </pubsub>
182
+ </iq>")
183
+ }
184
+
185
+ options = h.get_options_from(node, jid)
186
+ assert_kind_of(Jabber::PubSub::SubscriptionConfig, options)
187
+ assert_equal({'pubsub#deliver'=>'1'}, options.options)
188
+ wait_state
189
+ end
190
+
191
+ ##
192
+ # set subscription options
193
+ # examples 65 and 66 from
194
+ # http://www.xmpp.org/extensions/xep-0060.html#subscriber-configure-submit
195
+ def test_set_subscription_options
196
+ pubsub = Jabber::JID.new('pubsub.example.org')
197
+ node = 'princely_musings'
198
+ jid = Jabber::JID.new('test@test.com/test')
199
+ options = {'pubsub#deliver' => '0'}
200
+ h = PubSub::ServiceHelper.new(@client, pubsub)
201
+
202
+ state { |iq|
203
+ assert_kind_of(Jabber::Iq, iq)
204
+ assert_equal(:set, iq.type)
205
+ assert_equal(pubsub, iq.to)
206
+ assert_kind_of(Jabber::PubSub::SubscriptionConfig, iq.pubsub.first_element('options'))
207
+ assert_equal(node, iq.pubsub.first_element('options').node)
208
+ assert_equal(jid.strip, iq.pubsub.first_element('options').jid)
209
+
210
+ send( "<iq type='result'
211
+ from='#{iq.to}'
212
+ to='#{iq.from}'
213
+ id='#{iq.id}'/>")
214
+ }
215
+
216
+ assert_nothing_raised do
217
+ assert_equal(true, h.set_options_for(node, jid, options) )
218
+ end
219
+ wait_state
220
+ end
221
+
222
+ ##
223
+ # create node with default configuration
224
+ # example 119 and 121 from
225
+ # http://www.xmpp.org/extensions/xep-0060.html#owner-create-default
226
+ def test_create
227
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
228
+ assert_kind_of(PubSub::ServiceHelper, h)
229
+
230
+ state { |iq|
231
+ assert_kind_of(Jabber::Iq, iq)
232
+ assert_equal(:set, iq.type)
233
+ assert_equal(1, iq.children.size)
234
+ assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
235
+ assert_equal(2, iq.pubsub.children.size)
236
+ assert_equal('create', iq.pubsub.children.first.name)
237
+ assert_equal('mynode', iq.pubsub.children.first.attributes['node'])
238
+ assert_equal('configure', iq.pubsub.children[1].name)
239
+ assert_equal({}, iq.pubsub.children[1].attributes)
240
+ assert_equal([], iq.pubsub.children[1].children)
241
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
242
+ }
243
+ assert_equal('mynode', h.create_node('mynode'))
244
+ wait_state
245
+ end
246
+
247
+ ##
248
+ # create node with configuration
249
+ # example 123 and 124 from
250
+ # http://www.xmpp.org/extensions/xep-0060.html#owner-create-and-configure
251
+ def test_create_configure
252
+ node = 'mynode'
253
+ options = {'pubsub#access_model'=>'open'}
254
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
255
+
256
+ state { |iq|
257
+ assert_kind_of(Jabber::Iq, iq)
258
+ assert_equal(:set, iq.type)
259
+ assert_equal(1, iq.children.size)
260
+ assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
261
+ assert_equal(2, iq.pubsub.children.size)
262
+ assert_equal('create', iq.pubsub.children.first.name)
263
+ assert_equal(node, iq.pubsub.children.first.attributes['node'])
264
+ assert_kind_of(Jabber::PubSub::NodeConfig, iq.pubsub.children[1])
265
+ assert_equal(options, iq.pubsub.children[1].options)
266
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
267
+ }
268
+
269
+ assert_nothing_raised do
270
+ assert_equal(node, h.create_node(node, Jabber::PubSub::NodeConfig.new(node, options)))
271
+ end
272
+
273
+ wait_state
274
+ end
275
+
276
+ ##
277
+ # create node a collection node
278
+ # example 203 and 204 from
279
+ # http://www.xmpp.org/extensions/xep-0060.html#collections-createnode
280
+ def test_create_collection
281
+ node = 'mynode'
282
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
283
+ required_options = {'pubsub#node_type' => 'collection'}
284
+ state { |iq|
285
+ assert_kind_of(Jabber::Iq, iq)
286
+ assert_equal(:set, iq.type)
287
+ assert_equal(1, iq.children.size)
288
+ assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
289
+ assert_equal(2, iq.pubsub.children.size)
290
+ assert_equal('create', iq.pubsub.children.first.name)
291
+ assert_equal(node, iq.pubsub.children.first.attributes['node'])
292
+ assert_kind_of(Jabber::PubSub::NodeConfig, iq.pubsub.children[1])
293
+ assert_equal(required_options, iq.pubsub.children[1].options)
294
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
295
+ }
296
+ assert_equal('mynode', h.create_collection_node('mynode'))
297
+ wait_state
298
+ end
299
+
300
+ ##
301
+ # delete node
302
+ # example 144 and 145 from
303
+ # http://www.xmpp.org/extensions/xep-0060.html#owner-delete-request
304
+ def test_delete
305
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
306
+
307
+ state { |iq|
308
+ assert_kind_of(Jabber::Iq, iq)
309
+ assert_equal(:set, iq.type)
310
+ assert_equal(1, iq.children.size)
311
+ assert_equal(1, iq.pubsub.children.size)
312
+ assert_equal('delete', iq.pubsub.children.first.name)
313
+ assert_equal('mynode', iq.pubsub.children.first.attributes['node'])
314
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
315
+ }
316
+ h.delete_node('mynode')
317
+ wait_state
318
+ end
319
+
320
+ ##
321
+ # publish to a node
322
+ # example 88 and 89 from
323
+ # http://www.xmpp.org/extensions/xep-0060.html#publisher-publish
324
+ def test_publish
325
+ node = 'mynode'
326
+ item1 = Jabber::PubSub::Item.new
327
+ item1.text = 'foobar'
328
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
329
+ state { |iq|
330
+ assert_kind_of(Jabber::Iq, iq)
331
+ assert_equal(:set, iq.type)
332
+ assert_equal(1, iq.children.size)
333
+ assert_equal(1, iq.pubsub.children.size)
334
+ assert_equal('publish', iq.pubsub.children[0].name)
335
+ assert_equal(node, iq.pubsub.children[0].attributes['node'])
336
+ assert_equal(1, iq.pubsub.children[0].children.size)
337
+ assert_equal('item', iq.pubsub.children[0].children[0].name)
338
+ assert_equal(1, iq.pubsub.children[0].children[0].children.size)
339
+ assert_equal(item1.children.to_s, iq.pubsub.children[0].children[0].children[0].to_s)
340
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
341
+ }
342
+ assert_nothing_raised { h.publish_item_to(node, item1) }
343
+ wait_state
344
+ end
345
+
346
+ ##
347
+ # publish item with id
348
+ # example 88 and 89 from
349
+ # http://www.xmpp.org/extensions/xep-0060.html#publisher-publish
350
+ def test_publish_pubsub_item_with_id
351
+ item1 = Jabber::PubSub::Item.new
352
+ item1.text = 'foobar'
353
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
354
+
355
+ state { |iq|
356
+ assert_kind_of(Jabber::Iq, iq)
357
+ assert_equal(:set, iq.type)
358
+ assert_equal(1, iq.children.size)
359
+ assert_equal(1, iq.pubsub.children.size)
360
+ assert_equal('publish', iq.pubsub.children[0].name)
361
+ assert_equal(1, iq.pubsub.children[0].children.size)
362
+ assert_equal('item', iq.pubsub.children[0].children[0].name)
363
+ assert_equal('blubb', iq.pubsub.children[0].children[0].attributes['id'] )
364
+ assert_equal(1, iq.pubsub.children[0].children[0].children.size)
365
+ assert_equal(item1.children.to_s, iq.pubsub.children[0].children[0].children[0].to_s)
366
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
367
+ }
368
+ assert_nothing_raised { h.publish_item_with_id_to('mynode', item1,"blubb") }
369
+ wait_state
370
+ end
371
+
372
+ ##
373
+ # publish item and trap client-side error
374
+ # examples 88 from
375
+ # http://www.xmpp.org/extensions/xep-0060.html#publisher-publish
376
+ def test_publish_pubsub_item_with_id_and_produce_a_local_error
377
+ item1 = 'foobarbaz'
378
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
379
+
380
+ assert_raise RuntimeError do h.publish_item_with_id_to('mynode', item1,"blubb") end
381
+ end
382
+
383
+ ##
384
+ # publish item and trap server-side error
385
+ # examples 88 from
386
+ # http://www.xmpp.org/extensions/xep-0060.html#publisher-publish
387
+ # and 93 from
388
+ # http://www.xmpp.org/extensions/xep-0060.html#publisher-publish-error-forbidden
389
+ def test_publish_pubsub_item_with_id_and_produce_an_error
390
+ item1 = Jabber::PubSub::Item.new
391
+ item1.text = "foobarbaz"
392
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
393
+
394
+ state { |iq|
395
+ assert_kind_of(Jabber::Iq, iq)
396
+ assert_equal(:set, iq.type)
397
+ assert_equal(1, iq.children.size)
398
+ assert_equal(1, iq.pubsub.children.size)
399
+ assert_equal('publish', iq.pubsub.children[0].name)
400
+ assert_equal(1, iq.pubsub.children[0].children.size)
401
+ assert_equal('item', iq.pubsub.children[0].children[0].name)
402
+ assert_equal('blubb', iq.pubsub.children[0].children[0].attributes['id'] )
403
+ assert_equal(1, iq.pubsub.children[0].children[0].children.size)
404
+ assert_equal(item1.children.to_s, iq.pubsub.children[0].children[0].children[0].to_s)
405
+ send("<iq type='error' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>
406
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
407
+ <publish node='#{iq.pubsub.children[0].attributes['node']}'>
408
+ <item id='#{iq.pubsub.children[0].children[0].attributes['id']}'/>
409
+ </publish>
410
+ </pubsub>
411
+ <error type='auth'>
412
+ <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
413
+ </error>")
414
+ }
415
+ assert_raise Jabber::ServerError do h.publish_item_with_id_to('mynode', item1,"blubb") end
416
+ wait_state
417
+ end
418
+
419
+ ##
420
+ # retrieve all items
421
+ # examples 70 and 71 from
422
+ # http://www.xmpp.org/extensions/xep-0060.html#subscriber-retrieve-returnall
423
+ def test_items
424
+ item1 = Jabber::PubSub::Item.new("1")
425
+ item1.text = 'foobar'
426
+ item2 = Jabber::PubSub::Item.new("2")
427
+ item2.text = 'barfoo'
428
+
429
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
430
+
431
+ state { |iq|
432
+ assert_kind_of(Jabber::Iq, iq)
433
+ assert_equal(:get, iq.type)
434
+ assert_equal(1, iq.pubsub.children.size)
435
+ assert_equal('items', iq.pubsub.children.first.name)
436
+ assert_equal('mynode', iq.pubsub.children.first.attributes['node'])
437
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
438
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
439
+ <items node='mynode'>
440
+ #{item1.to_s}
441
+ #{item2.to_s}
442
+ </items>
443
+ </pubsub>
444
+ </iq>")
445
+ }
446
+
447
+ items = h.get_items_from('mynode')
448
+ assert_equal(2, items.size)
449
+ assert_kind_of(REXML::Text, items['1'])
450
+ assert_kind_of(REXML::Text, items['2'])
451
+ assert_equal(item1.children.join, items['1'].to_s)
452
+ assert_equal(item2.children.join, items['2'].to_s)
453
+ wait_state
454
+ end
455
+
456
+ ##
457
+ # get affiliation
458
+ # example 184 and 185 from
459
+ # http://www.xmpp.org/extensions/xep-0060.html#owner-affiliations-retrieve-success1
460
+ def test_affiliations
461
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
462
+
463
+ state { |iq|
464
+ assert_kind_of(Jabber::Iq, iq)
465
+ assert_equal(:get, iq.type)
466
+ assert_equal(1, iq.pubsub.children.size)
467
+ assert_equal('affiliations', iq.pubsub.children.first.name)
468
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
469
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
470
+ <affiliations>
471
+ <affiliation node='node1' affiliation='owner'/>
472
+ <affiliation node='node2' affiliation='publisher'/>
473
+ <affiliation node='node5' affiliation='outcast'/>
474
+ <affiliation node='node6' affiliation='owner'/>
475
+ </affiliations>
476
+ </pubsub>
477
+ </iq>")
478
+ }
479
+
480
+ a = h.get_affiliations
481
+ assert_kind_of(Hash, a)
482
+ assert_equal(4, a.size)
483
+ assert_equal(:owner, a['node1'])
484
+ assert_equal(:publisher, a['node2'])
485
+ assert_equal(:outcast, a['node5'])
486
+ assert_equal(:owner, a['node6'])
487
+ wait_state
488
+ end
489
+
490
+ ##
491
+ # get_subscriptions_from
492
+ # example 171 and 172 from
493
+ # http://www.xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve-request
494
+ def test_subscriptions
495
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
496
+ state { |iq|
497
+ assert_kind_of(Jabber::Iq, iq)
498
+ assert_equal(:get, iq.type)
499
+ assert_equal(1, iq.pubsub.children.size)
500
+ assert_equal('subscriptions', iq.pubsub.children.first.name)
501
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
502
+ <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
503
+ <subscriptions node='node1'>
504
+ <subscription jid='hamlet@denmark.lit' subscription='subscribed'/>
505
+ <subscription jid='polonius@denmark.lit' subscription='unconfigured'/>
506
+ <subscription jid='bernardo@denmark.lit' subscription='subscribed' subid='123-abc'/>
507
+ <subscription jid='bernardo@denmark.lit' subscription='subscribed' subid='004-yyy'/>
508
+ </subscriptions>
509
+ </pubsub>
510
+ </iq>")
511
+ }
512
+
513
+ s = h.get_subscriptions_from('node1')
514
+ assert_kind_of(Array,s)
515
+ assert_equal(4,s.size)
516
+ assert_kind_of(Jabber::PubSub::Subscription,s[0])
517
+ assert_kind_of(Jabber::PubSub::Subscription,s[1])
518
+ assert_kind_of(Jabber::PubSub::Subscription,s[2])
519
+ assert_kind_of(Jabber::PubSub::Subscription,s[3])
520
+ assert_equal(:subscribed,s[0].state)
521
+ assert_equal(:unconfigured,s[1].state)
522
+ assert_equal(JID.new("hamlet@denmark.lit"),s[0].jid)
523
+ assert_equal("123-abc",s[2].subid)
524
+ wait_state
525
+ end
526
+
527
+ ##
528
+ # get_subscribers
529
+ # example 171 and 172 from
530
+ # http://www.xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve
531
+ def test_subscribers
532
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
533
+
534
+ state { |iq|
535
+ assert_kind_of(Jabber::Iq, iq)
536
+ assert_equal(:get, iq.type)
537
+ assert_equal(1, iq.pubsub.children.size)
538
+ assert_equal('subscriptions', iq.pubsub.children.first.name)
539
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
540
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
541
+ <subscriptions node='princely_musings'>
542
+ <subscription jid='peter@denmark.lit' subscription='subscribed'/>
543
+ <subscription jid='frank@denmark.lit' subscription='subscribed'/>
544
+ <subscription jid='albrecht@denmark.lit' subscription='unconfigured'/>
545
+ <subscription jid='hugo@denmark.lit' subscription='pending'/>
546
+ </subscriptions>
547
+ </pubsub>
548
+ </iq>")
549
+ }
550
+
551
+ s = h.get_subscribers_from('princely_musings')
552
+ assert_equal(4,s.size)
553
+ assert_kind_of(Jabber::JID,s[0])
554
+ assert_kind_of(Jabber::JID,s[1])
555
+ assert_kind_of(Jabber::JID,s[2])
556
+ assert_kind_of(Jabber::JID,s[3])
557
+ wait_state
558
+ end
559
+
560
+ ##
561
+ # get_all_subscriptions
562
+ def test_get_all_subscriptions
563
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
564
+
565
+ state { |iq|
566
+ assert_kind_of(Jabber::Iq, iq)
567
+ assert_equal(:get, iq.type)
568
+ assert_equal(1, iq.pubsub.children.size)
569
+ assert_equal('subscriptions', iq.pubsub.children.first.name)
570
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
571
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
572
+ <subscriptions>
573
+ <subscription node='node1' jid='francisco@denmark.lit' subscription='subscribed'/>
574
+ <subscription node='node2' jid='francisco@denmark.lit' subscription='subscribed'/>
575
+ <subscription node='node5' jid='francisco@denmark.lit' subscription='unconfigured'/>
576
+ <subscription node='node6' jid='francisco@denmark.lit' subscription='pending'/>
577
+ </subscriptions>
578
+ </pubsub>
579
+ </iq>")
580
+ }
581
+
582
+ s = h.get_subscriptions_from_all_nodes
583
+ assert_kind_of(Array,s)
584
+ assert_equal(4,s.size)
585
+ assert_kind_of(Jabber::PubSub::Subscription,s[0])
586
+ assert_kind_of(Jabber::PubSub::Subscription,s[1])
587
+ assert_kind_of(Jabber::PubSub::Subscription,s[2])
588
+ assert_kind_of(Jabber::PubSub::Subscription,s[3])
589
+ assert_equal(:subscribed,s[0].state)
590
+ assert_equal(:unconfigured,s[2].state)
591
+ assert_equal(:pending,s[3].state)
592
+ assert_equal(JID.new("francisco@denmark.lit"),s[0].jid)
593
+ assert_equal("node1",s[0].node)
594
+
595
+ wait_state
596
+ end
597
+
598
+ ##
599
+ # get all subscriptions with no subscriptions
600
+ def test_get_all_subscriptions_with_no_subscriptions
601
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
602
+
603
+ state { |iq|
604
+ assert_kind_of(Jabber::Iq, iq)
605
+ assert_equal(:get, iq.type)
606
+ assert_equal(1, iq.pubsub.children.size)
607
+ assert_equal('subscriptions', iq.pubsub.children.first.name)
608
+ send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'>
609
+ <pubsub xmlns='http://jabber.org/protocol/pubsub'>
610
+ <subscriptions />
611
+ </pubsub>
612
+ </iq>")
613
+ }
614
+
615
+ s = h.get_subscriptions_from_all_nodes
616
+ assert_kind_of(Array,s)
617
+ assert_equal(0,s.size)
618
+ wait_state
619
+ end
620
+
621
+ ##
622
+ # get configuration for a node
623
+ # example 125 and 126 from
624
+ # http://www.xmpp.org/extensions/xep-0060.html#owner-configure-request
625
+ def test_get_node_config
626
+ pubsub = 'pubsub.example.org'
627
+ h = PubSub::ServiceHelper.new(@client, pubsub)
628
+
629
+ state { |iq|
630
+ assert_kind_of(Jabber::Iq, iq)
631
+ assert_equal(:get, iq.type)
632
+ assert_equal(pubsub, iq.to.to_s)
633
+ assert_kind_of(Jabber::PubSub::OwnerNodeConfig, iq.pubsub.first_element('configure'))
634
+
635
+ send( "<iq type='result'
636
+ from='#{iq.to}'
637
+ to='#{iq.from}'
638
+ id='#{iq.id}'>
639
+ <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
640
+ <configure node='princely_musings'>
641
+ <x xmlns='jabber:x:data' type='form'>
642
+ <field var='FORM_TYPE' type='hidden'>
643
+ <value>http://jabber.org/protocol/pubsub#node_config</value>
644
+ </field>
645
+ <field var='pubsub#title' type='text-single'
646
+ label='A friendly name for the node'/>
647
+ </x>
648
+ </configure>
649
+ </pubsub>
650
+ </iq>")
651
+ }
652
+
653
+ config = h.get_config_from('princelymusings')
654
+ assert_kind_of(Jabber::PubSub::OwnerNodeConfig, config)
655
+ wait_state
656
+ end
657
+
658
+ def test_to_s
659
+ h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
660
+ assert_equal('pubsub.example.org',h.to_s)
661
+ end
662
+ end