cerberus 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- 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,54 @@
|
|
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/children/node_config'
|
10
|
+
require 'xmpp4r/dataforms'
|
11
|
+
include Jabber
|
12
|
+
|
13
|
+
# Jabber.debug = true
|
14
|
+
|
15
|
+
class PubSub::NodeConfigTest < Test::Unit::TestCase
|
16
|
+
include ClientTester
|
17
|
+
|
18
|
+
def test_create()
|
19
|
+
config = PubSub::NodeConfig.new()
|
20
|
+
assert_nil(config.form)
|
21
|
+
assert_nil(config.node)
|
22
|
+
assert_equal({}, config.options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_create_with_options
|
26
|
+
options = {'pubsub#access_model'=>'open'}
|
27
|
+
|
28
|
+
config = PubSub::NodeConfig.new(nil, options)
|
29
|
+
assert_kind_of(Jabber::Dataforms::XData, config.form)
|
30
|
+
assert_equal(options, config.options)
|
31
|
+
assert_equal(:submit, config.form.type)
|
32
|
+
assert_equal('http://jabber.org/protocol/pubsub#node_config', config.form.field('FORM_TYPE').values.first)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_create_with_options_and_node
|
36
|
+
node = 'mynode'
|
37
|
+
options = {'pubsub#access_model'=>'open'}
|
38
|
+
|
39
|
+
config = PubSub::NodeConfig.new(node, options)
|
40
|
+
assert_equal(node, config.node)
|
41
|
+
assert_kind_of(Jabber::Dataforms::XData, config.form)
|
42
|
+
assert_equal(options, config.options)
|
43
|
+
assert_equal(:submit, config.form.type)
|
44
|
+
assert_equal('http://jabber.org/protocol/pubsub#node_config', config.form.field('FORM_TYPE').values.first)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_set_options
|
48
|
+
options = {'pubsub#access_model'=>'open'}
|
49
|
+
config = PubSub::NodeConfig.new()
|
50
|
+
config.options = options
|
51
|
+
assert_kind_of(Jabber::Dataforms::XData, config.form)
|
52
|
+
assert_equal(options, config.options)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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/children/subscription_config'
|
10
|
+
require 'xmpp4r/dataforms'
|
11
|
+
include Jabber
|
12
|
+
|
13
|
+
# Jabber.debug = true
|
14
|
+
|
15
|
+
class PubSub::SubscriptionConfigTest < Test::Unit::TestCase
|
16
|
+
include ClientTester
|
17
|
+
|
18
|
+
def test_create()
|
19
|
+
config = PubSub::SubscriptionConfig.new()
|
20
|
+
assert_nil(config.form)
|
21
|
+
assert_nil(config.node)
|
22
|
+
assert_equal({}, config.options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_create_with_options
|
26
|
+
node = 'mynode'
|
27
|
+
jid = 'test@test.com'
|
28
|
+
options = {'pubsub#access_model'=>'open'}
|
29
|
+
subid = '004-yyy'
|
30
|
+
|
31
|
+
config = PubSub::SubscriptionConfig.new(node, jid, options, subid)
|
32
|
+
assert_equal(node, config.node)
|
33
|
+
assert_equal(subid, config.subid)
|
34
|
+
assert_kind_of(Jabber::JID, config.jid)
|
35
|
+
assert_equal(Jabber::JID.new(jid), config.jid)
|
36
|
+
assert_kind_of(Jabber::Dataforms::XData, config.form)
|
37
|
+
assert_equal(options, config.options)
|
38
|
+
assert_equal(:submit, config.form.type)
|
39
|
+
assert_equal('http://jabber.org/protocol/pubsub#subscribe_options', config.form.field('FORM_TYPE').values.first)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,514 @@
|
|
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/roster/helper/roster'
|
10
|
+
require 'xmpp4r/semaphore'
|
11
|
+
include Jabber
|
12
|
+
|
13
|
+
class Roster::HelperTest < Test::Unit::TestCase
|
14
|
+
include ClientTester
|
15
|
+
|
16
|
+
def test_simple
|
17
|
+
state { |iq|
|
18
|
+
assert_kind_of(Iq, iq)
|
19
|
+
assert_equal(:get, iq.type)
|
20
|
+
assert_nil(iq.to)
|
21
|
+
assert_equal('jabber:iq:roster', iq.queryns)
|
22
|
+
|
23
|
+
send("<iq type='result'><query xmlns='jabber:iq:version'/></iq>")
|
24
|
+
send("<iq type='result' id='#{iq.id}'>
|
25
|
+
<query xmlns='jabber:iq:roster'>
|
26
|
+
<item jid='a@b.c' subscription='both'/>
|
27
|
+
<item jid='b@b.c' name='b guy' subscription='from' ask='subscribe'/>
|
28
|
+
<item jid='123@xyz' name='123' subscription='to'/>
|
29
|
+
</query>
|
30
|
+
</iq>")
|
31
|
+
}
|
32
|
+
|
33
|
+
query_waiter = Semaphore.new
|
34
|
+
h = Roster::Helper.new(@client)
|
35
|
+
h.add_query_callback { |iq|
|
36
|
+
query_waiter.run
|
37
|
+
}
|
38
|
+
wait_state
|
39
|
+
query_waiter.wait
|
40
|
+
|
41
|
+
assert_equal([nil], h.groups)
|
42
|
+
jids = h.find_by_group(nil).collect { |item| item.jid }.sort
|
43
|
+
assert_equal([JID.new('123@xyz'), JID.new('a@b.c'), JID.new('b@b.c')], jids)
|
44
|
+
assert_equal(1, h.find('123@xyz/res').size)
|
45
|
+
|
46
|
+
assert_kind_of(Roster::Helper::RosterItem, h['a@b.c'])
|
47
|
+
assert_equal(JID.new('a@b.c'), h['a@b.c'].jid)
|
48
|
+
assert_nil(h['a@b.c'].iname)
|
49
|
+
assert_equal(:both, h['a@b.c'].subscription)
|
50
|
+
assert_nil(h['a@b.c'].ask)
|
51
|
+
|
52
|
+
assert_kind_of(Roster::Helper::RosterItem, h[JID.new('b@b.c')])
|
53
|
+
assert_equal(JID.new('b@b.c'), h['b@b.c'].jid)
|
54
|
+
assert_equal('b guy', h['b@b.c'].iname)
|
55
|
+
assert_equal(:from, h['b@b.c'].subscription)
|
56
|
+
assert_equal(:subscribe, h['b@b.c'].ask)
|
57
|
+
|
58
|
+
assert_kind_of(Roster::Helper::RosterItem, h['123@xyz'])
|
59
|
+
assert_equal(JID.new('123@xyz'), h['123@xyz'].jid)
|
60
|
+
assert_equal('123', h['123@xyz'].iname)
|
61
|
+
assert_equal(:to, h['123@xyz'].subscription)
|
62
|
+
assert_nil(h['123@xyz'].ask)
|
63
|
+
|
64
|
+
assert_nil(h['c@b.c'])
|
65
|
+
assert_nil(h[JID.new('c@b.c')])
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_rosterpush
|
69
|
+
state { |iq|
|
70
|
+
send("<iq type='result' id='#{iq.id}'>
|
71
|
+
<query xmlns='jabber:iq:roster'>
|
72
|
+
</query>
|
73
|
+
</iq>")
|
74
|
+
}
|
75
|
+
|
76
|
+
query_waiter = Semaphore.new
|
77
|
+
h = Roster::Helper.new(@client)
|
78
|
+
h.add_query_callback { |iq| query_waiter.run }
|
79
|
+
wait_state
|
80
|
+
query_waiter.wait
|
81
|
+
|
82
|
+
assert_equal([], h.groups)
|
83
|
+
assert_nil(h['a@b.c'])
|
84
|
+
|
85
|
+
send("<iq type='set'>
|
86
|
+
<query xmlns='jabber:iq:roster'>
|
87
|
+
<item jid='a@b.c'/>
|
88
|
+
</query>
|
89
|
+
</iq>")
|
90
|
+
query_waiter.wait
|
91
|
+
|
92
|
+
assert_kind_of(Roster::Helper::RosterItem, h['a@b.c'])
|
93
|
+
assert_equal(JID.new('a@b.c'), h['a@b.c'].jid)
|
94
|
+
assert_nil(h['a@b.c'].iname)
|
95
|
+
assert_nil(h['a@b.c'].subscription)
|
96
|
+
assert_nil(h['a@b.c'].ask)
|
97
|
+
|
98
|
+
send("<iq type='set'>
|
99
|
+
<query xmlns='jabber:iq:roster'>
|
100
|
+
<item jid='a@b.c' subscription='from' name='ABC' ask='subscribe'/>
|
101
|
+
</query>
|
102
|
+
</iq>")
|
103
|
+
query_waiter.wait
|
104
|
+
|
105
|
+
assert_kind_of(Roster::Helper::RosterItem, h['a@b.c'])
|
106
|
+
assert_equal(JID.new('a@b.c'), h['a@b.c'].jid)
|
107
|
+
assert_equal('ABC', h['a@b.c'].iname)
|
108
|
+
assert_equal(:from, h['a@b.c'].subscription)
|
109
|
+
assert_equal(:subscribe, h['a@b.c'].ask)
|
110
|
+
|
111
|
+
send("<iq type='set'>
|
112
|
+
<query xmlns='jabber:iq:roster'>
|
113
|
+
<item jid='a@b.c'/>
|
114
|
+
</query>
|
115
|
+
</iq>")
|
116
|
+
query_waiter.wait
|
117
|
+
|
118
|
+
assert_kind_of(Roster::Helper::RosterItem, h['a@b.c'])
|
119
|
+
assert_equal(JID.new('a@b.c'), h['a@b.c'].jid)
|
120
|
+
assert_nil(h['a@b.c'].iname)
|
121
|
+
assert_nil(h['a@b.c'].subscription)
|
122
|
+
assert_nil(h['a@b.c'].ask)
|
123
|
+
|
124
|
+
send("<iq type='set'>
|
125
|
+
<query xmlns='jabber:iq:roster'>
|
126
|
+
<item jid='a@b.c' subscription='remove'/>
|
127
|
+
</query>
|
128
|
+
</iq>")
|
129
|
+
query_waiter.wait
|
130
|
+
|
131
|
+
assert_nil(h['a@b.c'])
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_presence
|
135
|
+
state { |iq|
|
136
|
+
send("<iq type='result' id='#{iq.id}'>
|
137
|
+
<query xmlns='jabber:iq:roster'>
|
138
|
+
<item jid='a@b.c' subscription='both'/>
|
139
|
+
</query>
|
140
|
+
</iq>")
|
141
|
+
}
|
142
|
+
|
143
|
+
query_waiter = Semaphore.new
|
144
|
+
presence_waiter = Semaphore.new
|
145
|
+
h = Roster::Helper.new(@client)
|
146
|
+
h.add_query_callback { |iq|
|
147
|
+
query_waiter.run
|
148
|
+
}
|
149
|
+
cb_item, cb_op, cb_p = nil, nil, nil
|
150
|
+
h.add_presence_callback { |item,oldpres,pres|
|
151
|
+
# HACK:
|
152
|
+
# if two stanzas are expected for one sent stanza,
|
153
|
+
# race conditions may appear here
|
154
|
+
Thread.pass
|
155
|
+
|
156
|
+
cb_item, cb_op, cb_p = item, oldpres, pres
|
157
|
+
presence_waiter.run
|
158
|
+
}
|
159
|
+
|
160
|
+
wait_state
|
161
|
+
query_waiter.wait
|
162
|
+
|
163
|
+
assert_equal(false, h['a@b.c'].online?)
|
164
|
+
presences = 0
|
165
|
+
h['a@b.c'].each_presence { presences += 1 }
|
166
|
+
assert_equal(0, presences)
|
167
|
+
|
168
|
+
send("<presence from='a@b.c/r'/>")
|
169
|
+
presence_waiter.wait
|
170
|
+
|
171
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
172
|
+
assert_nil(cb_op)
|
173
|
+
assert_kind_of(Presence, cb_p)
|
174
|
+
assert_nil(cb_p.type)
|
175
|
+
assert_equal(true, h['a@b.c'].online?)
|
176
|
+
presences = 0
|
177
|
+
h['a@b.c'].each_presence { presences += 1 }
|
178
|
+
assert_equal(1, presences)
|
179
|
+
|
180
|
+
send("<presence from='a@b.c/r2'/>")
|
181
|
+
presence_waiter.wait
|
182
|
+
|
183
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
184
|
+
assert_nil(cb_op)
|
185
|
+
assert_kind_of(Presence, cb_p)
|
186
|
+
assert_nil(cb_p.type)
|
187
|
+
assert_equal(true, h['a@b.c'].online?)
|
188
|
+
presences = 0
|
189
|
+
h['a@b.c'].each_presence { presences += 1 }
|
190
|
+
assert_equal(2, presences)
|
191
|
+
|
192
|
+
send("<presence from='a@b.c/r'/>")
|
193
|
+
presence_waiter.wait
|
194
|
+
|
195
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
196
|
+
assert_kind_of(Presence, cb_op)
|
197
|
+
assert_nil(cb_op.type)
|
198
|
+
assert_kind_of(Presence, cb_p)
|
199
|
+
assert_nil(cb_p.type)
|
200
|
+
assert_equal(true, h['a@b.c'].online?)
|
201
|
+
presences = 0
|
202
|
+
h['a@b.c'].each_presence { presences += 1 }
|
203
|
+
assert_equal(2, presences)
|
204
|
+
|
205
|
+
send("<presence from='a@b.c/r' type='error'/>")
|
206
|
+
presence_waiter.wait
|
207
|
+
|
208
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
209
|
+
assert_kind_of(Presence, cb_op)
|
210
|
+
assert_nil(cb_op.type)
|
211
|
+
assert_kind_of(Presence, cb_p)
|
212
|
+
assert_equal(:error, cb_p.type)
|
213
|
+
assert_equal(true, h['a@b.c'].online?)
|
214
|
+
presences = 0
|
215
|
+
h['a@b.c'].each_presence { presences += 1 }
|
216
|
+
assert_equal(2, presences)
|
217
|
+
|
218
|
+
send("<presence from='a@b.c/r2' type='unavailable'/>")
|
219
|
+
presence_waiter.wait
|
220
|
+
|
221
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
222
|
+
assert_kind_of(Presence, cb_op)
|
223
|
+
assert_nil(cb_op.type)
|
224
|
+
assert_kind_of(Presence, cb_p)
|
225
|
+
assert_equal(:unavailable, cb_p.type)
|
226
|
+
assert_equal(false, h['a@b.c'].online?)
|
227
|
+
presences = 0
|
228
|
+
h['a@b.c'].each_presence { presences += 1 }
|
229
|
+
assert_equal(2, presences)
|
230
|
+
|
231
|
+
send("<presence from='a@b.c/r'/>")
|
232
|
+
presence_waiter.wait
|
233
|
+
|
234
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
235
|
+
assert_kind_of(Presence, cb_op)
|
236
|
+
assert_equal(:error, cb_op.type)
|
237
|
+
assert_kind_of(Presence, cb_p)
|
238
|
+
assert_nil(cb_p.type)
|
239
|
+
assert_equal(true, h['a@b.c'].online?)
|
240
|
+
presences = 0
|
241
|
+
h['a@b.c'].each_presence { presences += 1 }
|
242
|
+
assert_equal(2, presences)
|
243
|
+
|
244
|
+
send("<presence from='a@b.c/r2'/>")
|
245
|
+
presence_waiter.wait
|
246
|
+
|
247
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
248
|
+
assert_kind_of(Presence, cb_op)
|
249
|
+
assert_equal(:unavailable, cb_op.type)
|
250
|
+
assert_kind_of(Presence, cb_p)
|
251
|
+
assert_nil(cb_p.type)
|
252
|
+
assert_equal(true, h['a@b.c'].online?)
|
253
|
+
presences = 0
|
254
|
+
h['a@b.c'].each_presence { presences += 1 }
|
255
|
+
assert_equal(2, presences)
|
256
|
+
|
257
|
+
send("<presence from='a@b.c' type='error'/>")
|
258
|
+
2.times {
|
259
|
+
presence_waiter.wait
|
260
|
+
|
261
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
262
|
+
assert_kind_of(Presence, cb_op)
|
263
|
+
assert_kind_of(Presence, cb_p)
|
264
|
+
assert_equal(:error, cb_p.type)
|
265
|
+
}
|
266
|
+
assert_equal(false, h['a@b.c'].online?)
|
267
|
+
presences = 0
|
268
|
+
h['a@b.c'].each_presence { presences += 1 }
|
269
|
+
assert_equal(1, presences)
|
270
|
+
|
271
|
+
send("<presence from='a@b.c/r'/>")
|
272
|
+
presence_waiter.wait
|
273
|
+
|
274
|
+
assert_kind_of(Roster::Helper::RosterItem, cb_item)
|
275
|
+
assert_nil(cb_op)
|
276
|
+
assert_kind_of(Presence, cb_p)
|
277
|
+
assert_nil(cb_p.type)
|
278
|
+
assert_equal(true, h['a@b.c'].online?)
|
279
|
+
presences = 0
|
280
|
+
h['a@b.c'].each_presence { presences += 1 }
|
281
|
+
assert_equal(1, presences)
|
282
|
+
end
|
283
|
+
|
284
|
+
def test_subscribe
|
285
|
+
state { |iq|
|
286
|
+
send("<iq type='result' id='#{iq.id}'>
|
287
|
+
<query xmlns='jabber:iq:roster'/>
|
288
|
+
</iq>")
|
289
|
+
}
|
290
|
+
|
291
|
+
query_waiter = Semaphore.new
|
292
|
+
h = Roster::Helper.new(@client)
|
293
|
+
h.add_query_callback { |iq| query_waiter.run }
|
294
|
+
wait_state
|
295
|
+
query_waiter.wait
|
296
|
+
|
297
|
+
state { |iq|
|
298
|
+
assert_kind_of(Iq, iq)
|
299
|
+
assert_equal('jabber:iq:roster', iq.queryns)
|
300
|
+
assert_equal(JID.new('contact@example.org'), iq.query.first_element('item').jid)
|
301
|
+
assert_equal('MyContact', iq.query.first_element('item').iname)
|
302
|
+
send("<iq type='set'>
|
303
|
+
<query xmlns='jabber:iq:roster'>
|
304
|
+
<item jid='contact@example.org' subscription='none' name='MyContact'/>
|
305
|
+
</query>
|
306
|
+
</iq>
|
307
|
+
<iq type='result' id='#{iq.id}'/>")
|
308
|
+
}
|
309
|
+
state { |pres|
|
310
|
+
assert_kind_of(Presence, pres)
|
311
|
+
assert_equal(:subscribe, pres.type)
|
312
|
+
assert_equal(JID.new('contact@example.org'), pres.to)
|
313
|
+
Thread.pass
|
314
|
+
}
|
315
|
+
h.add('contact@example.org', 'MyContact', true)
|
316
|
+
wait_state
|
317
|
+
query_waiter.wait
|
318
|
+
wait_state
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_accept_subscription
|
322
|
+
state { |iq|
|
323
|
+
send("<iq type='result' id='#{iq.id}'>
|
324
|
+
<query xmlns='jabber:iq:roster'/>
|
325
|
+
</iq>")
|
326
|
+
}
|
327
|
+
|
328
|
+
query_waiter = Semaphore.new
|
329
|
+
h = Roster::Helper.new(@client)
|
330
|
+
h.add_query_callback { |iq| query_waiter.run }
|
331
|
+
wait_state
|
332
|
+
query_waiter.wait
|
333
|
+
|
334
|
+
state { |pres|
|
335
|
+
assert_kind_of(Presence, pres)
|
336
|
+
assert_equal(:subscribed, pres.type)
|
337
|
+
}
|
338
|
+
state { |iq|
|
339
|
+
assert_kind_of(Iq, iq)
|
340
|
+
assert_equal(:set, iq.type)
|
341
|
+
send("<iq type='result' id='#{iq.id}'/>")
|
342
|
+
}
|
343
|
+
|
344
|
+
cb_lock = Semaphore.new
|
345
|
+
h.add_subscription_request_callback { |item,pres|
|
346
|
+
assert_nil(item)
|
347
|
+
assert_kind_of(Presence, pres)
|
348
|
+
h.accept_subscription(pres.from)
|
349
|
+
cb_lock.run
|
350
|
+
}
|
351
|
+
send("<presence type='subscribe' from='contact@example.org' to='user@example.com'/>")
|
352
|
+
skip_state
|
353
|
+
wait_state
|
354
|
+
cb_lock.wait
|
355
|
+
|
356
|
+
state { |pres|
|
357
|
+
assert_kind_of(Presence, pres)
|
358
|
+
assert_equal(:subscribed, pres.type)
|
359
|
+
assert_equal(JID.new('contact@example.org'), pres.to)
|
360
|
+
}
|
361
|
+
wait_state
|
362
|
+
end
|
363
|
+
|
364
|
+
def test_decline_subscription
|
365
|
+
state { |iq|
|
366
|
+
send("<iq type='result' id='#{iq.id}'>
|
367
|
+
<query xmlns='jabber:iq:roster'/>
|
368
|
+
</iq>")
|
369
|
+
}
|
370
|
+
|
371
|
+
query_waiter = Semaphore.new
|
372
|
+
h = Roster::Helper.new(@client)
|
373
|
+
h.add_query_callback { |iq| query_waiter.run }
|
374
|
+
wait_state
|
375
|
+
query_waiter.wait
|
376
|
+
|
377
|
+
state { |pres|
|
378
|
+
assert_kind_of(Presence, pres)
|
379
|
+
assert_equal(:unsubscribed, pres.type)
|
380
|
+
assert_equal(JID.new('contact@example.org'), pres.to)
|
381
|
+
}
|
382
|
+
cb_lock = Semaphore.new
|
383
|
+
h.add_subscription_request_callback { |item,pres|
|
384
|
+
assert_nil(item)
|
385
|
+
assert_kind_of(Presence, pres)
|
386
|
+
h.decline_subscription(pres.from)
|
387
|
+
|
388
|
+
cb_lock.run
|
389
|
+
}
|
390
|
+
|
391
|
+
send("<presence type='subscribe' from='contact@example.org' to='user@example.com'/>")
|
392
|
+
wait_state
|
393
|
+
cb_lock.wait
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_groupset
|
397
|
+
state { |iq|
|
398
|
+
send("<iq type='result'>
|
399
|
+
<query xmlns='jabber:iq:roster'>
|
400
|
+
<item jid='test@test' subscription='both'>
|
401
|
+
<group>One</group>
|
402
|
+
<group>Two</group>
|
403
|
+
</item>
|
404
|
+
</query>
|
405
|
+
</iq>")
|
406
|
+
}
|
407
|
+
|
408
|
+
query_waiter = Semaphore.new
|
409
|
+
h = Roster::Helper.new(@client)
|
410
|
+
h.add_query_callback { query_waiter.run }
|
411
|
+
wait_state
|
412
|
+
query_waiter.wait
|
413
|
+
|
414
|
+
assert_equal(1, h.items.size)
|
415
|
+
assert_equal(%w(One Two).sort, h['test@test'].groups.sort)
|
416
|
+
|
417
|
+
state { |iq|
|
418
|
+
send("<iq type='result' id='#{iq.id}'>#{iq.query}</iq>")
|
419
|
+
}
|
420
|
+
h['test@test'].groups = %w(One Two Three)
|
421
|
+
h['test@test'].send
|
422
|
+
wait_state
|
423
|
+
query_waiter.wait
|
424
|
+
assert_equal(%w(One Two Three).sort, h['test@test'].groups.sort)
|
425
|
+
end
|
426
|
+
|
427
|
+
def test_nameset
|
428
|
+
state { |iq|
|
429
|
+
send("<iq type='result'>
|
430
|
+
<query xmlns='jabber:iq:roster'>
|
431
|
+
<item jid='test@test' subscription='both'/>
|
432
|
+
</query>
|
433
|
+
</iq>")
|
434
|
+
}
|
435
|
+
|
436
|
+
query_waiter = Semaphore.new
|
437
|
+
h = Roster::Helper.new(@client)
|
438
|
+
h.add_query_callback { query_waiter.run }
|
439
|
+
wait_state
|
440
|
+
query_waiter.wait
|
441
|
+
|
442
|
+
assert_equal(1, h.items.size)
|
443
|
+
assert_nil(h['test@test'].iname)
|
444
|
+
|
445
|
+
state { |iq|
|
446
|
+
send("<iq type='result' id='#{iq.id}'>#{iq.query}</iq>")
|
447
|
+
}
|
448
|
+
h['test@test'].iname = 'Unknown'
|
449
|
+
h['test@test'].send
|
450
|
+
wait_state
|
451
|
+
query_waiter.wait
|
452
|
+
assert_equal('Unknown', h['test@test'].iname)
|
453
|
+
|
454
|
+
state { |iq|
|
455
|
+
send("<iq type='result' id='#{iq.id}'>#{iq.query}</iq>")
|
456
|
+
}
|
457
|
+
h['test@test'].iname = 'Known'
|
458
|
+
h['test@test'].send
|
459
|
+
wait_state
|
460
|
+
query_waiter.wait
|
461
|
+
assert_equal('Known', h['test@test'].iname)
|
462
|
+
|
463
|
+
state { |iq|
|
464
|
+
send("<iq type='result' id='#{iq.id}'>#{iq.query}</iq>")
|
465
|
+
}
|
466
|
+
h['test@test'].iname = nil
|
467
|
+
h['test@test'].send
|
468
|
+
wait_state
|
469
|
+
query_waiter.wait
|
470
|
+
assert_nil(h['test@test'].iname)
|
471
|
+
end
|
472
|
+
|
473
|
+
def test_update_callback
|
474
|
+
update_args = nil
|
475
|
+
update_waiter = Semaphore.new
|
476
|
+
|
477
|
+
h = Roster::Helper.new(@client)
|
478
|
+
h.add_update_callback { |*a|
|
479
|
+
update_args = a
|
480
|
+
update_waiter.run
|
481
|
+
}
|
482
|
+
|
483
|
+
send("<iq type='set'>
|
484
|
+
<query xmlns='jabber:iq:roster'>
|
485
|
+
<item jid='foo@bar' name='Foo'/>
|
486
|
+
</query>
|
487
|
+
</iq>")
|
488
|
+
update_waiter.wait
|
489
|
+
assert_nil(update_args[0])
|
490
|
+
assert_equal(JID.new('foo@bar'), update_args[1].jid)
|
491
|
+
assert_equal('Foo', update_args[1].iname)
|
492
|
+
|
493
|
+
send("<iq type='set'>
|
494
|
+
<query xmlns='jabber:iq:roster'>
|
495
|
+
<item jid='foo@bar'/>
|
496
|
+
</query>
|
497
|
+
</iq>")
|
498
|
+
update_waiter.wait
|
499
|
+
assert_equal(JID.new('foo@bar'), update_args[0].jid)
|
500
|
+
assert_equal('Foo', update_args[0].iname)
|
501
|
+
assert_equal(JID.new('foo@bar'), update_args[1].jid)
|
502
|
+
assert_nil(update_args[1].iname)
|
503
|
+
|
504
|
+
send("<iq type='set'>
|
505
|
+
<query xmlns='jabber:iq:roster'>
|
506
|
+
<item jid='foo@bar' subscription='remove'/>
|
507
|
+
</query>
|
508
|
+
</iq>")
|
509
|
+
update_waiter.wait
|
510
|
+
assert_equal(JID.new('foo@bar'), update_args[0].jid)
|
511
|
+
assert_nil(update_args[0].iname)
|
512
|
+
assert_nil(update_args[1])
|
513
|
+
end
|
514
|
+
end
|