cerberus 0.6 → 0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Authors.txt +4 -0
- data/Changelog.txt +11 -0
- data/Copyright.txt +16 -0
- data/Rakefile +16 -25
- data/Readme.markdown +1 -3
- data/bin/cerberus +5 -0
- data/lib/cerberus/builder/bjam.rb +1 -3
- data/lib/cerberus/builder/maven2.rb +0 -1
- data/lib/cerberus/builder/rake.rb +1 -1
- data/lib/cerberus/builder/rspec.rb +0 -1
- data/lib/cerberus/builder/ruby_base.rb +0 -1
- data/lib/cerberus/component_lazy_loader.rb +6 -2
- data/lib/cerberus/config.example.yml +1 -0
- data/lib/cerberus/constants.rb +2 -2
- data/lib/cerberus/manager.rb +7 -1
- data/lib/cerberus/publisher/mail.rb +4 -4
- data/lib/cerberus/publisher/twitter.rb +0 -1
- data/lib/cerberus/scm/base.rb +19 -0
- data/lib/cerberus/scm/bzr.rb +62 -0
- data/lib/cerberus/scm/cvs.rb +2 -7
- data/lib/cerberus/scm/darcs.rb +2 -11
- data/lib/cerberus/scm/git.rb +6 -14
- data/lib/cerberus/scm/perforce.rb +4 -4
- data/lib/cerberus/scm/svn.rb +2 -7
- data/lib/cerberus/utils.rb +5 -0
- data/lib/vendor/irc/README +23 -0
- data/lib/vendor/irc/lib/IRC.rb +164 -0
- data/lib/vendor/irc/lib/IRCChannel.rb +33 -0
- data/lib/vendor/irc/lib/IRCConnection.rb +134 -0
- data/lib/vendor/irc/lib/IRCEvent.rb +91 -0
- data/lib/vendor/irc/lib/IRCUser.rb +23 -0
- data/lib/vendor/irc/lib/IRCUtil.rb +49 -0
- data/lib/vendor/irc/lib/eventmap.yml +247 -0
- data/lib/vendor/twitter/CHANGES +129 -0
- data/lib/vendor/twitter/MIT-LICENSE +20 -0
- data/lib/vendor/twitter/README +37 -0
- data/lib/vendor/twitter/TODO +7 -0
- data/lib/vendor/twitter/lib/twitter.rb +34 -0
- data/lib/vendor/twitter/lib/twitter/client.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/account.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/auth.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/base.rb +93 -0
- data/lib/vendor/twitter/lib/twitter/client/blocks.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/favorites.rb +53 -0
- data/lib/vendor/twitter/lib/twitter/client/friendship.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/graph.rb +37 -0
- data/lib/vendor/twitter/lib/twitter/client/messaging.rb +79 -0
- data/lib/vendor/twitter/lib/twitter/client/profile.rb +29 -0
- data/lib/vendor/twitter/lib/twitter/client/search.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/status.rb +51 -0
- data/lib/vendor/twitter/lib/twitter/client/timeline.rb +72 -0
- data/lib/vendor/twitter/lib/twitter/client/user.rb +65 -0
- data/lib/vendor/twitter/lib/twitter/config.rb +77 -0
- data/lib/vendor/twitter/lib/twitter/console.rb +31 -0
- data/lib/vendor/twitter/lib/twitter/core.rb +137 -0
- data/lib/vendor/twitter/lib/twitter/ext.rb +2 -0
- data/lib/vendor/twitter/lib/twitter/ext/stdlib.rb +52 -0
- data/lib/vendor/twitter/lib/twitter/extras.rb +39 -0
- data/lib/vendor/twitter/lib/twitter/meta.rb +56 -0
- data/lib/vendor/twitter/lib/twitter/model.rb +360 -0
- data/lib/vendor/twitter/lib/twitter/version.rb +19 -0
- data/lib/vendor/twitter/spec/twitter/client/account_spec.rb +28 -0
- data/lib/vendor/twitter/spec/twitter/client/auth_spec.rb +34 -0
- data/lib/vendor/twitter/spec/twitter/client/base_spec.rb +242 -0
- data/lib/vendor/twitter/spec/twitter/client/blocks_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/favorites_spec.rb +183 -0
- data/lib/vendor/twitter/spec/twitter/client/friendship_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/graph_spec.rb +67 -0
- data/lib/vendor/twitter/spec/twitter/client/messaging_spec.rb +135 -0
- data/lib/vendor/twitter/spec/twitter/client/profile_spec.rb +91 -0
- data/lib/vendor/twitter/spec/twitter/client/search_spec.rb +68 -0
- data/lib/vendor/twitter/spec/twitter/client/status_spec.rb +119 -0
- data/lib/vendor/twitter/spec/twitter/client/timeline_spec.rb +79 -0
- data/lib/vendor/twitter/spec/twitter/client/user_spec.rb +203 -0
- data/lib/vendor/twitter/spec/twitter/client_spec.rb +2 -0
- data/lib/vendor/twitter/spec/twitter/config_spec.rb +86 -0
- data/lib/vendor/twitter/spec/twitter/console_spec.rb +15 -0
- data/lib/vendor/twitter/spec/twitter/core_spec.rb +127 -0
- data/lib/vendor/twitter/spec/twitter/ext/stdlib_spec.rb +59 -0
- data/lib/vendor/twitter/spec/twitter/extras_spec.rb +46 -0
- data/lib/vendor/twitter/spec/twitter/meta_spec.rb +90 -0
- data/lib/vendor/twitter/spec/twitter/model_spec.rb +508 -0
- data/lib/vendor/twitter/spec/twitter/version_spec.rb +19 -0
- data/lib/vendor/xmpp4r/CHANGELOG +83 -0
- data/lib/vendor/xmpp4r/COPYING +340 -0
- data/lib/vendor/xmpp4r/LICENSE +59 -0
- data/lib/vendor/xmpp4r/README.rdoc +110 -0
- data/lib/vendor/xmpp4r/README_ruby19.txt +43 -0
- data/lib/vendor/xmpp4r/Rakefile +262 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb +70 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/component.rb +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/register.rb +42 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r.rb +116 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/base64.rb +32 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/callbacks.rb +124 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/c.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/generator.rb +160 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb +87 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/client.rb +317 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/helper/responder.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/iq/command.rb +154 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/component.rb +103 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/connection.rb +219 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms/x/data.rb +297 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/debuglog.rb +42 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay/x/delay.rb +99 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/helper/responder.rb +165 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/errors.rb +281 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/base.rb +55 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/bot.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding/client.rb +285 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/idgenerator.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/iq.rb +221 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/jid.rb +167 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/message.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc.rb +14 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/item.rb +143 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/muc.rb +70 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/presence.rb +232 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub.rb +8 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/event.rb +49 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/item.rb +35 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/items.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/publish.rb +24 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/query.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rexmladdons.rb +151 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/helper/roster.rb +519 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/iq/roster.rb +215 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/x/roster.rb +138 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/client.rb +123 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/server.rb +74 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/sasl.rb +237 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/semaphore.rb +38 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/stream.rb +497 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/streamparser.rb +77 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/helper/helper.rb +58 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/tune.rb +113 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard.rb +6 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/responder.rb +72 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/iq/version.rb +105 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/x.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml/html.rb +115 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmpp4r.rb +18 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppelement.rb +168 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppstanza.rb +162 -0
- data/lib/vendor/xmpp4r/setup.rb +1586 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_ibb.rb +186 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_socks5bytestreams.rb +113 -0
- data/lib/vendor/xmpp4r/test/caps/tc_helper.rb +156 -0
- data/lib/vendor/xmpp4r/test/dataforms/tc_data.rb +81 -0
- data/lib/vendor/xmpp4r/test/delay/tc_xdelay.rb +51 -0
- data/lib/vendor/xmpp4r/test/discovery/tc_responder.rb +91 -0
- data/lib/vendor/xmpp4r/test/lib/assert_equal_xml.rb +14 -0
- data/lib/vendor/xmpp4r/test/lib/clienttester.rb +120 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_mucclient.rb +830 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_simplemucclient.rb +114 -0
- data/lib/vendor/xmpp4r/test/muc/tc_mucowner.rb +50 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_helper.rb +662 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_nodeconfig.rb +54 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_subscriptionconfig.rb +41 -0
- data/lib/vendor/xmpp4r/test/roster/tc_helper.rb +514 -0
- data/lib/vendor/xmpp4r/test/roster/tc_iqqueryroster.rb +173 -0
- data/lib/vendor/xmpp4r/test/roster/tc_xroster.rb +73 -0
- data/lib/vendor/xmpp4r/test/rpc/tc_helper.rb +96 -0
- data/lib/vendor/xmpp4r/test/tc_callbacks.rb +129 -0
- data/lib/vendor/xmpp4r/test/tc_class_names.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_client.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_errors.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_idgenerator.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_iq.rb +113 -0
- data/lib/vendor/xmpp4r/test/tc_iqquery.rb +31 -0
- data/lib/vendor/xmpp4r/test/tc_jid.rb +204 -0
- data/lib/vendor/xmpp4r/test/tc_message.rb +116 -0
- data/lib/vendor/xmpp4r/test/tc_presence.rb +150 -0
- data/lib/vendor/xmpp4r/test/tc_rexml.rb +139 -0
- data/lib/vendor/xmpp4r/test/tc_stream.rb +229 -0
- data/lib/vendor/xmpp4r/test/tc_streamComponent.rb +95 -0
- data/lib/vendor/xmpp4r/test/tc_streamError.rb +131 -0
- data/lib/vendor/xmpp4r/test/tc_streamSend.rb +59 -0
- data/lib/vendor/xmpp4r/test/tc_streamparser.rb +112 -0
- data/lib/vendor/xmpp4r/test/tc_xmppstanza.rb +135 -0
- data/lib/vendor/xmpp4r/test/ts_xmpp4r.rb +53 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_recv.rb +84 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_send.rb +74 -0
- data/lib/vendor/xmpp4r/test/tune/tc_tune.rb +79 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_helper.rb +49 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb +62 -0
- data/lib/vendor/xmpp4r/test/version/tc_helper.rb +60 -0
- data/lib/vendor/xmpp4r/test/version/tc_iqqueryversion.rb +97 -0
- data/lib/vendor/xmpp4r/test/xhtml/tc_html.rb +41 -0
- data/lib/vendor/xmpp4r/tools/gen_requires.bash +31 -0
- data/lib/vendor/xmpp4r/tools/xmpp4r-gemspec-test.rb +11 -0
- data/lib/vendor/xmpp4r/xmpp4r.gemspec +291 -0
- data/test/jabber_publisher_test.rb +1 -1
- data/test/mail_publisher_test.rb +2 -2
- data/test/mock/twitter.rb +0 -1
- data/test/rspec_builder_test.rb +39 -2
- data/test/rss_publisher_test.rb +1 -1
- data/test/twitter_publisher_test.rb +1 -1
- metadata +268 -53
- data/lib/cerberus/publisher/gmailer.rb +0 -17
|
@@ -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
|