{ "info": { "author": "Ross Patterson", "author_email": "me@rpatterson.net", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "===================\nrpatterson.mailsync\n===================\n\nIntegration between mswatch, OfflineIMAP, and Gnus for realtime mail\n\n.. contents::\n\nThis package provides some scripts that wrap parts of mswatch and\nOfflineIMAP and integrate with Gnus to provide a local maildir that\nis synchronized with a remote maildir as changes occur, instead of\npolling on a regular basis. This provides for near instant delivery\nof new mail while also reducing resource utilization. Integration\nwith the Emacs mail and newsreader, Gnus, is also provided in such a\nway that your single threaded Emacs process is blocked much less as\nchanges occur to the maildirs.\n\nRequirements\n============\n\n* `mswatch `_\n* `OfflineIMAP `_\n* `Gnus `_\n\nActually, they're all kinda optional. The OfflineIMAP sync wrapper\nscript can be used with mswatch without Gnus. The Gnus checkers can\nbe used without OfflineIMAP. For that matter, the OfflineIMAP sync\nwrapper script can be used without mswatch, but why would you? :)\n\nInstallation\n============\n\nAll you need is easy_install_::\n\n $ easy_install rpatterson.mailsync\n\nThe mailsync-gnus.el library will be installed in the site-lisp\ndirectory in the egg. To use the library, you'll need to add this\npath to your emacs load-path. It should be something like the\nfollowing but be sure to substitute the question marks with the\nappropriate values for your version of Python, the version of\nrpatterson.mailsync, and your easy_install site-dirs::\n\n /usr/lib/python?.?/site-packages/rpatterson.mailsync-?-py?.?.egg/site-lisp/\n\nAlternatively, if you have a /usr/local/emacs/site-lisp directory, the\nmailsync-gnus.el library can be installed into that directory if you\ninstall rpatterson.mailsync from a source distribution. You can still\nuse easy_install to get the source distribution::\n\n $ easy_install --editable --build-directory=/usr/local/src rpatterson.mailsync\n $ cd /usr/local/src/rpatterson.mailsync/\n $ python setup.py install\n\nOnce the library is on Emacs' load-path, to use the\nmailsync/gnus-check function, you'll need to make sure it's loaded in\nyour Emacs. You can do this by adding the following to your .gnus.el::\n\n (load-library \"mailsync-gnus\")\n\nIf you'll be using mailsync_offlineimap to synchronize your mail,\nstart by configuring OfflineIMAP as per the OfflineIMAP\ndocumentation. Once OfflineIMAP is verified working, verify\nmailsync_offlineimap by running it from the console.\n\nOn any machine where you'll be using the maildir watchers, either with\nor without mswatch, see the mswatch documentation and verify that\nwatch_maildirs works. Install rpatterson.mailsync wherever you want\nto use mailsync_gnus_watch. Run it from the console to test it. It\nshould check all groups in Gnus and output a blank line when it's\nstarted up and then it should check any changed maildir folder groups\nin Gnus when changed and then omit the folder name. Use\n\"mailsync_gnus_watch --help\" to see what options are available to\nmodifying the watcher behavior.\n\nTo use mswatch, see the mswatch documentation but base your\n~/.mswatchrc on the following and see the \"MAILSYNC:\" comments for\nwhat to change::\n\n # minimum time after first queued mailbox change to synchronization (default: 10s)\n #base_delay 10\n \n # minimum time between two syncs or failed attempts (default: 60s)\n #inter_delay 60\n \n # minimum time between two syncs or failed attempts for specific lists\n #inter_delay 30 important_list\n #inter_delay 600 high_volume_list another_list\n \n # maximum waiting time between failed attempts (default: 600s)\n #max_delay 600\n \n # program (and arguments) to run to sync the mail stores (required)\n # sync mswatch-sync\n \n # MAILSYNC: use the following to have mswatch use your OfflineIMAP\n # setup to sync folders on change.\n sync mailsync_offlineimap\n \n # prefix this string to sync's mailboxes; \n # useful as mbsync channel or OfflineIMAP account.\n # the first string (\"mydomain\") is always prefixed\n # the second string (\":\") is prefixed only when syncing a particular mailbox\n mailbox_prefix foo :\n \n # a store to watch, call it \"local\" (required)\n store local\n {\n \t# program (and args) that will monitor this store for changes (required)\n \t# see 'man watch_maildirs' to tell watch_maildirs where to find mail\n \t# watch watch_maildirs\n \n # MAILSYNC: use the following to have your local Gnus check\n # folders as they change, otherwise, just use the above.\n \twatch mailsync_gnus_watch\n }\n \n # the other store to watch, call it \"mydomain\" (required)\n store foo.com\n {\n \t# program (and args) that will monitor this store for changes (required).\n \t#\n \t# Uses ssh private/public keys to login without password prompting.\n \t# Uses ssh BatchMode so that 'mswatch' promptly detects disconnects.\n \t# Uses 'inputkill' to run 'watch_maildirs' so that 'watch_maildirs'\n \t# promptly exits if the connection dies.\n # watch ssh -o BatchMode=yes foo.com inputkill watch_maildirs\n \n # MAILSYNC: use the following to have your remote Gnus check\n # folders as they change, otherwise, just use the above.\n \twatch ssh -o BatchMode=yes foo.com inputkill mailsync_gnus_watch\n }\n\n.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install\n\n\nTODO\n====\n\n* Use optparse for syncers\n\n Add built-in help and clearer option and argument handling for the\n syncers using optparse.\n\n* Use delay in watchers/checkers\n\n Currently, the checkers run every time the watcher emits a folder\n name. Most maildir changes emit the same folder multiple times\n resulting in the checker running reduntantly. With mswatch, the\n logic for coalescing events using a delay is in the mswatch process.\n To address this problem, that logic would have to be extended to the\n watchers. This is another reason among many for reimplementing\n mswatch.\n\n* Invoke OfflineIMAP in the same process\n\n Currently, mailsync invokes OfflineIMAP as a subprocess which is a\n little wasteful given how heavy launching a python app can be. I\n briefly looked at the OfflineIMAP code to see if it could be easily\n done but was disappointed.\n \n It would be great if any OfflineIMAP people want to show me how I\n can do this.\n\n* Long running syncers\n\n Currently, mswatch invokes the sync process anew every time. Pretty\n much any sync process establishes one or more network connections.\n There's no need to do this every time. Better to have a long\n running sync process that mswatch can feed the folders to sync as\n they require syncing. Implementing this would require modifying or\n reimplementing mswatch itself. It would also require support in the\n sync process. Perhaps OfflineIMAP could be used as a library to\n accomplish this.\n\n* Ignore duplicate maildir notifications\n\n As described_ on the mswatch page, every sync is redundantly issued\n twice. To address this would require modifying or reimplementing\n mswatch itself.\n \n .. _described: http://mswatch.sourceforge.net/#limitations\n\n* maildrop and gnus splitting?\n\n Maybe have maildrop directly invoke Gnus splitting and feed\n incomming messages to be split at time of delivery. This would\n eliminate redundant syncs on the INBOX where gnus would otherwise\n just immediately move the message into another folder. This\n approach is, however, probably way to heavy for a maildrop pipeline.\n \n An alternative approach would be to use a maildir (~/Incomming)\n separate from the real INBOX maildir (~/Maildir) where mails would\n first be delivered. This incomming maildir could be monitored using\n a checker/watcher whose only real purpose is to get gnus to check\n the incomming maildir and split messages. The split would then move\n the message to the destination or fallback to the real INBOX maildir\n which would in turn trigger any real watchers/checkers used by\n mswatch.\n \n This approach requires no additional mailsync support. It also\n keeps maildrop job small and light, decoupling the gnus splitting\n work from delivery.\n \n An advantage of either approach is that mail would be split on the\n server even when the local mswatch wasn't connected. As it is now,\n mail is only split when mswatch is running or if the Gnus running on\n the server checks all mail periodically.\n\n* Use Gamin\n\n Use Gamin to provide compatibility across the file modification\n services available.\n\n\nChangelog\n=========\n\n0.4 - 2009-06-28\n----------------\n\n* Propogate non-zero return codes from subprocesses so that mswatch\n can know to restart things.\n\n* Don't check if the sync fails, allows mswatch to keep trying to sync\n when offline without constantly making the checkers run\n\n* Add another syncer for offlineimap with a local-only gnus checker\n\n* Translate Gmail and Gnus IMAP folder separators\n\n\n0.3 - 2008-05-13\n----------------\n\n* Clarify and correct documentation\n\n0.2 - 2008-05-07\n----------------\n\n* Fix handling of site-lisp for easy_install\n\n0.1 - 2008-05-01\n----------------\n\n* Initial release\n\n0.0 - Backstory\n---------------\n\nIt is amazing that `MUAs do indeed still suck`_. In my case this is\nexacerbated by a strong preference to use Gnus as my MUA. Thunderbird\nmay be great, but since it lacks good integration with Emacs (and no,\nemacsclient external editor is not enoug), it really doesn't matter.\n\nI began by using nnimap to access dovecot on my server. I was still a\nGnus newbie at that time and I ran into many problems with nnimap. I\ntried using the Gnus agent to address these but then my head and my\nEmacs exploded in unison.\n\nAs many others have before, I moved on to sync the ~/Maildir on my\nserver with a full local copy using OfflineIMAP. Then I setup gnus on\nmy laptop to use nnimap talking to Dovecot running locally on my\nlaptop. This worked fabulously with one exception, I had to choose\nbetween how quickly new mail would show up and how much bandwidth\nOfflineIMAP would use. I'm pretty impatient about my email, so with a\nsync frequency of every minute, I found that OfflineIMAP could easily\nsaturate what little bandwidth was available at a cafe or somesuch.\nLengthening the frequency only improved things slightly since every 5\nminutes or what have you, my web browsing would still slow to a crawl.\nI assume I was also slowing down everyone else, please don't tell\nthem. Still I used this approach for a year or more since I could\nthink of nothing better.\n\nTime went on and I used more and more of Gnus' features. I have a\nbeautiful BBDB fancy splitting setup. I use automatic scoring which\nis just a delight. I agree that Gnus is much too hard to learn and\nconfigure, but in all honesty, it could be even harder and I'd still\nuse Gnus.\n\nLater, with much more Gnus experience under my belt, I blew away my\n.emacs and .gnus.el determined to use nnimap and the agent now that I\nwas more proficient. I set it all up and it all seemed to work but as\ntime went on I kept running into more and more problems. Over and\nover again, the Group buffer would show inaccurate counts of new\nmessages or not show new messages at all. I'd find that articles\nhadn't been downloaded after all so I wasn't able to read them\noffline. I came to resemble a Skinarian pigeon, genuflecting before\nGnus in the face of chaos with mysterious combinations of \"C-u g\" and\n\"M-x gnus-agent-regenerate\". In addition to those and many other\nsmall annoyances, there was still the bandwidth vs check frequency\nissue, only this time every time the mail would be checked my emacs\nwould block as well.\n\nThen I learned about IMAP IDLE and was beside myself with excitement.\nThen I learned that neither OfflineIMAP nor Gnus nnimap supported it\nand that Thunderbird did and I found myself seriously considering\nswitching. Reluctance to leave Gnus, however, kept me googling for\nsome time and eventually I found mswatch. Really a trio of three\nutilities, mswatch uses Linux's file modification notification system\n(inotify or dnotify) to synchronize maildirs as needed.\n\nInitially, I tried mswatch with its intended sync program, mbsync, but\nmbsync cannot sync nested IMAP folders. The author of mswatch was\nkind enough to document clearly the interfaces used for the separate\nprocesses, so I set about writing a script that wraps OfflineIMAP to\nprovide the mswatch interface. For the first time, I finally had a\nmail setup that delivered new mail quickly and didn't consume obscene\namounts of bandwidth.\n\nBut wait, I use Gnus splitting with BBDB, so whenever mail arrived in\nthe INBOX on my server, it would be synced to my laptop which Gnus\nwould then split into its destination and then it would be synced back\nto the server. This little dance doubles the bandwidth consumption.\nFurthermore, I've always wanted my BBDB splitting to be done on my\nserver for those times when I use Gnus in an SSH session or when I\naccess my mail from another IMAP client. So I also wanted to notify\nmy gnus runnong on my server when when mail arrived.\n\nSo then I set about writing a checker script that wraps the mswatch's\nwatcher processes and uses \"emacsclient --eval\" to tell Gnus to check\nthe folder where a change has occurred. On my server, this means the\nmail will be split before notifying the mswatch process that a change\nhas occurred which means that mswatch will also synchronize the folder\nthe message was moved to. No more round trip. This also has the\nadded benefit of keeping Gnus up to date on all of my mail folders\nwithout having to use gnus-demon to periodically check all folders.\nAll in all, *much* faster, very current information, and much less\ninterruptions.\n\nThere are many things about this solution that are hackish and\ninefficient so I'd say it's somewhere between %75 and %80 there, as it\nwere. Given, however, that no previous solution has even broken %50\nI'm happy as a clam for now.\n\n.. _`MUAs do indeed still suck`: http://groups.google.com/group/linux.debian.user/msg/7594165a2b6d1c49", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/rpatterson.mailsync", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "rpatterson.mailsync", "package_url": "https://pypi.org/project/rpatterson.mailsync/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rpatterson.mailsync/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/rpatterson.mailsync" }, "release_url": "https://pypi.org/project/rpatterson.mailsync/0.4/", "requires_dist": null, "requires_python": null, "summary": "Integration between mswatch, OfflineIMAP, and Gnus for realtime mail", "version": "0.4" }, "last_serial": 799057, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "1f4ec305ea2820ab9b788c8da2bee5ae", "sha256": "75195765e82389a13df3c861919e83a4268716ed124826bbc529a2cd84e2f53d" }, "downloads": -1, "filename": "rpatterson.mailsync-0.1.tar.gz", "has_sig": false, "md5_digest": "1f4ec305ea2820ab9b788c8da2bee5ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24574, "upload_time": "2008-05-01T08:07:31", "url": "https://files.pythonhosted.org/packages/4f/fb/b3efa41b8d01819a59dacfac22d071647cb32dcf726f0f67ee2e884ea12e/rpatterson.mailsync-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "c8b3313fd2372c93220a9d097cba2881", "sha256": "2e3159fa76bee7f4f0881c45dfd1219fe0ea37554f12c8efafb77944271ea9df" }, "downloads": -1, "filename": "rpatterson.mailsync-0.2.tar.gz", "has_sig": false, "md5_digest": "c8b3313fd2372c93220a9d097cba2881", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25323, "upload_time": "2008-05-07T19:27:13", "url": "https://files.pythonhosted.org/packages/af/43/9378cb62ae151fa08d19b1daa3d7e8bca5757948ecb695ded5c70069641c/rpatterson.mailsync-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "3ba851316f0cc88447b4e8a96567a20d", "sha256": "ca34788afbc3d3900b3b255194e5e969961f64cd20db6b59a5014ca5eeb87096" }, "downloads": -1, "filename": "rpatterson.mailsync-0.3.tar.gz", "has_sig": false, "md5_digest": "3ba851316f0cc88447b4e8a96567a20d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25855, "upload_time": "2008-05-14T04:22:40", "url": "https://files.pythonhosted.org/packages/fc/38/9dfce0009c7356f4edd1bf864e6b1caea69aecec5c499a16f6eb78af4fd8/rpatterson.mailsync-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "bf03316e9531077d2c68045ff6329436", "sha256": "104737e403129ead9ccce53c00229eddbef18253a0e0970e1dde37b10e9ada64" }, "downloads": -1, "filename": "rpatterson.mailsync-0.4.tar.gz", "has_sig": false, "md5_digest": "bf03316e9531077d2c68045ff6329436", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26464, "upload_time": "2009-06-28T10:26:06", "url": "https://files.pythonhosted.org/packages/a0/c2/969cbeba1fc7fa6785bf57e1b00765c723c155f485e604fc5a0de769e97d/rpatterson.mailsync-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bf03316e9531077d2c68045ff6329436", "sha256": "104737e403129ead9ccce53c00229eddbef18253a0e0970e1dde37b10e9ada64" }, "downloads": -1, "filename": "rpatterson.mailsync-0.4.tar.gz", "has_sig": false, "md5_digest": "bf03316e9531077d2c68045ff6329436", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26464, "upload_time": "2009-06-28T10:26:06", "url": "https://files.pythonhosted.org/packages/a0/c2/969cbeba1fc7fa6785bf57e1b00765c723c155f485e604fc5a0de769e97d/rpatterson.mailsync-0.4.tar.gz" } ] }