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,46 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
|
3
|
+
= Attachment handling file
|
4
|
+
|
5
|
+
=end
|
6
|
+
|
7
|
+
require 'stringio'
|
8
|
+
|
9
|
+
module TMail
|
10
|
+
class Attachment < StringIO
|
11
|
+
attr_accessor :original_filename, :content_type
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mail
|
15
|
+
def has_attachments?
|
16
|
+
multipart? && parts.any? { |part| attachment?(part) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def attachment?(part)
|
20
|
+
part.disposition_is_attachment? || part.content_type_is_text?
|
21
|
+
end
|
22
|
+
|
23
|
+
def attachments
|
24
|
+
if multipart?
|
25
|
+
parts.collect { |part|
|
26
|
+
if part.multipart?
|
27
|
+
part.attachments
|
28
|
+
elsif attachment?(part)
|
29
|
+
content = part.body # unquoted automatically by TMail#body
|
30
|
+
file_name = (part['content-location'] &&
|
31
|
+
part['content-location'].body) ||
|
32
|
+
part.sub_header("content-type", "name") ||
|
33
|
+
part.sub_header("content-disposition", "filename")
|
34
|
+
|
35
|
+
next if file_name.blank? || content.blank?
|
36
|
+
|
37
|
+
attachment = Attachment.new(content)
|
38
|
+
attachment.original_filename = file_name.strip
|
39
|
+
attachment.content_type = part.content_type
|
40
|
+
attachment
|
41
|
+
end
|
42
|
+
}.flatten.compact
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
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
|
+
#:stopdoc:
|
27
|
+
module TMail
|
28
|
+
module Base64
|
29
|
+
|
30
|
+
module_function
|
31
|
+
|
32
|
+
def folding_encode( str, eol = "\n", limit = 60 )
|
33
|
+
[str].pack('m')
|
34
|
+
end
|
35
|
+
|
36
|
+
def encode( str )
|
37
|
+
[str].pack('m').tr( "\r\n", '' )
|
38
|
+
end
|
39
|
+
|
40
|
+
def decode( str, strict = false )
|
41
|
+
str.unpack('m').first
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
#:startdoc:
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#:stopdoc:
|
2
|
+
unless Enumerable.method_defined?(:map)
|
3
|
+
module Enumerable #:nodoc:
|
4
|
+
alias map collect
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
unless Enumerable.method_defined?(:select)
|
9
|
+
module Enumerable #:nodoc:
|
10
|
+
alias select find_all
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
unless Enumerable.method_defined?(:reject)
|
15
|
+
module Enumerable #:nodoc:
|
16
|
+
def reject
|
17
|
+
result = []
|
18
|
+
each do |i|
|
19
|
+
result.push i unless yield(i)
|
20
|
+
end
|
21
|
+
result
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
unless Enumerable.method_defined?(:sort_by)
|
27
|
+
module Enumerable #:nodoc:
|
28
|
+
def sort_by
|
29
|
+
map {|i| [yield(i), i] }.sort.map {|val, i| i }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
unless File.respond_to?(:read)
|
35
|
+
def File.read(fname) #:nodoc:
|
36
|
+
File.open(fname) {|f|
|
37
|
+
return f.read
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
#:startdoc:
|
@@ -0,0 +1,67 @@
|
|
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
|
+
#:stopdoc:
|
27
|
+
module TMail
|
28
|
+
|
29
|
+
class Config
|
30
|
+
|
31
|
+
def initialize( strict )
|
32
|
+
@strict_parse = strict
|
33
|
+
@strict_base64decode = strict
|
34
|
+
end
|
35
|
+
|
36
|
+
def strict_parse?
|
37
|
+
@strict_parse
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_writer :strict_parse
|
41
|
+
|
42
|
+
def strict_base64decode?
|
43
|
+
@strict_base64decode
|
44
|
+
end
|
45
|
+
|
46
|
+
attr_writer :strict_base64decode
|
47
|
+
|
48
|
+
def new_body_port( mail )
|
49
|
+
StringPort.new
|
50
|
+
end
|
51
|
+
|
52
|
+
alias new_preamble_port new_body_port
|
53
|
+
alias new_part_port new_body_port
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
DEFAULT_CONFIG = Config.new(false)
|
58
|
+
DEFAULT_STRICT_CONFIG = Config.new(true)
|
59
|
+
|
60
|
+
def Config.to_config( arg )
|
61
|
+
return DEFAULT_STRICT_CONFIG if arg == true
|
62
|
+
return DEFAULT_CONFIG if arg == false
|
63
|
+
arg or DEFAULT_CONFIG
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
#:startdoc:
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#:stopdoc:
|
2
|
+
unless Object.respond_to?(:blank?)
|
3
|
+
class Object
|
4
|
+
# Check first to see if we are in a Rails environment, no need to
|
5
|
+
# define these methods if we are
|
6
|
+
|
7
|
+
# An object is blank if it's nil, empty, or a whitespace string.
|
8
|
+
# For example, "", " ", nil, [], and {} are blank.
|
9
|
+
#
|
10
|
+
# This simplifies
|
11
|
+
# if !address.nil? && !address.empty?
|
12
|
+
# to
|
13
|
+
# if !address.blank?
|
14
|
+
def blank?
|
15
|
+
if respond_to?(:empty?) && respond_to?(:strip)
|
16
|
+
empty? or strip.empty?
|
17
|
+
elsif respond_to?(:empty?)
|
18
|
+
empty?
|
19
|
+
else
|
20
|
+
!self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class NilClass
|
26
|
+
def blank?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class FalseClass
|
32
|
+
def blank?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class TrueClass
|
38
|
+
def blank?
|
39
|
+
false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Array
|
44
|
+
alias_method :blank?, :empty?
|
45
|
+
end
|
46
|
+
|
47
|
+
class Hash
|
48
|
+
alias_method :blank?, :empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
class String
|
52
|
+
def blank?
|
53
|
+
empty? || strip.empty?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Numeric
|
58
|
+
def blank?
|
59
|
+
false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
#:startdoc:
|
@@ -0,0 +1,581 @@
|
|
1
|
+
#--
|
2
|
+
# = COPYRIGHT:
|
3
|
+
#
|
4
|
+
# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
#
|
25
|
+
# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
|
26
|
+
# with permission of Minero Aoki.
|
27
|
+
#++
|
28
|
+
#:stopdoc:
|
29
|
+
require 'nkf'
|
30
|
+
require 'tmail/base64'
|
31
|
+
require 'tmail/stringio'
|
32
|
+
require 'tmail/utils'
|
33
|
+
#:startdoc:
|
34
|
+
|
35
|
+
|
36
|
+
module TMail
|
37
|
+
|
38
|
+
#:stopdoc:
|
39
|
+
class << self
|
40
|
+
attr_accessor :KCODE
|
41
|
+
end
|
42
|
+
self.KCODE = 'NONE'
|
43
|
+
|
44
|
+
module StrategyInterface
|
45
|
+
|
46
|
+
def create_dest( obj )
|
47
|
+
case obj
|
48
|
+
when nil
|
49
|
+
StringOutput.new
|
50
|
+
when String
|
51
|
+
StringOutput.new(obj)
|
52
|
+
when IO, StringOutput
|
53
|
+
obj
|
54
|
+
else
|
55
|
+
raise TypeError, 'cannot handle this type of object for dest'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
module_function :create_dest
|
59
|
+
|
60
|
+
#:startdoc:
|
61
|
+
# Returns the TMail object encoded and ready to be sent via SMTP etc.
|
62
|
+
# You should call this before you are packaging up your email to
|
63
|
+
# correctly escape all the values that need escaping in the email, line
|
64
|
+
# wrap the email etc.
|
65
|
+
#
|
66
|
+
# It is also a good idea to call this before you marshal or serialize
|
67
|
+
# a TMail object.
|
68
|
+
#
|
69
|
+
# For Example:
|
70
|
+
#
|
71
|
+
# email = TMail::Load(my_email_file)
|
72
|
+
# email_to_send = email.encoded
|
73
|
+
def encoded( eol = "\r\n", charset = 'j', dest = nil )
|
74
|
+
accept_strategy Encoder, eol, charset, dest
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns the TMail object decoded and ready to be used by you, your
|
78
|
+
# program etc.
|
79
|
+
#
|
80
|
+
# You should call this before you are packaging up your email to
|
81
|
+
# correctly escape all the values that need escaping in the email, line
|
82
|
+
# wrap the email etc.
|
83
|
+
#
|
84
|
+
# For Example:
|
85
|
+
#
|
86
|
+
# email = TMail::Load(my_email_file)
|
87
|
+
# email_to_send = email.encoded
|
88
|
+
def decoded( eol = "\n", charset = 'e', dest = nil )
|
89
|
+
# Turn the E-Mail into a string and return it with all
|
90
|
+
# encoded characters decoded. alias for to_s
|
91
|
+
accept_strategy Decoder, eol, charset, dest
|
92
|
+
end
|
93
|
+
|
94
|
+
alias to_s decoded
|
95
|
+
|
96
|
+
def accept_strategy( klass, eol, charset, dest = nil ) #:nodoc:
|
97
|
+
dest ||= ''
|
98
|
+
accept klass.new( create_dest(dest), charset, eol )
|
99
|
+
dest
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
#:stopdoc:
|
105
|
+
|
106
|
+
###
|
107
|
+
### MIME B encoding decoder
|
108
|
+
###
|
109
|
+
|
110
|
+
class Decoder
|
111
|
+
|
112
|
+
include TextUtils
|
113
|
+
|
114
|
+
encoded = '=\?(?:iso-2022-jp|euc-jp|shift_jis)\?[QB]\?[a-z0-9+/=]+\?='
|
115
|
+
ENCODED_WORDS = /#{encoded}(?:\s+#{encoded})*/i
|
116
|
+
|
117
|
+
OUTPUT_ENCODING = {
|
118
|
+
'EUC' => 'e',
|
119
|
+
'SJIS' => 's',
|
120
|
+
}
|
121
|
+
|
122
|
+
def self.decode( str, encoding = nil )
|
123
|
+
encoding ||= (OUTPUT_ENCODING[TMail.KCODE] || 'j')
|
124
|
+
opt = '-mS' + encoding
|
125
|
+
str.gsub(ENCODED_WORDS) {|s| NKF.nkf(opt, s) }
|
126
|
+
end
|
127
|
+
|
128
|
+
def initialize( dest, encoding = nil, eol = "\n" )
|
129
|
+
@f = StrategyInterface.create_dest(dest)
|
130
|
+
@encoding = (/\A[ejs]/ === encoding) ? encoding[0,1] : nil
|
131
|
+
@eol = eol
|
132
|
+
end
|
133
|
+
|
134
|
+
def decode( str )
|
135
|
+
self.class.decode(str, @encoding)
|
136
|
+
end
|
137
|
+
private :decode
|
138
|
+
|
139
|
+
def terminate
|
140
|
+
end
|
141
|
+
|
142
|
+
def header_line( str )
|
143
|
+
@f << decode(str)
|
144
|
+
end
|
145
|
+
|
146
|
+
def header_name( nm )
|
147
|
+
@f << nm << ': '
|
148
|
+
end
|
149
|
+
|
150
|
+
def header_body( str )
|
151
|
+
@f << decode(str)
|
152
|
+
end
|
153
|
+
|
154
|
+
def space
|
155
|
+
@f << ' '
|
156
|
+
end
|
157
|
+
|
158
|
+
alias spc space
|
159
|
+
|
160
|
+
def lwsp( str )
|
161
|
+
@f << str
|
162
|
+
end
|
163
|
+
|
164
|
+
def meta( str )
|
165
|
+
@f << str
|
166
|
+
end
|
167
|
+
|
168
|
+
def text( str )
|
169
|
+
@f << decode(str)
|
170
|
+
end
|
171
|
+
|
172
|
+
def phrase( str )
|
173
|
+
@f << quote_phrase(decode(str))
|
174
|
+
end
|
175
|
+
|
176
|
+
def kv_pair( k, v )
|
177
|
+
v = dquote(v) unless token_safe?(v)
|
178
|
+
@f << k << '=' << v
|
179
|
+
end
|
180
|
+
|
181
|
+
def puts( str = nil )
|
182
|
+
@f << str if str
|
183
|
+
@f << @eol
|
184
|
+
end
|
185
|
+
|
186
|
+
def write( str )
|
187
|
+
@f << str
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
|
193
|
+
###
|
194
|
+
### MIME B-encoding encoder
|
195
|
+
###
|
196
|
+
|
197
|
+
#
|
198
|
+
# FIXME: This class can handle only (euc-jp/shift_jis -> iso-2022-jp).
|
199
|
+
#
|
200
|
+
class Encoder
|
201
|
+
|
202
|
+
include TextUtils
|
203
|
+
|
204
|
+
BENCODE_DEBUG = false unless defined?(BENCODE_DEBUG)
|
205
|
+
|
206
|
+
def Encoder.encode( str )
|
207
|
+
e = new()
|
208
|
+
e.header_body str
|
209
|
+
e.terminate
|
210
|
+
e.dest.string
|
211
|
+
end
|
212
|
+
|
213
|
+
SPACER = "\t"
|
214
|
+
MAX_LINE_LEN = 78
|
215
|
+
RFC_2822_MAX_LENGTH = 998
|
216
|
+
|
217
|
+
OPTIONS = {
|
218
|
+
'EUC' => '-Ej -m0',
|
219
|
+
'SJIS' => '-Sj -m0',
|
220
|
+
'UTF8' => nil, # FIXME
|
221
|
+
'NONE' => nil
|
222
|
+
}
|
223
|
+
|
224
|
+
def initialize( dest = nil, encoding = nil, eol = "\r\n", limit = nil )
|
225
|
+
@f = StrategyInterface.create_dest(dest)
|
226
|
+
@opt = OPTIONS[TMail.KCODE]
|
227
|
+
@eol = eol
|
228
|
+
@folded = false
|
229
|
+
@preserve_quotes = true
|
230
|
+
reset
|
231
|
+
end
|
232
|
+
|
233
|
+
def preserve_quotes=( bool )
|
234
|
+
@preserve_quotes
|
235
|
+
end
|
236
|
+
|
237
|
+
def preserve_quotes
|
238
|
+
@preserve_quotes
|
239
|
+
end
|
240
|
+
|
241
|
+
def normalize_encoding( str )
|
242
|
+
if @opt
|
243
|
+
then NKF.nkf(@opt, str)
|
244
|
+
else str
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def reset
|
249
|
+
@text = ''
|
250
|
+
@lwsp = ''
|
251
|
+
@curlen = 0
|
252
|
+
end
|
253
|
+
|
254
|
+
def terminate
|
255
|
+
add_lwsp ''
|
256
|
+
reset
|
257
|
+
end
|
258
|
+
|
259
|
+
def dest
|
260
|
+
@f
|
261
|
+
end
|
262
|
+
|
263
|
+
def puts( str = nil )
|
264
|
+
@f << str if str
|
265
|
+
@f << @eol
|
266
|
+
end
|
267
|
+
|
268
|
+
def write( str )
|
269
|
+
@f << str
|
270
|
+
end
|
271
|
+
|
272
|
+
#
|
273
|
+
# add
|
274
|
+
#
|
275
|
+
|
276
|
+
def header_line( line )
|
277
|
+
scanadd line
|
278
|
+
end
|
279
|
+
|
280
|
+
def header_name( name )
|
281
|
+
add_text name.split(/-/).map {|i| i.capitalize }.join('-')
|
282
|
+
add_text ':'
|
283
|
+
add_lwsp ' '
|
284
|
+
end
|
285
|
+
|
286
|
+
def header_body( str )
|
287
|
+
scanadd normalize_encoding(str)
|
288
|
+
end
|
289
|
+
|
290
|
+
def space
|
291
|
+
add_lwsp ' '
|
292
|
+
end
|
293
|
+
|
294
|
+
alias spc space
|
295
|
+
|
296
|
+
def lwsp( str )
|
297
|
+
add_lwsp str.sub(/[\r\n]+[^\r\n]*\z/, '')
|
298
|
+
end
|
299
|
+
|
300
|
+
def meta( str )
|
301
|
+
add_text str
|
302
|
+
end
|
303
|
+
|
304
|
+
def text( str )
|
305
|
+
scanadd normalize_encoding(str)
|
306
|
+
end
|
307
|
+
|
308
|
+
def phrase( str )
|
309
|
+
str = normalize_encoding(str)
|
310
|
+
if CONTROL_CHAR === str
|
311
|
+
scanadd str
|
312
|
+
else
|
313
|
+
add_text quote_phrase(str)
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
# FIXME: implement line folding
|
318
|
+
#
|
319
|
+
def kv_pair( k, v )
|
320
|
+
return if v.nil?
|
321
|
+
v = normalize_encoding(v)
|
322
|
+
if token_safe?(v)
|
323
|
+
add_text k + '=' + v
|
324
|
+
elsif not CONTROL_CHAR === v
|
325
|
+
add_text k + '=' + quote_token(v)
|
326
|
+
else
|
327
|
+
# apply RFC2231 encoding
|
328
|
+
kv = k + '*=' + "iso-2022-jp'ja'" + encode_value(v)
|
329
|
+
add_text kv
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
def encode_value( str )
|
334
|
+
str.gsub(TOKEN_UNSAFE) {|s| '%%%02x' % s[0] }
|
335
|
+
end
|
336
|
+
|
337
|
+
private
|
338
|
+
|
339
|
+
def scanadd( str, force = false )
|
340
|
+
types = ''
|
341
|
+
strs = []
|
342
|
+
if str.respond_to?(:encoding)
|
343
|
+
enc = str.encoding
|
344
|
+
str.force_encoding(Encoding::ASCII_8BIT)
|
345
|
+
end
|
346
|
+
until str.empty?
|
347
|
+
if m = /\A[^\e\t\r\n ]+/.match(str)
|
348
|
+
types << (force ? 'j' : 'a')
|
349
|
+
if str.respond_to?(:encoding)
|
350
|
+
strs.push m[0].force_encoding(enc)
|
351
|
+
else
|
352
|
+
strs.push m[0]
|
353
|
+
end
|
354
|
+
elsif m = /\A[\t\r\n ]+/.match(str)
|
355
|
+
types << 's'
|
356
|
+
if str.respond_to?(:encoding)
|
357
|
+
strs.push m[0].force_encoding(enc)
|
358
|
+
else
|
359
|
+
strs.push m[0]
|
360
|
+
end
|
361
|
+
|
362
|
+
elsif m = /\A\e../.match(str)
|
363
|
+
esc = m[0]
|
364
|
+
str = m.post_match
|
365
|
+
if esc != "\e(B" and m = /\A[^\e]+/.match(str)
|
366
|
+
types << 'j'
|
367
|
+
if str.respond_to?(:encoding)
|
368
|
+
strs.push m[0].force_encoding(enc)
|
369
|
+
else
|
370
|
+
strs.push m[0]
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
else
|
375
|
+
raise 'TMail FATAL: encoder scan fail'
|
376
|
+
end
|
377
|
+
(str = m.post_match) unless m.nil?
|
378
|
+
end
|
379
|
+
|
380
|
+
do_encode types, strs
|
381
|
+
end
|
382
|
+
|
383
|
+
def do_encode( types, strs )
|
384
|
+
#
|
385
|
+
# result : (A|E)(S(A|E))*
|
386
|
+
# E : W(SW)*
|
387
|
+
# W : (J|A)+ but must contain J # (J|A)*J(J|A)*
|
388
|
+
# A : <<A character string not to be encoded>>
|
389
|
+
# J : <<A character string to be encoded>>
|
390
|
+
# S : <<LWSP>>
|
391
|
+
#
|
392
|
+
# An encoding unit is `E'.
|
393
|
+
# Input (parameter `types') is (J|A)(J|A|S)*(J|A)
|
394
|
+
#
|
395
|
+
if BENCODE_DEBUG
|
396
|
+
puts
|
397
|
+
puts '-- do_encode ------------'
|
398
|
+
puts types.split(//).join(' ')
|
399
|
+
p strs
|
400
|
+
end
|
401
|
+
|
402
|
+
e = /[ja]*j[ja]*(?:s[ja]*j[ja]*)*/
|
403
|
+
|
404
|
+
while m = e.match(types)
|
405
|
+
pre = m.pre_match
|
406
|
+
concat_A_S pre, strs[0, pre.size] unless pre.empty?
|
407
|
+
concat_E m[0], strs[m.begin(0) ... m.end(0)]
|
408
|
+
types = m.post_match
|
409
|
+
strs.slice! 0, m.end(0)
|
410
|
+
end
|
411
|
+
concat_A_S types, strs
|
412
|
+
end
|
413
|
+
|
414
|
+
def concat_A_S( types, strs )
|
415
|
+
if RUBY_VERSION < '1.9'
|
416
|
+
a = ?a; s = ?s
|
417
|
+
else
|
418
|
+
a = 'a'.ord; s = 's'.ord
|
419
|
+
end
|
420
|
+
i = 0
|
421
|
+
types.each_byte do |t|
|
422
|
+
case t
|
423
|
+
when a then add_text strs[i]
|
424
|
+
when s then add_lwsp strs[i]
|
425
|
+
else
|
426
|
+
raise "TMail FATAL: unknown flag: #{t.chr}"
|
427
|
+
end
|
428
|
+
i += 1
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
METHOD_ID = {
|
433
|
+
?j => :extract_J,
|
434
|
+
?e => :extract_E,
|
435
|
+
?a => :extract_A,
|
436
|
+
?s => :extract_S
|
437
|
+
}
|
438
|
+
|
439
|
+
def concat_E( types, strs )
|
440
|
+
if BENCODE_DEBUG
|
441
|
+
puts '---- concat_E'
|
442
|
+
puts "types=#{types.split(//).join(' ')}"
|
443
|
+
puts "strs =#{strs.inspect}"
|
444
|
+
end
|
445
|
+
|
446
|
+
flush() unless @text.empty?
|
447
|
+
|
448
|
+
chunk = ''
|
449
|
+
strs.each_with_index do |s,i|
|
450
|
+
mid = METHOD_ID[types[i]]
|
451
|
+
until s.empty?
|
452
|
+
unless c = __send__(mid, chunk.size, s)
|
453
|
+
add_with_encode chunk unless chunk.empty?
|
454
|
+
flush
|
455
|
+
chunk = ''
|
456
|
+
fold
|
457
|
+
c = __send__(mid, 0, s)
|
458
|
+
raise 'TMail FATAL: extract fail' unless c
|
459
|
+
end
|
460
|
+
chunk << c
|
461
|
+
end
|
462
|
+
end
|
463
|
+
add_with_encode chunk unless chunk.empty?
|
464
|
+
end
|
465
|
+
|
466
|
+
def extract_J( chunksize, str )
|
467
|
+
size = max_bytes(chunksize, str.size) - 6
|
468
|
+
size = (size % 2 == 0) ? (size) : (size - 1)
|
469
|
+
return nil if size <= 0
|
470
|
+
if str.respond_to?(:encoding)
|
471
|
+
enc = str.encoding
|
472
|
+
str.force_encoding(Encoding::ASCII_8BIT)
|
473
|
+
"\e$B#{str.slice!(0, size)}\e(B".force_encoding(enc)
|
474
|
+
else
|
475
|
+
"\e$B#{str.slice!(0, size)}\e(B"
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
def extract_A( chunksize, str )
|
480
|
+
size = max_bytes(chunksize, str.size)
|
481
|
+
return nil if size <= 0
|
482
|
+
str.slice!(0, size)
|
483
|
+
end
|
484
|
+
|
485
|
+
alias extract_S extract_A
|
486
|
+
|
487
|
+
def max_bytes( chunksize, ssize )
|
488
|
+
(restsize() - '=?iso-2022-jp?B??='.size) / 4 * 3 - chunksize
|
489
|
+
end
|
490
|
+
|
491
|
+
#
|
492
|
+
# free length buffer
|
493
|
+
#
|
494
|
+
|
495
|
+
def add_text( str )
|
496
|
+
@text << str
|
497
|
+
# puts '---- text -------------------------------------'
|
498
|
+
# puts "+ #{str.inspect}"
|
499
|
+
# puts "txt >>>#{@text.inspect}<<<"
|
500
|
+
end
|
501
|
+
|
502
|
+
def add_with_encode( str )
|
503
|
+
@text << "=?iso-2022-jp?B?#{Base64.encode(str)}?="
|
504
|
+
end
|
505
|
+
|
506
|
+
def add_lwsp( lwsp )
|
507
|
+
# puts '---- lwsp -------------------------------------'
|
508
|
+
# puts "+ #{lwsp.inspect}"
|
509
|
+
fold if restsize() <= 0
|
510
|
+
flush(@folded)
|
511
|
+
@lwsp = lwsp
|
512
|
+
end
|
513
|
+
|
514
|
+
def flush(folded = false)
|
515
|
+
# puts '---- flush ----'
|
516
|
+
# puts "spc >>>#{@lwsp.inspect}<<<"
|
517
|
+
# puts "txt >>>#{@text.inspect}<<<"
|
518
|
+
@f << @lwsp << @text
|
519
|
+
if folded
|
520
|
+
@curlen = 0
|
521
|
+
else
|
522
|
+
@curlen += (@lwsp.size + @text.size)
|
523
|
+
end
|
524
|
+
@text = ''
|
525
|
+
@lwsp = ''
|
526
|
+
end
|
527
|
+
|
528
|
+
def fold
|
529
|
+
# puts '---- fold ----'
|
530
|
+
unless @f.string =~ /^.*?:$/
|
531
|
+
@f << @eol
|
532
|
+
@lwsp = SPACER
|
533
|
+
else
|
534
|
+
fold_header
|
535
|
+
@folded = true
|
536
|
+
end
|
537
|
+
@curlen = 0
|
538
|
+
end
|
539
|
+
|
540
|
+
def fold_header
|
541
|
+
# Called because line is too long - so we need to wrap.
|
542
|
+
# First look for whitespace in the text
|
543
|
+
# if it has text, fold there
|
544
|
+
# check the remaining text, if too long, fold again
|
545
|
+
# if it doesn't, then don't fold unless the line goes beyond 998 chars
|
546
|
+
|
547
|
+
# Check the text to see if there is whitespace, or if not
|
548
|
+
@wrapped_text = []
|
549
|
+
until @text.blank?
|
550
|
+
fold_the_string
|
551
|
+
end
|
552
|
+
@text = @wrapped_text.join("#{@eol}#{SPACER}")
|
553
|
+
end
|
554
|
+
|
555
|
+
def fold_the_string
|
556
|
+
whitespace_location = @text =~ /\s/ || @text.length
|
557
|
+
# Is the location of the whitespace shorter than the RCF_2822_MAX_LENGTH?
|
558
|
+
# if there is no whitespace in the string, then this
|
559
|
+
unless mazsize(whitespace_location) <= 0
|
560
|
+
@text.strip!
|
561
|
+
@wrapped_text << @text.slice!(0...whitespace_location)
|
562
|
+
# If it is not less, we have to wrap it destructively
|
563
|
+
else
|
564
|
+
slice_point = RFC_2822_MAX_LENGTH - @curlen - @lwsp.length
|
565
|
+
@text.strip!
|
566
|
+
@wrapped_text << @text.slice!(0...slice_point)
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
def restsize
|
571
|
+
MAX_LINE_LEN - (@curlen + @lwsp.size + @text.size)
|
572
|
+
end
|
573
|
+
|
574
|
+
def mazsize(whitespace_location)
|
575
|
+
# Per RFC2822, the maximum length of a line is 998 chars
|
576
|
+
RFC_2822_MAX_LENGTH - (@curlen + @lwsp.size + whitespace_location)
|
577
|
+
end
|
578
|
+
|
579
|
+
end
|
580
|
+
#:startdoc:
|
581
|
+
end # module TMail
|