From: Gaute Hope <eg@gaute.vetsj.com>
To: Sup Talk <sup-talk@rubyforge.org>
Subject: updated before-poll hook for offlineimap
Date: Wed, 09 Sep 2009 10:49:21 +0200 [thread overview]
Message-ID: <1252485986-sup-4958@qwerzila> (raw)
[-- Attachment #1: Type: text/plain, Size: 792 bytes --]
Greetings,
Here's an updated before-poll.rb hook for offlineimap working with
latest git. I'm suppressing some nasty python deprecation errors as
well.
before-poll.rb:
def offlineimap(*folders)
cmd = "offlineimap -u Noninteractive.Basic 2>&1"
cmd << " -f #{folders * ','}" unless folders.compact.empty?
`#{cmd}`
end
def folder_names(sources)
sources.map { |s| s.uri.split('/').last }
end
def inbox_sources(sources = SourceManager.sources)
sources.find_all { |s| !s.archived? }.sort_by {|s| s.id }
end
if (@last_fetch || Time.at(0)) < Time.now - 120
say "Running offlineimap..."
# only check non-auto-archived sources on the first run
log offlineimap(@last_fetch ? nil : folder_names(inbox_sources))
say "Finished offlineimap."
end
@last_fetch = Time.now
Cheers, Gaute
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
WARNING: multiple messages have this Message-ID
From: eg@gaute.vetsj.com (Gaute Hope)
Subject: [sup-talk] updated before-poll hook for offlineimap
Date: Wed, 09 Sep 2009 10:49:21 +0200 [thread overview]
Message-ID: <1252485986-sup-4958@qwerzila> (raw)
Message-ID: <20090909084921.U-4JykwJ3Gsnmw6cBWhLvhSO-raNlCCQwsqnpnaOlDY@z> (raw)
Greetings,
Here's an updated before-poll.rb hook for offlineimap working with
latest git. I'm suppressing some nasty python deprecation errors as
well.
before-poll.rb:
def offlineimap(*folders)
cmd = "offlineimap -u Noninteractive.Basic 2>&1"
cmd << " -f #{folders * ','}" unless folders.compact.empty?
`#{cmd}`
end
def folder_names(sources)
sources.map { |s| s.uri.split('/').last }
end
def inbox_sources(sources = SourceManager.sources)
sources.find_all { |s| !s.archived? }.sort_by {|s| s.id }
end
if (@last_fetch || Time.at(0)) < Time.now - 120
say "Running offlineimap..."
# only check non-auto-archived sources on the first run
log offlineimap(@last_fetch ? nil : folder_names(inbox_sources))
say "Finished offlineimap."
end
@last_fetch = Time.now
Cheers, Gaute
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090909/1b71019d/attachment.bin>
next reply other threads:[~2009-09-09 8:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 8:49 Gaute Hope [this message]
2009-09-09 8:49 ` [sup-talk] " Gaute Hope
2009-09-09 17:37 ` Gaute Hope
2009-09-09 17:37 ` [sup-talk] " Gaute Hope
2009-09-10 14:34 ` William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1252485986-sup-4958@qwerzila \
--to=eg@gaute.vetsj.com \
--cc=sup-talk@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox