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,7 @@
|
|
|
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/version/helper/responder.rb'
|
|
6
|
+
require 'xmpp4r/version/helper/simpleresponder.rb'
|
|
7
|
+
require 'xmpp4r/version/iq/version.rb'
|
|
@@ -0,0 +1,72 @@
|
|
|
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/callbacks'
|
|
6
|
+
require 'xmpp4r/version/iq/version'
|
|
7
|
+
|
|
8
|
+
module Jabber
|
|
9
|
+
module Version
|
|
10
|
+
##
|
|
11
|
+
# A class to answer version requests using IqQueryVersion
|
|
12
|
+
#
|
|
13
|
+
# If you don't need the flexibility of dynamic responses with
|
|
14
|
+
# the callback you can register with add_version_callback,
|
|
15
|
+
# take a look at SimpleResponder
|
|
16
|
+
class Responder
|
|
17
|
+
##
|
|
18
|
+
# Initialize a new version responder
|
|
19
|
+
#
|
|
20
|
+
# Registers it's callback (prio = 180, ref = self)
|
|
21
|
+
# stream:: [Stream] Where to register callback handlers
|
|
22
|
+
def initialize(stream)
|
|
23
|
+
@stream = stream
|
|
24
|
+
@versioncbs = CallbackList.new
|
|
25
|
+
|
|
26
|
+
stream.add_iq_callback(180, self) { |iq|
|
|
27
|
+
iq_callback(iq)
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Add a callback for Iq stanzas with IqQueryVersion
|
|
33
|
+
#
|
|
34
|
+
# First argument passed to block is the Iq stanza,
|
|
35
|
+
# second argument is a block, which can be called with
|
|
36
|
+
# software name, version and os
|
|
37
|
+
#
|
|
38
|
+
# Example:
|
|
39
|
+
# my_version_helper.add_version_callback { |iq,block|
|
|
40
|
+
# block.call('Cool client', '6.0', 'Cool OS')
|
|
41
|
+
# }
|
|
42
|
+
def add_version_callback(priority = 0, ref = nil, &block)
|
|
43
|
+
@versioncbs.add(priority, ref, block)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# <iq/> callback handler to answer Software Version queries
|
|
48
|
+
# (registered by constructor and used internally only)
|
|
49
|
+
#
|
|
50
|
+
# Used internally
|
|
51
|
+
def iq_callback(iq)
|
|
52
|
+
if iq.type == :get
|
|
53
|
+
if iq.query.kind_of?(IqQueryVersion)
|
|
54
|
+
replyblock = lambda { |name,version,os|
|
|
55
|
+
answer = iq.answer
|
|
56
|
+
answer.type = :result
|
|
57
|
+
answer.query.set_iname(name).set_version(version).set_os(os)
|
|
58
|
+
|
|
59
|
+
@stream.send(answer)
|
|
60
|
+
true
|
|
61
|
+
}
|
|
62
|
+
@versioncbs.process(iq, replyblock)
|
|
63
|
+
else
|
|
64
|
+
false
|
|
65
|
+
end
|
|
66
|
+
else
|
|
67
|
+
false
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
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/iq'
|
|
6
|
+
require 'xmpp4r/version/helper/responder'
|
|
7
|
+
|
|
8
|
+
module Jabber
|
|
9
|
+
module Version
|
|
10
|
+
##
|
|
11
|
+
# A class to answer version requests using IqQueryVersion
|
|
12
|
+
#
|
|
13
|
+
# This is simplification as one doesn't need dynamic
|
|
14
|
+
# version answering normally.
|
|
15
|
+
#
|
|
16
|
+
# Example usage:
|
|
17
|
+
# Jabber::Version::SimpleResponder.new(my_client, "My cool XMPP4R script", "1.0", "Younicks")
|
|
18
|
+
class SimpleResponder < Responder
|
|
19
|
+
attr_accessor :name
|
|
20
|
+
attr_accessor :version
|
|
21
|
+
attr_accessor :os
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
# Initialize a new version responder
|
|
25
|
+
#
|
|
26
|
+
# Registers it's callback (prio = 180, ref = self)
|
|
27
|
+
# stream:: [Stream] Where to register callback handlers
|
|
28
|
+
# name:: [String] Software name for answers
|
|
29
|
+
# version:: [String] Software versio for answers
|
|
30
|
+
# os:: [String] Optional operating system name for answers
|
|
31
|
+
def initialize(stream, name, version, os=nil)
|
|
32
|
+
super stream
|
|
33
|
+
|
|
34
|
+
@name = name
|
|
35
|
+
@version = version
|
|
36
|
+
@os = os
|
|
37
|
+
|
|
38
|
+
add_version_callback(180, self) { |iq,block|
|
|
39
|
+
block.call(@name, @version, @os)
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
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/query'
|
|
6
|
+
|
|
7
|
+
module Jabber
|
|
8
|
+
module Version
|
|
9
|
+
##
|
|
10
|
+
# Class for handling queries for 'Software Version'
|
|
11
|
+
# (JEP 0092)
|
|
12
|
+
#
|
|
13
|
+
# Notice that according to JEP 0092 only the <os/> element can be omitted,
|
|
14
|
+
# <name/> (iname) and <version/> must be present
|
|
15
|
+
class IqQueryVersion < IqQuery
|
|
16
|
+
name_xmlns 'query', 'jabber:iq:version'
|
|
17
|
+
|
|
18
|
+
##
|
|
19
|
+
# Create a new <query xmlns='jabber:iq:version'/> element
|
|
20
|
+
def initialize(iname=nil, version=nil, os=nil)
|
|
21
|
+
super()
|
|
22
|
+
set_iname(iname) if iname
|
|
23
|
+
set_version(version) if version
|
|
24
|
+
set_os(os) if os
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# Get the name of the software
|
|
29
|
+
#
|
|
30
|
+
# This has been renamed to 'iname' here to keep
|
|
31
|
+
# REXML::Element#name accessible
|
|
32
|
+
def iname
|
|
33
|
+
first_element_text('name')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# Set the name of the software
|
|
38
|
+
#
|
|
39
|
+
# The element won't be deleted if text is nil as
|
|
40
|
+
# it must occur in a version query, but its text will
|
|
41
|
+
# be empty.
|
|
42
|
+
def iname=(text)
|
|
43
|
+
replace_element_text('name', text.nil? ? '' : text)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Set the name of the software (chaining-friendly)
|
|
48
|
+
# result:: [String] or nil
|
|
49
|
+
def set_iname(text)
|
|
50
|
+
self.iname = text
|
|
51
|
+
self
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
# Get the version of the software
|
|
56
|
+
# result:: [String] or nil
|
|
57
|
+
def version
|
|
58
|
+
first_element_text('version')
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
##
|
|
62
|
+
# Set the version of the software
|
|
63
|
+
#
|
|
64
|
+
# The element won't be deleted if text is nil as
|
|
65
|
+
# it must occur in a version query
|
|
66
|
+
def version=(text)
|
|
67
|
+
replace_element_text('version', text.nil? ? '' : text)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
##
|
|
71
|
+
# Set the version of the software (chaining-friendly)
|
|
72
|
+
# text:: [String]
|
|
73
|
+
def set_version(text)
|
|
74
|
+
self.version = text
|
|
75
|
+
self
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
# Get the operating system or nil
|
|
80
|
+
# (os is not mandatory for Version Query)
|
|
81
|
+
def os
|
|
82
|
+
first_element_text('os')
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
##
|
|
86
|
+
# Set the os of the software
|
|
87
|
+
# text:: [String] or nil
|
|
88
|
+
def os=(text)
|
|
89
|
+
if text
|
|
90
|
+
replace_element_text('os', text)
|
|
91
|
+
else
|
|
92
|
+
delete_elements('os')
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
##
|
|
97
|
+
# Set the os of the software (chaining-friendly)
|
|
98
|
+
# text:: [String] or nil
|
|
99
|
+
def set_os(text)
|
|
100
|
+
self.os = text
|
|
101
|
+
self
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
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/xmppelement'
|
|
6
|
+
|
|
7
|
+
module Jabber
|
|
8
|
+
##
|
|
9
|
+
# A class used to build/parse <x/> elements
|
|
10
|
+
#
|
|
11
|
+
# These elements may occur as "attachments"
|
|
12
|
+
# in [Message] and [Presence] stanzas
|
|
13
|
+
class X < XMPPElement
|
|
14
|
+
name_xmlns 'x'
|
|
15
|
+
force_xmlns true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module XParent
|
|
19
|
+
##
|
|
20
|
+
# Get the first <x/> element in this stanza, or nil if none found.
|
|
21
|
+
# wanted_xmlns:: [String] Optional, find the first <x/> element having this xmlns,
|
|
22
|
+
# wanted_xmlns can also be a derivate of XMPPElement from which the namespace will be taken
|
|
23
|
+
# result:: [REXML::Element] or nil
|
|
24
|
+
def x(wanted_xmlns=nil)
|
|
25
|
+
if wanted_xmlns.kind_of? Class and wanted_xmlns.ancestors.include? XMPPElement
|
|
26
|
+
wanted_xmlns = wanted_xmlns.new.namespace
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
each_element('x') { |x|
|
|
30
|
+
if wanted_xmlns.nil? or wanted_xmlns == x.namespace
|
|
31
|
+
return x
|
|
32
|
+
end
|
|
33
|
+
}
|
|
34
|
+
nil
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'xmpp4r/xhtml/html'
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
require 'xmpp4r/xmppelement'
|
|
2
|
+
|
|
3
|
+
module Jabber
|
|
4
|
+
module XHTML
|
|
5
|
+
NS_XHTML_IM = 'http://jabber.org/protocol/xhtml-im'
|
|
6
|
+
NS_XHTML = 'http://www.w3.org/1999/xhtml'
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
# XHTML-IM (XEP-0071) container
|
|
10
|
+
#
|
|
11
|
+
# The important methods are:
|
|
12
|
+
# * HTML#contents=
|
|
13
|
+
# * HTML#to_text
|
|
14
|
+
class HTML < XMPPElement
|
|
15
|
+
name_xmlns 'html', NS_XHTML_IM
|
|
16
|
+
force_xmlns true
|
|
17
|
+
|
|
18
|
+
##
|
|
19
|
+
# Initialize element with HTML contents (see HTML#contents=)
|
|
20
|
+
def initialize(contents=[])
|
|
21
|
+
super()
|
|
22
|
+
self.contents = contents
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
##
|
|
26
|
+
# Get first XHTML::Body child
|
|
27
|
+
def body
|
|
28
|
+
first_element('body') || add(Body.new)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Replace first XHTML::Body child
|
|
33
|
+
def body=(body)
|
|
34
|
+
delete_elements('body')
|
|
35
|
+
add(body)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# Replace first XHTML::Body child (chainable)
|
|
40
|
+
def set_body(body)
|
|
41
|
+
self.body = body
|
|
42
|
+
self
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# Set contents of this HTML document. The "contents" parameter can be:
|
|
47
|
+
# * An Array of REXML::Element and Strings which will replace the current children of the body
|
|
48
|
+
# * A single REXML::Element which will replace all other children of the body
|
|
49
|
+
# * An instance of XHTML::Body which will replace the current body
|
|
50
|
+
# * A String comprising an HTML fragment. This will be parsed, which could raise an Exception.
|
|
51
|
+
# We must never send invalid XML over an XMPP stream. If you intend to put variable data in
|
|
52
|
+
# your HTML, use something like Rails' Builder::XmlMarkup or Ramaze::Gestalt
|
|
53
|
+
def contents=(contents)
|
|
54
|
+
if contents.kind_of? String
|
|
55
|
+
self.body = REXML::Document.new("<body xmlns='#{NS_XHTML}'>#{contents}</body>").root
|
|
56
|
+
elsif contents.kind_of? Body
|
|
57
|
+
self.body = contents
|
|
58
|
+
elsif contents.kind_of? Array
|
|
59
|
+
self.body = Body.new
|
|
60
|
+
contents.each do |element|
|
|
61
|
+
if element.kind_of? String
|
|
62
|
+
body.add_text(element)
|
|
63
|
+
else
|
|
64
|
+
body.add(element)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
else
|
|
68
|
+
self.body = Body.new
|
|
69
|
+
body.add(contents)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
##
|
|
74
|
+
# HTML#contents= chainable
|
|
75
|
+
def set_contents(contents)
|
|
76
|
+
self.contents = contents
|
|
77
|
+
self
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# Convert contents of this XHTML container to plain text
|
|
82
|
+
# for easy usage with an additional fall-back <body/> in message stanzas
|
|
83
|
+
#
|
|
84
|
+
# The resulting string is recursively composed of the text nodes of
|
|
85
|
+
# all children.
|
|
86
|
+
# This works because of the design criteria of HTML/XHTML:
|
|
87
|
+
# readable content is not being put into attributes but as text children.
|
|
88
|
+
#
|
|
89
|
+
# If you require clickable links and proper information representation
|
|
90
|
+
# then compose the text yourself!
|
|
91
|
+
def to_text
|
|
92
|
+
text_getter = nil # Create binding so that the following lambda can work recursively
|
|
93
|
+
|
|
94
|
+
text_getter = lambda do |element|
|
|
95
|
+
if element.kind_of? REXML::Text
|
|
96
|
+
element.value
|
|
97
|
+
elsif element.kind_of? REXML::Element
|
|
98
|
+
element.children.collect { |child|
|
|
99
|
+
text_getter.call(child)
|
|
100
|
+
}.join
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
text_getter.call(self) # Finally, execute and return results
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
##
|
|
109
|
+
# HTML Body element, must be the only child of XHTML::HTML
|
|
110
|
+
class Body < XMPPElement
|
|
111
|
+
name_xmlns 'body', NS_XHTML
|
|
112
|
+
force_xmlns true
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
##
|
|
6
|
+
# The Jabber module is the root namespace of the library.
|
|
7
|
+
module Jabber
|
|
8
|
+
# XMPP4R Version number. This is the ONLY place where the version number
|
|
9
|
+
# should be specified. This constant is used to determine the version of
|
|
10
|
+
# package tarballs and generated gems.
|
|
11
|
+
XMPP4R_VERSION = '0.4'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
require 'xmpp4r/client'
|
|
15
|
+
require 'xmpp4r/component'
|
|
16
|
+
require 'xmpp4r/debuglog'
|
|
17
|
+
require 'xmpp4r/errors'
|
|
18
|
+
|
|
@@ -0,0 +1,168 @@
|
|
|
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/rexmladdons'
|
|
6
|
+
|
|
7
|
+
module Jabber
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# This class represents an XML element and provides functionality
|
|
11
|
+
# for automatic casting of XML element classes according to their
|
|
12
|
+
# element name and namespace.
|
|
13
|
+
#
|
|
14
|
+
# Deriving classes must met these criteria:
|
|
15
|
+
# * The element name and namespace must be specified by calling
|
|
16
|
+
# the name_xmlns class method
|
|
17
|
+
# * The class constructor must be callable with no mandatory parameter
|
|
18
|
+
class XMPPElement < REXML::Element
|
|
19
|
+
@@name_xmlns_classes = {}
|
|
20
|
+
@@force_xmlns = false
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Specify XML element name and xmlns for a deriving class,
|
|
24
|
+
# this pair and the class will be added to a global pool
|
|
25
|
+
#
|
|
26
|
+
# If the namespace is nil the class is a "wildcard class"
|
|
27
|
+
# matching elements with any xmlns if no other class with
|
|
28
|
+
# that namespace was defined
|
|
29
|
+
def self.name_xmlns(name, xmlns=nil)
|
|
30
|
+
@@name_xmlns_classes[[name, xmlns]] = self
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Set whether this element is always built with an xmlns attribute
|
|
35
|
+
def self.force_xmlns(force)
|
|
36
|
+
@@force_xmlns = force
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
##
|
|
40
|
+
# Whether this element is always built with an xmlns attribute
|
|
41
|
+
def self.force_xmlns?
|
|
42
|
+
@@force_xmlns
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# Find the name and namespace for a given class.
|
|
47
|
+
# This class must have registered these two values
|
|
48
|
+
# by calling name_xmlns at definition time.
|
|
49
|
+
#
|
|
50
|
+
# Raises an exception if none was found
|
|
51
|
+
# klass:: [Class]
|
|
52
|
+
# result:: [String, String] name and namespace
|
|
53
|
+
def self.name_xmlns_for_class(klass)
|
|
54
|
+
klass.ancestors.each do |klass1|
|
|
55
|
+
@@name_xmlns_classes.each do |name_xmlns,k|
|
|
56
|
+
if klass1 == k
|
|
57
|
+
return name_xmlns
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
raise NoNameXmlnsRegistered.new(klass)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
# Find a class for given name and namespace
|
|
67
|
+
# name:: [String]
|
|
68
|
+
# xmlns:: [String]
|
|
69
|
+
# result:: A descendant of XMPPElement or REXML::Element
|
|
70
|
+
def self.class_for_name_xmlns(name, xmlns)
|
|
71
|
+
if @@name_xmlns_classes.has_key? [name, xmlns]
|
|
72
|
+
@@name_xmlns_classes[[name, xmlns]]
|
|
73
|
+
elsif @@name_xmlns_classes.has_key? [name, nil]
|
|
74
|
+
@@name_xmlns_classes[[name, nil]]
|
|
75
|
+
else
|
|
76
|
+
REXML::Element
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# Import another REXML::Element descendant to:
|
|
82
|
+
# * Either an element class that registered with
|
|
83
|
+
# name and xmlns before
|
|
84
|
+
# * Or if none was found to the class itself
|
|
85
|
+
# (you may call this class method on a deriving class)
|
|
86
|
+
def self.import(element)
|
|
87
|
+
klass = class_for_name_xmlns(element.name, element.namespace)
|
|
88
|
+
if klass != self and klass.ancestors.include?(self)
|
|
89
|
+
klass.new.import(element)
|
|
90
|
+
else
|
|
91
|
+
self.new.import(element)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
##
|
|
96
|
+
# Initialize this element, which will then be initialized
|
|
97
|
+
# with the name registered with name_xmlns.
|
|
98
|
+
def initialize(*arg)
|
|
99
|
+
if arg.empty?
|
|
100
|
+
name, xmlns = self.class::name_xmlns_for_class(self.class)
|
|
101
|
+
super(name)
|
|
102
|
+
if self.class::force_xmlns?
|
|
103
|
+
add_namespace(xmlns)
|
|
104
|
+
end
|
|
105
|
+
else
|
|
106
|
+
super
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
##
|
|
111
|
+
# Add a child element which will be imported according to the
|
|
112
|
+
# child's name and xmlns
|
|
113
|
+
# element:: [REXML::Element] Child
|
|
114
|
+
# result:: [REXML::Element or descendant of XMPPElement] New child
|
|
115
|
+
def typed_add(element)
|
|
116
|
+
if element.kind_of? REXML::Element
|
|
117
|
+
element_ns = (element.namespace.to_s == '') ? namespace : element.namespace
|
|
118
|
+
|
|
119
|
+
klass = XMPPElement::class_for_name_xmlns(element.name, element_ns)
|
|
120
|
+
if klass != element.class
|
|
121
|
+
element = klass.import(element)
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
super(element)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def parent=(new_parent)
|
|
129
|
+
if parent and parent.namespace('') == namespace('') and attributes['xmlns'].nil?
|
|
130
|
+
add_namespace parent.namespace('')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
super
|
|
134
|
+
|
|
135
|
+
if new_parent and new_parent.namespace('') == namespace('')
|
|
136
|
+
delete_namespace
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def clone
|
|
141
|
+
cloned = self.class.new
|
|
142
|
+
cloned.add_attributes self.attributes.clone
|
|
143
|
+
cloned.context = @context
|
|
144
|
+
cloned
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
##
|
|
148
|
+
# Generic XML attribute 'xml:lang'
|
|
149
|
+
# (REXML provides no shortcut)
|
|
150
|
+
def xml_lang
|
|
151
|
+
attributes['xml:lang']
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
##
|
|
155
|
+
# Set XML language attribute
|
|
156
|
+
def xml_lang=(l)
|
|
157
|
+
attributes['xml:lang'] = l
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
##
|
|
161
|
+
# Set XML language attribute (chainable)
|
|
162
|
+
def set_xml_lang(l)
|
|
163
|
+
self.xml_lang = l
|
|
164
|
+
self
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
end
|