From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (c96364BC1.dhcp.bluecom.no [193.75.54.150]) by mx.google.com with ESMTPS id 5sm3469948eyh.42.2009.09.09.10.37.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Sep 2009 10:37:17 -0700 (PDT) Subject: Re: updated before-poll hook for offlineimap From: Gaute Hope To: Sup Talk In-reply-to: <1252485986-sup-4958@qwerzila> References: <1252485986-sup-4958@qwerzila> Date: Wed, 09 Sep 2009 19:37:29 +0200 Message-Id: <1252517773-sup-6259@qwerzila> User-Agent: Sup/git Content-Transfer-Encoding: 8bit Content-Type: multipart/signed; micalg="pgp-sha1"; boundary="=-1252517852-76590-23350-5845-1-="; protocol="application/pgp-signature" MIME-Version: 1.0 --=-1252517852-76590-23350-5845-1-= Content-Type: text/plain; charset=UTF-8 Greetings, It seems like the before-poll.rb hooks is not run when i manually poll for messages; pressing P. Could this be correct? Running 8903cdedc81 - gaute Excerpts from Gaute Hope's message of on. sep. 09 10:49:21 +0200 2009: > 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 --=-1252517852-76590-23350-5845-1-= Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkqn59kACgkQCLbddHnmqqbBiQCgkaUTyuLeV0j3xjI8eaHj9zks PUsAn3Q+QSlDPCzJaISP+u8xpIjPRm0a =kTuT -----END PGP SIGNATURE----- --=-1252517852-76590-23350-5845-1-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: eg@gaute.vetsj.com (Gaute Hope) Date: Wed, 09 Sep 2009 19:37:29 +0200 Subject: [sup-talk] updated before-poll hook for offlineimap In-Reply-To: <1252485986-sup-4958@qwerzila> References: <1252485986-sup-4958@qwerzila> Message-ID: <1252517773-sup-6259@qwerzila> Message-ID: <20090909173729.6lvgjYEXp8dfOhEB1zx9K0vhyQx8gGM1cRnIS_ceX4c@z> Greetings, It seems like the before-poll.rb hooks is not run when i manually poll for messages; pressing P. Could this be correct? Running 8903cdedc81 - gaute Excerpts from Gaute Hope's message of on. sep. 09 10:49:21 +0200 2009: > 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: