Excerpts from Micah Anderson's message of fr. nov. 13 16:53:15 +0100 2009:
>
> The before-poll.rb wiki example[0] seems to be what I am interested in,
> however it doesn't work and provides a traceback. It reads as follows:
>
> def offlineimap(*folders)
> cmd = "offlineimap -q -u Noninteractive.Basic"
> 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 = Index.usual_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 run."
> end
> @last_fetch = Time.now
Im using this modified version; and I filter the folders in
offlineimaprc.
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 - 20
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
- gaute
signature.asc
Description: PGP signature
_______________________________________________ sup-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/sup-talk
