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,81 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift File::dirname(__FILE__) + '/../../lib'
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'xmpp4r/dataforms'
|
7
|
+
include Jabber
|
8
|
+
|
9
|
+
class DataFormsTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_create_defaults
|
12
|
+
v = Dataforms::XDataTitle.new
|
13
|
+
assert_nil(v.title)
|
14
|
+
assert_equal("", v.to_s)
|
15
|
+
|
16
|
+
v = Dataforms::XDataInstructions.new
|
17
|
+
assert_nil(v.instructions)
|
18
|
+
assert_equal("", v.to_s)
|
19
|
+
|
20
|
+
v = Dataforms::XDataField.new
|
21
|
+
assert_nil(v.label)
|
22
|
+
assert_nil(v.var)
|
23
|
+
assert_nil(v.type)
|
24
|
+
assert_equal(false, v.required?)
|
25
|
+
assert_equal([], v.values)
|
26
|
+
assert_equal({}, v.options)
|
27
|
+
|
28
|
+
v = Dataforms::XData.new
|
29
|
+
assert_equal([], v.fields)
|
30
|
+
assert_nil(v.type)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_create
|
34
|
+
v = Dataforms::XDataTitle.new "This is the title"
|
35
|
+
assert_equal("This is the title",v.title)
|
36
|
+
assert_equal("This is the title", v.to_s)
|
37
|
+
|
38
|
+
v = Dataforms::XDataInstructions.new "Instructions"
|
39
|
+
assert_equal("Instructions",v.instructions)
|
40
|
+
assert_equal("Instructions", v.to_s)
|
41
|
+
|
42
|
+
f = Dataforms::XDataField.new "botname", :text_single
|
43
|
+
assert_nil(f.label)
|
44
|
+
assert_equal("botname", f.var)
|
45
|
+
assert_equal(:text_single, f.type)
|
46
|
+
assert_equal(false, f.required?)
|
47
|
+
assert_equal([], f.values)
|
48
|
+
assert_equal({}, f.options)
|
49
|
+
f.label = "The name of your bot"
|
50
|
+
assert_equal("The name of your bot", f.label)
|
51
|
+
[:boolean, :fixed, :hidden, :jid_multi, :jid_single,
|
52
|
+
:list_multi, :list_single, :text_multi, :text_private,
|
53
|
+
:text_single].each do |type|
|
54
|
+
f.type = type
|
55
|
+
assert_equal(type, f.type)
|
56
|
+
end
|
57
|
+
f.type = :wrong_type
|
58
|
+
assert_nil(f.type)
|
59
|
+
f.required= true
|
60
|
+
assert_equal(true, f.required?)
|
61
|
+
f.values = ["the value"]
|
62
|
+
assert_equal(["the value"], f.values)
|
63
|
+
f.options = { "option 1" => "Label 1", "option 2" => "Label 2", "option 3" => nil }
|
64
|
+
assert_equal({ "option 1" => "Label 1", "option 2" => "Label 2", "option 3" => nil }, f.options)
|
65
|
+
|
66
|
+
|
67
|
+
f = Dataforms::XDataField.new "test", :text_single
|
68
|
+
v = Dataforms::XData.new :form
|
69
|
+
assert_equal([], v.fields)
|
70
|
+
assert_equal(:form, v.type)
|
71
|
+
[:form, :result, :submit, :cancel].each do |type|
|
72
|
+
v.type = type
|
73
|
+
assert_equal(type, v.type)
|
74
|
+
end
|
75
|
+
v.add f
|
76
|
+
assert_equal(f, v.field('test'))
|
77
|
+
assert_nil(v.field('wrong field'))
|
78
|
+
assert_equal([f], v.fields)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift File::dirname(__FILE__) + '/../../lib'
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'xmpp4r/rexmladdons'
|
7
|
+
require 'xmpp4r/delay/x/delay'
|
8
|
+
include Jabber
|
9
|
+
|
10
|
+
class XDelayTest < Test::Unit::TestCase
|
11
|
+
def test_create1
|
12
|
+
d = Delay::XDelay.new(false)
|
13
|
+
assert_equal(nil, d.stamp)
|
14
|
+
assert_equal(nil, d.from)
|
15
|
+
assert_equal('jabber:x:delay', d.namespace)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_create2
|
19
|
+
d = Delay::XDelay.new
|
20
|
+
# Hopefully the seconds don't change here...
|
21
|
+
assert_equal(Time.now.to_s, d.stamp.to_s)
|
22
|
+
assert_equal(nil, d.from)
|
23
|
+
assert_equal('jabber:x:delay', d.namespace)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_from
|
27
|
+
d = Delay::XDelay.new
|
28
|
+
assert_equal(nil, d.from)
|
29
|
+
d.from = JID.new('astro@spaceboyz.net')
|
30
|
+
assert_equal(JID.new('astro@spaceboyz.net'), d.from)
|
31
|
+
assert_equal(d, d.set_from(nil))
|
32
|
+
assert_equal(nil, d.from)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_stamp
|
36
|
+
d = Delay::XDelay.new(false)
|
37
|
+
assert_equal(nil, d.stamp)
|
38
|
+
now = Time.now
|
39
|
+
d.stamp = now
|
40
|
+
assert_equal(now.to_s, d.stamp.to_s)
|
41
|
+
assert_equal(d, d.set_stamp(nil))
|
42
|
+
assert_equal(nil, d.stamp)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_import
|
46
|
+
x1 = X.new
|
47
|
+
x1.add_namespace('jabber:x:delay')
|
48
|
+
x2 = X::import(x1)
|
49
|
+
assert_equal(Delay::XDelay, x2.class)
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,91 @@
|
|
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/discovery/helper/responder'
|
9
|
+
include Jabber
|
10
|
+
|
11
|
+
class Discovery::ResponderTest < Test::Unit::TestCase
|
12
|
+
include ClientTester
|
13
|
+
|
14
|
+
def test_new
|
15
|
+
r = Discovery::Responder.new(@client)
|
16
|
+
assert_nil(r.node)
|
17
|
+
assert_equal([], r.identities)
|
18
|
+
assert_equal([], r.features)
|
19
|
+
assert_equal([], r.forms)
|
20
|
+
assert_equal([], r.items)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_new2
|
24
|
+
r = Discovery::Responder.new(@client, 'xmpp4r',
|
25
|
+
[Discovery::Identity.new('client', 'XMPP4R', 'bot'),
|
26
|
+
Discovery::Identity.new('pubsub', 'Personal events', 'pep')],
|
27
|
+
['ipv6', Discovery::Feature.new('sslc2s')],
|
28
|
+
[Discovery::Item.new('foo@bar', 'Foo', nil), Discovery::Item.new('bar@baz', 'Bar', 'barbaz')])
|
29
|
+
assert_equal('xmpp4r', r.node)
|
30
|
+
assert_equal([Discovery::Identity.new('client', 'XMPP4R', 'bot'),
|
31
|
+
Discovery::Identity.new('pubsub', 'Personal events', 'pep')], r.identities)
|
32
|
+
assert_equal([Discovery::Feature.new('ipv6'), Discovery::Feature.new('sslc2s')], r.features)
|
33
|
+
assert_equal([], r.forms)
|
34
|
+
assert_equal([Discovery::Item.new('foo@bar', 'Foo', nil), Discovery::Item.new('bar@baz', 'Bar', 'barbaz')], r.items)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_generate_item
|
38
|
+
r = Discovery::Responder.new(@client, nil, [Discovery::Identity.new('client', 'XMPP4R', 'bot')])
|
39
|
+
assert_equal(Discovery::Item.new(@client.jid, 'XMPP4R'), r.generate_item)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_query
|
43
|
+
Discovery::Responder.new(@client, nil,
|
44
|
+
[Discovery::Identity.new('client', 'XMPP4R', 'bot')],
|
45
|
+
['ipv6'],
|
46
|
+
[Discovery::Item.new('foo@bar', 'Foo', nil)])
|
47
|
+
|
48
|
+
iq1 = Iq.new(:get)
|
49
|
+
iq1.add(Discovery::IqQueryDiscoInfo.new)
|
50
|
+
reply1 = @server.send_with_id(iq1)
|
51
|
+
assert_equal(:result, reply1.type)
|
52
|
+
assert_kind_of(Discovery::IqQueryDiscoInfo, reply1.query)
|
53
|
+
assert_nil(reply1.query.node)
|
54
|
+
assert_equal(1, reply1.query.identities.size)
|
55
|
+
assert_equal('XMPP4R', reply1.query.identities[0].iname)
|
56
|
+
assert_equal(['ipv6'], reply1.query.features)
|
57
|
+
|
58
|
+
iq2 = Iq.new(:get)
|
59
|
+
iq2.add(Discovery::IqQueryDiscoItems.new)
|
60
|
+
reply2 = @server.send_with_id(iq2)
|
61
|
+
assert_equal(:result, reply2.type)
|
62
|
+
assert_kind_of(Discovery::IqQueryDiscoItems, reply2.query)
|
63
|
+
assert_nil(reply2.query.node)
|
64
|
+
assert_equal(1, reply2.query.items.size)
|
65
|
+
assert_equal(JID.new('foo@bar'), reply2.query.items[0].jid)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_linked
|
69
|
+
class << @client
|
70
|
+
remove_method(:jid) # avoids warning
|
71
|
+
def jid
|
72
|
+
JID.new('foo@bar/baz')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
r1 = Discovery::Responder.new(@client, 'child',
|
76
|
+
[Discovery::Identity.new('client', 'Child', 'bot')])
|
77
|
+
r2 = Discovery::Responder.new(@client, nil,
|
78
|
+
[], [],
|
79
|
+
[r1])
|
80
|
+
|
81
|
+
iq = Iq.new(:get)
|
82
|
+
iq.add(Discovery::IqQueryDiscoItems.new)
|
83
|
+
reply = @server.send_with_id(iq)
|
84
|
+
assert_kind_of(Discovery::IqQueryDiscoItems, reply.query)
|
85
|
+
assert_nil(reply.query.node)
|
86
|
+
assert_equal(1, reply.query.items.size)
|
87
|
+
assert_equal(JID.new('foo@bar/baz'), reply.query.items[0].jid)
|
88
|
+
assert_equal('Child', reply.query.items[0].iname)
|
89
|
+
assert_equal('child', reply.query.items[0].node)
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Test::Unit::Assertions
|
2
|
+
public
|
3
|
+
##
|
4
|
+
# Like assert_equal, but actual comparision switches parameters to
|
5
|
+
# make use of our attribute order agnostic REXML#==
|
6
|
+
def assert_equal_xml(expected, actual, message=nil)
|
7
|
+
full_message = build_message(message, <<EOT, expected, actual)
|
8
|
+
<?> expected but was
|
9
|
+
<?>.
|
10
|
+
EOT
|
11
|
+
assert_block(full_message) { actual == expected }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,120 @@
|
|
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
|
+
$:.unshift '../lib'
|
6
|
+
require 'xmpp4r'
|
7
|
+
require 'test/unit'
|
8
|
+
require 'socket'
|
9
|
+
require 'xmpp4r/semaphore'
|
10
|
+
|
11
|
+
# This is sane for tests:
|
12
|
+
Thread::abort_on_exception = true
|
13
|
+
|
14
|
+
# Turn $VERBOSE off to suppress warnings about redefinition
|
15
|
+
oldverbose = $VERBOSE
|
16
|
+
$VERBOSE = false
|
17
|
+
|
18
|
+
module Jabber
|
19
|
+
##
|
20
|
+
# The ClientTester is a mix-in which provides a setup and teardown
|
21
|
+
# method to prepare a Stream object (@client) and the method
|
22
|
+
# interfacing as the "server side":
|
23
|
+
# * send(xml):: Send a stanza to @client
|
24
|
+
#
|
25
|
+
# The server side is a stream, too: add your callbacks to @server
|
26
|
+
#
|
27
|
+
# ClientTester is written to test complex helper classes.
|
28
|
+
module ClientTester
|
29
|
+
@@SOCKET_PORT = 65223
|
30
|
+
|
31
|
+
def setup
|
32
|
+
servlisten = TCPServer.new(@@SOCKET_PORT)
|
33
|
+
serverwait = Semaphore.new
|
34
|
+
stream = '<stream:stream xmlns:stream="http://etherx.jabber.org/streams">'
|
35
|
+
|
36
|
+
Thread.new do
|
37
|
+
Thread.current.abort_on_exception = true
|
38
|
+
serversock = servlisten.accept
|
39
|
+
servlisten.close
|
40
|
+
serversock.sync = true
|
41
|
+
@server = Stream.new
|
42
|
+
@server.add_xml_callback do |xml|
|
43
|
+
if xml.prefix == 'stream' and xml.name == 'stream'
|
44
|
+
send(stream)
|
45
|
+
true
|
46
|
+
else
|
47
|
+
false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
@server.start(serversock)
|
51
|
+
|
52
|
+
serverwait.run
|
53
|
+
end
|
54
|
+
|
55
|
+
clientsock = TCPSocket.new('localhost', @@SOCKET_PORT)
|
56
|
+
clientsock.sync = true
|
57
|
+
@client = Stream.new
|
58
|
+
#=begin
|
59
|
+
class << @client
|
60
|
+
def jid
|
61
|
+
begin
|
62
|
+
#raise
|
63
|
+
rescue
|
64
|
+
puts $!.backtrace.join("\n")
|
65
|
+
end
|
66
|
+
JID.new('test@test.com/test')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
#=end
|
70
|
+
@client.start(clientsock)
|
71
|
+
@client.send(stream) { |reply| true }
|
72
|
+
|
73
|
+
@state = 0
|
74
|
+
@states = []
|
75
|
+
@state_wait = Semaphore.new
|
76
|
+
@state_wait2 = Semaphore.new
|
77
|
+
@server.add_stanza_callback { |stanza|
|
78
|
+
if @state < @states.size
|
79
|
+
begin
|
80
|
+
@states[@state].call(stanza)
|
81
|
+
rescue
|
82
|
+
puts "Exception in state: #{$!.class}: #{$!}\n#{$!.join("\n")}"
|
83
|
+
end
|
84
|
+
@state += 1
|
85
|
+
@state_wait2.wait
|
86
|
+
@state_wait.run
|
87
|
+
end
|
88
|
+
|
89
|
+
false
|
90
|
+
}
|
91
|
+
|
92
|
+
serverwait.wait
|
93
|
+
end
|
94
|
+
|
95
|
+
def teardown
|
96
|
+
@client.close
|
97
|
+
@server.close
|
98
|
+
end
|
99
|
+
|
100
|
+
def send(xml)
|
101
|
+
@server.send(xml)
|
102
|
+
end
|
103
|
+
|
104
|
+
def state(&block)
|
105
|
+
@states << block
|
106
|
+
end
|
107
|
+
|
108
|
+
def wait_state
|
109
|
+
@state_wait2.run
|
110
|
+
@state_wait.wait
|
111
|
+
end
|
112
|
+
|
113
|
+
def skip_state
|
114
|
+
@state_wait2.run
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Restore the old $VERBOSE setting
|
120
|
+
$VERBOSE = oldverbose
|
@@ -0,0 +1,830 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
|
4
|
+
$:.unshift File::dirname(__FILE__) + '/../../lib'
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require File::dirname(__FILE__) + '/../lib/clienttester'
|
8
|
+
require 'xmpp4r/muc'
|
9
|
+
require 'xmpp4r/semaphore'
|
10
|
+
include Jabber
|
11
|
+
|
12
|
+
class MUCClientTest < Test::Unit::TestCase
|
13
|
+
include ClientTester
|
14
|
+
|
15
|
+
def test_new1
|
16
|
+
m = MUC::MUCClient.new(@client)
|
17
|
+
assert_equal(nil, m.jid)
|
18
|
+
assert_equal(nil, m.my_jid)
|
19
|
+
assert_equal({}, m.roster)
|
20
|
+
assert(!m.active?)
|
21
|
+
end
|
22
|
+
|
23
|
+
# JEP-0045: 6.3 Entering a Room
|
24
|
+
def test_enter_room
|
25
|
+
state { |pres|
|
26
|
+
assert_kind_of(Presence, pres)
|
27
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
28
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/thirdwitch'), pres.to)
|
29
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
30
|
+
"<error code='400' type='modify'>" +
|
31
|
+
"<jid-malformed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>" +
|
32
|
+
"</error></presence>")
|
33
|
+
}
|
34
|
+
state { |pres|
|
35
|
+
assert_kind_of(Presence, pres)
|
36
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
37
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/thirdwitch'), pres.to)
|
38
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/firstwitch' to='hag66@shakespeare.lit/pda'>" +
|
39
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='owner' role='moderator'/></x>" +
|
40
|
+
"</presence>" +
|
41
|
+
"<presence from='darkcave@macbeth.shakespeare.lit/secondwitch' to='hag66@shakespeare.lit/pda'>" +
|
42
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='admin' role='moderator'/></x>" +
|
43
|
+
"</presence>" +
|
44
|
+
"<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
45
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
46
|
+
"</presence>")
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
m = MUC::MUCClient.new(@client)
|
51
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
52
|
+
assert(!m.active?)
|
53
|
+
assert_nil(m.room)
|
54
|
+
|
55
|
+
assert_raises(ServerError) {
|
56
|
+
m.join('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
57
|
+
}
|
58
|
+
wait_state
|
59
|
+
assert(!m.active?)
|
60
|
+
assert_nil(m.room)
|
61
|
+
|
62
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
|
63
|
+
wait_state
|
64
|
+
assert(m.active?)
|
65
|
+
assert_equal('darkcave', m.room)
|
66
|
+
assert_equal(3, m.roster.size)
|
67
|
+
m.roster.each { |resource,pres|
|
68
|
+
assert_equal(resource, pres.from.resource)
|
69
|
+
assert_equal('darkcave', pres.from.node)
|
70
|
+
assert_equal('macbeth.shakespeare.lit', pres.from.domain)
|
71
|
+
assert_kind_of(String, resource)
|
72
|
+
assert_kind_of(Presence, pres)
|
73
|
+
assert(%w(firstwitch secondwitch thirdwitch).include?(resource))
|
74
|
+
assert_kind_of(MUC::XMUCUser, pres.x)
|
75
|
+
assert_kind_of(Array, pres.x.items)
|
76
|
+
assert_equal(1, pres.x.items.size)
|
77
|
+
}
|
78
|
+
assert_equal(:owner, m.roster['firstwitch'].x.items[0].affiliation)
|
79
|
+
assert_equal(:moderator, m.roster['firstwitch'].x.items[0].role)
|
80
|
+
assert_equal(:admin, m.roster['secondwitch'].x.items[0].affiliation)
|
81
|
+
assert_equal(:moderator, m.roster['secondwitch'].x.items[0].role)
|
82
|
+
assert_equal(:member, m.roster['thirdwitch'].x.items[0].affiliation)
|
83
|
+
assert_equal(:participant, m.roster['thirdwitch'].x.items[0].role)
|
84
|
+
assert_nil(m.roster['thirdwitch'].x.items[0].jid)
|
85
|
+
|
86
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='crone1@shakespeare.lit/desktop'>" +
|
87
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' jid='hag66@shakespeare.lit/pda' role='participant'/></x>" +
|
88
|
+
"</presence>")
|
89
|
+
sleep 0.1
|
90
|
+
assert_equal(3, m.roster.size)
|
91
|
+
assert_equal(:none, m.roster['thirdwitch'].x.items[0].affiliation)
|
92
|
+
assert_equal(:participant, m.roster['thirdwitch'].x.items[0].role)
|
93
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), m.roster['thirdwitch'].x.items[0].jid)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_enter_room_password
|
97
|
+
state { |pres|
|
98
|
+
assert_kind_of(Presence, pres)
|
99
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
100
|
+
"<error code='401' type='auth'><not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>" +
|
101
|
+
"</presence>")
|
102
|
+
}
|
103
|
+
state { |pres|
|
104
|
+
assert_kind_of(Presence, pres)
|
105
|
+
assert_equal('cauldron', pres.x.password)
|
106
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
107
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
108
|
+
"</presence>")
|
109
|
+
}
|
110
|
+
|
111
|
+
m = MUC::MUCClient.new(@client)
|
112
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
113
|
+
assert_raises(ServerError) {
|
114
|
+
m.join('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
115
|
+
}
|
116
|
+
wait_state
|
117
|
+
assert(!m.active?)
|
118
|
+
|
119
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch', 'cauldron'))
|
120
|
+
wait_state
|
121
|
+
assert(m.active?)
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_members_only_room
|
125
|
+
state { |pres|
|
126
|
+
assert_kind_of(Presence, pres)
|
127
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
128
|
+
"<error code='407' type='auth'><registration-required xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>" +
|
129
|
+
"</presence>")
|
130
|
+
}
|
131
|
+
|
132
|
+
m = MUC::MUCClient.new(@client)
|
133
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
134
|
+
assert_raises(ServerError) {
|
135
|
+
m.join('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
136
|
+
}
|
137
|
+
assert(!m.active?)
|
138
|
+
|
139
|
+
wait_state
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_banned_users
|
143
|
+
state { |pres|
|
144
|
+
assert_kind_of(Presence, pres)
|
145
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
146
|
+
"<error code='403' type='auth'><forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>" +
|
147
|
+
"</presence>")
|
148
|
+
}
|
149
|
+
|
150
|
+
m = MUC::MUCClient.new(@client)
|
151
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
152
|
+
assert_raises(ServerError) {
|
153
|
+
m.join('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
154
|
+
}
|
155
|
+
assert(!m.active?)
|
156
|
+
|
157
|
+
wait_state
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_nickname_conflict
|
161
|
+
state { |pres|
|
162
|
+
assert_kind_of(Presence, pres)
|
163
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
164
|
+
"<error code='409' type='cancel'><conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>" +
|
165
|
+
"</presence>")
|
166
|
+
}
|
167
|
+
|
168
|
+
m = MUC::MUCClient.new(@client)
|
169
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
170
|
+
assert_raises(ServerError) {
|
171
|
+
m.join('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
172
|
+
}
|
173
|
+
assert(!m.active?)
|
174
|
+
|
175
|
+
wait_state
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_max_users
|
179
|
+
state { |pres|
|
180
|
+
assert_kind_of(Presence, pres)
|
181
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
182
|
+
"<error code='503' type='wait'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>" +
|
183
|
+
"</presence>")
|
184
|
+
}
|
185
|
+
|
186
|
+
m = MUC::MUCClient.new(@client)
|
187
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
188
|
+
assert_raises(ServerError) {
|
189
|
+
m.join('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
190
|
+
}
|
191
|
+
assert(!m.active?)
|
192
|
+
|
193
|
+
wait_state
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_locked_room
|
197
|
+
state { |pres|
|
198
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
199
|
+
"<error code='404' type='cancel'><item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>" +
|
200
|
+
"</presence>")
|
201
|
+
}
|
202
|
+
|
203
|
+
m = MUC::MUCClient.new(@client)
|
204
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
205
|
+
assert_raises(ServerError) {
|
206
|
+
m.join('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
207
|
+
}
|
208
|
+
assert(!m.active?)
|
209
|
+
wait_state
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_exit_room
|
213
|
+
state { |pres|
|
214
|
+
assert_kind_of(Presence, pres)
|
215
|
+
assert_nil(pres.type)
|
216
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
217
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
218
|
+
"</presence>")
|
219
|
+
}
|
220
|
+
state { |pres|
|
221
|
+
assert_kind_of(Presence, pres)
|
222
|
+
assert_equal(:unavailable, pres.type)
|
223
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
224
|
+
assert_nil(pres.status)
|
225
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/secondwitch' to='hag66@shakespeare.lit/pda'>" +
|
226
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
227
|
+
"</presence>")
|
228
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda' type='unavailable'>" +
|
229
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='none'/></x>" +
|
230
|
+
"</presence>")
|
231
|
+
}
|
232
|
+
|
233
|
+
ignored_stanzas = 0
|
234
|
+
@client.add_stanza_callback { |stanza|
|
235
|
+
ignored_stanzas += 1
|
236
|
+
}
|
237
|
+
|
238
|
+
m = MUC::MUCClient.new(@client)
|
239
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
240
|
+
assert_equal(0, ignored_stanzas)
|
241
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
|
242
|
+
wait_state
|
243
|
+
assert(m.active?)
|
244
|
+
|
245
|
+
assert_equal(0, ignored_stanzas)
|
246
|
+
assert_equal(m, m.exit)
|
247
|
+
wait_state
|
248
|
+
assert(!m.active?)
|
249
|
+
assert_equal(1, ignored_stanzas)
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_custom_exit_message
|
253
|
+
state { |pres|
|
254
|
+
assert_kind_of(Presence, pres)
|
255
|
+
assert_nil(pres.type)
|
256
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
257
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
258
|
+
"</presence>")
|
259
|
+
}
|
260
|
+
state { |pres|
|
261
|
+
assert_kind_of(Presence, pres)
|
262
|
+
assert_equal(:unavailable, pres.type)
|
263
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
264
|
+
assert_equal('gone where the goblins go', pres.status)
|
265
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda' type='unavailable'>" +
|
266
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='none'/></x>" +
|
267
|
+
"</presence>")
|
268
|
+
}
|
269
|
+
|
270
|
+
m = MUC::MUCClient.new(@client)
|
271
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
272
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
|
273
|
+
assert(m.active?)
|
274
|
+
wait_state
|
275
|
+
|
276
|
+
assert_equal(m, m.exit('gone where the goblins go'))
|
277
|
+
assert(!m.active?)
|
278
|
+
wait_state
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_joins
|
282
|
+
state { |pres|
|
283
|
+
assert_kind_of(Presence, pres)
|
284
|
+
assert_nil(pres.type)
|
285
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
286
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/thirdwitch'), pres.to)
|
287
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
288
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
289
|
+
"</presence>")
|
290
|
+
}
|
291
|
+
state { |pres|
|
292
|
+
assert_kind_of(Presence, pres)
|
293
|
+
assert_equal(:unavailable, pres.type)
|
294
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
295
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/thirdwitch'), pres.to)
|
296
|
+
assert_nil(pres.status)
|
297
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda' type='unavailable'>" +
|
298
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='none'/></x>" +
|
299
|
+
"</presence>")
|
300
|
+
}
|
301
|
+
state { |pres|
|
302
|
+
assert_kind_of(Presence, pres)
|
303
|
+
assert_nil(pres.type)
|
304
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
305
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/fourthwitch'), pres.to)
|
306
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/fourthwitch' to='hag66@shakespeare.lit/pda'>" +
|
307
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
308
|
+
"</presence>")
|
309
|
+
}
|
310
|
+
state { |pres|
|
311
|
+
assert_kind_of(Presence, pres)
|
312
|
+
assert_equal(:unavailable, pres.type)
|
313
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
314
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/fourthwitch'), pres.to)
|
315
|
+
assert_equal(pres.status, 'Exiting one last time')
|
316
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/fourthwitch' to='hag66@shakespeare.lit/pda' type='unavailable'>" +
|
317
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='none'/></x>" +
|
318
|
+
"</presence>")
|
319
|
+
}
|
320
|
+
|
321
|
+
m = MUC::MUCClient.new(@client)
|
322
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
323
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
|
324
|
+
wait_state
|
325
|
+
assert(m.active?)
|
326
|
+
|
327
|
+
assert_raises(RuntimeError) { m.join('darkcave@macbeth.shakespeare.lit/thirdwitch') }
|
328
|
+
assert_raises(RuntimeError) { m.join('darkcave@macbeth.shakespeare.lit/fourthwitch') }
|
329
|
+
assert(m.active?)
|
330
|
+
|
331
|
+
assert_equal(m, m.exit)
|
332
|
+
wait_state
|
333
|
+
assert(!m.active?)
|
334
|
+
assert_raises(RuntimeError) { m.exit }
|
335
|
+
assert(!m.active?)
|
336
|
+
|
337
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/fourthwitch'))
|
338
|
+
wait_state
|
339
|
+
assert(m.active?)
|
340
|
+
|
341
|
+
assert_raises(RuntimeError) { m.join('darkcave@macbeth.shakespeare.lit/thirdwitch') }
|
342
|
+
assert_raises(RuntimeError) { m.join('darkcave@macbeth.shakespeare.lit/fourthwitch') }
|
343
|
+
assert(m.active?)
|
344
|
+
|
345
|
+
assert_equal(m, m.exit('Exiting one last time'))
|
346
|
+
wait_state
|
347
|
+
assert(!m.active?)
|
348
|
+
assert_raises(RuntimeError) { m.exit }
|
349
|
+
assert(!m.active?)
|
350
|
+
end
|
351
|
+
|
352
|
+
def test_message_callback
|
353
|
+
state { |pres|
|
354
|
+
assert_kind_of(Presence, pres)
|
355
|
+
assert_equal('cauldron', pres.x.password)
|
356
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
357
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
358
|
+
"</presence>")
|
359
|
+
}
|
360
|
+
|
361
|
+
message_lock = Semaphore.new
|
362
|
+
|
363
|
+
messages_client = 0
|
364
|
+
@client.add_message_callback { |msg|
|
365
|
+
messages_client += 1
|
366
|
+
message_lock.run
|
367
|
+
}
|
368
|
+
|
369
|
+
m = MUC::MUCClient.new(@client)
|
370
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
371
|
+
messages_muc = 0
|
372
|
+
m.add_message_callback { |msg|
|
373
|
+
messages_muc += 1
|
374
|
+
message_lock.run
|
375
|
+
}
|
376
|
+
messages_muc_private = 0
|
377
|
+
m.add_private_message_callback { |msg|
|
378
|
+
messages_muc_private += 1
|
379
|
+
message_lock.run
|
380
|
+
}
|
381
|
+
|
382
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch', 'cauldron'))
|
383
|
+
assert(m.active?)
|
384
|
+
|
385
|
+
assert_equal(0, messages_client)
|
386
|
+
assert_equal(0, messages_muc)
|
387
|
+
assert_equal(0, messages_muc_private)
|
388
|
+
|
389
|
+
send("<message from='darkcave@macbeth.shakespeare.lit/firstwitch' to='hag66@shakespeare.lit/pda'><body>Hello</body></message>")
|
390
|
+
message_lock.wait
|
391
|
+
|
392
|
+
assert_equal(0, messages_client)
|
393
|
+
assert_equal(1, messages_muc)
|
394
|
+
assert_equal(0, messages_muc_private)
|
395
|
+
|
396
|
+
send("<message from='user@domain/resource' to='hag66@shakespeare.lit/pda'><body>Hello</body></message>")
|
397
|
+
message_lock.wait
|
398
|
+
|
399
|
+
assert_equal(1, messages_client)
|
400
|
+
assert_equal(1, messages_muc)
|
401
|
+
assert_equal(0, messages_muc_private)
|
402
|
+
|
403
|
+
send("<message type='chat' from='darkcave@macbeth.shakespeare.lit/firstwitch' to='hag66@shakespeare.lit/pda'><body>Hello</body></message>")
|
404
|
+
message_lock.wait
|
405
|
+
|
406
|
+
assert_equal(1, messages_client)
|
407
|
+
assert_equal(1, messages_muc)
|
408
|
+
assert_equal(1, messages_muc_private)
|
409
|
+
|
410
|
+
wait_state
|
411
|
+
end
|
412
|
+
|
413
|
+
def test_presence_callbacks
|
414
|
+
state { |pres|
|
415
|
+
assert_kind_of(Presence, pres)
|
416
|
+
assert_nil(pres.x.password)
|
417
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
418
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
419
|
+
"</presence>")
|
420
|
+
}
|
421
|
+
|
422
|
+
presence_lock = Semaphore.new
|
423
|
+
|
424
|
+
presences_client = 0
|
425
|
+
@client.add_presence_callback { |pres|
|
426
|
+
presences_client += 1
|
427
|
+
presence_lock.run
|
428
|
+
}
|
429
|
+
m = MUC::MUCClient.new(@client)
|
430
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
431
|
+
presences_join = 0
|
432
|
+
m.add_join_callback { |pres|
|
433
|
+
presences_join += 1
|
434
|
+
presence_lock.run
|
435
|
+
}
|
436
|
+
presences_leave = 0
|
437
|
+
m.add_leave_callback { |pres|
|
438
|
+
presences_leave += 1
|
439
|
+
presence_lock.run
|
440
|
+
}
|
441
|
+
presences_muc = 0
|
442
|
+
m.add_presence_callback { |pres|
|
443
|
+
presences_muc += 1
|
444
|
+
presence_lock.run
|
445
|
+
}
|
446
|
+
|
447
|
+
assert_equal(0, presences_client)
|
448
|
+
assert_equal(0, presences_join)
|
449
|
+
assert_equal(0, presences_leave)
|
450
|
+
assert_equal(0, presences_muc)
|
451
|
+
|
452
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
|
453
|
+
assert(m.active?)
|
454
|
+
|
455
|
+
assert_equal(0, presences_client)
|
456
|
+
assert_equal(0, presences_join) # Joins before own join won't be called back
|
457
|
+
assert_equal(0, presences_leave)
|
458
|
+
assert_equal(0, presences_muc)
|
459
|
+
|
460
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/firstwitch' to='hag66@shakespeare.lit/pda'>" +
|
461
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
462
|
+
"</presence>")
|
463
|
+
presence_lock.wait
|
464
|
+
assert_equal(0, presences_client)
|
465
|
+
assert_equal(1, presences_join)
|
466
|
+
assert_equal(0, presences_leave)
|
467
|
+
assert_equal(0, presences_muc)
|
468
|
+
|
469
|
+
send("<presence from='user@domain/resource' to='hag66@shakespeare.lit/pda'>" +
|
470
|
+
"<show>chat</show>" +
|
471
|
+
"</presence>")
|
472
|
+
presence_lock.wait
|
473
|
+
assert_equal(1, presences_client)
|
474
|
+
assert_equal(1, presences_join)
|
475
|
+
assert_equal(0, presences_leave)
|
476
|
+
assert_equal(0, presences_muc)
|
477
|
+
|
478
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/firstwitch' to='hag66@shakespeare.lit/pda'>" +
|
479
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
480
|
+
"<show>away</show></presence>")
|
481
|
+
presence_lock.wait
|
482
|
+
assert_equal(1, presences_client)
|
483
|
+
assert_equal(1, presences_join)
|
484
|
+
assert_equal(0, presences_leave)
|
485
|
+
assert_equal(1, presences_muc)
|
486
|
+
|
487
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/firstwitch' to='hag66@shakespeare.lit/pda' type='unavailable'/>")
|
488
|
+
presence_lock.wait
|
489
|
+
assert_equal(1, presences_client)
|
490
|
+
assert_equal(1, presences_join)
|
491
|
+
assert_equal(1, presences_leave)
|
492
|
+
assert_equal(1, presences_muc)
|
493
|
+
wait_state
|
494
|
+
end
|
495
|
+
|
496
|
+
def test_send
|
497
|
+
state { |pres|
|
498
|
+
assert_kind_of(Presence, pres)
|
499
|
+
assert_nil(pres.x.password)
|
500
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
501
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
502
|
+
"</presence>")
|
503
|
+
}
|
504
|
+
state { |stanza|
|
505
|
+
assert_kind_of(Message, stanza)
|
506
|
+
assert(:groupchat, stanza.type)
|
507
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), stanza.from)
|
508
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit'), stanza.to)
|
509
|
+
assert_equal('First message', stanza.body)
|
510
|
+
}
|
511
|
+
state { |stanza|
|
512
|
+
assert_kind_of(Message, stanza)
|
513
|
+
assert(:chat, stanza.type)
|
514
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), stanza.from)
|
515
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/secondwitch'), stanza.to)
|
516
|
+
assert_equal('Second message', stanza.body)
|
517
|
+
}
|
518
|
+
state { |stanza|
|
519
|
+
assert_kind_of(Message, stanza)
|
520
|
+
assert(:chat, stanza.type)
|
521
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), stanza.from)
|
522
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/firstwitch'), stanza.to)
|
523
|
+
assert_equal('Third message', stanza.body)
|
524
|
+
}
|
525
|
+
|
526
|
+
m = MUC::MUCClient.new(@client)
|
527
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
528
|
+
|
529
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
|
530
|
+
wait_state
|
531
|
+
assert(m.active?)
|
532
|
+
|
533
|
+
m.send(Jabber::Message.new(nil, 'First message'))
|
534
|
+
wait_state
|
535
|
+
m.send(Jabber::Message.new(nil, 'Second message'), 'secondwitch')
|
536
|
+
wait_state
|
537
|
+
m.send(Jabber::Message.new('secondwitch', 'Third message'), 'firstwitch')
|
538
|
+
wait_state
|
539
|
+
end
|
540
|
+
|
541
|
+
def test_nick
|
542
|
+
state { |pres|
|
543
|
+
assert_kind_of(Presence, pres)
|
544
|
+
assert_nil(pres.x.password)
|
545
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
546
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='member' role='participant'/></x>" +
|
547
|
+
"</presence>")
|
548
|
+
}
|
549
|
+
state { |pres|
|
550
|
+
assert_kind_of(Presence, pres)
|
551
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
552
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/secondwitch'), pres.to)
|
553
|
+
assert_nil(pres.type)
|
554
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit' to='hag66@shakespeare.lit/pda' type='error'>" +
|
555
|
+
"<error code='409' type='cancel'><conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>" +
|
556
|
+
"</presence>")
|
557
|
+
}
|
558
|
+
state { |pres|
|
559
|
+
assert_kind_of(Presence, pres)
|
560
|
+
assert_equal(JID.new('hag66@shakespeare.lit/pda'), pres.from)
|
561
|
+
assert_equal(JID.new('darkcave@macbeth.shakespeare.lit/oldhag'), pres.to)
|
562
|
+
assert_nil(pres.type)
|
563
|
+
send("<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda' type='unavailable'>" +
|
564
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'>" +
|
565
|
+
"<item affiliation='member' jid='hag66@shakespeare.lit/pda' nick='oldhag' role='participant'/>" +
|
566
|
+
"<status code='303'/>" +
|
567
|
+
"</x></presence>" +
|
568
|
+
"<presence from='darkcave@macbeth.shakespeare.lit/oldhag' to='hag66@shakespeare.lit/pda'>" +
|
569
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'>" +
|
570
|
+
"<item affiliation='member' jid='hag66@shakespeare.lit/pda' role='participant'/>" +
|
571
|
+
"</x></presence>")
|
572
|
+
}
|
573
|
+
|
574
|
+
m = MUC::MUCClient.new(@client)
|
575
|
+
m.my_jid = 'hag66@shakespeare.lit/pda'
|
576
|
+
|
577
|
+
assert_equal(m, m.join('darkcave@macbeth.shakespeare.lit/thirdwitch'))
|
578
|
+
wait_state
|
579
|
+
assert(m.active?)
|
580
|
+
assert_equal('thirdwitch', m.nick)
|
581
|
+
|
582
|
+
assert_raises(ServerError) {
|
583
|
+
m.nick = 'secondwitch'
|
584
|
+
}
|
585
|
+
wait_state
|
586
|
+
assert(m.active?)
|
587
|
+
assert_equal('thirdwitch', m.nick)
|
588
|
+
|
589
|
+
m.nick = 'oldhag'
|
590
|
+
wait_state
|
591
|
+
assert(m.active?)
|
592
|
+
assert_equal('oldhag', m.nick)
|
593
|
+
end
|
594
|
+
|
595
|
+
# JEP-0045: 10.2 Room Configuration
|
596
|
+
def test_configuration
|
597
|
+
room = JID.new('darkcave@macbeth.shakespeare.lit/thirdwitch')
|
598
|
+
jid = JID.new('hag66@shakespeare.lit/pda')
|
599
|
+
|
600
|
+
state { |pres|
|
601
|
+
send(
|
602
|
+
"<presence from='darkcave@macbeth.shakespeare.lit/thirdwitch' to='hag66@shakespeare.lit/pda'>" +
|
603
|
+
"<x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='owner' role='moderator'/></x>" +
|
604
|
+
"</presence>"
|
605
|
+
)
|
606
|
+
}
|
607
|
+
|
608
|
+
state { |iq|
|
609
|
+
assert_kind_of(Jabber::Iq,iq)
|
610
|
+
assert_equal(jid, iq.from)
|
611
|
+
assert_equal(room.strip, iq.to)
|
612
|
+
assert_equal(:get, iq.type)
|
613
|
+
|
614
|
+
assert_kind_of(Jabber::MUC::IqQueryMUCOwner, iq.first_element('query'))
|
615
|
+
|
616
|
+
send(muc_config_form.sub("id='config1'","id='#{iq.id}'"))
|
617
|
+
}
|
618
|
+
|
619
|
+
state { |room_config|
|
620
|
+
assert_kind_of(Jabber::Iq, room_config)
|
621
|
+
assert_equal(room.strip, room_config.to)
|
622
|
+
assert_equal(:set, room_config.type)
|
623
|
+
|
624
|
+
assert_kind_of(Jabber::MUC::IqQueryMUCOwner, room_config.first_element('query'))
|
625
|
+
|
626
|
+
form = room_config.first_element('query/x')
|
627
|
+
assert_kind_of(Dataforms::XData, form)
|
628
|
+
assert_equal(:submit, form.type)
|
629
|
+
assert_equal(1, form.elements.size)
|
630
|
+
assert_equal('muc#roomconfig_roomname', form.first_element('field').var)
|
631
|
+
assert_equal(['Dunsinane'], form.first_element('field').values)
|
632
|
+
|
633
|
+
send(muc_config_acknowledgement.sub("id='config1'","id='#{room_config.id}'"))
|
634
|
+
}
|
635
|
+
|
636
|
+
m = MUC::MUCClient.new(@client)
|
637
|
+
m.my_jid = jid
|
638
|
+
m.join(room)
|
639
|
+
wait_state
|
640
|
+
assert_equal(true, m.owner?)
|
641
|
+
|
642
|
+
assert_equal(%w{muc#roomconfig_roomname muc#roomconfig_roomdesc
|
643
|
+
muc#roomconfig_enablelogging muc#roomconfig_changesubject muc#roomconfig_allowinvites
|
644
|
+
muc#roomconfig_maxusers muc#roomconfig_presencebroadcast muc#roomconfig_getmemberlist
|
645
|
+
muc#roomconfig_publicroom muc#roomconfig_persistentroom muc#roomconfig_moderatedroom
|
646
|
+
muc#roomconfig_membersonly muc#roomconfig_passwordprotectedroom muc#roomconfig_roomsecret
|
647
|
+
muc#roomconfig_whois muc#roomconfig_roomadmins muc#roomconfig_roomowners}, m.get_room_configuration)
|
648
|
+
wait_state
|
649
|
+
|
650
|
+
m.submit_room_configuration( 'muc#roomconfig_roomname' => 'Dunsinane' )
|
651
|
+
wait_state
|
652
|
+
end
|
653
|
+
|
654
|
+
# example 150 from XEP-0045
|
655
|
+
def muc_config_form
|
656
|
+
"<iq from='darkcave@macbeth.shakespeare.lit'
|
657
|
+
id='config1'
|
658
|
+
to='crone1@shakespeare.lit/desktop'
|
659
|
+
type='result'>
|
660
|
+
<query xmlns='http://jabber.org/protocol/muc#owner'>
|
661
|
+
<x xmlns='jabber:x:data' type='form'>
|
662
|
+
<title>Configuration for \"darkcave\" Room</title>
|
663
|
+
<instructions>
|
664
|
+
Complete this form to make changes to
|
665
|
+
the configuration of your room.
|
666
|
+
</instructions>
|
667
|
+
<field
|
668
|
+
type='hidden'
|
669
|
+
var='FORM_TYPE'>
|
670
|
+
<value>http://jabber.org/protocol/muc#roomconfig</value>
|
671
|
+
</field>
|
672
|
+
<field
|
673
|
+
label='Natural-Language Room Name'
|
674
|
+
type='text-single'
|
675
|
+
var='muc#roomconfig_roomname'>
|
676
|
+
<value>A Dark Cave</value>
|
677
|
+
</field>
|
678
|
+
<field
|
679
|
+
label='Short Description of Room'
|
680
|
+
type='text-single'
|
681
|
+
var='muc#roomconfig_roomdesc'>
|
682
|
+
<value>The place for all good witches!</value>
|
683
|
+
</field>
|
684
|
+
<field
|
685
|
+
label='Enable Public Logging?'
|
686
|
+
type='boolean'
|
687
|
+
var='muc#roomconfig_enablelogging'>
|
688
|
+
<value>0</value>
|
689
|
+
</field>
|
690
|
+
<field
|
691
|
+
label='Allow Occupants to Change Subject?'
|
692
|
+
type='boolean'
|
693
|
+
var='muc#roomconfig_changesubject'>
|
694
|
+
<value>0</value>
|
695
|
+
</field>
|
696
|
+
<field
|
697
|
+
label='Allow Occupants to Invite Others?'
|
698
|
+
type='boolean'
|
699
|
+
var='muc#roomconfig_allowinvites'>
|
700
|
+
<value>0</value>
|
701
|
+
</field>
|
702
|
+
<field
|
703
|
+
label='Maximum Number of Occupants'
|
704
|
+
type='list-single'
|
705
|
+
var='muc#roomconfig_maxusers'>
|
706
|
+
<value>10</value>
|
707
|
+
<option label='10'><value>10</value></option>
|
708
|
+
<option label='20'><value>20</value></option>
|
709
|
+
<option label='30'><value>30</value></option>
|
710
|
+
<option label='50'><value>50</value></option>
|
711
|
+
<option label='100'><value>100</value></option>
|
712
|
+
<option label='None'><value>none</value></option>
|
713
|
+
</field>
|
714
|
+
<field
|
715
|
+
label='Roles for which Presence is Broadcast'
|
716
|
+
type='list-multi'
|
717
|
+
var='muc#roomconfig_presencebroadcast'>
|
718
|
+
<value>moderator</value>
|
719
|
+
<value>participant</value>
|
720
|
+
<value>visitor</value>
|
721
|
+
<option label='Moderator'><value>moderator</value></option>
|
722
|
+
<option label='Participant'><value>participant</value></option>
|
723
|
+
<option label='Visitor'><value>visitor</value></option>
|
724
|
+
</field>
|
725
|
+
<field
|
726
|
+
label='Roles and Affiliations that May Retrieve Member List'
|
727
|
+
type='list-multi'
|
728
|
+
var='muc#roomconfig_getmemberlist'>
|
729
|
+
<value>moderator</value>
|
730
|
+
<value>participant</value>
|
731
|
+
<value>visitor</value>
|
732
|
+
<option label='Moderator'><value>moderator</value></option>
|
733
|
+
<option label='Participant'><value>participant</value></option>
|
734
|
+
<option label='Visitor'><value>visitor</value></option>
|
735
|
+
</field>
|
736
|
+
<field
|
737
|
+
label='Make Room Publicly Searchable?'
|
738
|
+
type='boolean'
|
739
|
+
var='muc#roomconfig_publicroom'>
|
740
|
+
<value>0</value>
|
741
|
+
</field>
|
742
|
+
<field
|
743
|
+
label='Make Room Persistent?'
|
744
|
+
type='boolean'
|
745
|
+
var='muc#roomconfig_persistentroom'>
|
746
|
+
<value>0</value>
|
747
|
+
</field>
|
748
|
+
<field
|
749
|
+
label='Make Room Moderated?'
|
750
|
+
type='boolean'
|
751
|
+
var='muc#roomconfig_moderatedroom'>
|
752
|
+
<value>0</value>
|
753
|
+
</field>
|
754
|
+
<field
|
755
|
+
label='Make Room Members Only?'
|
756
|
+
type='boolean'
|
757
|
+
var='muc#roomconfig_membersonly'>
|
758
|
+
<value>0</value>
|
759
|
+
</field>
|
760
|
+
<field
|
761
|
+
label='Password Required for Entry?'
|
762
|
+
type='boolean'
|
763
|
+
var='muc#roomconfig_passwordprotectedroom'>
|
764
|
+
<value>1</value>
|
765
|
+
</field>
|
766
|
+
<field type='fixed'>
|
767
|
+
<value>
|
768
|
+
If a password is required to enter this room,
|
769
|
+
you must specify the password below.
|
770
|
+
</value>
|
771
|
+
</field>
|
772
|
+
<field
|
773
|
+
label='Password'
|
774
|
+
type='text-private'
|
775
|
+
var='muc#roomconfig_roomsecret'>
|
776
|
+
<value>cauldronburn</value>
|
777
|
+
</field>
|
778
|
+
<field
|
779
|
+
label='Who May Discover Real JIDs?'
|
780
|
+
type='list-single'
|
781
|
+
var='muc#roomconfig_whois'>
|
782
|
+
<value>moderators</value>
|
783
|
+
<option label='Moderators Only'>
|
784
|
+
<value>moderators</value>
|
785
|
+
</option>
|
786
|
+
<option label='Anyone'>
|
787
|
+
<value>anyone</value>
|
788
|
+
</option>
|
789
|
+
</field>
|
790
|
+
<field type='fixed'>
|
791
|
+
<value>
|
792
|
+
You may specify additional people who have
|
793
|
+
administrative privileges in the room. Please
|
794
|
+
provide one Jabber ID per line.
|
795
|
+
</value>
|
796
|
+
</field>
|
797
|
+
<field
|
798
|
+
label='Room Admins'
|
799
|
+
type='jid-multi'
|
800
|
+
var='muc#roomconfig_roomadmins'>
|
801
|
+
<value>wiccarocks@shakespeare.lit</value>
|
802
|
+
<value>hecate@shakespeare.lit</value>
|
803
|
+
</field>
|
804
|
+
<field type='fixed'>
|
805
|
+
<value>
|
806
|
+
You may specify additional owners for this
|
807
|
+
room. Please provide one Jabber ID per line.
|
808
|
+
</value>
|
809
|
+
</field>
|
810
|
+
<field
|
811
|
+
label='Room Owners'
|
812
|
+
type='jid-multi'
|
813
|
+
var='muc#roomconfig_roomowners'/>
|
814
|
+
</x>
|
815
|
+
</query>
|
816
|
+
</iq>"
|
817
|
+
end
|
818
|
+
|
819
|
+
def muc_config_acknowledgement
|
820
|
+
"<iq from='darkcave@macbeth.shakespeare.lit'
|
821
|
+
id='config1'
|
822
|
+
to='crone1@shakespeare.lit/desktop'>
|
823
|
+
<query xmlns='http://jabber.org/protocol/muc#owner'>
|
824
|
+
<x xmlns='jabber:x:data' type='result'>
|
825
|
+
<field var='muc#roomconfig_roomname'><value>Dunsinane</value></field>
|
826
|
+
</x>
|
827
|
+
</query>
|
828
|
+
</iq>"
|
829
|
+
end
|
830
|
+
end
|