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,156 @@
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
+ # For documentation of the return values please see [Jabber::PubSub::ServiceHelper]
6
+ # This class is only a wrapper around [Jabber::PubSub::ServiceHelper]
7
+ #
8
+
9
+
10
+ require 'xmpp4r/pubsub/helper/servicehelper'
11
+ require 'xmpp4r/pubsub/helper/nodebrowser'
12
+
13
+ module Jabber
14
+ module PubSub
15
+ class NodeHelper < ServiceHelper
16
+
17
+ attr_reader :nodename
18
+ attr_reader :name
19
+ attr_reader :jid
20
+ attr_reader :my_subscriptions
21
+ ##
22
+ # creates a new node
23
+ # new(client,service,nodename)
24
+ # stream:: [Jabber::Stream]
25
+ # jid:: [String] (jid of the pubsub service)
26
+ # nodename:: [String]
27
+ def initialize(stream, jid, nodename = nil, create_if_not_exist = true)
28
+ super(stream,jid)
29
+ @nodename = nodename
30
+ @jid = jid
31
+ @stream = stream
32
+
33
+ if create_if_not_exist and not node_exist?
34
+ # if no nodename is given a instant node will created
35
+ # (if the service supports instant nodes)
36
+ @nodename = create_node
37
+ else
38
+ get_subscriptions
39
+ end
40
+ end
41
+
42
+ ##
43
+ # creates the node
44
+ # create(configuration=nil)
45
+ # configuration:: [Jabber::XData]
46
+ def create_node(configuration = Jabber::PubSub::NodeConfig.new)
47
+ unless node_exist?
48
+ super(@nodename,configuration)
49
+ else
50
+ false
51
+ end
52
+ end
53
+
54
+ ##
55
+ # get the configuration of the node
56
+ # get_configuration(configuration=nil)
57
+ # configuration:: [Jabber::XData]
58
+ def get_configuration(subid = nil)
59
+ get_options(@nodename, subid)
60
+ end
61
+
62
+ ##
63
+ # set the configuration of the node
64
+ # set_configuration(configuration=nil)
65
+ # configuration:: [Jabber::XData]
66
+ # subid:: [String] default is nil
67
+ def set_configuration(configuration,subid = nil)
68
+ set_options(@nodename, configuration, subid)
69
+ end
70
+
71
+ ##
72
+ # deletes the node
73
+ # delete
74
+ def delete_node
75
+ delete(@nodename)
76
+ end
77
+
78
+ ##
79
+ # publishing content on this node
80
+ # publish_content(items)
81
+ # items:: [REXML::Element]
82
+ def publish_content(items)
83
+ publish_item_to(@nodename,items)
84
+ end
85
+
86
+ ##
87
+ # gets all items from the node
88
+ # get_all_items
89
+ def get_all_items
90
+ items(@nodename)
91
+ end
92
+
93
+ ##
94
+ # get a count of items
95
+ # get_items(count)
96
+ # count:: [Fixnum]
97
+ def get_items(count)
98
+ items(@nodename,count)
99
+ end
100
+
101
+ ##
102
+ # get all node affiliations
103
+ # get_affiliations
104
+ def get_affiliations
105
+ affiliations
106
+ end
107
+
108
+ ##
109
+ # get all subscriptions on this node
110
+ # get_subscriptions
111
+ def get_subscriptions
112
+ get_subscriptions_from(@nodename)
113
+ end
114
+
115
+ ##
116
+ # get all subscribers subscribed on this node
117
+ # get_subscribers
118
+ def get_subscribers
119
+ @subscriptions = subscribers(@nodename)
120
+ end
121
+
122
+ ##
123
+ # subscribe to this node
124
+ # do_subscribe
125
+ def do_subscribe
126
+ subscribe_to(@nodename)
127
+ get_subscriptions
128
+ end
129
+
130
+ ##
131
+ # unsubscribe from this node
132
+ # do_unsubscribe(subid = nil)
133
+ # subid:: [String]
134
+ def do_unsubscribe(subid)
135
+ unsubscribe(@nodename,subid)
136
+ end
137
+
138
+ ##
139
+ # purge all items from this node
140
+ # purge_items
141
+ def purge_items
142
+ purge(@nodename)
143
+ end
144
+
145
+ private
146
+
147
+ def node_exist?
148
+ nodebrowser = PubSub::NodeBrowser.new(@stream)
149
+ nodebrowser.nodes(@jid).include?(@nodename)
150
+ end
151
+ def disco_info
152
+ end
153
+
154
+ end #class
155
+ end #module
156
+ end #module
@@ -0,0 +1,417 @@
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
+ # It's recommented to read the XEP-0060 before you use this Helper. (Maybe its
6
+ # better not use the helper for now ) ;)
7
+ # The whole code is getting better, but may still contain bugs - be careful!
8
+ #
9
+ # Maybe the following structure is good
10
+ # ( taken from the xep-0060 )
11
+ #
12
+ # entity usecases
13
+ # retrieve all subscriptions
14
+ # retrieve all affiliations
15
+ # NOTE: the disco stuff will done by the nodebrowserhelper
16
+ # subscriber usecases
17
+ # subscribe
18
+ # unsubscribe
19
+ # configure subscription options
20
+ # retrieve items from a node
21
+ # publisher usecases
22
+ # publish a item to a node
23
+ # delete a item from a node
24
+ # owner usecases
25
+ # create a node
26
+ # configure a node
27
+ # request default configuration options
28
+ # delete a node
29
+ # purge all node items
30
+ # manage subscription requests
31
+ # process pending subscriptions
32
+ # manage subscriptions
33
+ # manage affiliations
34
+ #
35
+ # collection nodes
36
+ #
37
+ # If someone want to implement something i think its better to do this in
38
+ # this order because everyone who reads the xep-0060 do know where to search in the file
39
+ #
40
+ require 'xmpp4r/pubsub/iq/pubsub'
41
+ require 'xmpp4r/pubsub/children/event'
42
+ require 'xmpp4r/pubsub/children/item'
43
+ require 'xmpp4r/pubsub/children/items'
44
+ require 'xmpp4r/pubsub/children/subscription'
45
+ require 'xmpp4r/pubsub/children/unsubscribe'
46
+ require 'xmpp4r/pubsub/children/node_config'
47
+ require 'xmpp4r/pubsub/children/subscription_config'
48
+ require 'xmpp4r/dataforms'
49
+
50
+ module Jabber
51
+ module PubSub
52
+ ##
53
+ # A Helper representing a PubSub Service
54
+ class ServiceHelper
55
+
56
+ ##
57
+ # Creates a new representation of a pubsub service
58
+ # stream:: [Jabber::Stream]
59
+ # pubsubjid:: [String] or [Jabber::JID]
60
+ def initialize(stream, pubsubjid)
61
+ @stream = stream
62
+ @pubsubjid = pubsubjid
63
+ @event_cbs = CallbackList.new
64
+ @stream.add_message_callback(200,self) { |message|
65
+ handle_message(message)
66
+ }
67
+ end
68
+
69
+ ##
70
+ # get all subscriptions on a pubsub component
71
+ # return:: [Hash] of [PubSub::Subscription]
72
+ def get_subscriptions_from_all_nodes
73
+ iq = basic_pubsub_query(:get)
74
+ entities = iq.pubsub.add(REXML::Element.new('subscriptions'))
75
+ res = nil
76
+ @stream.send_with_id(iq) { |reply|
77
+ if reply.pubsub.first_element('subscriptions')
78
+ res = []
79
+ reply.pubsub.first_element('subscriptions').each_element('subscription') { |subscription|
80
+ res << Jabber::PubSub::Subscription.import(subscription)
81
+ }
82
+ end
83
+ }
84
+
85
+ res
86
+ end
87
+ ##
88
+ # subscribe to a node
89
+ # node:: [String]
90
+ # return:: [Hash] of { attributename => value }
91
+ def subscribe_to(node)
92
+ iq = basic_pubsub_query(:set)
93
+ sub = REXML::Element.new('subscribe')
94
+ sub.attributes['node'] = node
95
+ sub.attributes['jid'] = @stream.jid.strip.to_s
96
+ iq.pubsub.add(sub)
97
+ res = nil
98
+ @stream.send_with_id(iq) do |reply|
99
+ pubsubanswer = reply.pubsub
100
+ if pubsubanswer.first_element('subscription')
101
+ res = PubSub::Subscription.import(pubsubanswer.first_element('subscription'))
102
+ end
103
+ end # @stream.send_with_id(iq)
104
+ res
105
+ end
106
+
107
+ ##
108
+ # Unsubscribe from a node with an optional subscription id
109
+ #
110
+ # May raise ServerError
111
+ # node:: [String]
112
+ # subid:: [String] or nil (not supported)
113
+ # return:: true
114
+ def unsubscribe_from(node, subid=nil)
115
+ iq = basic_pubsub_query(:set)
116
+ unsub = PubSub::Unsubscribe.new
117
+ unsub.node = node
118
+ unsub.jid = @stream.jid.strip
119
+ iq.pubsub.add(unsub)
120
+ ret = false
121
+ @stream.send_with_id(iq) { |reply|
122
+ ret = reply.kind_of?(Jabber::Iq) and reply.type == :result
123
+ } # @stream.send_with_id(iq)
124
+ ret
125
+ end
126
+
127
+ ##
128
+ # gets all items from a pubsub node
129
+ # node:: [String]
130
+ # count:: [Fixnum]
131
+ # return:: [Hash] { id => [Jabber::PubSub::Item] }
132
+ def get_items_from(node, count=nil)
133
+ iq = basic_pubsub_query(:get)
134
+ items = Jabber::PubSub::Items.new
135
+ items.node = node
136
+ iq.pubsub.add(items)
137
+ res = nil
138
+ @stream.send_with_id(iq) { |reply|
139
+ if reply.kind_of?(Iq) and reply.pubsub and reply.pubsub.first_element('items')
140
+ res = {}
141
+ reply.pubsub.first_element('items').each_element('item') do |item|
142
+ res[item.attributes['id']] = item.children.first if item.children.first
143
+ end
144
+ end
145
+ true
146
+ }
147
+ res
148
+ end
149
+
150
+ ##
151
+ # NOTE: this method sends only one item per publish request because some services
152
+ # may not allow batch processing. Maybe this will changed in the future?
153
+ # node:: [String]
154
+ # item:: [Jabber::PubSub::Item]
155
+ # return:: true
156
+ # it automatically generates an id for the item
157
+ def publish_item_to(node,item)
158
+ iq = basic_pubsub_query(:set)
159
+ publish = iq.pubsub.add(REXML::Element.new('publish'))
160
+ publish.attributes['node'] = node
161
+
162
+ if item.kind_of?(Jabber::PubSub::Item)
163
+ item.id = Jabber::IdGenerator.generate_id
164
+ publish.add(item)
165
+ @stream.send_with_id(iq)
166
+ end
167
+ end
168
+
169
+ ##
170
+ # node:: [String]
171
+ # item:: [REXML::Element]
172
+ # id:: [String]
173
+ # return:: true
174
+ def publish_item_with_id_to(node,item,id)
175
+ iq = basic_pubsub_query(:set)
176
+ publish = iq.pubsub.add(REXML::Element.new('publish'))
177
+ publish.attributes['node'] = node
178
+
179
+ if item.kind_of?(REXML::Element)
180
+ xmlitem = Jabber::PubSub::Item.new
181
+ xmlitem.id = id
182
+ xmlitem.import(item)
183
+ publish.add(xmlitem)
184
+ else
185
+ raise "given item is not a proper xml document or Jabber::PubSub::Item"
186
+ end
187
+ @stream.send_with_id(iq)
188
+ end
189
+
190
+ ##
191
+ # purges all items on a persistent node
192
+ # node:: [String]
193
+ # return:: true
194
+ def purge_items_from(node)
195
+ iq = basic_pubsub_query(:set)
196
+ purge = REXML::Element.new('purge')
197
+ purge.attributes['node'] = node
198
+ iq.pubsub.add(purge)
199
+ @stream.send_with_id(iq)
200
+ end
201
+
202
+ ##
203
+ # Create a new node on the pubsub service
204
+ # node:: [String] the node name - otherwise you get a automatically generated one (in most cases)
205
+ # configure:: [Jabber::PubSub::NodeConfig] if you want to configure your node (default nil)
206
+ # return:: [String]
207
+ def create_node(node = nil, configure = Jabber::PubSub::NodeConfig.new)
208
+ rnode = nil
209
+ iq = basic_pubsub_query(:set)
210
+ iq.pubsub.add(REXML::Element.new('create')).attributes['node'] = node
211
+ if configure
212
+ if configure.kind_of?(Jabber::PubSub::NodeConfig)
213
+ iq.pubsub.add(configure)
214
+ end
215
+ end
216
+
217
+ @stream.send_with_id(iq) do |reply|
218
+ if reply.kind_of?(Jabber::Iq) and reply.type == :result
219
+ rnode = node
220
+ end
221
+ end
222
+
223
+ rnode
224
+ end
225
+
226
+ ##
227
+ # Create a new collection node on the pubsub service
228
+ # node:: [String] the node name - otherwise you get an automatically generated one (in most cases)
229
+ # configure:: [Jabber::PubSub::NodeConfig] if you want to configure your node (default nil)
230
+ # return:: [String]
231
+ def create_collection_node(node = nil, configure = Jabber::PubSub::NodeConfig.new)
232
+ if configure.options['pubsub#node_type'] && configure.options['pubsub#node_type'] != 'collection'
233
+ raise Jabber::ArgumentError, "Invalid node_type specified in node configuration. Either do not specify one, or use 'collection'"
234
+ end
235
+ configure.options = configure.options.merge({'pubsub#node_type' => 'collection'})
236
+ create_node(node, configure)
237
+ end
238
+
239
+ ##
240
+ # get configuration from a node
241
+ # node:: [String]
242
+ # return:: [Jabber::PubSub::Configure]
243
+ def get_config_from(node)
244
+ iq = basic_pubsub_query(:get, true)
245
+ iq.pubsub.add(Jabber::PubSub::OwnerNodeConfig.new(node))
246
+ ret = nil
247
+ @stream.send_with_id(iq) do |reply|
248
+ ret = reply.pubsub.first_element('configure')
249
+ end
250
+ ret
251
+ end
252
+
253
+ ##
254
+ # set configuration for a node
255
+ # node:: [String]
256
+ # options:: [Jabber::PubSub::NodeConfig]
257
+ # return:: true on success
258
+ def set_config_for(node, config)
259
+ iq = basic_pubsub_query( :set )
260
+ iq.pubsub.add(config.form)
261
+ @stream.send_with_id(iq)
262
+ end
263
+
264
+ ##
265
+ # Delete a pubsub node
266
+ # node:: [String]
267
+ # return:: true
268
+ def delete_node(node)
269
+ iq = basic_pubsub_query(:set,true)
270
+ iq.pubsub.add(REXML::Element.new('delete')).attributes['node'] = node
271
+ @stream.send_with_id(iq)
272
+ end
273
+
274
+
275
+ ##
276
+ # shows the affiliations on a pubsub service
277
+ # node:: [String]
278
+ # return:: [Hash] of { node => symbol }
279
+ def get_affiliations(node = nil)
280
+ iq = basic_pubsub_query(:get)
281
+ affiliations = iq.pubsub.add(REXML::Element.new('affiliations'))
282
+ affiliations.attributes['node'] = node
283
+ res = nil
284
+ @stream.send_with_id(iq) { |reply|
285
+ if reply.pubsub.first_element('affiliations')
286
+ res = {}
287
+ reply.pubsub.first_element('affiliations').each_element('affiliation') do |affiliation|
288
+ # TODO: This should be handled by an affiliation element class
289
+ aff = case affiliation.attributes['affiliation']
290
+ when 'owner' then :owner
291
+ when 'publisher' then :publisher
292
+ when 'none' then :none
293
+ when 'outcast' then :outcast
294
+ else nil
295
+ end
296
+ res[affiliation.attributes['node']] = aff
297
+ end
298
+ end
299
+ true
300
+ }
301
+ res
302
+ end
303
+
304
+ ##
305
+ # shows all subscriptions on the given node
306
+ # node:: [String]
307
+ # return:: [Array] of [Jabber::Pubsub::Subscription]
308
+ def get_subscriptions_from(node)
309
+ iq = basic_pubsub_query(:get)
310
+ entities = iq.pubsub.add(REXML::Element.new('subscriptions'))
311
+ entities.attributes['node'] = node
312
+ res = nil
313
+ @stream.send_with_id(iq) { |reply|
314
+ if reply.pubsub.first_element('subscriptions')
315
+ res = []
316
+ if reply.pubsub.first_element('subscriptions').attributes['node'] == node
317
+ reply.pubsub.first_element('subscriptions').each_element('subscription') { |subscription|
318
+ res << PubSub::Subscription.import(subscription)
319
+ }
320
+ end
321
+ end
322
+ true
323
+ }
324
+ res
325
+ end
326
+
327
+ ##
328
+ # shows all jids of subscribers of a node
329
+ # node:: [String]
330
+ # return:: [Array] of [String]
331
+ def get_subscribers_from(node)
332
+ res = []
333
+ get_subscriptions_from(node).each { |sub|
334
+ res << sub.jid
335
+ }
336
+ res
337
+ end
338
+
339
+
340
+ ##
341
+ # get options from a subscription
342
+ # node:: [String]
343
+ # jid:: [Jabber::JID] or [String]
344
+ # subid:: [String] or nil
345
+ # return:: [Jabber::PubSub::OwnerConfigure]
346
+ def get_options_from(node, jid, subid = nil)
347
+ iq = basic_pubsub_query(:get)
348
+ iq.pubsub.add(Jabber::PubSub::SubscriptionConfig.new(node, jid.kind_of?(String) ? Jabber::JID.new(jid).strip: jid.strip, subid))
349
+ ret = nil
350
+ @stream.send_with_id(iq) do |reply|
351
+ ret = reply.pubsub.first_element('options')
352
+ end
353
+ ret
354
+ end
355
+
356
+ ##
357
+ # set options for a subscription
358
+ # node:: [String]
359
+ # jid:: [Jabber::JID] or [String]
360
+ # options:: [Jabber::PubSub::SubscriptionConfig} specifying configuration options
361
+ # subid:: [String] or nil
362
+ # return:: true
363
+ def set_options_for(node, jid, options, subid = nil)
364
+ iq = basic_pubsub_query(:set)
365
+ iq.pubsub.add(Jabber::PubSub::SubscriptionConfig.new(node, jid.kind_of?(String) ? Jabber::JID.new(jid).strip: jid.strip, options, subid))
366
+ ret = false
367
+ @stream.send_with_id(iq) do |reply|
368
+ ret = ( reply.type == :result )
369
+ end
370
+
371
+ ret
372
+ end
373
+
374
+ ##
375
+ # String representation
376
+ # result:: [String] The PubSub service's JID
377
+ def to_s
378
+ @pubsubjid.to_s
379
+ end
380
+
381
+ ##
382
+ # Register callbacks for incoming events
383
+ # (i.e. Message stanzas containing) PubSub notifications
384
+ def add_event_callback(prio = 200, ref = nil, &block)
385
+ @event_cbs.add(prio, ref, block)
386
+ end
387
+
388
+ private
389
+
390
+ ##
391
+ # creates a basic pubsub iq
392
+ # basic_pubsub_query(type)
393
+ # type:: [Symbol]
394
+ def basic_pubsub_query(type,ownerusecase = false)
395
+ iq = Jabber::Iq.new(type,@pubsubjid)
396
+ if ownerusecase
397
+ iq.add(IqPubSubOwner.new)
398
+ else
399
+ iq.add(IqPubSub.new)
400
+ end
401
+ iq.from = @stream.jid #.strip
402
+ iq
403
+ end
404
+
405
+ ##
406
+ # handling incoming events
407
+ # handle_message(message)
408
+ # message:: [Jabber::Message]
409
+ def handle_message(message)
410
+ if message.from == @pubsubjid and message.first_element('event').kind_of?(Jabber::PubSub::Event)
411
+ event = message.first_element('event')
412
+ @event_cbs.process(event)
413
+ end
414
+ end
415
+ end
416
+ end
417
+ end