cerberus 0.6 → 0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Authors.txt +4 -0
- data/Changelog.txt +11 -0
- data/Copyright.txt +16 -0
- data/Rakefile +16 -25
- data/Readme.markdown +1 -3
- data/bin/cerberus +5 -0
- data/lib/cerberus/builder/bjam.rb +1 -3
- data/lib/cerberus/builder/maven2.rb +0 -1
- data/lib/cerberus/builder/rake.rb +1 -1
- data/lib/cerberus/builder/rspec.rb +0 -1
- data/lib/cerberus/builder/ruby_base.rb +0 -1
- data/lib/cerberus/component_lazy_loader.rb +6 -2
- data/lib/cerberus/config.example.yml +1 -0
- data/lib/cerberus/constants.rb +2 -2
- data/lib/cerberus/manager.rb +7 -1
- data/lib/cerberus/publisher/mail.rb +4 -4
- data/lib/cerberus/publisher/twitter.rb +0 -1
- data/lib/cerberus/scm/base.rb +19 -0
- data/lib/cerberus/scm/bzr.rb +62 -0
- data/lib/cerberus/scm/cvs.rb +2 -7
- data/lib/cerberus/scm/darcs.rb +2 -11
- data/lib/cerberus/scm/git.rb +6 -14
- data/lib/cerberus/scm/perforce.rb +4 -4
- data/lib/cerberus/scm/svn.rb +2 -7
- data/lib/cerberus/utils.rb +5 -0
- data/lib/vendor/irc/README +23 -0
- data/lib/vendor/irc/lib/IRC.rb +164 -0
- data/lib/vendor/irc/lib/IRCChannel.rb +33 -0
- data/lib/vendor/irc/lib/IRCConnection.rb +134 -0
- data/lib/vendor/irc/lib/IRCEvent.rb +91 -0
- data/lib/vendor/irc/lib/IRCUser.rb +23 -0
- data/lib/vendor/irc/lib/IRCUtil.rb +49 -0
- data/lib/vendor/irc/lib/eventmap.yml +247 -0
- data/lib/vendor/twitter/CHANGES +129 -0
- data/lib/vendor/twitter/MIT-LICENSE +20 -0
- data/lib/vendor/twitter/README +37 -0
- data/lib/vendor/twitter/TODO +7 -0
- data/lib/vendor/twitter/lib/twitter.rb +34 -0
- data/lib/vendor/twitter/lib/twitter/client.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/account.rb +24 -0
- data/lib/vendor/twitter/lib/twitter/client/auth.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/base.rb +93 -0
- data/lib/vendor/twitter/lib/twitter/client/blocks.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/favorites.rb +53 -0
- data/lib/vendor/twitter/lib/twitter/client/friendship.rb +35 -0
- data/lib/vendor/twitter/lib/twitter/client/graph.rb +37 -0
- data/lib/vendor/twitter/lib/twitter/client/messaging.rb +79 -0
- data/lib/vendor/twitter/lib/twitter/client/profile.rb +29 -0
- data/lib/vendor/twitter/lib/twitter/client/search.rb +27 -0
- data/lib/vendor/twitter/lib/twitter/client/status.rb +51 -0
- data/lib/vendor/twitter/lib/twitter/client/timeline.rb +72 -0
- data/lib/vendor/twitter/lib/twitter/client/user.rb +65 -0
- data/lib/vendor/twitter/lib/twitter/config.rb +77 -0
- data/lib/vendor/twitter/lib/twitter/console.rb +31 -0
- data/lib/vendor/twitter/lib/twitter/core.rb +137 -0
- data/lib/vendor/twitter/lib/twitter/ext.rb +2 -0
- data/lib/vendor/twitter/lib/twitter/ext/stdlib.rb +52 -0
- data/lib/vendor/twitter/lib/twitter/extras.rb +39 -0
- data/lib/vendor/twitter/lib/twitter/meta.rb +56 -0
- data/lib/vendor/twitter/lib/twitter/model.rb +360 -0
- data/lib/vendor/twitter/lib/twitter/version.rb +19 -0
- data/lib/vendor/twitter/spec/twitter/client/account_spec.rb +28 -0
- data/lib/vendor/twitter/spec/twitter/client/auth_spec.rb +34 -0
- data/lib/vendor/twitter/spec/twitter/client/base_spec.rb +242 -0
- data/lib/vendor/twitter/spec/twitter/client/blocks_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/favorites_spec.rb +183 -0
- data/lib/vendor/twitter/spec/twitter/client/friendship_spec.rb +76 -0
- data/lib/vendor/twitter/spec/twitter/client/graph_spec.rb +67 -0
- data/lib/vendor/twitter/spec/twitter/client/messaging_spec.rb +135 -0
- data/lib/vendor/twitter/spec/twitter/client/profile_spec.rb +91 -0
- data/lib/vendor/twitter/spec/twitter/client/search_spec.rb +68 -0
- data/lib/vendor/twitter/spec/twitter/client/status_spec.rb +119 -0
- data/lib/vendor/twitter/spec/twitter/client/timeline_spec.rb +79 -0
- data/lib/vendor/twitter/spec/twitter/client/user_spec.rb +203 -0
- data/lib/vendor/twitter/spec/twitter/client_spec.rb +2 -0
- data/lib/vendor/twitter/spec/twitter/config_spec.rb +86 -0
- data/lib/vendor/twitter/spec/twitter/console_spec.rb +15 -0
- data/lib/vendor/twitter/spec/twitter/core_spec.rb +127 -0
- data/lib/vendor/twitter/spec/twitter/ext/stdlib_spec.rb +59 -0
- data/lib/vendor/twitter/spec/twitter/extras_spec.rb +46 -0
- data/lib/vendor/twitter/spec/twitter/meta_spec.rb +90 -0
- data/lib/vendor/twitter/spec/twitter/model_spec.rb +508 -0
- data/lib/vendor/twitter/spec/twitter/version_spec.rb +19 -0
- data/lib/vendor/xmpp4r/CHANGELOG +83 -0
- data/lib/vendor/xmpp4r/COPYING +340 -0
- data/lib/vendor/xmpp4r/LICENSE +59 -0
- data/lib/vendor/xmpp4r/README.rdoc +110 -0
- data/lib/vendor/xmpp4r/README_ruby19.txt +43 -0
- data/lib/vendor/xmpp4r/Rakefile +262 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb +70 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/component.rb +11 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/register.rb +42 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
- data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r.rb +116 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/base64.rb +32 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/callbacks.rb +124 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/c.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/generator.rb +160 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb +87 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/client.rb +317 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/helper/responder.rb +53 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/command/iq/command.rb +154 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/component.rb +103 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/connection.rb +219 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms/x/data.rb +297 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/debuglog.rb +42 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/delay/x/delay.rb +99 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/helper/responder.rb +165 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/errors.rb +281 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/base.rb +55 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/framework/bot.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding.rb +5 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding/client.rb +285 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/idgenerator.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/iq.rb +221 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/jid.rb +167 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/message.rb +148 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc.rb +14 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/item.rb +143 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/muc.rb +70 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/presence.rb +232 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub.rb +8 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/event.rb +49 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/item.rb +35 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/items.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/publish.rb +24 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/query.rb +15 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rexmladdons.rb +151 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/helper/roster.rb +519 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/iq/roster.rb +215 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/roster/x/roster.rb +138 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/client.rb +123 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/server.rb +74 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/sasl.rb +237 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/semaphore.rb +38 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/stream.rb +497 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/streamparser.rb +77 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune.rb +2 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/helper/helper.rb +58 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/tune/tune.rb +113 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard.rb +6 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version.rb +7 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/responder.rb +72 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/version/iq/version.rb +105 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/x.rb +37 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml.rb +1 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml/html.rb +115 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmpp4r.rb +18 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppelement.rb +168 -0
- data/lib/vendor/xmpp4r/lib/xmpp4r/xmppstanza.rb +162 -0
- data/lib/vendor/xmpp4r/setup.rb +1586 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_ibb.rb +186 -0
- data/lib/vendor/xmpp4r/test/bytestreams/tc_socks5bytestreams.rb +113 -0
- data/lib/vendor/xmpp4r/test/caps/tc_helper.rb +156 -0
- data/lib/vendor/xmpp4r/test/dataforms/tc_data.rb +81 -0
- data/lib/vendor/xmpp4r/test/delay/tc_xdelay.rb +51 -0
- data/lib/vendor/xmpp4r/test/discovery/tc_responder.rb +91 -0
- data/lib/vendor/xmpp4r/test/lib/assert_equal_xml.rb +14 -0
- data/lib/vendor/xmpp4r/test/lib/clienttester.rb +120 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_mucclient.rb +830 -0
- data/lib/vendor/xmpp4r/test/muc/tc_muc_simplemucclient.rb +114 -0
- data/lib/vendor/xmpp4r/test/muc/tc_mucowner.rb +50 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_helper.rb +662 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_nodeconfig.rb +54 -0
- data/lib/vendor/xmpp4r/test/pubsub/tc_subscriptionconfig.rb +41 -0
- data/lib/vendor/xmpp4r/test/roster/tc_helper.rb +514 -0
- data/lib/vendor/xmpp4r/test/roster/tc_iqqueryroster.rb +173 -0
- data/lib/vendor/xmpp4r/test/roster/tc_xroster.rb +73 -0
- data/lib/vendor/xmpp4r/test/rpc/tc_helper.rb +96 -0
- data/lib/vendor/xmpp4r/test/tc_callbacks.rb +129 -0
- data/lib/vendor/xmpp4r/test/tc_class_names.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_client.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_errors.rb +146 -0
- data/lib/vendor/xmpp4r/test/tc_idgenerator.rb +30 -0
- data/lib/vendor/xmpp4r/test/tc_iq.rb +113 -0
- data/lib/vendor/xmpp4r/test/tc_iqquery.rb +31 -0
- data/lib/vendor/xmpp4r/test/tc_jid.rb +204 -0
- data/lib/vendor/xmpp4r/test/tc_message.rb +116 -0
- data/lib/vendor/xmpp4r/test/tc_presence.rb +150 -0
- data/lib/vendor/xmpp4r/test/tc_rexml.rb +139 -0
- data/lib/vendor/xmpp4r/test/tc_stream.rb +229 -0
- data/lib/vendor/xmpp4r/test/tc_streamComponent.rb +95 -0
- data/lib/vendor/xmpp4r/test/tc_streamError.rb +131 -0
- data/lib/vendor/xmpp4r/test/tc_streamSend.rb +59 -0
- data/lib/vendor/xmpp4r/test/tc_streamparser.rb +112 -0
- data/lib/vendor/xmpp4r/test/tc_xmppstanza.rb +135 -0
- data/lib/vendor/xmpp4r/test/ts_xmpp4r.rb +53 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_recv.rb +84 -0
- data/lib/vendor/xmpp4r/test/tune/tc_helper_send.rb +74 -0
- data/lib/vendor/xmpp4r/test/tune/tc_tune.rb +79 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_helper.rb +49 -0
- data/lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb +62 -0
- data/lib/vendor/xmpp4r/test/version/tc_helper.rb +60 -0
- data/lib/vendor/xmpp4r/test/version/tc_iqqueryversion.rb +97 -0
- data/lib/vendor/xmpp4r/test/xhtml/tc_html.rb +41 -0
- data/lib/vendor/xmpp4r/tools/gen_requires.bash +31 -0
- data/lib/vendor/xmpp4r/tools/xmpp4r-gemspec-test.rb +11 -0
- data/lib/vendor/xmpp4r/xmpp4r.gemspec +291 -0
- data/test/jabber_publisher_test.rb +1 -1
- data/test/mail_publisher_test.rb +2 -2
- data/test/mock/twitter.rb +0 -1
- data/test/rspec_builder_test.rb +39 -2
- data/test/rss_publisher_test.rb +1 -1
- data/test/twitter_publisher_test.rb +1 -1
- metadata +268 -53
- data/lib/cerberus/publisher/gmailer.rb +0 -17
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Jabber
|
|
2
|
+
|
|
3
|
+
module Command
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# The Responder Helper handles the low-level stuff of the
|
|
7
|
+
# Ad-hoc commands (JEP 0050).
|
|
8
|
+
class Responder
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
# Initialize a Responder
|
|
12
|
+
def initialize(stream)
|
|
13
|
+
@stream = stream
|
|
14
|
+
@commandsdiscocbs = CallbackList.new
|
|
15
|
+
@commandexeccbs = CallbackList.new
|
|
16
|
+
|
|
17
|
+
stream.add_iq_callback(180, self) { |iq|
|
|
18
|
+
iq_callback(iq)
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Add a callback for <query> stanzas asking for the list
|
|
24
|
+
# of ad-hoc commands
|
|
25
|
+
def add_commands_disco_callback(priority = 0, ref = nil, &block)
|
|
26
|
+
@commandsdiscocbs.add(priority, ref, block)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# Add a callback for <command> stanzas asking for the execution
|
|
31
|
+
# of an ad-hoc command
|
|
32
|
+
def add_commands_exec_callback(priority = 0, ref = nil, &block)
|
|
33
|
+
@commandexeccbs.add(priority, ref, block)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# Handles <iq> stanzas and execute callbacks
|
|
38
|
+
def iq_callback(iq)
|
|
39
|
+
if iq.type == :get
|
|
40
|
+
if iq.query.kind_of?(Jabber::Discovery::IqQueryDiscoItems) &&
|
|
41
|
+
iq.query.node == "http://jabber.org/protocol/commands"
|
|
42
|
+
@commandsdiscocbs.process(iq)
|
|
43
|
+
end
|
|
44
|
+
elsif iq.type == :set && iq.command
|
|
45
|
+
@commandexeccbs.process(iq)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
require 'xmpp4r/iq'
|
|
2
|
+
|
|
3
|
+
module Jabber
|
|
4
|
+
|
|
5
|
+
module Command
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Class for handling ad-hoc commands
|
|
9
|
+
# (JEP 0050)
|
|
10
|
+
#
|
|
11
|
+
# A command is uniquely identified by its node attribute.
|
|
12
|
+
class IqCommand < Iq
|
|
13
|
+
name_xmlns 'command', 'http://jabber.org/protocol/commands'
|
|
14
|
+
|
|
15
|
+
def initialize(node=nil, action=nil)
|
|
16
|
+
super()
|
|
17
|
+
set_node(node)
|
|
18
|
+
set_action(action)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# Get the node of the Command stanza
|
|
23
|
+
# result:: [String] or nil
|
|
24
|
+
def node
|
|
25
|
+
attributes['node']
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
# Set the node of the Command stanza
|
|
30
|
+
# v:: [String] or nil
|
|
31
|
+
def node=(v)
|
|
32
|
+
attributes['node'] = v
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
# Set the node of the Command stanza (chaining-friendly)
|
|
37
|
+
# v:: [String] or nil
|
|
38
|
+
def set_node(v)
|
|
39
|
+
self.node = v
|
|
40
|
+
self
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
##
|
|
44
|
+
# Get the sessionid of the Command stanza
|
|
45
|
+
# result:: [String] or nil
|
|
46
|
+
def sessionid
|
|
47
|
+
attributes['sessionid']
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
##
|
|
51
|
+
# Set the sessionid of the Command stanza
|
|
52
|
+
# v:: [String] or nil
|
|
53
|
+
def sessionid=(v)
|
|
54
|
+
attributes['sessionid'] = v
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
##
|
|
58
|
+
# Set the sessionid of the Command stanza (chaining-friendly)
|
|
59
|
+
# v:: [String] or nil
|
|
60
|
+
def set_sessionid(v)
|
|
61
|
+
self.sessionid = v
|
|
62
|
+
self
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
# Get the action of the Command stanza
|
|
67
|
+
#
|
|
68
|
+
# The following Symbols are allowed:
|
|
69
|
+
# * :execute
|
|
70
|
+
# * :cancel
|
|
71
|
+
# * :prev
|
|
72
|
+
# * :next
|
|
73
|
+
# * :complete
|
|
74
|
+
# return:: [Symbol] or nil
|
|
75
|
+
def action
|
|
76
|
+
case attributes['action']
|
|
77
|
+
when 'execute' then :execute
|
|
78
|
+
when 'cancel' then :cancel
|
|
79
|
+
when 'prev' then :prev
|
|
80
|
+
when 'next' then :next
|
|
81
|
+
when 'complete' then :complete
|
|
82
|
+
else nil
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
##
|
|
87
|
+
# Set the action of the Command stanza (see IqCommand#action for details)
|
|
88
|
+
# v:: [Symbol] or nil
|
|
89
|
+
def action=(v)
|
|
90
|
+
attributes['action'] = case v
|
|
91
|
+
when :execute then 'execute'
|
|
92
|
+
when :cancel then 'cancel'
|
|
93
|
+
when :prev then 'prev'
|
|
94
|
+
when :next then 'next'
|
|
95
|
+
when :complete then 'complete'
|
|
96
|
+
else nil
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
##
|
|
101
|
+
# Set the action of the Command stanza (chaining-friendly)
|
|
102
|
+
# v:: [Symbol] or nil
|
|
103
|
+
def set_action(v)
|
|
104
|
+
self.action = v
|
|
105
|
+
self
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
##
|
|
109
|
+
# Get the status of the Command stanza
|
|
110
|
+
#
|
|
111
|
+
# The following Symbols are allowed:
|
|
112
|
+
# * :executing
|
|
113
|
+
# * :completed
|
|
114
|
+
# * :canceled
|
|
115
|
+
# return:: [Symbol] or nil
|
|
116
|
+
def status
|
|
117
|
+
case attributes['status']
|
|
118
|
+
when 'executing' then :executing
|
|
119
|
+
when 'completed' then :completed
|
|
120
|
+
when 'canceled' then :canceled
|
|
121
|
+
else nil
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
##
|
|
126
|
+
# Set the status of the Command stanza (see IqCommand#status for details)
|
|
127
|
+
# v:: [Symbol] or nil
|
|
128
|
+
def status=(v)
|
|
129
|
+
attributes['status'] = case v
|
|
130
|
+
when :executing then 'executing'
|
|
131
|
+
when :completed then 'completed'
|
|
132
|
+
when :canceled then 'canceled'
|
|
133
|
+
else nil
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
##
|
|
138
|
+
# Set the status of the Command stanza (chaining-friendly)
|
|
139
|
+
# v:: [Symbol] or nil
|
|
140
|
+
def set_status(v)
|
|
141
|
+
self.status = v
|
|
142
|
+
self
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
##
|
|
146
|
+
# Get the actions allowed
|
|
147
|
+
# return:: [REXML::Element] or nil
|
|
148
|
+
def actions
|
|
149
|
+
first_element('actions')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
require 'xmpp4r/connection'
|
|
6
|
+
|
|
7
|
+
module Jabber
|
|
8
|
+
##
|
|
9
|
+
# The component class provides everything needed to build a XMPP Component.
|
|
10
|
+
#
|
|
11
|
+
# Components are more flexible as they are only restricted in the use of a
|
|
12
|
+
# fixed domain. node and resource of JIDs are freely choosable for all stanzas.
|
|
13
|
+
class Component < Connection
|
|
14
|
+
|
|
15
|
+
# The component's JID
|
|
16
|
+
attr_reader :jid
|
|
17
|
+
|
|
18
|
+
# The server's address
|
|
19
|
+
attr_reader :server_address
|
|
20
|
+
|
|
21
|
+
# The server's port
|
|
22
|
+
attr_reader :server_port
|
|
23
|
+
|
|
24
|
+
# Create a new Component
|
|
25
|
+
# jid:: [JID]
|
|
26
|
+
def initialize(jid, server_address=nil, server_port=5347)
|
|
27
|
+
super()
|
|
28
|
+
@jid = (jid.kind_of?(JID) ? jid : JID.new(jid.to_s))
|
|
29
|
+
|
|
30
|
+
if server_address
|
|
31
|
+
$stderr.puts "Passing server and port to Jabber::Component.new is " +
|
|
32
|
+
"obsolete and will vanish in some later XMPP4R release. " +
|
|
33
|
+
"Please use these arguments when calling " +
|
|
34
|
+
"Jabber::Client#connect"
|
|
35
|
+
@server_address = server_address
|
|
36
|
+
@server_port = server_port
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Connect to the server
|
|
41
|
+
# (chaining-friendly)
|
|
42
|
+
# server:: [String] Hostname
|
|
43
|
+
# port:: [Integer] TCP port (5347)
|
|
44
|
+
# return:: self
|
|
45
|
+
def connect(server=nil, port=5347)
|
|
46
|
+
if server
|
|
47
|
+
super(server, port)
|
|
48
|
+
else
|
|
49
|
+
super(@server_address, @server_port)
|
|
50
|
+
end
|
|
51
|
+
self
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
# Close the connection,
|
|
56
|
+
# sends <tt></stream:stream></tt> tag first
|
|
57
|
+
def close
|
|
58
|
+
send("</stream:stream>")
|
|
59
|
+
super
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def generate_stream_start(to=nil, from=nil, id=nil, xml_lang="en", xmlns="jabber:component:accept", version="1.0")
|
|
63
|
+
super
|
|
64
|
+
end
|
|
65
|
+
private :generate_stream_start
|
|
66
|
+
|
|
67
|
+
##
|
|
68
|
+
# Start the stream-parser and send the component-specific stream opening element
|
|
69
|
+
def start
|
|
70
|
+
super
|
|
71
|
+
send(generate_stream_start(@jid)) { |e|
|
|
72
|
+
if e.name == 'stream'
|
|
73
|
+
true
|
|
74
|
+
else
|
|
75
|
+
false
|
|
76
|
+
end
|
|
77
|
+
}
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# Send auth with given secret and wait for result
|
|
82
|
+
#
|
|
83
|
+
# Throws ComponentAuthenticationFailure
|
|
84
|
+
# secret:: [String] the shared secret
|
|
85
|
+
def auth(secret)
|
|
86
|
+
hash = Digest::SHA1::hexdigest(@streamid.to_s + secret)
|
|
87
|
+
authenticated = false
|
|
88
|
+
send("<handshake>#{hash}</handshake>") { |r|
|
|
89
|
+
if r.prefix == 'stream' and r.name == 'error'
|
|
90
|
+
true
|
|
91
|
+
elsif r.name == 'handshake'
|
|
92
|
+
authenticated = true
|
|
93
|
+
true
|
|
94
|
+
else
|
|
95
|
+
false
|
|
96
|
+
end
|
|
97
|
+
}
|
|
98
|
+
unless authenticated
|
|
99
|
+
raise ComponentAuthenticationFailure.new, "Component authentication failed"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,219 @@
|
|
|
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
|
+
begin
|
|
6
|
+
require 'openssl'
|
|
7
|
+
rescue LoadError
|
|
8
|
+
end
|
|
9
|
+
require 'xmpp4r/stream'
|
|
10
|
+
|
|
11
|
+
module Jabber
|
|
12
|
+
##
|
|
13
|
+
# The connection class manages the TCP connection to the Jabber server
|
|
14
|
+
#
|
|
15
|
+
class Connection < Stream
|
|
16
|
+
attr_reader :host, :port
|
|
17
|
+
|
|
18
|
+
# How many seconds to wait for <stream:features/>
|
|
19
|
+
# before proceeding
|
|
20
|
+
attr_accessor :features_timeout
|
|
21
|
+
|
|
22
|
+
# Keep-alive interval in seconds, defaults to 60
|
|
23
|
+
# (see private method keepalive_loop for implementation details)
|
|
24
|
+
attr_accessor :keepalive_interval
|
|
25
|
+
|
|
26
|
+
# Allow TLS negotiation? Defaults to true
|
|
27
|
+
attr_accessor :allow_tls
|
|
28
|
+
|
|
29
|
+
# Optional CA-Path for TLS-handshake
|
|
30
|
+
attr_accessor :ssl_capath
|
|
31
|
+
|
|
32
|
+
# Optional callback for verification of SSL peer
|
|
33
|
+
attr_accessor :ssl_verifycb
|
|
34
|
+
|
|
35
|
+
#whether to use the old and deprecated SSL protocol
|
|
36
|
+
#Defaults to false
|
|
37
|
+
attr_accessor :use_ssl
|
|
38
|
+
|
|
39
|
+
##
|
|
40
|
+
# Create a new connection to the given host and port
|
|
41
|
+
def initialize
|
|
42
|
+
super()
|
|
43
|
+
@host = nil
|
|
44
|
+
@port = nil
|
|
45
|
+
@allow_tls = defined? OpenSSL
|
|
46
|
+
@tls = false
|
|
47
|
+
@ssl_capath = nil
|
|
48
|
+
@ssl_verifycb = nil
|
|
49
|
+
@features_timeout = 10
|
|
50
|
+
@keepalive_interval = 60
|
|
51
|
+
@use_ssl = false
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
# Connect to the Jabber server through a TCP Socket,
|
|
56
|
+
# start the Jabber parser,
|
|
57
|
+
# invoke to accept_features to wait for TLS,
|
|
58
|
+
# start the keep-alive thread
|
|
59
|
+
def connect(host, port)
|
|
60
|
+
@host = host
|
|
61
|
+
@port = port
|
|
62
|
+
# Reset is_tls?, so that it works when reconnecting
|
|
63
|
+
@tls = false
|
|
64
|
+
|
|
65
|
+
Jabber::debuglog("CONNECTING:\n#{@host}:#{@port}")
|
|
66
|
+
@socket = TCPSocket.new(@host, @port)
|
|
67
|
+
|
|
68
|
+
# We want to use the old and deprecated SSL protocol (usually on port 5223)
|
|
69
|
+
if @use_ssl
|
|
70
|
+
ssl = OpenSSL::SSL::SSLSocket.new(@socket)
|
|
71
|
+
ssl.connect # start SSL session
|
|
72
|
+
ssl.sync_close = true
|
|
73
|
+
Jabber::debuglog("SSL connection established.")
|
|
74
|
+
@socket = ssl
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
start
|
|
78
|
+
|
|
79
|
+
accept_features
|
|
80
|
+
|
|
81
|
+
@keepaliveThread = Thread.new do
|
|
82
|
+
Thread.current.abort_on_exception = true
|
|
83
|
+
keepalive_loop
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
# Closing connection:
|
|
89
|
+
# first kill keepaliveThread, then call Stream#close!
|
|
90
|
+
def close!
|
|
91
|
+
@keepaliveThread.kill if @keepaliveThread and @keepaliveThread.alive?
|
|
92
|
+
super
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def accept_features
|
|
96
|
+
begin
|
|
97
|
+
Timeout::timeout(@features_timeout) {
|
|
98
|
+
Jabber::debuglog("FEATURES: waiting...")
|
|
99
|
+
@features_sem.wait
|
|
100
|
+
Jabber::debuglog("FEATURES: waiting finished")
|
|
101
|
+
}
|
|
102
|
+
rescue Timeout::Error
|
|
103
|
+
Jabber::debuglog("FEATURES: timed out when waiting, stream peer seems not XMPP compliant")
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if @allow_tls and not is_tls? and @stream_features['starttls'] == 'urn:ietf:params:xml:ns:xmpp-tls'
|
|
107
|
+
begin
|
|
108
|
+
starttls
|
|
109
|
+
rescue
|
|
110
|
+
Jabber::debuglog("STARTTLS:\nFailure: #{$!}")
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
##
|
|
116
|
+
# Start the parser on the previously connected socket
|
|
117
|
+
def start
|
|
118
|
+
super(@socket)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
##
|
|
122
|
+
# Do a <starttls/>
|
|
123
|
+
# (will be automatically done by connect if stream peer supports this)
|
|
124
|
+
def starttls
|
|
125
|
+
stls = REXML::Element.new('starttls')
|
|
126
|
+
stls.add_namespace('urn:ietf:params:xml:ns:xmpp-tls')
|
|
127
|
+
|
|
128
|
+
reply = nil
|
|
129
|
+
send(stls) { |r|
|
|
130
|
+
reply = r
|
|
131
|
+
true
|
|
132
|
+
}
|
|
133
|
+
if reply.name != 'proceed'
|
|
134
|
+
raise ServerError(reply.first_element('error'))
|
|
135
|
+
end
|
|
136
|
+
# Don't be interrupted
|
|
137
|
+
stop
|
|
138
|
+
|
|
139
|
+
begin
|
|
140
|
+
error = nil
|
|
141
|
+
|
|
142
|
+
# Context/user set-able stuff
|
|
143
|
+
ctx = OpenSSL::SSL::SSLContext.new
|
|
144
|
+
if @ssl_capath
|
|
145
|
+
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
146
|
+
ctx.ca_path = @ssl_capath
|
|
147
|
+
else
|
|
148
|
+
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
149
|
+
end
|
|
150
|
+
ctx.verify_callback = @ssl_verifycb
|
|
151
|
+
|
|
152
|
+
# SSL connection establishing
|
|
153
|
+
sslsocket = OpenSSL::SSL::SSLSocket.new(@socket, ctx)
|
|
154
|
+
sslsocket.sync_close = true
|
|
155
|
+
Jabber::debuglog("TLSv1: OpenSSL handshake in progress")
|
|
156
|
+
sslsocket.connect
|
|
157
|
+
|
|
158
|
+
# Make REXML believe it's a real socket
|
|
159
|
+
class << sslsocket
|
|
160
|
+
def kind_of?(o)
|
|
161
|
+
o == IO ? true : super
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# We're done and will use it
|
|
166
|
+
@tls = true
|
|
167
|
+
@socket = sslsocket
|
|
168
|
+
rescue
|
|
169
|
+
error = $!
|
|
170
|
+
ensure
|
|
171
|
+
Jabber::debuglog("TLSv1: restarting parser")
|
|
172
|
+
start
|
|
173
|
+
accept_features
|
|
174
|
+
raise error if error
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
##
|
|
179
|
+
# Have we gone to TLS mode?
|
|
180
|
+
# result:: [true] or [false]
|
|
181
|
+
def is_tls?
|
|
182
|
+
@tls
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def generate_stream_start(to=nil, from=nil, id=nil, xml_lang="en", xmlns="jabber:client", version="1.0")
|
|
186
|
+
stream_start_string = "<stream:stream xmlns:stream='http://etherx.jabber.org/streams' "
|
|
187
|
+
stream_start_string += "xmlns='#{xmlns}' " unless xmlns.nil?
|
|
188
|
+
stream_start_string += "to='#{to}' " unless to.nil?
|
|
189
|
+
stream_start_string += "from='#{from}' " unless from.nil?
|
|
190
|
+
stream_start_string += "id='#{id}' " unless id.nil?
|
|
191
|
+
stream_start_string += "xml:lang='#{xml_lang}' " unless xml_lang.nil?
|
|
192
|
+
stream_start_string += "version='#{version}' " unless version.nil?
|
|
193
|
+
stream_start_string += ">"
|
|
194
|
+
stream_start_string
|
|
195
|
+
end
|
|
196
|
+
private :generate_stream_start
|
|
197
|
+
|
|
198
|
+
##
|
|
199
|
+
# A loop to send "keep alive" data to prevent
|
|
200
|
+
# the Jabber connection from closing for inactivity.
|
|
201
|
+
#
|
|
202
|
+
# This loop sends a single white-space character if
|
|
203
|
+
# no other data has been sent in the last @keepalive_interval
|
|
204
|
+
# seconds.
|
|
205
|
+
def keepalive_loop
|
|
206
|
+
loop do
|
|
207
|
+
difference = @last_send + @keepalive_interval - Time.now
|
|
208
|
+
if difference <= 0
|
|
209
|
+
send(' ')
|
|
210
|
+
sleep @keepalive_interval
|
|
211
|
+
else
|
|
212
|
+
sleep(difference)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
private :keepalive_loop
|
|
217
|
+
|
|
218
|
+
end
|
|
219
|
+
end
|