mack-notifier 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems.rb +13 -0
- data/lib/gems/tmail-1.2.3.1/ext/Makefile +20 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/MANIFEST +4 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/depend +1 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/extconf.rb +33 -0
- data/lib/gems/tmail-1.2.3.1/ext/tmailscanner/tmail/tmailscanner.c +583 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail.rb +5 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/Makefile +18 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/address.rb +426 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/attachments.rb +46 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/base64.rb +46 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/compat.rb +41 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/config.rb +67 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/core_extensions.rb +63 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/encode.rb +581 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/header.rb +960 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/index.rb +9 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/interface.rb +1125 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/loader.rb +3 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/mail.rb +578 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/mailbox.rb +495 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/main.rb +6 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/mbox.rb +3 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/net.rb +248 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/obsolete.rb +132 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/parser.rb +1476 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/parser.y +381 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/port.rb +379 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/quoting.rb +118 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/require_arch.rb +58 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/scanner.rb +49 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/scanner_r.rb +261 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/stringio.rb +280 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/utils.rb +337 -0
- data/lib/gems/tmail-1.2.3.1/lib/tmail/version.rb +39 -0
- data/lib/gems/tmail-1.2.3.1/meta/MANIFEST +128 -0
- data/lib/gems/tmail-1.2.3.1/meta/VERSION +1 -0
- data/lib/gems/tmail-1.2.3.1/meta/project.yaml +30 -0
- data/lib/gems/tmail-1.2.3.1/meta/unixname +1 -0
- data/lib/gems/validatable-1.6.7/README +118 -0
- data/lib/gems/validatable-1.6.7/lib/child_validation.rb +15 -0
- data/lib/gems/validatable-1.6.7/lib/errors.rb +74 -0
- data/lib/gems/validatable-1.6.7/lib/included_validation.rb +9 -0
- data/lib/gems/validatable-1.6.7/lib/macros.rb +283 -0
- data/lib/gems/validatable-1.6.7/lib/object_extension.rb +21 -0
- data/lib/gems/validatable-1.6.7/lib/requireable.rb +26 -0
- data/lib/gems/validatable-1.6.7/lib/understandable.rb +31 -0
- data/lib/gems/validatable-1.6.7/lib/validatable.rb +19 -0
- data/lib/gems/validatable-1.6.7/lib/validatable_class_methods.rb +85 -0
- data/lib/gems/validatable-1.6.7/lib/validatable_instance_methods.rb +106 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_acceptance_of.rb +11 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_confirmation_of.rb +15 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_each.rb +14 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_format_of.rb +13 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_length_of.rb +25 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_numericality_of.rb +16 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_presence_of.rb +13 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validates_true_for.rb +13 -0
- data/lib/gems/validatable-1.6.7/lib/validations/validation_base.rb +88 -0
- data/lib/gems/validatable-1.6.7/rakefile.rb +50 -0
- data/lib/gems/validatable-1.6.7/test/all_tests.rb +1 -0
- data/lib/gems/validatable-1.6.7/test/functional/validatable_test.rb +437 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_acceptance_of_test.rb +16 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_confirmation_of_test.rb +56 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_each_test.rb +14 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_format_of_test.rb +34 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_length_of_test.rb +64 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_numericality_of_test.rb +57 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_presence_of_test.rb +16 -0
- data/lib/gems/validatable-1.6.7/test/functional/validates_true_for_test.rb +27 -0
- data/lib/gems/validatable-1.6.7/test/test_helper.rb +33 -0
- data/lib/gems/validatable-1.6.7/test/unit/errors_test.rb +64 -0
- data/lib/gems/validatable-1.6.7/test/unit/understandable_test.rb +19 -0
- data/lib/gems/validatable-1.6.7/test/unit/validatable_test.rb +38 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_acceptance_of_test.rb +21 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_confirmation_of_test.rb +64 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_format_of_test.rb +34 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_length_of_test.rb +75 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_numericality_of_test.rb +52 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_presence_of_test.rb +25 -0
- data/lib/gems/validatable-1.6.7/test/unit/validates_true_for_test.rb +29 -0
- data/lib/gems/validatable-1.6.7/test/unit/validation_base_test.rb +52 -0
- data/lib/gems/xmpp4r-0.4/CHANGELOG +83 -0
- data/lib/gems/xmpp4r-0.4/COPYING +340 -0
- data/lib/gems/xmpp4r-0.4/LICENSE +59 -0
- data/lib/gems/xmpp4r-0.4/README.rdoc +110 -0
- data/lib/gems/xmpp4r-0.4/README_ruby19.txt +43 -0
- data/lib/gems/xmpp4r-0.4/Rakefile +262 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/client.rb +70 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/component.rb +11 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/register.rb +42 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
- data/lib/gems/xmpp4r-0.4/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r.rb +116 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/base64.rb +32 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams.rb +15 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/callbacks.rb +124 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps.rb +1 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/c.rb +53 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/helper/generator.rb +160 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/caps/helper/helper.rb +87 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/client.rb +317 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/command/helper/responder.rb +53 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/command/iq/command.rb +154 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/component.rb +103 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/connection.rb +219 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/dataforms.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/dataforms/x/data.rb +297 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/debuglog.rb +42 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/delay.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/delay/x/delay.rb +99 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery.rb +7 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/helper/responder.rb +165 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/errors.rb +281 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/feature_negotiation.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/framework/base.rb +55 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/framework/bot.rb +148 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/httpbinding.rb +5 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/httpbinding/client.rb +285 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/idgenerator.rb +37 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/iq.rb +221 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/jid.rb +167 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/message.rb +148 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc.rb +14 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/item.rb +143 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/muc.rb +70 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/presence.rb +232 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub.rb +8 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/event.rb +49 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/item.rb +35 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/items.rb +44 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/publish.rb +24 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/query.rb +15 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rexmladdons.rb +151 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster.rb +7 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/helper/roster.rb +519 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/iq/roster.rb +215 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/roster/x/roster.rb +138 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc.rb +2 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/client.rb +123 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/server.rb +74 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/sasl.rb +237 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/semaphore.rb +38 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/stream.rb +497 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/streamparser.rb +77 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune.rb +2 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune/helper/helper.rb +58 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/tune/tune.rb +113 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard.rb +6 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version.rb +7 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/helper/responder.rb +72 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/version/iq/version.rb +105 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/x.rb +37 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xhtml.rb +1 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xhtml/html.rb +115 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmpp4r.rb +18 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmppelement.rb +168 -0
- data/lib/gems/xmpp4r-0.4/lib/xmpp4r/xmppstanza.rb +162 -0
- data/lib/gems/xmpp4r-0.4/setup.rb +1586 -0
- data/lib/gems/xmpp4r-0.4/test/bytestreams/tc_ibb.rb +186 -0
- data/lib/gems/xmpp4r-0.4/test/bytestreams/tc_socks5bytestreams.rb +113 -0
- data/lib/gems/xmpp4r-0.4/test/caps/tc_helper.rb +156 -0
- data/lib/gems/xmpp4r-0.4/test/dataforms/tc_data.rb +81 -0
- data/lib/gems/xmpp4r-0.4/test/delay/tc_xdelay.rb +51 -0
- data/lib/gems/xmpp4r-0.4/test/discovery/tc_responder.rb +91 -0
- data/lib/gems/xmpp4r-0.4/test/lib/assert_equal_xml.rb +14 -0
- data/lib/gems/xmpp4r-0.4/test/lib/clienttester.rb +120 -0
- data/lib/gems/xmpp4r-0.4/test/muc/tc_muc_mucclient.rb +830 -0
- data/lib/gems/xmpp4r-0.4/test/muc/tc_muc_simplemucclient.rb +114 -0
- data/lib/gems/xmpp4r-0.4/test/muc/tc_mucowner.rb +50 -0
- data/lib/gems/xmpp4r-0.4/test/pubsub/tc_helper.rb +662 -0
- data/lib/gems/xmpp4r-0.4/test/pubsub/tc_nodeconfig.rb +54 -0
- data/lib/gems/xmpp4r-0.4/test/pubsub/tc_subscriptionconfig.rb +41 -0
- data/lib/gems/xmpp4r-0.4/test/roster/tc_helper.rb +514 -0
- data/lib/gems/xmpp4r-0.4/test/roster/tc_iqqueryroster.rb +173 -0
- data/lib/gems/xmpp4r-0.4/test/roster/tc_xroster.rb +73 -0
- data/lib/gems/xmpp4r-0.4/test/rpc/tc_helper.rb +96 -0
- data/lib/gems/xmpp4r-0.4/test/tc_callbacks.rb +129 -0
- data/lib/gems/xmpp4r-0.4/test/tc_class_names.rb +146 -0
- data/lib/gems/xmpp4r-0.4/test/tc_client.rb +30 -0
- data/lib/gems/xmpp4r-0.4/test/tc_errors.rb +146 -0
- data/lib/gems/xmpp4r-0.4/test/tc_idgenerator.rb +30 -0
- data/lib/gems/xmpp4r-0.4/test/tc_iq.rb +113 -0
- data/lib/gems/xmpp4r-0.4/test/tc_iqquery.rb +31 -0
- data/lib/gems/xmpp4r-0.4/test/tc_jid.rb +204 -0
- data/lib/gems/xmpp4r-0.4/test/tc_message.rb +116 -0
- data/lib/gems/xmpp4r-0.4/test/tc_presence.rb +150 -0
- data/lib/gems/xmpp4r-0.4/test/tc_rexml.rb +139 -0
- data/lib/gems/xmpp4r-0.4/test/tc_stream.rb +229 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamComponent.rb +95 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamError.rb +131 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamSend.rb +59 -0
- data/lib/gems/xmpp4r-0.4/test/tc_streamparser.rb +112 -0
- data/lib/gems/xmpp4r-0.4/test/tc_xmppstanza.rb +135 -0
- data/lib/gems/xmpp4r-0.4/test/ts_xmpp4r.rb +53 -0
- data/lib/gems/xmpp4r-0.4/test/tune/tc_helper_recv.rb +84 -0
- data/lib/gems/xmpp4r-0.4/test/tune/tc_helper_send.rb +74 -0
- data/lib/gems/xmpp4r-0.4/test/tune/tc_tune.rb +79 -0
- data/lib/gems/xmpp4r-0.4/test/vcard/tc_helper.rb +49 -0
- data/lib/gems/xmpp4r-0.4/test/vcard/tc_iqvcard.rb +62 -0
- data/lib/gems/xmpp4r-0.4/test/version/tc_helper.rb +60 -0
- data/lib/gems/xmpp4r-0.4/test/version/tc_iqqueryversion.rb +97 -0
- data/lib/gems/xmpp4r-0.4/test/xhtml/tc_html.rb +41 -0
- data/lib/gems/xmpp4r-0.4/tools/gen_requires.bash +31 -0
- data/lib/gems/xmpp4r-0.4/tools/xmpp4r-gemspec-test.rb +11 -0
- data/lib/gems/xmpp4r-0.4/xmpp4r.gemspec +291 -0
- data/lib/gems/xmpp4r-simple-0.8.8/CHANGELOG +73 -0
- data/lib/gems/xmpp4r-simple-0.8.8/COPYING +281 -0
- data/lib/gems/xmpp4r-simple-0.8.8/README +59 -0
- data/lib/gems/xmpp4r-simple-0.8.8/lib/xmpp4r-simple.rb +492 -0
- data/lib/gems/xmpp4r-simple-0.8.8/test/test_xmpp4r_simple.rb +242 -0
- data/lib/mack-notifier.rb +1 -3
- metadata +398 -46
@@ -0,0 +1,280 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin rdoc
|
3
|
+
|
4
|
+
= String handling class
|
5
|
+
|
6
|
+
=end
|
7
|
+
#--
|
8
|
+
# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
|
9
|
+
#
|
10
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
11
|
+
# a copy of this software and associated documentation files (the
|
12
|
+
# "Software"), to deal in the Software without restriction, including
|
13
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
14
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
15
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
16
|
+
# the following conditions:
|
17
|
+
#
|
18
|
+
# The above copyright notice and this permission notice shall be
|
19
|
+
# included in all copies or substantial portions of the Software.
|
20
|
+
#
|
21
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
22
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
23
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
24
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
25
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
26
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
27
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
#
|
29
|
+
# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
|
30
|
+
# with permission of Minero Aoki.
|
31
|
+
#++
|
32
|
+
|
33
|
+
class StringInput#:nodoc:
|
34
|
+
|
35
|
+
include Enumerable
|
36
|
+
|
37
|
+
class << self
|
38
|
+
|
39
|
+
def new( str )
|
40
|
+
if block_given?
|
41
|
+
begin
|
42
|
+
f = super
|
43
|
+
yield f
|
44
|
+
ensure
|
45
|
+
f.close if f
|
46
|
+
end
|
47
|
+
else
|
48
|
+
super
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
alias open new
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def initialize( str )
|
57
|
+
@src = str
|
58
|
+
@pos = 0
|
59
|
+
@closed = false
|
60
|
+
@lineno = 0
|
61
|
+
end
|
62
|
+
|
63
|
+
attr_reader :lineno
|
64
|
+
|
65
|
+
def string
|
66
|
+
@src
|
67
|
+
end
|
68
|
+
|
69
|
+
def inspect
|
70
|
+
"#<#{self.class}:#{@closed ? 'closed' : 'open'},src=#{@src[0,30].inspect}>"
|
71
|
+
end
|
72
|
+
|
73
|
+
def close
|
74
|
+
stream_check!
|
75
|
+
@pos = nil
|
76
|
+
@closed = true
|
77
|
+
end
|
78
|
+
|
79
|
+
def closed?
|
80
|
+
@closed
|
81
|
+
end
|
82
|
+
|
83
|
+
def pos
|
84
|
+
stream_check!
|
85
|
+
[@pos, @src.size].min
|
86
|
+
end
|
87
|
+
|
88
|
+
alias tell pos
|
89
|
+
|
90
|
+
def seek( offset, whence = IO::SEEK_SET )
|
91
|
+
stream_check!
|
92
|
+
case whence
|
93
|
+
when IO::SEEK_SET
|
94
|
+
@pos = offset
|
95
|
+
when IO::SEEK_CUR
|
96
|
+
@pos += offset
|
97
|
+
when IO::SEEK_END
|
98
|
+
@pos = @src.size - offset
|
99
|
+
else
|
100
|
+
raise ArgumentError, "unknown seek flag: #{whence}"
|
101
|
+
end
|
102
|
+
@pos = 0 if @pos < 0
|
103
|
+
@pos = [@pos, @src.size + 1].min
|
104
|
+
offset
|
105
|
+
end
|
106
|
+
|
107
|
+
def rewind
|
108
|
+
stream_check!
|
109
|
+
@pos = 0
|
110
|
+
end
|
111
|
+
|
112
|
+
def eof?
|
113
|
+
stream_check!
|
114
|
+
@pos > @src.size
|
115
|
+
end
|
116
|
+
|
117
|
+
def each( &block )
|
118
|
+
stream_check!
|
119
|
+
begin
|
120
|
+
@src.each(&block)
|
121
|
+
ensure
|
122
|
+
@pos = 0
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def gets
|
127
|
+
stream_check!
|
128
|
+
if idx = @src.index(?\n, @pos)
|
129
|
+
idx += 1 # "\n".size
|
130
|
+
line = @src[ @pos ... idx ]
|
131
|
+
@pos = idx
|
132
|
+
@pos += 1 if @pos == @src.size
|
133
|
+
else
|
134
|
+
line = @src[ @pos .. -1 ]
|
135
|
+
@pos = @src.size + 1
|
136
|
+
end
|
137
|
+
@lineno += 1
|
138
|
+
|
139
|
+
line
|
140
|
+
end
|
141
|
+
|
142
|
+
def getc
|
143
|
+
stream_check!
|
144
|
+
ch = @src[@pos]
|
145
|
+
@pos += 1
|
146
|
+
@pos += 1 if @pos == @src.size
|
147
|
+
ch
|
148
|
+
end
|
149
|
+
|
150
|
+
def read( len = nil )
|
151
|
+
stream_check!
|
152
|
+
return read_all unless len
|
153
|
+
str = @src[@pos, len]
|
154
|
+
@pos += len
|
155
|
+
@pos += 1 if @pos == @src.size
|
156
|
+
str
|
157
|
+
end
|
158
|
+
|
159
|
+
alias sysread read
|
160
|
+
|
161
|
+
def read_all
|
162
|
+
stream_check!
|
163
|
+
return nil if eof?
|
164
|
+
rest = @src[@pos ... @src.size]
|
165
|
+
@pos = @src.size + 1
|
166
|
+
rest
|
167
|
+
end
|
168
|
+
|
169
|
+
def stream_check!
|
170
|
+
@closed and raise IOError, 'closed stream'
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
|
176
|
+
class StringOutput#:nodoc:
|
177
|
+
|
178
|
+
class << self
|
179
|
+
|
180
|
+
def new( str = '' )
|
181
|
+
if block_given?
|
182
|
+
begin
|
183
|
+
f = super
|
184
|
+
yield f
|
185
|
+
ensure
|
186
|
+
f.close if f
|
187
|
+
end
|
188
|
+
else
|
189
|
+
super
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
alias open new
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
def initialize( str = '' )
|
198
|
+
@dest = str
|
199
|
+
@closed = false
|
200
|
+
end
|
201
|
+
|
202
|
+
def close
|
203
|
+
@closed = true
|
204
|
+
end
|
205
|
+
|
206
|
+
def closed?
|
207
|
+
@closed
|
208
|
+
end
|
209
|
+
|
210
|
+
def string
|
211
|
+
@dest
|
212
|
+
end
|
213
|
+
|
214
|
+
alias value string
|
215
|
+
alias to_str string
|
216
|
+
|
217
|
+
def size
|
218
|
+
@dest.size
|
219
|
+
end
|
220
|
+
|
221
|
+
alias pos size
|
222
|
+
|
223
|
+
def inspect
|
224
|
+
"#<#{self.class}:#{@dest ? 'open' : 'closed'},#{object_id}>"
|
225
|
+
end
|
226
|
+
|
227
|
+
def print( *args )
|
228
|
+
stream_check!
|
229
|
+
raise ArgumentError, 'wrong # of argument (0 for >1)' if args.empty?
|
230
|
+
args.each do |s|
|
231
|
+
raise ArgumentError, 'nil not allowed' if s.nil?
|
232
|
+
@dest << s.to_s
|
233
|
+
end
|
234
|
+
nil
|
235
|
+
end
|
236
|
+
|
237
|
+
def puts( *args )
|
238
|
+
stream_check!
|
239
|
+
args.each do |str|
|
240
|
+
@dest << (s = str.to_s)
|
241
|
+
@dest << "\n" unless s[-1] == ?\n
|
242
|
+
end
|
243
|
+
@dest << "\n" if args.empty?
|
244
|
+
nil
|
245
|
+
end
|
246
|
+
|
247
|
+
def putc( ch )
|
248
|
+
stream_check!
|
249
|
+
@dest << ch.chr
|
250
|
+
nil
|
251
|
+
end
|
252
|
+
|
253
|
+
def printf( *args )
|
254
|
+
stream_check!
|
255
|
+
@dest << sprintf(*args)
|
256
|
+
nil
|
257
|
+
end
|
258
|
+
|
259
|
+
def write( str )
|
260
|
+
stream_check!
|
261
|
+
s = str.to_s
|
262
|
+
@dest << s
|
263
|
+
s.size
|
264
|
+
end
|
265
|
+
|
266
|
+
alias syswrite write
|
267
|
+
|
268
|
+
def <<( str )
|
269
|
+
stream_check!
|
270
|
+
@dest << str.to_s
|
271
|
+
self
|
272
|
+
end
|
273
|
+
|
274
|
+
private
|
275
|
+
|
276
|
+
def stream_check!
|
277
|
+
@closed and raise IOError, 'closed stream'
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
@@ -0,0 +1,337 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
|
24
|
+
# with permission of Minero Aoki.
|
25
|
+
#++
|
26
|
+
|
27
|
+
# = TMail - The EMail Swiss Army Knife for Ruby
|
28
|
+
#
|
29
|
+
# The TMail library provides you with a very complete way to handle and manipulate EMails
|
30
|
+
# from within your Ruby programs.
|
31
|
+
#
|
32
|
+
# Used as the backbone for email handling by the Ruby on Rails and Nitro web frameworks as
|
33
|
+
# well as a bunch of other Ruby apps including the Ruby-Talk mailing list to newsgroup email
|
34
|
+
# gateway, it is a proven and reliable email handler that won't let you down.
|
35
|
+
#
|
36
|
+
# Originally created by Minero Aoki, TMail has been recently picked up by Mikel Lindsaar and
|
37
|
+
# is being actively maintained. Numerous backlogged bug fixes have been applied as well as
|
38
|
+
# Ruby 1.9 compatibility and a swath of documentation to boot.
|
39
|
+
#
|
40
|
+
# TMail allows you to treat an email totally as an object and allow you to get on with your
|
41
|
+
# own programming without having to worry about crafting the perfect email address validation
|
42
|
+
# parser, or assembling an email from all it's component parts.
|
43
|
+
#
|
44
|
+
# TMail handles the most complex part of the email - the header. It generates and parses
|
45
|
+
# headers and provides you with instant access to their innards through simple and logically
|
46
|
+
# named accessor and setter methods.
|
47
|
+
#
|
48
|
+
# TMail also provides a wrapper to Net/SMTP as well as Unix Mailbox handling methods to
|
49
|
+
# directly read emails from your unix mailbox, parse them and use them.
|
50
|
+
#
|
51
|
+
# Following is the comprehensive list of methods to access TMail::Mail objects. You can also
|
52
|
+
# check out TMail::Mail, TMail::Address and TMail::Headers for other lists.
|
53
|
+
module TMail
|
54
|
+
|
55
|
+
# Provides an exception to throw on errors in Syntax within TMail's parsers
|
56
|
+
class SyntaxError < StandardError; end
|
57
|
+
|
58
|
+
# Provides a new email boundary to separate parts of the email. This is a random
|
59
|
+
# string based off the current time, so should be fairly unique.
|
60
|
+
#
|
61
|
+
# For Example:
|
62
|
+
#
|
63
|
+
# TMail.new_boundary
|
64
|
+
# #=> "mimepart_47bf656968207_25a8fbb80114"
|
65
|
+
# TMail.new_boundary
|
66
|
+
# #=> "mimepart_47bf66051de4_25a8fbb80240"
|
67
|
+
def TMail.new_boundary
|
68
|
+
'mimepart_' + random_tag
|
69
|
+
end
|
70
|
+
|
71
|
+
# Provides a new email message ID. You can use this to generate unique email message
|
72
|
+
# id's for your email so you can track them.
|
73
|
+
#
|
74
|
+
# Optionally takes a fully qualified domain name (default to the current hostname
|
75
|
+
# returned by Socket.gethostname) that will be appended to the message ID.
|
76
|
+
#
|
77
|
+
# For Example:
|
78
|
+
#
|
79
|
+
# email.message_id = TMail.new_message_id
|
80
|
+
# #=> "<47bf66845380e_25a8fbb80332@baci.local.tmail>"
|
81
|
+
# email.to_s
|
82
|
+
# #=> "Message-Id: <47bf668b633f1_25a8fbb80475@baci.local.tmail>\n\n"
|
83
|
+
# email.message_id = TMail.new_message_id("lindsaar.net")
|
84
|
+
# #=> "<47bf668b633f1_25a8fbb80475@lindsaar.net.tmail>"
|
85
|
+
# email.to_s
|
86
|
+
# #=> "Message-Id: <47bf668b633f1_25a8fbb80475@lindsaar.net.tmail>\n\n"
|
87
|
+
def TMail.new_message_id( fqdn = nil )
|
88
|
+
fqdn ||= ::Socket.gethostname
|
89
|
+
"<#{random_tag()}@#{fqdn}.tmail>"
|
90
|
+
end
|
91
|
+
|
92
|
+
#:stopdoc:
|
93
|
+
def TMail.random_tag #:nodoc:
|
94
|
+
@uniq += 1
|
95
|
+
t = Time.now
|
96
|
+
sprintf('%x%x_%x%x%d%x',
|
97
|
+
t.to_i, t.tv_usec,
|
98
|
+
$$, Thread.current.object_id, @uniq, rand(255))
|
99
|
+
end
|
100
|
+
private_class_method :random_tag
|
101
|
+
|
102
|
+
@uniq = 0
|
103
|
+
|
104
|
+
#:startdoc:
|
105
|
+
|
106
|
+
# Text Utils provides a namespace to define TOKENs, ATOMs, PHRASEs and CONTROL characters that
|
107
|
+
# are OK per RFC 2822.
|
108
|
+
#
|
109
|
+
# It also provides methods you can call to determine if a string is safe
|
110
|
+
module TextUtils
|
111
|
+
|
112
|
+
aspecial = %Q|()<>[]:;.\\,"|
|
113
|
+
tspecial = %Q|()<>[];:\\,"/?=|
|
114
|
+
lwsp = %Q| \t\r\n|
|
115
|
+
control = %Q|\x00-\x1f\x7f-\xff|
|
116
|
+
|
117
|
+
CONTROL_CHAR = /[#{control}]/n
|
118
|
+
ATOM_UNSAFE = /[#{Regexp.quote aspecial}#{control}#{lwsp}]/n
|
119
|
+
PHRASE_UNSAFE = /[#{Regexp.quote aspecial}#{control}]/n
|
120
|
+
TOKEN_UNSAFE = /[#{Regexp.quote tspecial}#{control}#{lwsp}]/n
|
121
|
+
|
122
|
+
# Returns true if the string supplied is free from characters not allowed as an ATOM
|
123
|
+
def atom_safe?( str )
|
124
|
+
not ATOM_UNSAFE === str
|
125
|
+
end
|
126
|
+
|
127
|
+
# If the string supplied has ATOM unsafe characters in it, will return the string quoted
|
128
|
+
# in double quotes, otherwise returns the string unmodified
|
129
|
+
def quote_atom( str )
|
130
|
+
(ATOM_UNSAFE === str) ? dquote(str) : str
|
131
|
+
end
|
132
|
+
|
133
|
+
# If the string supplied has PHRASE unsafe characters in it, will return the string quoted
|
134
|
+
# in double quotes, otherwise returns the string unmodified
|
135
|
+
def quote_phrase( str )
|
136
|
+
(PHRASE_UNSAFE === str) ? dquote(str) : str
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns true if the string supplied is free from characters not allowed as a TOKEN
|
140
|
+
def token_safe?( str )
|
141
|
+
not TOKEN_UNSAFE === str
|
142
|
+
end
|
143
|
+
|
144
|
+
# If the string supplied has TOKEN unsafe characters in it, will return the string quoted
|
145
|
+
# in double quotes, otherwise returns the string unmodified
|
146
|
+
def quote_token( str )
|
147
|
+
(TOKEN_UNSAFE === str) ? dquote(str) : str
|
148
|
+
end
|
149
|
+
|
150
|
+
# Wraps supplied string in double quotes unless it is already wrapped
|
151
|
+
# Returns double quoted string
|
152
|
+
def dquote( str ) #:nodoc:
|
153
|
+
unless str =~ /^".*?"$/
|
154
|
+
'"' + str.gsub(/["\\]/n) {|s| '\\' + s } + '"'
|
155
|
+
else
|
156
|
+
str
|
157
|
+
end
|
158
|
+
end
|
159
|
+
private :dquote
|
160
|
+
|
161
|
+
# Unwraps supplied string from inside double quotes
|
162
|
+
# Returns unquoted string
|
163
|
+
def unquote( str )
|
164
|
+
str =~ /^"(.*?)"$/ ? $1 : str
|
165
|
+
end
|
166
|
+
|
167
|
+
# Provides a method to join a domain name by it's parts and also makes it
|
168
|
+
# ATOM safe by quoting it as needed
|
169
|
+
def join_domain( arr )
|
170
|
+
arr.map {|i|
|
171
|
+
if /\A\[.*\]\z/ === i
|
172
|
+
i
|
173
|
+
else
|
174
|
+
quote_atom(i)
|
175
|
+
end
|
176
|
+
}.join('.')
|
177
|
+
end
|
178
|
+
|
179
|
+
#:stopdoc:
|
180
|
+
ZONESTR_TABLE = {
|
181
|
+
'jst' => 9 * 60,
|
182
|
+
'eet' => 2 * 60,
|
183
|
+
'bst' => 1 * 60,
|
184
|
+
'met' => 1 * 60,
|
185
|
+
'gmt' => 0,
|
186
|
+
'utc' => 0,
|
187
|
+
'ut' => 0,
|
188
|
+
'nst' => -(3 * 60 + 30),
|
189
|
+
'ast' => -4 * 60,
|
190
|
+
'edt' => -4 * 60,
|
191
|
+
'est' => -5 * 60,
|
192
|
+
'cdt' => -5 * 60,
|
193
|
+
'cst' => -6 * 60,
|
194
|
+
'mdt' => -6 * 60,
|
195
|
+
'mst' => -7 * 60,
|
196
|
+
'pdt' => -7 * 60,
|
197
|
+
'pst' => -8 * 60,
|
198
|
+
'a' => -1 * 60,
|
199
|
+
'b' => -2 * 60,
|
200
|
+
'c' => -3 * 60,
|
201
|
+
'd' => -4 * 60,
|
202
|
+
'e' => -5 * 60,
|
203
|
+
'f' => -6 * 60,
|
204
|
+
'g' => -7 * 60,
|
205
|
+
'h' => -8 * 60,
|
206
|
+
'i' => -9 * 60,
|
207
|
+
# j not use
|
208
|
+
'k' => -10 * 60,
|
209
|
+
'l' => -11 * 60,
|
210
|
+
'm' => -12 * 60,
|
211
|
+
'n' => 1 * 60,
|
212
|
+
'o' => 2 * 60,
|
213
|
+
'p' => 3 * 60,
|
214
|
+
'q' => 4 * 60,
|
215
|
+
'r' => 5 * 60,
|
216
|
+
's' => 6 * 60,
|
217
|
+
't' => 7 * 60,
|
218
|
+
'u' => 8 * 60,
|
219
|
+
'v' => 9 * 60,
|
220
|
+
'w' => 10 * 60,
|
221
|
+
'x' => 11 * 60,
|
222
|
+
'y' => 12 * 60,
|
223
|
+
'z' => 0 * 60
|
224
|
+
}
|
225
|
+
#:startdoc:
|
226
|
+
|
227
|
+
# Takes a time zone string from an EMail and converts it to Unix Time (seconds)
|
228
|
+
def timezone_string_to_unixtime( str )
|
229
|
+
if m = /([\+\-])(\d\d?)(\d\d)/.match(str)
|
230
|
+
sec = (m[2].to_i * 60 + m[3].to_i) * 60
|
231
|
+
m[1] == '-' ? -sec : sec
|
232
|
+
else
|
233
|
+
min = ZONESTR_TABLE[str.downcase] or
|
234
|
+
raise SyntaxError, "wrong timezone format '#{str}'"
|
235
|
+
min * 60
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
#:stopdoc:
|
240
|
+
WDAY = %w( Sun Mon Tue Wed Thu Fri Sat TMailBUG )
|
241
|
+
MONTH = %w( TMailBUG Jan Feb Mar Apr May Jun
|
242
|
+
Jul Aug Sep Oct Nov Dec TMailBUG )
|
243
|
+
|
244
|
+
def time2str( tm )
|
245
|
+
# [ruby-list:7928]
|
246
|
+
gmt = Time.at(tm.to_i)
|
247
|
+
gmt.gmtime
|
248
|
+
offset = tm.to_i - Time.local(*gmt.to_a[0,6].reverse).to_i
|
249
|
+
|
250
|
+
# DO NOT USE strftime: setlocale() breaks it
|
251
|
+
sprintf '%s, %s %s %d %02d:%02d:%02d %+.2d%.2d',
|
252
|
+
WDAY[tm.wday], tm.mday, MONTH[tm.month],
|
253
|
+
tm.year, tm.hour, tm.min, tm.sec,
|
254
|
+
*(offset / 60).divmod(60)
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
MESSAGE_ID = /<[^\@>]+\@[^>\@]+>/
|
259
|
+
|
260
|
+
def message_id?( str )
|
261
|
+
MESSAGE_ID === str
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
MIME_ENCODED = /=\?[^\s?=]+\?[QB]\?[^\s?=]+\?=/i
|
266
|
+
|
267
|
+
def mime_encoded?( str )
|
268
|
+
MIME_ENCODED === str
|
269
|
+
end
|
270
|
+
|
271
|
+
|
272
|
+
def decode_params( hash )
|
273
|
+
new = Hash.new
|
274
|
+
encoded = nil
|
275
|
+
hash.each do |key, value|
|
276
|
+
if m = /\*(?:(\d+)\*)?\z/.match(key)
|
277
|
+
((encoded ||= {})[m.pre_match] ||= [])[(m[1] || 0).to_i] = value
|
278
|
+
else
|
279
|
+
new[key] = to_kcode(value)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
if encoded
|
283
|
+
encoded.each do |key, strings|
|
284
|
+
new[key] = decode_RFC2231(strings.join(''))
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
new
|
289
|
+
end
|
290
|
+
|
291
|
+
NKF_FLAGS = {
|
292
|
+
'EUC' => '-e -m',
|
293
|
+
'SJIS' => '-s -m'
|
294
|
+
}
|
295
|
+
|
296
|
+
def to_kcode( str )
|
297
|
+
flag = NKF_FLAGS[TMail.KCODE] or return str
|
298
|
+
NKF.nkf(flag, str)
|
299
|
+
end
|
300
|
+
|
301
|
+
RFC2231_ENCODED = /\A(?:iso-2022-jp|euc-jp|shift_jis|us-ascii)?'[a-z]*'/in
|
302
|
+
|
303
|
+
def decode_RFC2231( str )
|
304
|
+
m = RFC2231_ENCODED.match(str) or return str
|
305
|
+
begin
|
306
|
+
to_kcode(m.post_match.gsub(/%[\da-f]{2}/in) {|s| s[1,2].hex.chr })
|
307
|
+
rescue
|
308
|
+
m.post_match.gsub(/%[\da-f]{2}/in, "")
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
def quote_boundary
|
313
|
+
# Make sure the Content-Type boundary= parameter is quoted if it contains illegal characters
|
314
|
+
# (to ensure any special characters in the boundary text are escaped from the parser
|
315
|
+
# (such as = in MS Outlook's boundary text))
|
316
|
+
if @body =~ /^(.*)boundary=(.*)$/m
|
317
|
+
preamble = $1
|
318
|
+
remainder = $2
|
319
|
+
if remainder =~ /;/
|
320
|
+
remainder =~ /^(.*?)(;.*)$/m
|
321
|
+
boundary_text = $1
|
322
|
+
post = $2.chomp
|
323
|
+
else
|
324
|
+
boundary_text = remainder.chomp
|
325
|
+
end
|
326
|
+
if boundary_text =~ /[\/\?\=]/
|
327
|
+
boundary_text = "\"#{boundary_text}\"" unless boundary_text =~ /^".*?"$/
|
328
|
+
@body = "#{preamble}boundary=#{boundary_text}#{post}"
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
#:startdoc:
|
333
|
+
|
334
|
+
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|