sup

A curses threads-with-tags style email client

sup-website.git

git clone https://supmua.dev/git/sup-website/

community/pipermail-archives/sup-talk/2008-03.txt (126949B) - raw

      1 From wmorgan-sup@masanjin.net  Sat Mar  1 15:37:35 2008
      2 From: wmorgan-sup@masanjin.net (William Morgan)
      3 Date: Sat, 01 Mar 2008 12:37:35 -0800
      4 Subject: [sup-talk] [PATCH] shell commands are now run in a child process
      5 In-Reply-To: <1645600603.20080229224209@rice.edu>
      6 References: <1203961671-sup-8158@south> <1645600603.20080229224209@rice.edu>
      7 Message-ID: <1204401464-sup-9155@south>
      8 
      9 Reformatted excerpts from Christopher Warrington's message of 2008-02-29:
     10 > I've been getting more of these when playing with offlineimap. I
     11 > submitted a bug upstream:
     12 > http://ferret.davebalmain.com/trac/ticket/343
     13 
     14 And it looks like Dave is back maintaining Ferret, so this might
     15 actually get addressed. That's great.
     16 
     17 -- 
     18 William <wmorgan-sup at masanjin.net>
     19 
     20 From wmorgan-sup@masanjin.net  Sun Mar  2 13:08:58 2008
     21 From: wmorgan-sup@masanjin.net (William Morgan)
     22 Date: Sun, 02 Mar 2008 10:08:58 -0800
     23 Subject: [sup-talk] [PATCH] First draft of attachment processing for
     24 	more gmail style searches
     25 In-Reply-To: <1204232994-sup-628@tomsk>
     26 References: <1203972458-sup-5906@tomsk> <1204220051-sup-129@south>
     27 	<1204232994-sup-628@tomsk>
     28 Message-ID: <1204479552-sup-4100@south>
     29 
     30 Reformatted excerpts from Marcus Williams's message of 2008-02-28:
     31 > The only thing I'm a little wary of is the join() I do of the
     32 > attachment filenames for the index (like labels). This means that
     33 > ferret doesnt actually know the difference between two files called
     34 > file1 and file2 and a single file called "file1 file2". Not sure it
     35 > matters that much for this usage though.
     36 
     37 The answer here is to escape the spaces and to use a Ferret custom
     38 analyzer for this field in the index, one that will split only on
     39 non-escaped spaces.
     40 
     41 Something like this (needs testing):
     42 
     43   irb(main):055:0> a = Ferret::Analysis::RegExpAnalyzer.new /([^\s\\]|(\\\s))+/, false
     44   => #<Ferret::Analysis::RegExpAnalyzer:0xb79740fc>
     45   irb(main):056:0> t = a.token_stream :potato, "one\\ two three\\ four"=> #<Ferret::Analysis::TokenStream:0xb79705d8>
     46   irb(main):057:0> t.next
     47   => token["one\ two":0:8:1]
     48   irb(main):058:0> t.next
     49   => token["three\ four":9:20:1]
     50 
     51 Then assign that analyzer to the :attachments field in index.rb circa
     52 line 37, just like I do for :subject and :body.
     53 
     54 You'll have to make sure to do the escaping properly both on user input
     55 at query time, and at storage time to the index.
     56 
     57 > Also I dont repopulate the attachments attribute on the message object
     58 > and I couldnt figure out quite how you do it for labels (through the
     59 > initialise?). 
     60 
     61 Not quite sure what you mean here, but the answer might be: index.rb
     62 line 371 is where we build a Message object from an index entry, and
     63 you'll need to pass in an :attachments attribute (and handle it within
     64 Message#initialize).
     65 
     66 -- 
     67 William <wmorgan-sup at masanjin.net>
     68 
     69 From chrisw@rice.edu  Mon Mar  3 02:07:55 2008
     70 From: chrisw@rice.edu (Christopher Warrington)
     71 Date: Mon, 03 Mar 2008 01:07:55 -0600
     72 Subject: [sup-talk] Maildir source with one message
     73 Message-ID: <1204528063-sup-7345@chris-tablet>
     74 
     75 In playing with offline IMAP and Maildir sources (much faster than a native IMAP source and it can be used offline!), I noticed an odd bug.
     76 
     77 If there is only one message in a Maildir source, neither sup not
     78 sup-sync can see this message. Adding another message makes both
     79 visible messages visible.
     80 
     81 --- here begins speculation ---
     82 
     83 I *THINK* that this has to do with the definitions Source.start_offset
     84 and Source.end_offset. As I understand it, they should define a range
     85 of message ids [start_offset, end_offset).
     86 
     87 Now, when start_offset = end_offset--as is the case when there is only
     88 one message, bad things happen. As I understand the math:
     89 (a,a) = {}
     90 [a,a) = {} *our case
     91 (a,a] = {}
     92 [a,a] = {a.
     93 
     94 Changing maildir.rb:126 from:
     95     @ids.last
     96 to
     97     @ids.last + 1
     98 appears to have fixed the problem without ill-effect.
     99 
    100 Simple inspection of imap.rp leads be to believe that it will have the
    101 same problem.
    102 
    103 A mbox source will have the same problem iff the mbox is empty.
    104 
    105 --- here ends speculation ---
    106 
    107 -- 
    108 Christopher Warrington <chrisw at rice.edu>
    109 
    110 From chrisw@rice.edu  Mon Mar  3 02:42:53 2008
    111 From: chrisw@rice.edu (Christopher Warrington)
    112 Date: Mon, 03 Mar 2008 01:42:53 -0600
    113 Subject: [sup-talk] new in next: faster saving and bigger indexes
    114 In-Reply-To: <1204219351-sup-3340@south>
    115 References: <1203871982-sup-7942@south> <1204138450-sup-1391@chris-tablet>
    116 	<1204219351-sup-3340@south>
    117 Message-ID: <1204530080-sup-987@chris-tablet>
    118 
    119 Excerpts from William Morgan's message of Thu Feb 28 11:23:29 -0600 2008:
    120 >> Now, we have offline(-ish) mode for IMAP. Horray! I can do e-mail
    121 >> on the plane.
    122 > You could always have used offlineimap. :)
    123 
    124 Wow! That's an amazing program! I'm using it now to read and write
    125 e-mail using sup at 30,000 feet (and much quicker than IMAP, too!).
    126 
    127 (Message sent at a paltry 200 feet...)
    128 
    129 -- 
    130 Christopher Warrington <chrisw at rice.edu>
    131 
    132 From chrisw@rice.edu  Mon Mar  3 03:00:33 2008
    133 From: chrisw@rice.edu (Christopher Warrington)
    134 Date: Mon,  3 Mar 2008 02:00:33 -0600
    135 Subject: [sup-talk] [PATCH] fixed off-by-one error in imap.rb and maildir.rb
    136 In-Reply-To: <1204528063-sup-7345@chris-tablet>
    137 References: <1204528063-sup-7345@chris-tablet>
    138 Message-ID: <1204531233-2092-1-git-send-email-chrisw@rice.edu>
    139 
    140 The end_offset reported by imap and maildir sources was incorrect if there was
    141 only one message in the source. Since end_offset is exclusive, we must add one to
    142 the last known id to get include all valid message ids in the range.
    143 ---
    144  lib/sup/imap.rb    |    2 +-
    145  lib/sup/maildir.rb |    2 +-
    146  2 files changed, 2 insertions(+), 2 deletions(-)
    147 
    148 diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb
    149 index e785597..1d36976 100644
    150 --- a/lib/sup/imap.rb
    151 +++ b/lib/sup/imap.rb
    152 @@ -176,7 +176,7 @@ class IMAP < Source
    153  
    154    def end_offset
    155      unsynchronized_scan_mailbox
    156 -    @ids.last
    157 +    @ids.last + 1
    158    end
    159    synchronized :end_offset
    160  
    161 diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
    162 index 5c9600d..584e657 100644
    163 --- a/lib/sup/maildir.rb
    164 +++ b/lib/sup/maildir.rb
    165 @@ -123,7 +123,7 @@ class Maildir < Source
    166  
    167    def end_offset
    168      scan_mailbox :rescan => true
    169 -    @ids.last
    170 +    @ids.last + 1
    171    end
    172  
    173    def pct_done; 100.0 * (@ids.index(cur_offset) || 0).to_f / (@ids.length - 1).to_f; end
    174 -- 
    175 1.5.3.7
    176 
    177 
    178 From chrisw@rice.edu  Mon Mar  3 03:01:20 2008
    179 From: chrisw@rice.edu (Christopher Warrington)
    180 Date: Mon,  3 Mar 2008 02:01:20 -0600
    181 Subject: [sup-talk] [PATCH] updated text and keybinding in
    182 	label-search-results-mode
    183 Message-ID: <1204531280-4048-1-git-send-email-chrisw@rice.edu>
    184 
    185 The text in label-search-results-mode now matches that of search-results-mode.
    186 ---
    187  lib/sup/modes/label-search-results-mode.rb |    4 ++--
    188  1 files changed, 2 insertions(+), 2 deletions(-)
    189 
    190 diff --git a/lib/sup/modes/label-search-results-mode.rb b/lib/sup/modes/label-search-results-mode.rb
    191 index af6831c..bca51d4 100644
    192 --- a/lib/sup/modes/label-search-results-mode.rb
    193 +++ b/lib/sup/modes/label-search-results-mode.rb
    194 @@ -10,12 +10,12 @@ class LabelSearchResultsMode < ThreadIndexMode
    195    end
    196  
    197    register_keymap do |k|
    198 -    k.add :refine_search, "Refine search", '.'
    199 +    k.add :refine_search, "Refine search", '|'
    200    end
    201  
    202    def refine_search
    203      label_query = @labels.size > 1 ? "(#{@labels.join('||')})" : @labels.first
    204 -    query = BufferManager.ask :search, "query: ", "+label:#{label_query} "
    205 +    query = BufferManager.ask :search, "refine query: ", "+label:#{label_query} "
    206      return unless query && query !~ /^\s*$/
    207      SearchResultsMode.spawn_from_query query
    208    end
    209 -- 
    210 1.5.3.7
    211 
    212 
    213 From chrisw@rice.edu  Mon Mar  3 04:33:15 2008
    214 From: chrisw@rice.edu (Christopher Warrington)
    215 Date: Mon, 03 Mar 2008 03:33:15 -0600
    216 Subject: [sup-talk] Newline Issues
    217 Message-ID: <1204536487-sup-9413@chris-tablet>
    218 
    219 Now, I'm running into newline issues.
    220 
    221 When I use offlineimap under Cgywin, the messages are delivered with
    222 CRLF. Sup cannot parse these: it thinks that the body is empty. I know
    223 that sup is seeing the entire message. If I press H, I see all of the
    224 message.
    225 
    226 Shouldn't sup handle CRLF delimited messages? As I understand RFC822,
    227 all headers should be terminated with CRLF.
    228 
    229 Failing that, is anyone well versed enough with offlineimap or python
    230 to tell me how to get it to deliver with LF instead of CRLF?
    231 
    232 -- 
    233 Christopher Warrington <chrisw at rice.edu>
    234 
    235 From marcus-sup@bar-coded.net  Wed Mar  5 05:01:14 2008
    236 From: marcus-sup@bar-coded.net (Marcus Williams)
    237 Date: Wed, 05 Mar 2008 10:01:14 +0000
    238 Subject: [sup-talk] [PATCH] First draft of attachment processing for
    239 	more gmail style searches
    240 In-Reply-To: <1204479552-sup-4100@south>
    241 References: <1203972458-sup-5906@tomsk> <1204220051-sup-129@south>
    242 	<1204232994-sup-628@tomsk> <1204479552-sup-4100@south>
    243 Message-ID: <1204711082-sup-3541@tomsk>
    244 
    245 On 2.3.2008, William Morgan wrote:
    246 > The answer here is to escape the spaces and to use a Ferret custom
    247 > analyzer for this field in the index, one that will split only on
    248 > non-escaped spaces.
    249 [snip]
    250 
    251 Ah, right. Should be easy enough (sup-sync here we come)
    252 
    253 > Not quite sure what you mean here, but the answer might be: index.rb
    254 > line 371 is where we build a Message object from an index entry, and
    255 > you'll need to pass in an :attachments attribute (and handle it within
    256 > Message#initialize).
    257 
    258 Ok thats what I figured in the end.
    259 
    260 ANother question - how do I get sent/drafts to get the attachment
    261 labels? They dont seem to get set up when I attach a file to a
    262 message. Should I just be adding/deleting them in the methods that
    263 deal with adding/deleting attachments in reply mode?
    264 
    265 Thanks
    266 
    267 Marcus
    268 
    269 From marcus-sup@bar-coded.net  Wed Mar  5 05:11:13 2008
    270 From: marcus-sup@bar-coded.net (Marcus Williams)
    271 Date: Wed, 05 Mar 2008 10:11:13 +0000
    272 Subject: [sup-talk] [PATCH] Fix for icon title in gnome terminal (possibly
    273 	others)
    274 Message-ID: <1204711708-sup-3638@tomsk>
    275 
    276 The escape code used for terminal titles works mostly but it doesnt set
    277 the icon title as well [1], which is useful when minimised. This patch makes
    278 the escape code set both window and icon title so the task bar updates
    279 correctly in the gnome terminal (and probably others).
    280 
    281 [1] http://rtfm.etla.org/xterm/ctlseq.html (see Operating System Controls)
    282 ---
    283  lib/sup/buffer.rb |    2 +-
    284  1 files changed, 1 insertions(+), 1 deletions(-)
    285 
    286 diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
    287 index d40a626..978e104 100644
    288 --- a/lib/sup/buffer.rb
    289 +++ b/lib/sup/buffer.rb
    290 @@ -263,7 +263,7 @@ EOS
    291          get_status_and_title @focus_buf # must be called outside of the ncurses lock
    292        end
    293  
    294 -    print "\033]2;#{title}\07" if title && @in_x
    295 +    print "\033]0;#{title}\07" if title && @in_x
    296  
    297      Ncurses.mutex.lock unless opts[:sync] == false
    298  
    299 -- 
    300 1.5.4.1
    301 
    302 
    303 From rodkoch@gmail.com  Thu Mar  6 18:21:18 2008
    304 From: rodkoch@gmail.com (rodneyk)
    305 Date: Thu, 6 Mar 2008 15:21:18 -0800 (PST)
    306 Subject: [sup-talk]  How to search for and mass tag thousands of emails?
    307 Message-ID: <15885391.post@talk.nabble.com>
    308 
    309 
    310 Hi,
    311 I just started using sup, after years of muttng I must say I like it a lot!
    312 I have a giant inbox mbox with thousands of emails which I want to
    313 starting using in sup. I can easily search and tag to categorize them all,
    314 however, I can only tag the current screen full of search results. Is there
    315 a way to tag all the search results, and not just the results on screen?
    316 
    317 Being able to import existing mail and quickly organize is probably
    318 something
    319 most new users will need to do. I also checked out sup from the git repo,
    320 and can run
    321 devel/console, so if this mass tagging can only be done manually, I can do
    322 it, as I'm
    323 pretty proficient with ruby.
    324 
    325 --Rodney
    326 -- 
    327 View this message in context: http://www.nabble.com/How-to-search-for-and-mass-tag-thousands-of-emails--tp15885391p15885391.html
    328 Sent from the SUP Talk mailing list archive at Nabble.com.
    329 
    330 
    331 From manish@gslab.com  Fri Mar  7 02:15:09 2008
    332 From: manish@gslab.com (Manish Sapariya)
    333 Date: Fri, 07 Mar 2008 12:45:09 +0530
    334 Subject: [sup-talk] How to search for and mass tag thousands of emails?
    335 In-Reply-To: <15885391.post@talk.nabble.com>
    336 References: <15885391.post@talk.nabble.com>
    337 Message-ID: <1204874020-sup-2295@alioth.gs-lab.com>
    338 
    339 I did it by writing before-add-message.rb hook and resyncing all
    340 messages. The before-add-message hook allows you to add delete
    341 labels before it indexes the message.
    342 
    343 Hope this helps.
    344 Regards,
    345 Manish
    346 
    347 Excerpts from rodneyk's message of Fri Mar 07 04:51:18 +0530 2008:
    348 > 
    349 > Hi,
    350 > I just started using sup, after years of muttng I must say I like it a lot!
    351 > I have a giant inbox mbox with thousands of emails which I want to
    352 > starting using in sup. I can easily search and tag to categorize them all,
    353 > however, I can only tag the current screen full of search results. Is there
    354 > a way to tag all the search results, and not just the results on screen?
    355 > 
    356 > Being able to import existing mail and quickly organize is probably
    357 > something
    358 > most new users will need to do. I also checked out sup from the git repo,
    359 > and can run
    360 > devel/console, so if this mass tagging can only be done manually, I can do
    361 > it, as I'm
    362 > pretty proficient with ruby.
    363 > 
    364 > --Rodney
    365 
    366 -- 
    367 
    368 From wmorgan-sup@masanjin.net  Fri Mar  7 10:52:40 2008
    369 From: wmorgan-sup@masanjin.net (William Morgan)
    370 Date: Fri, 07 Mar 2008 07:52:40 -0800
    371 Subject: [sup-talk] How to search for and mass tag thousands of emails?
    372 In-Reply-To: <15885391.post@talk.nabble.com>
    373 References: <15885391.post@talk.nabble.com>
    374 Message-ID: <1204904692-sup-7926@south>
    375 
    376 Reformatted excerpts from rodneyk's message of 2008-03-06:
    377 > I have a giant inbox mbox with thousands of emails which I want to
    378 > starting using in sup. I can easily search and tag to categorize them
    379 > all, however, I can only tag the current screen full of search
    380 > results. Is there a way to tag all the search results, and not just
    381 > the results on screen?
    382 
    383 You could do it through the GUI, but that probably won't scale well.
    384 A better approach is to use the before-add-hook as Manish said, or to
    385 use the development console to modify the index directly.
    386 
    387 Feed devel/console.sh something like (untested):
    388 
    389   Index.index.search_each("potato") do |id, score|
    390     m = Index.build_message(id)
    391     puts "[#{id}] [#{m.from}] [#{m.subj}]"
    392     m.add_label :potato
    393     m.save! Index
    394   end
    395 
    396 But there's not really much of a point to labeling the results of a
    397 (simple) search. Labels are good for things that are hard to search for;
    398 for everything else, just trust in the search!
    399 
    400 > Being able to import existing mail and quickly organize is probably
    401 > something most new users will need to do.
    402 
    403 Sup supports auto-labeling folders out of the box, which I think is the
    404 most common transition case.
    405 
    406 > I also checked out sup from the git repo, and can run devel/console,
    407 > so if this mass tagging can only be done manually, I can do it, as I'm
    408 > pretty proficient with ruby.
    409 
    410 The big advantaage of the git repo (the next branch, at least) right now
    411 is that adding labels to a message is much faster.
    412 
    413 -- 
    414 William <wmorgan-sup at masanjin.net>
    415 
    416 From wmorgan-sup@masanjin.net  Sat Mar  8 17:02:06 2008
    417 From: wmorgan-sup@masanjin.net (William Morgan)
    418 Date: Sat, 08 Mar 2008 14:02:06 -0800
    419 Subject: [sup-talk] [PATCH] First draft of attachment processing for
    420 	more gmail style searches
    421 In-Reply-To: <1204711082-sup-3541@tomsk>
    422 References: <1203972458-sup-5906@tomsk> <1204220051-sup-129@south>
    423 	<1204232994-sup-628@tomsk> <1204479552-sup-4100@south>
    424 	<1204711082-sup-3541@tomsk>
    425 Message-ID: <1205013484-sup-7653@south>
    426 
    427 Reformatted excerpts from Marcus Williams's message of 2008-03-05:
    428 > ANother question - how do I get sent/drafts to get the attachment
    429 > labels? They dont seem to get set up when I attach a file to a
    430 > message. Should I just be adding/deleting them in the methods that
    431 > deal with adding/deleting attachments in reply mode?
    432 
    433 Once the message is sent, SentManager.write_sent_message will call
    434 PollManager.add_messages_from, which in turn calls the index.rb code you
    435 tweaked to build the message object that's actually used outside of
    436 edit-message-mode. 
    437 
    438 I've just merged the topic branch that actually make SentManager work
    439 this way down to master (gotta love it when the same changes fix two
    440 different problems!), so if you rebase now, you should be good to go.
    441 
    442 Sorry for the general delay in replying. I've been coding up a little
    443 distributed issue tracker that I think will help me manage Sup a little
    444 better... or at least ensure I don't forget people's suggestions.
    445 
    446 -- 
    447 William <wmorgan-sup at masanjin.net>
    448 
    449 From jh@chabran.fr  Sun Mar  9 09:28:21 2008
    450 From: jh@chabran.fr (Jean-Hadrien CHABRAN)
    451 Date: Sun, 9 Mar 2008 14:28:21 +0100
    452 Subject: [sup-talk] startup crash
    453 Message-ID: <345330030803090628u2ac33bfcn3b8ab30da6b16be3@mail.gmail.com>
    454 
    455 Hello,
    456 
    457 I just discovered sup, and I wanted to give it a try, but sup-config /
    458 sup crash on startup, without any useful informations ( for me )  to
    459 discover why.
    460 
    461 Some informations :
    462 
    463 uname -a : Linux Gradius 2.6.24-gentoo-r2 #3 SMP Wed Feb 20 17:39:36
    464 CET 2008 i686 Intel(R) Pentium(R) 4 CPU 2.60GHz GenuineIntel GNU/Linux
    465 
    466 ruby : ruby 1.8.6 (2007-12-03 patchlevel 113) [i686-linux]
    467 
    468 using sup v0.4, installed with "gem i sup"
    469 
    470 backtrace :
    471 
    472 jh at gradius $ sup-config
    473 /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:7:in
    474 `initialize': no name for account (ArgumentError)
    475         from /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:44:in `new'
    476         from /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:44:in
    477 `add_account'
    478         from /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:26:in
    479 `initialize'
    480         from /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup.rb:98:in `new'
    481         from /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup.rb:98:in `start'
    482         from /usr/lib/ruby/gems/1.8/gems/sup-0.4/bin/sup-config:153
    483         from /usr/bin/sup-config:16:in `load'
    484         from /usr/bin/sup-config:16
    485 
    486 tested on my three gentoo boxes, got same results :(
    487 
    488 -- 
    489 Jean-Hadrien Chabran
    490 
    491 From jh@chabran.fr  Sun Mar  9 10:45:34 2008
    492 From: jh@chabran.fr (Jean-Hadrien CHABRAN)
    493 Date: Sun, 9 Mar 2008 15:45:34 +0100
    494 Subject: [sup-talk] startup crash
    495 In-Reply-To: <345330030803090628u2ac33bfcn3b8ab30da6b16be3@mail.gmail.com>
    496 References: <345330030803090628u2ac33bfcn3b8ab30da6b16be3@mail.gmail.com>
    497 Message-ID: <345330030803090745p1f0c6a14if40f95da893c07c0@mail.gmail.com>
    498 
    499 I just solved the problem on my FreeBSD 6.3, by installing
    500 ruby18-iconv-1.8.6.111,1.
    501 
    502 On my gentoo boxes, iconv seems to be correctly installed
    503 /usr/lib64/ruby/1.8/x86_64-linux/iconv.so, but this is now a
    504 distribution issue.
    505 
    506 But I'm still curious, why this dependency problem is showing itself
    507 in a such odd way ?
    508 
    509 On 3/9/08, Jean-Hadrien CHABRAN <jh at chabran.fr> wrote:
    510 > Hello,
    511 >
    512 >  I just discovered sup, and I wanted to give it a try, but sup-config /
    513 >  sup crash on startup, without any useful informations ( for me )  to
    514 >  discover why.
    515 ---- 8< --- 8< -------------------------------------------------------------------
    516 >
    517 
    518 
    519 -- 
    520 Jean-Hadrien Chabran
    521 Maitre-Oeuvre SEP EFREI
    522 Reponsable Tutorat-L
    523 
    524 From wmorgan-sup@masanjin.net  Sun Mar  9 13:44:07 2008
    525 From: wmorgan-sup@masanjin.net (William Morgan)
    526 Date: Sun, 09 Mar 2008 10:44:07 -0700
    527 Subject: [sup-talk] startup crash
    528 In-Reply-To: <345330030803090745p1f0c6a14if40f95da893c07c0@mail.gmail.com>
    529 References: <345330030803090628u2ac33bfcn3b8ab30da6b16be3@mail.gmail.com>
    530 	<345330030803090745p1f0c6a14if40f95da893c07c0@mail.gmail.com>
    531 Message-ID: <1205082815-sup-7754@south>
    532 
    533 Reformatted excerpts from Jean-Hadrien CHABRAN's message of 2008-03-09:
    534 > But I'm still curious, why this dependency problem is showing itself
    535 > in a such odd way ?
    536 
    537 Not sure. Sup generates the default name value using:
    538 
    539   require 'etc'
    540   Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first
    541 
    542 What does that evaluate to on your system?
    543 
    544 Now that actually could evaluate to nil for a variety of reasons, so
    545 I've fixed the logic to avoid the crash if so. But I'm not sure why it
    546 would be nil due to iconv not being installed.
    547 
    548 -- 
    549 William <wmorgan-sup at masanjin.net>
    550 
    551 From nicolas.pouillard@gmail.com  Mon Mar 10 04:11:17 2008
    552 From: nicolas.pouillard@gmail.com (Nicolas Pouillard)
    553 Date: Mon, 10 Mar 2008 09:11:17 +0100
    554 Subject: [sup-talk] [PATCH] Sort contacts when saving them.
    555 Message-ID: <12051366771380-git-send-email-nicolas.pouillard@gmail.com>
    556 
    557 This makes sup behave more nicely with versionning.
    558 ---
    559  lib/sup/contact.rb |    2 +-
    560  1 files changed, 1 insertions(+), 1 deletions(-)
    561 
    562 diff --git a/lib/sup/contact.rb b/lib/sup/contact.rb
    563 index 8050c06..b0c272e 100644
    564 --- a/lib/sup/contact.rb
    565 +++ b/lib/sup/contact.rb
    566 @@ -51,7 +51,7 @@ class ContactManager
    567  
    568    def save
    569      File.open(@fn, "w") do |f|
    570 -      @p2a.each do |p, a|
    571 +      @p2a.sort_by { |(p, a)| [p.full_address, a] }.each do |(p, a)|
    572          f.puts "#{a || ''}: #{p.full_address}"
    573        end
    574      end
    575 -- 
    576 1.5.3.1.109.gacd69
    577 
    578 
    579 From DMack@Tickets.com  Mon Mar 10 10:01:14 2008
    580 From: DMack@Tickets.com (Mack, Daemian)
    581 Date: Mon, 10 Mar 2008 10:01:14 -0400
    582 Subject: [sup-talk] startup crash
    583 In-Reply-To: <20080310134823.GA24401@lenin>
    584 Message-ID: <61B99676296C5044A1A088C0D0EA1BA801B3C342@syr2k3mail>
    585 
    586 > > But I'm still curious, why this dependency problem is showing itself
    587 
    588 > > in a such odd way ?
    589 > 
    590 > Not sure. Sup generates the default name value using:
    591 > 
    592 >   require 'etc'
    593 >   Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first
    594 > 
    595 > What does that evaluate to on your system?
    596 > 
    597 > Now that actually could evaluate to nil for a variety of 
    598 > reasons, so I've fixed the logic to avoid the crash if so. 
    599 > But I'm not sure why it would be nil due to iconv not being installed.
    600 
    601 I was getting the 'no name for account' message recently too, when
    602 setting up a test sup instance to play with the indexing, and wondered
    603 if it might be related to gecos info. 
    604 
    605 I've tried the test snippet above on three boxes (Debian Etch, Debian
    606 Sarge, Ubuntu 7.10), and it returns the current username when run under
    607 an existing user account. If I add a test user, and run the snippet as
    608 that user, it returns nil. This is true for all three boxes. I
    609 eventually got around it by hardcoding a dummy account name in
    610 account.rb, as I haven't had time to Do The Right Thing and figure out
    611 why ENV["USER"] isn't getting set for new accounts.
    612 
    613 Thanks for sup, incidentally! I'm experimenting with using it to manage
    614 a huge influx of business emails that Outlook makes somewhat annoying.
    615 
    616 
    617 
    618 DJFM
    619 --
    620 Daemian Mack
    621 Configuration Management
    622 Tickets.com
    623 344 W Genesee St
    624 Syracuse NY, 13202
    625 315.479.6663 x476
    626 AIM: daemianmack
    627  
    628 
    629 From wmorgan-sup@masanjin.net  Mon Mar 10 13:12:45 2008
    630 From: wmorgan-sup@masanjin.net (William Morgan)
    631 Date: Mon, 10 Mar 2008 10:12:45 -0700
    632 Subject: [sup-talk] startup crash
    633 In-Reply-To: <61B99676296C5044A1A088C0D0EA1BA801B3C342@syr2k3mail>
    634 References: <61B99676296C5044A1A088C0D0EA1BA801B3C342@syr2k3mail>
    635 Message-ID: <1205168755-sup-7027@south>
    636 
    637 Excerpts from Mack, Daemian's message of Mon Mar 10 07:01:14 -0700 2008:
    638 > This is true for all three boxes. I eventually got around it by
    639 > hardcoding a dummy account name in account.rb, as I haven't had time
    640 > to Do The Right Thing and figure out why ENV["USER"] isn't getting set
    641 > for new accounts.
    642 
    643 Is it really ENV["USER"], or is it the gecos entry being empty?
    644 
    645 At any rate, I think this should also be fixed in the newest git.
    646 
    647 -- 
    648 William <wmorgan-sup at masanjin.net>
    649 
    650 From alexandra@walford.id.au  Tue Mar 11 00:45:43 2008
    651 From: alexandra@walford.id.au (Alexandra Walford)
    652 Date: Tue, 11 Mar 2008 14:45:43 +1000
    653 Subject: [sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id
    654 	called on nil"
    655 Message-ID: <1205210652-sup-1364@amethyst>
    656 
    657 Hi all,
    658 
    659 I am getting frequent sup crashes with "wrong id called on nil" (using the
    660 latest git master), when thread_by_subject is true.
    661 
    662 The crash generally happens when the thread index is being built as a result of
    663 a search, or when opening the inbox (which is really just another sort of
    664 search).
    665 
    666 I have managed to narrow down one particular crash to two messages sent to the
    667 sup-talk list.  If I set up a new maildir containing only those two messages
    668 and a new sup config, accepting all sup-config defaults and changing
    669 thread_by_subject to true, then I can reproduce the crash reliably.  The second
    670 message References: the first message, although the subjects are dissimilar.
    671 
    672 I have attached the two messages, a transcript of my test case session
    673 (including backtrace), and sup-exception-log.txt.  I am not yet familiar enough
    674 with sup or ruby to offer a decent patch; my current fix just hides any thread
    675 which will cause a crash, on line 208 of lib/sup/modes/thread-index-mode.rb in
    676 git master, which is a hopeless workaround really.
    677 
    678 Thanks,
    679 
    680 Alexandra
    681 
    682 -- 
    683 alexandra at walford.id.au
    684 -------------- next part --------------
    685 An embedded and charset-unspecified text was scrubbed...
    686 Name: message1.txt
    687 Url: http://rubyforge.org/pipermail/sup-talk/attachments/20080311/3d1a1cb1/attachment.txt 
    688 -------------- next part --------------
    689 An embedded and charset-unspecified text was scrubbed...
    690 Name: message2.txt
    691 Url: http://rubyforge.org/pipermail/sup-talk/attachments/20080311/3d1a1cb1/attachment-0001.txt 
    692 -------------- next part --------------
    693 An embedded and charset-unspecified text was scrubbed...
    694 Name: sup-exception-log.txt
    695 Url: http://rubyforge.org/pipermail/sup-talk/attachments/20080311/3d1a1cb1/attachment-0002.txt 
    696 -------------- next part --------------
    697 An embedded and charset-unspecified text was scrubbed...
    698 Name: sup-test-case.txt
    699 Url: http://rubyforge.org/pipermail/sup-talk/attachments/20080311/3d1a1cb1/attachment-0003.txt 
    700 
    701 From chrisw@rice.edu  Tue Mar 11 03:06:08 2008
    702 From: chrisw@rice.edu (Christopher Warrington)
    703 Date: Tue, 11 Mar 2008 02:06:08 -0500
    704 Subject: [sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id
    705 	called on nil"
    706 In-Reply-To: <1205210652-sup-1364@amethyst>
    707 References: <1205210652-sup-1364@amethyst>
    708 Message-ID: <521619824.20080311020608@rice.edu>
    709 
    710 
    711 Alexandra Walford @ 2008-3-10 11:45:43 PM
    712 "[sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id  called on nil"" <mid:1205210652-sup-1364 at amethyst>
    713 
    714 > I have managed to narrow down one particular crash to two messages
    715 > sent to the sup-talk list. If I set up a new maildir containing only
    716 > those two messages and a new sup config, accepting all sup-config
    717 > defaults and changing thread_by_subject to true, then I can
    718 > reproduce the crash reliably. The second message References: the
    719 > first message, although the subjects are dissimilar.
    720 
    721 Sorry! :-)
    722 
    723 The first message was created with sup. The second with git's
    724 send-email command. I've not looked at them closely, but the messages
    725 may be malformed.
    726 
    727 -- 
    728 Christopher Warrington <chrisw at rice.edu>
    729 
    730 "The next best thing to being clever is being able to quote someone
    731 who is."
    732 -Mary Poole
    733 -------------- next part --------------
    734 A non-text attachment was scrubbed...
    735 Name: not available
    736 Type: application/pgp-signature
    737 Size: 183 bytes
    738 Desc: not available
    739 Url : http://rubyforge.org/pipermail/sup-talk/attachments/20080311/3ee207f6/attachment.bin 
    740 
    741 From sup-talk@gurski.org  Tue Mar 11 20:51:46 2008
    742 From: sup-talk@gurski.org (Michael Gurski)
    743 Date: Tue, 11 Mar 2008 20:51:46 -0400
    744 Subject: [sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id
    745 	called on nil"
    746 In-Reply-To: <521619824.20080311020608@rice.edu>
    747 References: <1205210652-sup-1364@amethyst> <521619824.20080311020608@rice.edu>
    748 Message-ID: <1205282947-sup-6038@ln>
    749 
    750 Excerpts from Christopher Warrington's message of Tue Mar 11 03:06:08 -0400 2008:
    751 > 
    752 > Alexandra Walford @ 2008-3-10 11:45:43 PM
    753 > "[sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id  called on
    754 > nil"" <mid:1205210652-sup-1364 at amethyst>
    755 > 
    756 > > I have managed to narrow down one particular crash to two messages
    757 > > sent to the sup-talk list. If I set up a new maildir containing only
    758 > > those two messages and a new sup config, accepting all sup-config
    759 > > defaults and changing thread_by_subject to true, then I can
    760 > > reproduce the crash reliably. The second message References: the
    761 > > first message, although the subjects are dissimilar.
    762 > 
    763 > Sorry! :-)
    764 > 
    765 > The first message was created with sup. The second with git's
    766 > send-email command. I've not looked at them closely, but the messages
    767 > may be malformed.
    768 > 
    769 
    770 Interestingly, the crashes I was seeing with the same error seem to
    771 have disappeared now that I've disabled thread_by_subject as well.
    772 Once I get past the huge amount of backlog in mail that I have (who'd
    773 have thought getting married would eat into my copious free time?),
    774 I'll rerun sup and try to get the debugging output from the patch that
    775 I applied to create a sendme.txt when this happens.
    776 
    777 Mike
    778 
    779 
    780 -- 
    781 Michael A. Gurski (opt. [first].)[last]@pobox.com  http://www.pobox.com/~[last]
    782 1024R/39B5BADD PGP: 34 93 A9 94 B1 59 48 B7  17 57 1E 4E 62 56 45 70
    783 1024D/1166213E GPG: 628F 37A4 62AF 1475 45DB  AD81 ADC9 E606 1166 213E
    784 4096R/C0B4F04B GPG: 5B3E 75D7 43CF CF34 4042  7788 1DCE B5EE C0B4 F04B
    785 Views expressed by the host do not reflect the staff, management or sponsors.
    786 
    787 
    788 From marcus-sup@bar-coded.net  Thu Mar 13 06:38:57 2008
    789 From: marcus-sup@bar-coded.net (Marcus Williams)
    790 Date: Thu, 13 Mar 2008 10:38:57 +0000
    791 Subject: [sup-talk] Switching from IMAP to offlineimap and maintaining status
    792 Message-ID: <1205404558-sup-1495@tomsk>
    793 
    794 Hi -
    795 
    796 Having switched to offlineimap at work using sup I want to make the
    797 switch for my out-of-work accounts. Finally had enough of IMAP speed.
    798 Is there any way to maintain my sup status (starred/spam/etc) when I
    799 make the switch? I know I can dump the status of the db, but if I
    800 switch sources is this dump going to be of any use?
    801 
    802 Thanks
    803 
    804 Marcus
    805 
    806 From johnbent@lanl.gov  Thu Mar 13 12:06:30 2008
    807 From: johnbent@lanl.gov (John Bent)
    808 Date: Thu, 13 Mar 2008 10:06:30 -0600
    809 Subject: [sup-talk] forwarded messages
    810 Message-ID: <1205424317-sup-1180@tangerine.lanl.gov>
    811 
    812 Whenever I forward a message, it appears as a new thread.  I always then tag
    813 it and the original and merge them.  Is there a way to make this happen
    814 automagically?  Should that rather be the default behavior?
    815 
    816 Thanks,
    817 
    818 John
    819 
    820 From mml@pobox.com  Fri Mar 14 11:01:41 2008
    821 From: mml@pobox.com (Matt Liggett)
    822 Date: Fri, 14 Mar 2008 11:01:41 -0400
    823 Subject: [sup-talk] viewing threads oldest-first
    824 Message-ID: <1205506459-sup-9596@chain.local>
    825 
    826 Forgive me; I'm just getting started with sup and I'm trying to get
    827 the hang of it, but I have not looked at the source yet, beyond a
    828 cursory glance.
    829 
    830 In every mailer I've used before my gmail days, I always viewed my
    831 email oldest first, especially in any inboxen.  Is there a config
    832 option (I don't see a keyboard shortcut) to do this?
    833 
    834 As I write this, I realize that oldest-first might mean different
    835 things in a threaded view.  Is that the oldest first message in the
    836 thread, or the oldest last message?  Do I generally want inbox threads
    837 sorted by unread messages (that is, ordering by oldest unread message
    838 in each thread)?  I'm not sure I know the answer to either question,
    839 but I'm sure I'd like to be able to try all the choices.
    840 
    841 I will try to start digging in to the code in the next few days,
    842 because I am interested in contributing and making this better, not
    843 least of all for myself.  In the meantime, can anyone give me a
    844 pointer as to where in the code I might start digging regarding such a
    845 feature?
    846 
    847 FWIW, I was a long time mutt user but switched to gmail for search and
    848 tagging.  I missed a lot of things, and I generally felt less able to
    849 deal with large numbers of email conversations on a daily basis, but I
    850 lived with it because "just archive and search" (and to a lesser
    851 extent, tagging) was killer.
    852 
    853 I tried mutt+mairix for awhile, but it was kludgy and slow.  sup looks
    854 like it might be the best of both worlds, enabling me to deal with a
    855 large volume of mail and still giving me the tagging and search that I
    856 love from gmail.  Thanks, William!
    857 
    858 -- 
    859 Matt Liggett <mml at pobox.com>                          http://mml.name/
    860 
    861 From wmorgan-sup@masanjin.net  Fri Mar 14 14:43:21 2008
    862 From: wmorgan-sup@masanjin.net (William Morgan)
    863 Date: Fri, 14 Mar 2008 11:43:21 -0700
    864 Subject: [sup-talk] Switching from IMAP to offlineimap and maintaining
    865 	status
    866 In-Reply-To: <1205404558-sup-1495@tomsk>
    867 References: <1205404558-sup-1495@tomsk>
    868 Message-ID: <1205520043-sup-2321@south>
    869 
    870 Reformatted excerpts from Marcus Williams's message of 2008-03-13:
    871 > Is there any way to maintain my sup status (starred/spam/etc) when I
    872 > make the switch? I know I can dump the status of the db, but if I
    873 > switch sources is this dump going to be of any use?
    874 
    875 The dump should do that for you, since it's keyed directly off of
    876 message id.
    877 
    878 There might be a way to do this without needing to rescan the messages,
    879 but it'll only be useful if the messages have been reindexed since the
    880 speedy-index stuff has been in. LMK if that's the case.
    881 
    882 -- 
    883 William <wmorgan-sup at masanjin.net>
    884 
    885 From wmorgan-sup@masanjin.net  Fri Mar 14 14:51:31 2008
    886 From: wmorgan-sup@masanjin.net (William Morgan)
    887 Date: Fri, 14 Mar 2008 11:51:31 -0700
    888 Subject: [sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id
    889 	called on nil"
    890 In-Reply-To: <1205210652-sup-1364@amethyst>
    891 References: <1205210652-sup-1364@amethyst>
    892 Message-ID: <1205520291-sup-7442@south>
    893 
    894 Reformatted excerpts from Alexandra Walford's message of 2008-03-10:
    895 > I am getting frequent sup crashes with "wrong id called on nil" (using
    896 > the latest git master), when thread_by_subject is true.
    897 
    898 The thread_by_subject stuff is broken and I have a patch to fix it, I
    899 just haven't merged it in yet. I'll try and do this soon. In the mean
    900 time, as you've discovered, turning off thread_by_subj is the
    901 workaround.
    902 
    903 -- 
    904 William <wmorgan-sup at masanjin.net>
    905 
    906 From wmorgan-sup@masanjin.net  Fri Mar 14 14:30:58 2008
    907 From: wmorgan-sup@masanjin.net (William Morgan)
    908 Date: Fri, 14 Mar 2008 11:30:58 -0700
    909 Subject: [sup-talk] viewing threads oldest-first
    910 In-Reply-To: <1205506459-sup-9596@chain.local>
    911 References: <1205506459-sup-9596@chain.local>
    912 Message-ID: <1205517246-sup-9385@south>
    913 
    914 Reformatted excerpts from Matt Liggett's message of 2008-03-14:
    915 > In every mailer I've used before my gmail days, I always viewed my
    916 > email oldest first, especially in any inboxen.  Is there a config
    917 > option (I don't see a keyboard shortcut) to do this?
    918 
    919 There's no option for this. I don't think it makes quite as much sense
    920 in a world where mailboxes can be arbitrarily large (a Sup mailbox is a
    921 search result across your entire set of email) and where loading is
    922 fairly slow.
    923 
    924 But there's no technical reason why this couldn't happen, and other
    925 people have asked for it before, so I'd be willing to add it.
    926 
    927 > As I write this, I realize that oldest-first might mean different
    928 > things in a threaded view.  Is that the oldest first message in the
    929 > thread, or the oldest last message?
    930 
    931 Currently a thread's timestamp is the timestamp of the most recent
    932 message in it, and I would be loathe to change that.
    933 
    934 > Do I generally want inbox threads sorted by unread messages (that is,
    935 > ordering by oldest unread message in each thread)? 
    936 
    937 That would be interesting, but unfortunately is not feasible in Sup. The
    938 index currently knows nothing about threads, just individual messages,
    939 so we can only sort by properties of messages, not by properties of
    940 threads.
    941 
    942 The way we build a threadset now is we search for messages which meet
    943 some search criterea, then we build a thread for each message.
    944 
    945 > In the meantime, can anyone give me a pointer as to where in the code
    946 > I might start digging regarding such a feature?
    947 
    948 Normally I would want a hook, but since there are really only two
    949 options that are technically feasible now, I would add a config variable
    950 called "sort_oldest_first" or something like that.  It will follow a
    951 very similar codepath to thread_by_subj (so grep for that): it should be
    952 initialized in sup.rb for new configurations, passed into a ThreadSet
    953 constructor from ThreadIndexMode#initialize_threads, and passed into
    954 Index#each_id_by_date, where it will change the query we send to Ferret.
    955 Finally, ThreadIndexMode#update (which handles the UI component of
    956 sorting) has got to respect this variable.
    957 
    958 > I tried mutt+mairix for awhile, but it was kludgy and slow.  sup looks
    959 > like it might be the best of both worlds, enabling me to deal with a
    960 > large volume of mail and still giving me the tagging and search that I
    961 > love from gmail.
    962 
    963 Yep, you're my target audience. :)
    964 
    965 -- 
    966 William <wmorgan-sup at masanjin.net>
    967 
    968 From wmorgan-sup@masanjin.net  Fri Mar 14 14:40:32 2008
    969 From: wmorgan-sup@masanjin.net (William Morgan)
    970 Date: Fri, 14 Mar 2008 11:40:32 -0700
    971 Subject: [sup-talk] forwarded messages
    972 In-Reply-To: <1205424317-sup-1180@tangerine.lanl.gov>
    973 References: <1205424317-sup-1180@tangerine.lanl.gov>
    974 Message-ID: <1205519620-sup-1897@south>
    975 
    976 Reformatted excerpts from John Bent's message of 2008-03-13:
    977 > Whenever I forward a message, it appears as a new thread.  I always
    978 > then tag it and the original and merge them.  Is there a way to make
    979 > this happen automagically?  Should that rather be the default
    980 > behavior?
    981 
    982 I've thought about having this be the default behavior because I often
    983 do that as well. There are two ways it could go: actually add a
    984 References: header (or a in-reply-to?), which would be pretty
    985 nonstandard, I think, or just do it in the index itself.
    986 
    987 The dirty secret of the thread joining (which I've just realized now) is
    988 that the joins won't be preserved if you reindex those messages. I need
    989 to add another blob of information somewhere to preserve that stuff.  If
    990 I added the header to the outgoing message, the threading would be
    991 preserved, of course...
    992 
    993 -- 
    994 William <wmorgan-sup at masanjin.net>
    995 
    996 From alexandra@walford.id.au  Fri Mar 14 18:28:39 2008
    997 From: alexandra@walford.id.au (Alexandra Walford)
    998 Date: Sat, 15 Mar 2008 08:28:39 +1000
    999 Subject: [sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id
   1000 	called on nil"
   1001 In-Reply-To: <1205520291-sup-7442@south>
   1002 References: <1205210652-sup-1364@amethyst> <1205520291-sup-7442@south>
   1003 Message-ID: <1205533710-sup-2188@amethyst>
   1004 
   1005 Excerpts from William Morgan's message of Sat Mar 15 04:51:31 +1000 2008:
   1006 > The thread_by_subject stuff is broken and I have a patch to fix it, I
   1007 > just haven't merged it in yet. I'll try and do this soon. In the mean
   1008 > time, as you've discovered, turning off thread_by_subj is the
   1009 > workaround.
   1010 
   1011 Sounds good!  Thanks :)
   1012 
   1013 -- 
   1014 alexandra at walford.id.au
   1015 
   1016 From wmorgan-sup@masanjin.net  Mon Mar 17 12:37:41 2008
   1017 From: wmorgan-sup@masanjin.net (William Morgan)
   1018 Date: Mon, 17 Mar 2008 09:37:41 -0700
   1019 Subject: [sup-talk] Crash on startup, "wrong id called on nil"
   1020 In-Reply-To: <1203172019-sup-1133@south>
   1021 References: <20080207172725.GA9157@gurski.org> <1203172019-sup-1133@south>
   1022 Message-ID: <1205771845-sup-9353@south>
   1023 
   1024 Reformatted excerpts from William Morgan's message of 2008-02-16:
   1025 > Reformatted excerpts from Michael Gurski's message of 2008-02-07:
   1026 > > It's been a while since I launched sup, and updating today from
   1027 > > master, I get a crash on startup:
   1028 > > 
   1029 > > --- RuntimeError from thread: load threads for thread-index-mode wrong
   1030 > > id called on nil
   1031 > 
   1032 > Hm, this is a bit tricky. It looks like on of the thread invariants I
   1033 > maintain is actually a variant.
   1034 
   1035 I think this should be fixed at this point.
   1036 
   1037 -- 
   1038 William <wmorgan-sup at masanjin.net>
   1039 
   1040 From wmorgan-sup@masanjin.net  Mon Mar 17 12:41:55 2008
   1041 From: wmorgan-sup@masanjin.net (William Morgan)
   1042 Date: Mon, 17 Mar 2008 09:41:55 -0700
   1043 Subject: [sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id
   1044 	called on nil"
   1045 In-Reply-To: <1205520291-sup-7442@south>
   1046 References: <1205210652-sup-1364@amethyst> <1205520291-sup-7442@south>
   1047 Message-ID: <1205771997-sup-226@south>
   1048 
   1049 Reformatted excerpts from William Morgan's message of 2008-03-14:
   1050 > The thread_by_subject stuff is broken and I have a patch to fix it, I
   1051 > just haven't merged it in yet. I'll try and do this soon.
   1052 
   1053 Ok, I've merged the changes into next. Enable thread-by-subject and see
   1054 what happens.
   1055 
   1056 If you're still seeing messages with "Re: " subjects in separate
   1057 threads, try reindexing those messages.
   1058 
   1059 -- 
   1060 William <wmorgan-sup at masanjin.net>
   1061 
   1062 From kendall@clarkparsia.com  Mon Mar 17 12:50:38 2008
   1063 From: kendall@clarkparsia.com (Kendall Grant Clark)
   1064 Date: Mon, 17 Mar 2008 12:50:38 -0400
   1065 Subject: [sup-talk] Kill thread doesn't seem to work
   1066 Message-ID: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1067 
   1068 Wm., et. al.,
   1069 
   1070 I'm using v0.4 on Fedora and when I &-mark a thread to kill it, I'm
   1071 expecting that new replies to that thread will *not* come back to my
   1072 inbox view. Except, that they do come back, and I'm puzzled as to
   1073 whether this is a bug, an artifact of my setup, etc. I looked through
   1074 sup-talk archives, but didn't see anything about this issue.
   1075 
   1076 I have a single source (imaps://...) being fed to sup; I sup-sync
   1077 every morning from a cron job, and, otherwise, everything "just
   1078 works".
   1079 
   1080 Any pointers or requests for further info would be great. And, FWIW,
   1081 other than this issue, I love-love-love sup! Thx!!
   1082 
   1083 -- 
   1084 Cheers,
   1085 Kendall
   1086 
   1087 From alexandra@walford.id.au  Tue Mar 18 08:35:24 2008
   1088 From: alexandra@walford.id.au (Alexandra Walford)
   1089 Date: Tue, 18 Mar 2008 22:35:24 +1000
   1090 Subject: [sup-talk] [Crash] "thread_by_subject: true" leads to "wrong id
   1091 	called on nil"
   1092 In-Reply-To: <1205771997-sup-226@south>
   1093 References: <1205210652-sup-1364@amethyst> <1205520291-sup-7442@south>
   1094 	<1205771997-sup-226@south>
   1095 Message-ID: <1205843716-sup-9243@amethyst>
   1096 
   1097 Excerpts from William Morgan's message of Tue Mar 18 02:41:55 +1000 2008:
   1098 > Ok, I've merged the changes into next. Enable thread-by-subject and see
   1099 > what happens.
   1100 
   1101 Nice, I'll give it a go :)
   1102 
   1103 -- 
   1104 alexandra at walford.id.au
   1105 
   1106 From wmorgan-sup@masanjin.net  Tue Mar 18 22:16:02 2008
   1107 From: wmorgan-sup@masanjin.net (William Morgan)
   1108 Date: Tue, 18 Mar 2008 19:16:02 -0700
   1109 Subject: [sup-talk] Kill thread doesn't seem to work
   1110 In-Reply-To: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1111 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1112 Message-ID: <1205892920-sup-9762@south>
   1113 
   1114 Reformatted excerpts from Kendall Grant Clark's message of 2008-03-17:
   1115 > I'm using v0.4 on Fedora and when I &-mark a thread to kill it, I'm
   1116 > expecting that new replies to that thread will *not* come back to my
   1117 > inbox view. Except, that they do come back, and I'm puzzled as to
   1118 > whether this is a bug, an artifact of my setup, etc. I looked through
   1119 > sup-talk archives, but didn't see anything about this issue.
   1120 
   1121 This should work. Can you try against git next? There have been a couple
   1122 commits that probably affected this.
   1123 
   1124 -- 
   1125 William <wmorgan-sup at masanjin.net>
   1126 
   1127 From kendall@clarkparsia.com  Wed Mar 19 09:59:14 2008
   1128 From: kendall@clarkparsia.com (Kendall Grant Clark)
   1129 Date: Wed, 19 Mar 2008 09:59:14 -0400
   1130 Subject: [sup-talk] Kill thread doesn't seem to work
   1131 In-Reply-To: <1205892920-sup-9762@south>
   1132 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1133 	<1205892920-sup-9762@south>
   1134 Message-ID: <1205935094-sup-6162@k-desktop.int.clarkparsia.com>
   1135 
   1136 Excerpts from William Morgan's message of Tue Mar 18 22:16:02 -0400 2008:
   1137 > Reformatted excerpts from Kendall Grant Clark's message of 2008-03-17:
   1138 > > I'm using v0.4 on Fedora and when I &-mark a thread to kill it, I'm
   1139 > > expecting that new replies to that thread will *not* come back to my
   1140 > > inbox view. Except, that they do come back, and I'm puzzled as to
   1141 > > whether this is a bug, an artifact of my setup, etc. I looked through
   1142 > > sup-talk archives, but didn't see anything about this issue.
   1143 > 
   1144 > This should work. Can you try against git next? There have been a couple
   1145 > commits that probably affected this.
   1146 
   1147 I'm a Python programmer, only marginally a Ruby src code reader... Is
   1148 there some kind of sandbox I can use to test the git next version,
   1149 w/out borking my existing (and working, except for this one issue) sup
   1150 install?
   1151 
   1152 -- 
   1153 Cheers,
   1154 Kendall
   1155 
   1156 From johnbent@lanl.gov  Wed Mar 19 10:51:29 2008
   1157 From: johnbent@lanl.gov (John Bent)
   1158 Date: Wed, 19 Mar 2008 08:51:29 -0600
   1159 Subject: [sup-talk] Kill thread doesn't seem to work
   1160 In-Reply-To: <1205935094-sup-6162@k-desktop.int.clarkparsia.com>
   1161 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1162 	<1205892920-sup-9762@south>
   1163 	<1205935094-sup-6162@k-desktop.int.clarkparsia.com>
   1164 Message-ID: <1205937908-sup-4264@tangerine.lanl.gov>
   1165 
   1166 Excerpts from Kendall Grant Clark's message of Wed Mar 19 07:59:14 -0600 2008:
   1167 > I'm a Python programmer, only marginally a Ruby src code reader... Is
   1168 > there some kind of sandbox I can use to test the git next version,
   1169 > w/out borking my existing (and working, except for this one issue) sup
   1170 > install?
   1171 > 
   1172 So this is from: http://sup.rubyforge.org/wiki/wiki.pl?Contributing
   1173 I set this up previously, so I'm not positive about the initial setup
   1174 syntax but the rest of it is definitely correct:
   1175 
   1176 # initial setup
   1177 git clone git://repo.or.cz/sup.git 
   1178 git branch --track next origin/next
   1179 git checkout next
   1180 
   1181 # getting current, building, running local copy
   1182 git pull
   1183 rake gem
   1184 ruby -I lib -w bin/sup
   1185 
   1186 This will then use a local next version w/out affecting your existing sup
   1187 install.  If you then decide you want to fully install the next version:
   1188 sudo gem install pkg/sup-999.gem
   1189 
   1190 John
   1191 
   1192 From johnbent@lanl.gov  Wed Mar 19 11:03:39 2008
   1193 From: johnbent@lanl.gov (John Bent)
   1194 Date: Wed, 19 Mar 2008 09:03:39 -0600
   1195 Subject: [sup-talk] update contact, compose new mail => crash
   1196 Message-ID: <1205938994-sup-2758@tangerine.lanl.gov>
   1197 
   1198 If I am reading an email, hit 'i' to capture a contact, hit 'x' to
   1199 get back to my inbox, hit 'c' to compose a new email, sup (next) crashes.
   1200 Exception log contents:
   1201 
   1202 --- NoMethodError from thread: main
   1203 undefined method `<=>' for nil:NilClass
   1204 /opt/local/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:494:in `sort'
   1205 /opt/local/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:494:in `ask_for_contacts'
   1206 /opt/local/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:497:in `send'
   1207 /opt/local/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:497:in `method_missing'
   1208 /opt/local/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/compose-mode.rb:23:in `spawn_nicely'
   1209 /opt/local/lib/ruby/gems/1.8/gems/sup-999/bin/sup:274
   1210 /opt/local/bin/sup:16:in `load'
   1211 /opt/local/bin/sup:16
   1212 
   1213 From kendall@clarkparsia.com  Wed Mar 19 11:17:07 2008
   1214 From: kendall@clarkparsia.com (Kendall Grant Clark)
   1215 Date: Wed, 19 Mar 2008 11:17:07 -0400
   1216 Subject: [sup-talk] Kill thread doesn't seem to work
   1217 In-Reply-To: <1205937908-sup-4264@tangerine.lanl.gov>
   1218 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1219 	<1205892920-sup-9762@south>
   1220 	<1205935094-sup-6162@k-desktop.int.clarkparsia.com>
   1221 	<1205937908-sup-4264@tangerine.lanl.gov>
   1222 Message-ID: <1205939782-sup-1932@k-desktop.int.clarkparsia.com>
   1223 
   1224 Excerpts from John Bent's message of Wed Mar 19 10:51:29 -0400 2008:
   1225 
   1226 > So this is from: http://sup.rubyforge.org/wiki/wiki.pl?Contributing
   1227 
   1228 Doh. Sorry, I should have rechecked the wiki for this.
   1229 
   1230 > I set this up previously, so I'm not positive about the initial setup
   1231 > syntax but the rest of it is definitely correct:
   1232 
   1233 It worked for me; thx! Testing now. :>
   1234 
   1235 -- 
   1236 Cheers,
   1237 Kendall
   1238 
   1239 From kendall@clarkparsia.com  Wed Mar 19 11:20:37 2008
   1240 From: kendall@clarkparsia.com (Kendall Grant Clark)
   1241 Date: Wed, 19 Mar 2008 11:20:37 -0400
   1242 Subject: [sup-talk] Kill thread doesn't seem to work
   1243 In-Reply-To: <1205892920-sup-9762@south>
   1244 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1245 	<1205892920-sup-9762@south>
   1246 Message-ID: <1205939956-sup-9857@k-desktop.int.clarkparsia.com>
   1247 
   1248 Excerpts from William Morgan's message of Tue Mar 18 22:16:02 -0400 2008:
   1249 > This should work. Can you try against git next? There have been a couple
   1250 > commits that probably affected this.
   1251 
   1252 Doesn't work for me w/ git next either. I asked a coworker to send me
   1253 a message, I replied. Then I killed the thread. He replied to my
   1254 reply, and it popped right up in my INBOX with the +killed tag on it.
   1255 
   1256 -- 
   1257 Cheers,
   1258 Kendall
   1259 
   1260 From patroclo7@gmail.com  Wed Mar 19 11:24:10 2008
   1261 From: patroclo7@gmail.com (Giorgio Lando)
   1262 Date: Wed, 19 Mar 2008 16:24:10 +0100
   1263 Subject: [sup-talk] Kill thread doesn't seem to work
   1264 In-Reply-To: <1205939956-sup-9857@k-desktop.int.clarkparsia.com>
   1265 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1266 	<1205892920-sup-9762@south>
   1267 	<1205939956-sup-9857@k-desktop.int.clarkparsia.com>
   1268 Message-ID: <1205940116-sup-6578@clarabella.clarabella>
   1269 
   1270 Excerpts from Kendall Grant Clark's message of Wed Mar 19 16:20:37 +0100 2008:
   1271 > Doesn't work for me w/ git next either. I asked a coworker to send me
   1272 > a message, I replied. Then I killed the thread. He replied to my
   1273 > reply, and it popped right up in my INBOX with the +killed tag on it.
   1274 
   1275 I confirm, at some point killed threads stopped
   1276 working for me (they are back in the INBOX when a new message is
   1277 received). Both git next and git master have this problem for me.
   1278 
   1279 -- 
   1280 Giorgio Lando <patroclo7 at gmail dot com>
   1281 
   1282 From wmorgan-sup@masanjin.net  Wed Mar 19 12:20:50 2008
   1283 From: wmorgan-sup@masanjin.net (William Morgan)
   1284 Date: Wed, 19 Mar 2008 09:20:50 -0700
   1285 Subject: [sup-talk] Kill thread doesn't seem to work
   1286 In-Reply-To: <1205935094-sup-6162@k-desktop.int.clarkparsia.com>
   1287 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1288 	<1205892920-sup-9762@south>
   1289 	<1205935094-sup-6162@k-desktop.int.clarkparsia.com>
   1290 Message-ID: <1205943578-sup-2011@south>
   1291 
   1292 Reformatted excerpts from Kendall Grant Clark's message of 2008-03-19:
   1293 > I'm a Python programmer, only marginally a Ruby src code reader... Is
   1294 > there some kind of sandbox I can use to test the git next version,
   1295 > w/out borking my existing (and working, except for this one issue) sup
   1296 > install?
   1297 
   1298 Once you have git next in a directory somewhere (top part of
   1299 http://sup.rubyforge.org/wiki/wiki.pl?Contributing), the HACKING file
   1300 has instructions on how to run it locally. Please let me know if
   1301 anything is unclear in either...
   1302 
   1303 -- 
   1304 William <wmorgan-sup at masanjin.net>
   1305 
   1306 From kendall@clarkparsia.com  Wed Mar 19 12:45:25 2008
   1307 From: kendall@clarkparsia.com (Kendall Grant Clark)
   1308 Date: Wed, 19 Mar 2008 12:45:25 -0400
   1309 Subject: [sup-talk] Kill thread doesn't seem to work
   1310 In-Reply-To: <1205943578-sup-2011@south>
   1311 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1312 	<1205892920-sup-9762@south>
   1313 	<1205935094-sup-6162@k-desktop.int.clarkparsia.com>
   1314 	<1205943578-sup-2011@south>
   1315 Message-ID: <1205945088-sup-5986@k-desktop.int.clarkparsia.com>
   1316 
   1317 Excerpts from William Morgan's message of Wed Mar 19 12:20:50 -0400 2008:
   1318 
   1319 > Once you have git next in a directory somewhere (top part of
   1320 > http://sup.rubyforge.org/wiki/wiki.pl?Contributing), the HACKING file
   1321 > has instructions on how to run it locally. Please let me know if
   1322 > anything is unclear in either...
   1323 
   1324 Yes, I ran git next version and it still doesn't handle +killed tagged
   1325 threads correctly; that is, they show up in searches, which I expect,
   1326 but new messages in the thread also cause the thread to reappear in
   1327 INBOX. (FWIW, this test thread is tagged: +/INBOX +inbox +killed
   1328 +sent.)
   1329 
   1330 
   1331 -- 
   1332 Cheers,
   1333 Kendall
   1334 
   1335 From wmorgan-sup@masanjin.net  Wed Mar 19 15:23:02 2008
   1336 From: wmorgan-sup@masanjin.net (William Morgan)
   1337 Date: Wed, 19 Mar 2008 12:23:02 -0700
   1338 Subject: [sup-talk] Kill thread doesn't seem to work
   1339 In-Reply-To: <1205940116-sup-6578@clarabella.clarabella>
   1340 References: <1205772559-sup-6593@k-desktop.int.clarkparsia.com>
   1341 	<1205892920-sup-9762@south>
   1342 	<1205939956-sup-9857@k-desktop.int.clarkparsia.com>
   1343 	<1205940116-sup-6578@clarabella.clarabella>
   1344 Message-ID: <1205954571-sup-5093@south>
   1345 
   1346 Reformatted excerpts from Giorgio Lando's message of 2008-03-19:
   1347 > I confirm, at some point killed threads stopped working for me (they
   1348 > are back in the INBOX when a new message is received). Both git next
   1349 > and git master have this problem for me.
   1350 
   1351 Ok, I'll take a look.
   1352 
   1353 -- 
   1354 William <wmorgan-sup at masanjin.net>
   1355 
   1356 From kendall@clarkparsia.com  Thu Mar 20 10:58:59 2008
   1357 From: kendall@clarkparsia.com (Kendall Grant Clark)
   1358 Date: Thu, 20 Mar 2008 10:58:59 -0400
   1359 Subject: [sup-talk] File saving wart...
   1360 Message-ID: <1206024540-sup-8048@k-desktop.int.clarkparsia.com>
   1361 
   1362 I lazily haven't looked in sup-talk archives to see if this has been
   1363 reported, and I can't find a bug/ticket tracking thing to check
   1364 there...
   1365 
   1366 When saving an attachment (or message, for that matter) the built-in
   1367 filesystem navigator thingie has this annoying wart where it will
   1368 expand "~/" when you tab, but if you just give "~/" in the path to
   1369 save to, it doesn't do an expansion and complains that there's no such
   1370 directory or file.
   1371 
   1372 This is a minor wart, not really a bug, so not a big deal, but it is a
   1373 daily annoyance, since I always remember that "~/" works but I never
   1374 seem to remember that it only works for tab expansion, but not for
   1375 direct saving.
   1376 
   1377 -- 
   1378 Cheers,
   1379 Kendall
   1380 
   1381 From johnbent@lanl.gov  Thu Mar 20 15:05:03 2008
   1382 From: johnbent@lanl.gov (John Bent)
   1383 Date: Thu, 20 Mar 2008 13:05:03 -0600
   1384 Subject: [sup-talk] manually merging threads not persistent in next
   1385 Message-ID: <1206039801-sup-1759@tangerine.lanl.gov>
   1386 
   1387 I'm running next and I've got ":thread_by_subject: true" in my config.
   1388 I've noticed that manually merging threads works in my current session but
   1389 is not persistent across a quit and restart (i.e. they reappear as separate
   1390 threads).  Has anyone else noticed this?
   1391 
   1392 Thanks,
   1393 
   1394 John
   1395 
   1396 From rodkoch@gmail.com  Thu Mar 20 14:57:55 2008
   1397 From: rodkoch@gmail.com (rodneyk)
   1398 Date: Thu, 20 Mar 2008 11:57:55 -0700 (PDT)
   1399 Subject: [sup-talk] Support for non-black background in transparent
   1400  terminals?
   1401 Message-ID: <16186298.post@talk.nabble.com>
   1402 
   1403 
   1404 Hi,
   1405 I was wondering if it's possible to re-configure the black background to be
   1406 another color,
   1407 or even work with a transparent terminal? I checked the Colormap in bin/sup
   1408 but there's nothing
   1409 related to the background.
   1410 
   1411 Also, regarding the Colormap, if I wanted to change the inbox color for the
   1412 'date' and 'from' fields,
   1413 which item handles that? I'm not really sure what most of the items in the
   1414 Colormap do.
   1415 
   1416 Thanks,
   1417 --Rodney
   1418 -- 
   1419 View this message in context: http://www.nabble.com/Support-for-non-black-background-in-transparent-terminals--tp16186298p16186298.html
   1420 Sent from the SUP Talk mailing list archive at Nabble.com.
   1421 
   1422 
   1423 From johnbent@lanl.gov  Thu Mar 20 15:24:08 2008
   1424 From: johnbent@lanl.gov (John Bent)
   1425 Date: Thu, 20 Mar 2008 13:24:08 -0600
   1426 Subject: [sup-talk] default domain name
   1427 Message-ID: <1206040874-sup-2650@tangerine.lanl.gov>
   1428 
   1429 My apologies if this is not a sup question.  But I feel like this used to
   1430 work in pine ... My putmail config has server = server1.lanl.gov which 
   1431 works for sending mail.  However, if I just send to an address without
   1432 a domain attached (e.g. to johnbent instead of to johnbent at lanl.gov), then 
   1433 I get a bounce from server1.lanl.gov saying "there is no 
   1434 johnbent at server1.lanl.gov."  Is there some way to config sup (or the rest of
   1435 my email infrastructure) to teach it a particular default email address?
   1436 
   1437 Thanks,
   1438 
   1439 John
   1440 
   1441 From johnbent@lanl.gov  Thu Mar 20 18:37:42 2008
   1442 From: johnbent@lanl.gov (John Bent)
   1443 Date: Thu, 20 Mar 2008 16:37:42 -0600
   1444 Subject: [sup-talk] can't remove draft label
   1445 In-Reply-To: <1202013739-sup-550@south>
   1446 References: <1201716067-sup-3586@tangerine.lanl.gov>
   1447 	<1201754138-sup-7276@chris-tablet>
   1448 	<1201759596-sup-4274@tangerine.lanl.gov> <1202013739-sup-550@south>
   1449 Message-ID: <1206052546-sup-3667@tangerine.lanl.gov>
   1450 
   1451 Excerpts from William Morgan's message of Sat Feb 02 21:44:41 -0700 2008:
   1452 > I'm not sure why that label would be there, but you can perform some
   1453 > index surgery to remove it.
   1454 > 
   1455 > $ sh devel/console.sh 
   1456 > irb(main):001:0>
   1457 > r=Index.ferret.search("message_id:1201759596-sup-4274 at tangerine.lanl.gov")
   1458 > => #<struct Ferret::Search::TopDocs total_hits=1, hits=[#<struct
   1459 > Ferret::Search::Hit doc=92571, score=10.82630443573>],
   1460 > max_score=10.82630443573, searcher=#<Ferret::Search::Searcher:0xb740dff0>>
   1461 > irb(main):002:0> id=r.hits.first.doc
   1462 > => 92571
   1463 > irb(main):003:0> m = Index.build_message id
   1464 > [...]
   1465 > irb(main):004:0> m.remove_label :draft
   1466 > => true
   1467 > irb(main):005:0> m.save Index
   1468 > => false
   1469 > irb(main):006:0> exit
   1470 > 
   1471 Two months later and I finally did this... :)  It worked great.  The only
   1472 slight problem was that somehow all 25 messages in that thread were falsely
   1473 labeled so I had to repeat the above 25 times.  Although I did eventually
   1474 realize that the console accepted semicolons so I combined them into a 
   1475 single line and then just did arrow up 25 times so it was pretty fast.
   1476 
   1477 Thanks!
   1478 
   1479 John
   1480 
   1481 From marcus-sup@bar-coded.net  Sun Mar 23 17:13:58 2008
   1482 From: marcus-sup@bar-coded.net (Marcus Williams)
   1483 Date: Sun, 23 Mar 2008 21:13:58 +0000
   1484 Subject: [sup-talk] [PATCH] First draft of attachment processing for
   1485 	more gmail style searches
   1486 In-Reply-To: <1205013484-sup-7653@south>
   1487 References: <1203972458-sup-5906@tomsk> <1204220051-sup-129@south>
   1488 	<1204232994-sup-628@tomsk> <1204479552-sup-4100@south>
   1489 	<1204711082-sup-3541@tomsk> <1205013484-sup-7653@south>
   1490 Message-ID: <1206306720-sup-2563@tomsk>
   1491 
   1492 On 8.3.2008, William Morgan wrote:
   1493 > Sorry for the general delay in replying. I've been coding up a little
   1494 > distributed issue tracker that I think will help me manage Sup a little
   1495 > better... or at least ensure I don't forget people's suggestions.
   1496 
   1497 Mmmmm - I'm on the lookout for a decent issue tracker :) Any more info?
   1498 
   1499 Marcus
   1500 
   1501 From 5srmspw02@sneakemail.com  Wed Mar 26 01:57:05 2008
   1502 From: 5srmspw02@sneakemail.com (Guarded Identity)
   1503 Date: Wed, 26 Mar 2008 00:57:05 -0500
   1504 Subject: [sup-talk] New User Questions
   1505 In-Reply-To: <1199944172-sup-660@south>
   1506 References: <29393-78803@sneakemail.com> <1199944172-sup-660@south>
   1507 Message-ID: <13352-37236@sneakemail.com>
   1508 
   1509 Hi,
   1510 
   1511 I've been using Sup for a few months now, read up a little more on Ruby, and
   1512 thought I might be in more of a position to respond to this thread.
   1513 
   1514 Excerpts from William Morgan's message of Thu Jan 10 00:34:03 -0600 2008:
   1515 > Excerpts from Guarded Identity's message of Tue Jan 08 19:39:18 -0800 2008:
   1516 
   1517 > > Will migration of maildir mail from new/ to cur/ necessitate an execution
   1518 > > of sup-sync?
   1519 >
   1520 > Hm. I don't think so. As long as the mtime and size of the file are
   1521 > preserved (which I believe they are during a move) you should be ok.
   1522 
   1523 I was thinking about the algorithm for calculating the message's unique
   1524 "source_info" for Maildir mail (mtime appended to filesize).  I know altering
   1525 the backend might really be something you don't want to support, so maybe I'm
   1526 voicing a moot concern.  It's just that sometimes I get annoyed at people
   1527 sending me mail with large attachments (especially at work where I just can't
   1528 control this kind of thing too well).  In the past, I'd use mutt to purge mail
   1529 of their large attachments.
   1530 
   1531 However, I guess if I do this en mass, I loose my labeling of these messages
   1532 when I do a sup-sync because the message's source_info changes, right?, but
   1533 have you considered using a message's "Message-Id" header as part of the
   1534 source_info?  I'm thinking you might have.  For the most part, this should be
   1535 pretty unique, right?  I know the Message-Id is sometimes missing, but we can
   1536 default to the old source_id if things are really wacky (which should be
   1537 rarely, right?).  The only reason I could think you wouldn't use the Message-Id
   1538 is because maybe it's less efficient to open up a message than look at it's
   1539 file stats.  Or maybe there's another reason?
   1540 
   1541 > > I had done this before, actually, but I noticed that Sup indexing was
   1542 > > slowed down quite a bit (rss2email and mailing lists generate a lot of new
   1543 > > mail).
   1544 >
   1545 > If that's true, then it must be due to IMAP transmission costs. I'm
   1546 > certainly willing to believe that pulling a message from IMAP is
   1547 > significantly slower than a disk read.
   1548 
   1549 I was thinking about this too.  Is there anything we can do to pull down
   1550 headers first to fill the index (backgrounding the indexing)?  Maybe that might
   1551 make the delay with IMAP less of a nuisance?
   1552 
   1553 However, I won't harp on this too much.  Because I wasn't comfortable
   1554 synchronizing (say with Unison) sup Ferret indexes across hosts, I'm ssh'ing
   1555 into the machine with the index and using "maildir" sources.  But this
   1556 unfortunately causes me a problem with viewing graphical attachments because X
   1557 forwarding is really slow.  So for now I'm saving attachments and scp'ing them
   1558 over.  I'm not sure there's much anyone can do about any of this.
   1559 
   1560 > > I would really like to have time-based auto-expiry (excluding starred or
   1561 > > special-labeled items) for some of my mail (primarily mailing lists and rss
   1562 > > feeds). With mboxes, I guess I could do some "deleted"-labeling with a Ruby
   1563 > > script followed by a call to sup-sync-back.
   1564 >
   1565 > That sounds like the right approach.
   1566 >
   1567 > > 6. What are my scripting options for mail expiry with Maildirs?  The search
   1568 > > to get the message objects is pretty straight forward.  How much further
   1569 > > work is it to delete the message from the index and to get a filename of
   1570 > > the message to delete from the maildir?
   1571 >
   1572 > Trivial, although the filename/IMAP id require minor API changes to expose
   1573 > those functions. But with a working sup-sync-back that applies to all source
   1574 > types, you won't have to do anything other than inject :deleted labels
   1575 > everywhere and simply call sup-sync-back.
   1576 
   1577 Okay,
   1578 
   1579 So I've been using a helper script that does some things to help me manage my
   1580 Maildir mail (all other source types are ignored).  My primary idea was to have
   1581 a script to expire mail, but allowing me to save threads labeled "starred" or
   1582 "save".  Eventually I added in a function to manipulate labels.  Unlike
   1583 sup-tweak-labels, this script gathers it's pool of messages from the index
   1584 using a Ferret query (Chronic allowed) rather than using source URIs.
   1585 
   1586 I got around some of the encapsulation inherent in the API by just brute force
   1587 breaking encapsulation (which Ruby makes kind of ridiculously easy it seems).
   1588 
   1589 I've attached the script, and would like to see any feedback if people have
   1590 some.  In particular, I'm eager to know of any concerns people have with the
   1591 approach or defects people catch.  I'm still pretty new to Ruby, so if I did
   1592 anything flat out stupid with the language, please let me know.
   1593 
   1594 By the way, I was thinking that there seems to be a good deal of healthy
   1595 participation in this list.  Does anybody see any value to hanging out in #sup
   1596 on Freenode?  Sometimes it's just nice to have an IRC forum.
   1597 
   1598 -Sukant
   1599 -------------- next part --------------
   1600 A non-text attachment was scrubbed...
   1601 Name: sup-tweak-maildir
   1602 Type: application/octet-stream
   1603 Size: 6652 bytes
   1604 Desc: not available
   1605 Url : http://rubyforge.org/pipermail/sup-talk/attachments/20080326/cef1c568/attachment.obj 
   1606 
   1607 From wmorgan-sup@masanjin.net  Wed Mar 26 12:04:10 2008
   1608 From: wmorgan-sup@masanjin.net (William Morgan)
   1609 Date: Wed, 26 Mar 2008 09:04:10 -0700
   1610 Subject: [sup-talk] [PATCH] fixed off-by-one error in imap.rb and
   1611 	maildir.rb
   1612 In-Reply-To: <1204531233-2092-1-git-send-email-chrisw@rice.edu>
   1613 References: <1204528063-sup-7345@chris-tablet>
   1614 	<1204531233-2092-1-git-send-email-chrisw@rice.edu>
   1615 Message-ID: <1206547432-sup-4074@south>
   1616 
   1617 Reformatted excerpts from Christopher Warrington's message of 2008-03-03:
   1618 > The end_offset reported by imap and maildir sources was incorrect if
   1619 > there was only one message in the source. Since end_offset is
   1620 > exclusive, we must add one to the last known id to get include all
   1621 > valid message ids in the range.
   1622 
   1623 Precisely so. Applied. Thanks!
   1624 
   1625 -- 
   1626 William <wmorgan-sup at masanjin.net>
   1627 
   1628 From wmorgan-sup@masanjin.net  Wed Mar 26 12:07:20 2008
   1629 From: wmorgan-sup@masanjin.net (William Morgan)
   1630 Date: Wed, 26 Mar 2008 09:07:20 -0700
   1631 Subject: [sup-talk] [PATCH] updated text and keybinding in
   1632 	label-search-results-mode
   1633 In-Reply-To: <1204531280-4048-1-git-send-email-chrisw@rice.edu>
   1634 References: <1204531280-4048-1-git-send-email-chrisw@rice.edu>
   1635 Message-ID: <1206547632-sup-4441@south>
   1636 
   1637 Reformatted excerpts from Christopher Warrington's message of 2008-03-03:
   1638 > The text in label-search-results-mode now matches that of search-results-mode.
   1639 
   1640 Applied, thanks!
   1641 
   1642 -- 
   1643 William <wmorgan-sup at masanjin.net>
   1644 
   1645 From wmorgan-sup@masanjin.net  Wed Mar 26 12:11:49 2008
   1646 From: wmorgan-sup@masanjin.net (William Morgan)
   1647 Date: Wed, 26 Mar 2008 09:11:49 -0700
   1648 Subject: [sup-talk] [PATCH] Fix for icon title in gnome terminal
   1649 	(possibly others)
   1650 In-Reply-To: <1204711708-sup-3638@tomsk>
   1651 References: <1204711708-sup-3638@tomsk>
   1652 Message-ID: <1206547886-sup-1106@south>
   1653 
   1654 Reformatted excerpts from Marcus Williams's message of 2008-03-05:
   1655 > The escape code used for terminal titles works mostly but it doesnt
   1656 > set the icon title as well [1], which is useful when minimised. This
   1657 > patch makes the escape code set both window and icon title so the task
   1658 > bar updates correctly in the gnome terminal (and probably others).
   1659 
   1660 Reworked slightly (to avoid duplicating the conditional) and applied.
   1661 Thanks!
   1662 
   1663 -- 
   1664 William <wmorgan-sup at masanjin.net>
   1665 
   1666 From wmorgan-sup@masanjin.net  Wed Mar 26 12:13:53 2008
   1667 From: wmorgan-sup@masanjin.net (William Morgan)
   1668 Date: Wed, 26 Mar 2008 09:13:53 -0700
   1669 Subject: [sup-talk] [PATCH] Sort contacts when saving them.
   1670 In-Reply-To: <12051366771380-git-send-email-nicolas.pouillard@gmail.com>
   1671 References: <12051366771380-git-send-email-nicolas.pouillard@gmail.com>
   1672 Message-ID: <1206548025-sup-37@south>
   1673 
   1674 Reformatted excerpts from nicolas.pouillard's message of 2008-03-10:
   1675 > This makes sup behave more nicely with versionning.
   1676 
   1677 Applied. Thanks!
   1678 
   1679 -- 
   1680 William <wmorgan-sup at masanjin.net>
   1681 
   1682 From wmorgan-sup@masanjin.net  Wed Mar 26 12:40:24 2008
   1683 From: wmorgan-sup@masanjin.net (William Morgan)
   1684 Date: Wed, 26 Mar 2008 09:40:24 -0700
   1685 Subject: [sup-talk] Newline Issues
   1686 In-Reply-To: <1204536487-sup-9413@chris-tablet>
   1687 References: <1204536487-sup-9413@chris-tablet>
   1688 Message-ID: <1206549226-sup-8056@south>
   1689 
   1690 Reformatted excerpts from Christopher Warrington's message of 2008-03-03:
   1691 > When I use offlineimap under Cgywin, the messages are delivered with
   1692 > CRLF. Sup cannot parse these: it thinks that the body is empty. I know
   1693 > that sup is seeing the entire message. If I press H, I see all of the
   1694 > message.
   1695 
   1696 I've finally had a chance to look into this. I've just patched Sup to
   1697 handle carriage returns in mbox files, but things are still broken
   1698 because of RubyMail.
   1699 
   1700 It looks like there's an outstanding RubyMail patch here:
   1701 
   1702 http://rubyforge.org/tracker/index.php?func=detail&aid=2821&group_id=446&atid=1756
   1703 
   1704 If you apply that and get the latest git, I think things should work.
   1705 
   1706 -- 
   1707 William <wmorgan-sup at masanjin.net>
   1708 
   1709 From cjs@weisshuhn.de  Thu Mar 27 00:49:02 2008
   1710 From: cjs@weisshuhn.de (Carsten =?iso-8859-1?Q?Sch=F6lzki?=)
   1711 Date: Thu, 27 Mar 2008 05:49:02 +0100
   1712 Subject: [sup-talk] ISO 8859-15 at the header
   1713 Message-ID: <20080327044901.GA12106@weisshuhn.de>
   1714 
   1715 Hi,
   1716 
   1717 I started trying sup today and it seems to be wonderful for me. Till
   1718 now I'm a mutt user for over 10 years - but know I found a reason to
   1719 change...
   1720 
   1721 But there is a little problem with the header-encoding. Seems, that
   1722 sup doesn't de- or encode ISO 8859-15 correct.
   1723 
   1724 There are no problems with the body or with ISO 8859-1 in the
   1725 header.
   1726 
   1727 Did I messed up some settings or is this bug?
   1728 
   1729 I'm using sup v0.4 on MacOS X 10.5.2. - encoding in mutt works fine.
   1730 
   1731 
   1732 Thanks, Carsten
   1733 
   1734 From marc.hartstein@alum.vassar.edu  Thu Mar 27 20:22:09 2008
   1735 From: marc.hartstein@alum.vassar.edu (Marc Hartstein)
   1736 Date: Thu, 27 Mar 2008 20:22:09 -0400
   1737 Subject: [sup-talk] New User Questions
   1738 Message-ID: <1206662265-sup-7439@cabinet>
   1739 
   1740 Sorry if any of this has been discussed elsewhere.  I've read the docs
   1741 on the website, skimmed the wiki, and skimmed the mailing list archives
   1742 for the past few months, but I could easily have missed something.
   1743 
   1744 First, I ran into the same problem discussed in the thread "startup
   1745 crash" started on 2008-03-09.  (I'm also running Gentoo and installed
   1746 the latest from portage)  I poked around the source a bit, and it
   1747 seems that when AccountManager.initialize is called out of
   1748 Redwood::start (sup line 113), the code to set up the default
   1749 configuration (lib/sup.rb, starts at line 166) has *not* been called, so
   1750 the $config object is empty.
   1751 
   1752 Just in case the information helps; I'm not a Ruby person (yet), and I
   1753 didn't poke around enough to be clear on how it's supposed to be
   1754 working.
   1755 
   1756 2. sup is pretty cool.  I'm particularly intrigued by this tag (sorry,
   1757 label) concept.
   1758 
   1759 3. Is there an IRC channel?  It would be nice to be able to lurk and
   1760 drop questions if anybody happens to be around.
   1761 
   1762 4. I use maildir.  Is there any way sup can mark messages as read (and,
   1763 perhaps more importantly, no longer new) once I've read them and hit
   1764 '$'?  I can deal with mutt being confused (I know sup doesn't play well
   1765 with others anyway), but it's really confusing my mail monitor, and
   1766 that's bugging me.
   1767 
   1768 5. Can sup be set to automatically poll local sources for new messages
   1769 every n seconds?  Mutt does this, and it's nice not having to tell it
   1770 that I know there are new messages and it should go find them.
   1771 
   1772 6. Mutt can pass text/html attachments through an external program and
   1773 display the result in its internal pager.  Is there a way to get sup to
   1774 do the equivalent?
   1775 
   1776 7. How does sup choose the email address to use as "From" when replying
   1777 to an email?  It's definitely choosing the wrong thing in my setup.  My
   1778 primary address forwards to gmail, sup is configured with the primary as
   1779 my :email:, but whenever I hit reply it sets "From" to be my gmail
   1780 address.  I'd like it to be whatever alternate of mine is in To/CC if
   1781 any, and my primary address otherwise.
   1782 
   1783 8. Is there any way to specify custom keybindings in a configuration
   1784 file, or would it require hacking the source?
   1785 
   1786 8.1 I'd really like a one-touch reply-all like I had in mutt.
   1787 
   1788 9. Is there a way to default to making all messages PGP-signed?
   1789 
   1790 10. Is there (planned) a compose-hook?  I'd like to be able to switch to
   1791 sign-and-encrypt when I have a public key for every recipient.
   1792 
   1793 Thanks for the cool project.  I'll probably have more "I miss this
   1794 feature from mutt" thoughts in the future, at least if I don't go
   1795 running back.
   1796 -------------- next part --------------
   1797 A non-text attachment was scrubbed...
   1798 Name: signature.asc
   1799 Type: application/pgp-signature
   1800 Size: 189 bytes
   1801 Desc: not available
   1802 Url : http://rubyforge.org/pipermail/sup-talk/attachments/20080327/ca129127/attachment.bin 
   1803 
   1804 From marcus-sup@bar-coded.net  Fri Mar 28 06:33:45 2008
   1805 From: marcus-sup@bar-coded.net (Marcus Williams)
   1806 Date: Fri, 28 Mar 2008 10:33:45 +0000
   1807 Subject: [sup-talk] New User Questions
   1808 In-Reply-To: <1206662265-sup-7439@cabinet>
   1809 References: <1206662265-sup-7439@cabinet>
   1810 Message-ID: <1206699001-sup-9770@tomsk>
   1811 
   1812 On 28.3.2008, Marc Hartstein wrote:
   1813 > 3. Is there an IRC channel?  It would be nice to be able to lurk and
   1814 > drop questions if anybody happens to be around.
   1815 
   1816 Someone has suggested #sup on freenode but no takers so far. I'd
   1817 probably lurk on a channel if we can agree on one :)
   1818 
   1819 > 4. I use maildir.  Is there any way sup can mark messages as read (and,
   1820 > perhaps more importantly, no longer new) once I've read them and hit
   1821 > '$'?  I can deal with mutt being confused (I know sup doesn't play well
   1822 > with others anyway), but it's really confusing my mail monitor, and
   1823 > that's bugging me.
   1824 
   1825 Technically not (although you could probably write a hook to do this).
   1826 However, you could change the way your monitor works if you're using
   1827 sup locally. See the before/after poll hooks [1]
   1828 
   1829 > 5. Can sup be set to automatically poll local sources for new messages
   1830 > every n seconds?  Mutt does this, and it's nice not having to tell it
   1831 > that I know there are new messages and it should go find them.
   1832 
   1833 It should do already. I dont know offhand what the delay is though.
   1834 
   1835 > 6. Mutt can pass text/html attachments through an external program and
   1836 > display the result in its internal pager.  Is there a way to get sup to
   1837 > do the equivalent?
   1838 
   1839 Theres more than one way to do this. Via a hook for auto-demangling
   1840 (mime-decode.rb) [1] and via the pipe attachment/message keypress '|'
   1841 in thread view mode. Basically if you want to view an attachment put
   1842 your cursor line over the attachment line and hit '|'. sup will pipe
   1843 the attachment to what ever command line you type in here. html2text
   1844 works well (as does antiword for word docs). If your cursor is in the
   1845 message somewhere other than an attachment line it will pipe the raw
   1846 message to the command.
   1847 
   1848 > 7. How does sup choose the email address to use as "From" when replying
   1849 > to an email?  It's definitely choosing the wrong thing in my setup.  My
   1850 > primary address forwards to gmail, sup is configured with the primary as
   1851 > my :email:, but whenever I hit reply it sets "From" to be my gmail
   1852 > address.  I'd like it to be whatever alternate of mine is in To/CC if
   1853 > any, and my primary address otherwise.
   1854 
   1855 The :alternates: setting is probably what you want here. I think you
   1856 should just have to add your gmail address as an alternate in your
   1857 default account. At least this is how I think it should work!
   1858 Basically the alternate emails list tell sup you receive email at this
   1859 account as these addresses as well, but that you reply using the
   1860 default :email: setting.
   1861 
   1862 You may also be interested in the :regexen: list - this allows you to
   1863 setup mail extensions (like marcus-sup that I use) and get sup to
   1864 reply using the extension.
   1865 
   1866 > 8. Is there any way to specify custom keybindings in a configuration
   1867 > file, or would it require hacking the source?
   1868 
   1869 Hack the source afaik
   1870 
   1871 > 8.1 I'd really like a one-touch reply-all like I had in mutt.
   1872 
   1873 I'm about to submit a patch for this.
   1874 
   1875 > 9. Is there a way to default to making all messages PGP-signed?
   1876 
   1877 I dont think so at the moment (again, it wouldnt be hard to add)
   1878 
   1879 > 10. Is there (planned) a compose-hook?  I'd like to be able to
   1880 > switch to sign-and-encrypt when I have a public key for every
   1881 > recipient.
   1882 
   1883 Theres certainly a before-edit hook, which you may be able to do
   1884 things like this in. I havnt played with the pgp stuff yet so someone
   1885 else probably knows more here.
   1886 
   1887 HTH 
   1888 
   1889 Marcus
   1890 
   1891 [1] http://sup.rubyforge.org/wiki/wiki.pl?Hooks
   1892 
   1893 From vasudeva@linkswarm.com  Fri Mar 28 07:24:47 2008
   1894 From: vasudeva@linkswarm.com (vasudeva)
   1895 Date: Fri, 28 Mar 2008 07:24:47 -0400
   1896 Subject: [sup-talk] New User Questions
   1897 In-Reply-To: <1206699001-sup-9770@tomsk>
   1898 References: <1206662265-sup-7439@cabinet> <1206699001-sup-9770@tomsk>
   1899 Message-ID: <1206703335-sup-6607@lenin>
   1900 
   1901 Excerpts from Marcus Williams's message of Fri Mar 28 06:33:45 -0400 2008:
   1902 > On 28.3.2008, Marc Hartstein wrote:
   1903 > > 3. Is there an IRC channel?  It would be nice to be able to lurk and
   1904 > > drop questions if anybody happens to be around.
   1905 > 
   1906 > Someone has suggested #sup on freenode but no takers so far. I'd
   1907 > probably lurk on a channel if we can agree on one :)
   1908 
   1909 Actually, there are a couple of us lurking there now. Come on in.
   1910 
   1911 
   1912 
   1913 
   1914 -- 
   1915 linkswarm.com :: Collaborative Insolence
   1916 vasudeva.linkswarm.com/gallery :: For The Faint of Heart
   1917 
   1918 
   1919 From 5srmspw02@sneakemail.com  Fri Mar 28 11:54:11 2008
   1920 From: 5srmspw02@sneakemail.com (Guarded Identity)
   1921 Date: Fri, 28 Mar 2008 10:54:11 -0500
   1922 Subject: [sup-talk] Wiki updates, more people on #sup
   1923 Message-ID: <18635-64358@sneakemail.com>
   1924 
   1925 Hey everyone,
   1926 
   1927 So now we've got five people lurking in #sup on Freenode (only two of us are
   1928 quasi-active, though).  I was going to post some of my recent configurations
   1929 for Sup to the mailing list, but then vasudeva noted the Wiki was
   1930 under-utilized, so I made two new pages there [1,2].  One thing to note about
   1931 these configurations are that I'm relying on other tools to solve problems
   1932 rather than asking William to "improve" Sup.  However, regarding [2], I guess I
   1933 wish that contact tab-complete could be customizable (say to hook into ldbdq).
   1934 I'm completely fine with the solution in [1] as-is, though.
   1935 
   1936 [1] http://sup.rubyforge.org/wiki/wiki.pl?WebBrowserIntegration
   1937 [2] http://sup.rubyforge.org/wiki/wiki.pl?LbdbIntegration
   1938 
   1939 Regards,
   1940 Sukant
   1941 
   1942 From marc.hartstein@alum.vassar.edu  Fri Mar 28 13:23:29 2008
   1943 From: marc.hartstein@alum.vassar.edu (Marc Hartstein)
   1944 Date: Fri, 28 Mar 2008 13:23:29 -0400
   1945 Subject: [sup-talk] New User Questions
   1946 In-Reply-To: <1206699001-sup-9770@tomsk>
   1947 References: <1206662265-sup-7439@cabinet> <1206699001-sup-9770@tomsk>
   1948 Message-ID: <1206724477-sup-3121@cabinet>
   1949 
   1950 Excerpts from Marcus Williams's message of Fri Mar 28 06:33:45 -0400 2008:
   1951 > On 28.3.2008, Marc Hartstein wrote:
   1952 > 
   1953 > > 5. Can sup be set to automatically poll local sources for new messages
   1954 > > every n seconds?  Mutt does this, and it's nice not having to tell it
   1955 > > that I know there are new messages and it should go find them.
   1956 > 
   1957 > It should do already. I dont know offhand what the delay is though.
   1958 
   1959 So it does, I think it's just less frequent than I'm accustomed to.
   1960 This should probably go on the list of things which should eventually be
   1961 configurable.
   1962 
   1963 > > 6. Mutt can pass text/html attachments through an external program and
   1964 > > display the result in its internal pager.  Is there a way to get sup to
   1965 > > do the equivalent?
   1966 > 
   1967 > Theres more than one way to do this. Via a hook for auto-demangling
   1968 > (mime-decode.rb)
   1969 
   1970 Thanks, that's exactly what I was looking for.  And should be nicely
   1971 extensible if I ever want.
   1972 
   1973 > and via the pipe attachment/message keypress '|' in thread view mode.
   1974 > Basically if you want to view an attachment put your cursor line over
   1975 > the attachment line and hit '|'. sup will pipe the attachment to what
   1976 > ever command line you type in here.
   1977 
   1978 Probably too much effort unless it can consult mailcap or something and
   1979 fill in an appropriate default.  I wonder how difficult that would be to
   1980 add....
   1981 
   1982 > > 7. How does sup choose the email address to use as "From" when replying
   1983 > > to an email?  It's definitely choosing the wrong thing in my setup.  My
   1984 > > primary address forwards to gmail, sup is configured with the primary as
   1985 > > my :email:, but whenever I hit reply it sets "From" to be my gmail
   1986 > > address.  I'd like it to be whatever alternate of mine is in To/CC if
   1987 > > any, and my primary address otherwise.
   1988 > 
   1989 > The :alternates: setting is probably what you want here. I think you
   1990 > should just have to add your gmail address as an alternate in your
   1991 > default account. At least this is how I think it should work!
   1992 > Basically the alternate emails list tell sup you receive email at this
   1993 > account as these addresses as well, but that you reply using the
   1994 > default :email: setting.
   1995 
   1996 Nope.  The gmail address is an alternate, the primary is the :email:, it
   1997 tries to reply with the gmail address.  But only sometimes.  I still
   1998 haven't figured out what's causing it.
   1999 
   2000 > You may also be interested in the :regexen: list - this allows you to
   2001 > setup mail extensions (like marcus-sup that I use) and get sup to
   2002 > reply using the extension.
   2003 
   2004 I'll look into this, thanks.
   2005 
   2006 > > 8. Is there any way to specify custom keybindings in a configuration
   2007 > > file, or would it require hacking the source?
   2008 > 
   2009 > Hack the source afaik
   2010 
   2011 Feh, hope that's on the planned features list.
   2012 
   2013 > > 9. Is there a way to default to making all messages PGP-signed?
   2014 > 
   2015 > I dont think so at the moment (again, it wouldnt be hard to add)
   2016 
   2017 Should probably be a config setting.
   2018 
   2019 > Theres certainly a before-edit hook, which you may be able to do
   2020 > things like this in. I havnt played with the pgp stuff yet so someone
   2021 > else probably knows more here.
   2022 
   2023 That one's definitely not on the wiki.  I'll have to track down the
   2024 canonical list of available hooks...
   2025 -------------- next part --------------
   2026 A non-text attachment was scrubbed...
   2027 Name: signature.asc
   2028 Type: application/pgp-signature
   2029 Size: 189 bytes
   2030 Desc: not available
   2031 Url : http://rubyforge.org/pipermail/sup-talk/attachments/20080328/7a51264e/attachment.bin 
   2032 
   2033 From marcus-sup@bar-coded.net  Fri Mar 28 15:51:18 2008
   2034 From: marcus-sup@bar-coded.net (Marcus Williams)
   2035 Date: Fri, 28 Mar 2008 19:51:18 +0000
   2036 Subject: [sup-talk] New User Questions
   2037 In-Reply-To: <1206724477-sup-3121@cabinet>
   2038 References: <1206662265-sup-7439@cabinet> <1206699001-sup-9770@tomsk>
   2039 	<1206724477-sup-3121@cabinet>
   2040 Message-ID: <1206733867-sup-2930@tomsk>
   2041 
   2042 On 28.3.2008, Marc Hartstein wrote:
   2043 > > Theres certainly a before-edit hook, which you may be able to do
   2044 > > things like this in. I havnt played with the pgp stuff yet so someone
   2045 > > else probably knows more here.
   2046 > 
   2047 > That one's definitely not on the wiki.  I'll have to track down the
   2048 > canonical list of available hooks...
   2049 
   2050 sup --list-hooks
   2051 
   2052 :)
   2053 
   2054 Marcus
   2055 
   2056 From marc.hartstein@alum.vassar.edu  Fri Mar 28 16:21:19 2008
   2057 From: marc.hartstein@alum.vassar.edu (Marc Hartstein)
   2058 Date: Fri, 28 Mar 2008 16:21:19 -0400
   2059 Subject: [sup-talk] Crash
   2060 Message-ID: <1206735524-sup-1255@cabinet>
   2061 
   2062 Attached is the exception log as requested.
   2063 
   2064 Sequence of events:
   2065 
   2066 $ sup-add -l looney maildir:/home/magus/.maildir/looney
   2067 
   2068 $ sup
   2069 
   2070 L looney while the index counter is still incrementing in the status
   2071 line.
   2072 
   2073 Search page appears, a couple of lines get added (I think), then crash.
   2074 
   2075 Hope it helps.
   2076 -------------- next part --------------
   2077 An embedded and charset-unspecified text was scrubbed...
   2078 Name: sup-exception-log.txt
   2079 Url: http://rubyforge.org/pipermail/sup-talk/attachments/20080328/78d42c7c/attachment-0001.txt 
   2080 -------------- next part --------------
   2081 A non-text attachment was scrubbed...
   2082 Name: signature.asc
   2083 Type: application/pgp-signature
   2084 Size: 189 bytes
   2085 Desc: not available
   2086 Url : http://rubyforge.org/pipermail/sup-talk/attachments/20080328/78d42c7c/attachment-0001.bin 
   2087 
   2088 From martindemello@gmail.com  Fri Mar 28 18:13:26 2008
   2089 From: martindemello@gmail.com (Martin DeMello)
   2090 Date: Fri, 28 Mar 2008 15:13:26 -0700
   2091 Subject: [sup-talk] sup crashes on startup
   2092 Message-ID: <f93a6bcc0803281513s429f3a3bw485c63e5d9cce818@mail.gmail.com>
   2093 
   2094 --- ArgumentError from thread: main
   2095 no name for account
   2096 /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:7:in `initialize'
   2097 /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:44:in `new'
   2098 /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:44:in `add_account'
   2099 /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup/account.rb:26:in `initialize'
   2100 /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup.rb:98:in `new'
   2101 /usr/lib/ruby/gems/1.8/gems/sup-0.4/lib/sup.rb:98:in `start'
   2102 /usr/lib/ruby/gems/1.8/gems/sup-0.4/bin/sup:113
   2103 /usr/bin/sup:16:in `load'
   2104 /usr/bin/sup:16
   2105 
   2106 From sup-talk@gurski.org  Fri Mar 28 23:03:56 2008
   2107 From: sup-talk@gurski.org (Michael Gurski)
   2108 Date: Fri, 28 Mar 2008 23:03:56 -0400
   2109 Subject: [sup-talk] crash while sup is sitting idle
   2110 Message-ID: <20080329030356.GA8459@gurski.org>
   2111 
   2112 After a 28+ hour sup-sync -a -o, on git head, sup sitting idle crashed
   2113 with the following error:
   2114 
   2115 --- Ferret::StateError from thread: load threads for thread-index-mode
   2116 State Error occured at <except.c>:93 in xraise
   2117 Error occured in index.c:4150 - sr_get_lazy_doc
   2118         Document 69 has already been deleted
   2119 
   2120 /var/lib/gems/1.8/gems/ferret-0.11.6/lib/ferret/index.rb:421:in `[]'
   2121 /var/lib/gems/1.8/gems/ferret-0.11.6/lib/ferret/index.rb:421:in `[]'
   2122 /usr/lib/ruby/1.8/monitor.rb:238:in `synchronize'
   2123 /var/lib/gems/1.8/gems/ferret-0.11.6/lib/ferret/index.rb:413:in `[]'
   2124 ./lib/sup/index.rb:228:in `each_id_by_date'
   2125 ./lib/sup/index.rb:228:in `each'
   2126 ./lib/sup/index.rb:228:in `each_id_by_date'
   2127 ./lib/sup/thread.rb:326:in `load_n_threads'
   2128 ./lib/sup/modes/thread-index-mode.rb:507:in
   2129 `__unprotected_load_n_threads'
   2130 (eval):12:in `load_n_threads'
   2131 ./lib/sup/modes/thread-index-mode.rb:491:in
   2132 `load_n_threads_background'
   2133 ./lib/sup.rb:60:in `reporting_thread'
   2134 ./lib/sup.rb:58:in `initialize'
   2135 ./lib/sup.rb:58:in `new'
   2136 ./lib/sup.rb:58:in `reporting_thread'
   2137 ./lib/sup/modes/thread-index-mode.rb:490:in
   2138 `load_n_threads_background'
   2139 ./lib/sup/modes/thread-index-mode.rb:560:in
   2140 `__unprotected_load_threads'
   2141 (eval):12:in `load_threads'
   2142 ./lib/sup/modes/thread-index-mode.rb:70:in `initialize'
   2143 ./lib/sup/modes/line-cursor-mode.rb:177:in `call'
   2144 ./lib/sup/modes/line-cursor-mode.rb:177:in `call_load_more_callbacks'
   2145 ./lib/sup/modes/line-cursor-mode.rb:177:in `each'
   2146 ./lib/sup/modes/line-cursor-mode.rb:177:in `call_load_more_callbacks'
   2147 ./lib/sup/modes/line-cursor-mode.rb:80:in `cursor_down'
   2148 ./lib/sup/mode.rb:49:in `send'
   2149 ./lib/sup/mode.rb:49:in `handle_input'
   2150 ./lib/sup/buffer.rb:231:in `handle_input'
   2151 bin/sup:223
   2152 --- SystemExit from thread: main
   2153 State Error occured at <except.c>:93 in xraise
   2154 Error occured in index.c:4150 - sr_get_lazy_doc
   2155         Document 69 has already been deleted
   2156 
   2157 ./lib/sup.rb:64:in `select'
   2158 ./lib/sup/buffer.rb:31:in `nonblocking_getch'
   2159 bin/sup:217
   2160 
   2161 -- 
   2162 Michael A. Gurski (opt. [first].)[last]@pobox.com  http://www.pobox.com/~[last]
   2163 1024R/39B5BADD PGP: 34 93 A9 94 B1 59 48 B7  17 57 1E 4E 62 56 45 70
   2164 1024D/1166213E GPG: 628F 37A4 62AF 1475 45DB  AD81 ADC9 E606 1166 213E
   2165 4096R/C0B4F04B GPG: 5B3E 75D7 43CF CF34 4042  7788 1DCE B5EE C0B4 F04B
   2166 Views expressed by the host do not reflect the staff, management or sponsors.
   2167 
   2168 
   2169 From chrisw@rice.edu  Sat Mar 29 03:57:51 2008
   2170 From: chrisw@rice.edu (Christopher Warrington)
   2171 Date: Sat, 29 Mar 2008 02:57:51 -0500
   2172 Subject: [sup-talk] [PATCH] polling is now done per source
   2173 In-Reply-To: <1206724477-sup-3121@cabinet>
   2174 References: <1206724477-sup-3121@cabinet>
   2175 Message-ID: <1206777471-1360-1-git-send-email-chrisw@rice.edu>
   2176 
   2177 Each source has a poll_interval property. This property is used to
   2178 determine whether the source should be polled. The user can still for a
   2179 poll of all sources.
   2180 ---
   2181  bin/sup                    |    4 +-
   2182  bin/sup-add                |   12 ++-
   2183  lib/sup.rb                 |    4 +-
   2184  lib/sup/imap.rb            |    6 +-
   2185  lib/sup/maildir.rb         |    6 +-
   2186  lib/sup/mbox/loader.rb     |    4 +-
   2187  lib/sup/modes/poll-mode.rb |    4 +-
   2188  lib/sup/poll.rb            |  211 +++++++++++++++++++++++++++++++++-----------
   2189  lib/sup/source.rb          |    8 +-
   2190  9 files changed, 189 insertions(+), 70 deletions(-)
   2191  mode change 100755 => 100644 lib/sup/buffer.rb
   2192 
   2193 diff --git a/bin/sup b/bin/sup
   2194 index 84fd77c..86a2d9f 100644
   2195 --- a/bin/sup
   2196 +++ b/bin/sup
   2197 @@ -197,7 +197,7 @@ begin
   2198      end
   2199    end unless $opts[:no_initial_poll]
   2200    
   2201 -  imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread("poll after loading inbox") { sleep 1; PollManager.poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
   2202 +  imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread("poll after loading inbox") { sleep 1; PollManager.auto_poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
   2203  
   2204    if $opts[:compose]
   2205      ComposeMode.spawn_nicely :to_default => $opts[:compose]
   2206 @@ -263,7 +263,7 @@ begin
   2207      when :compose
   2208        ComposeMode.spawn_nicely
   2209      when :poll
   2210 -      reporting_thread("user-invoked poll") { PollManager.poll }
   2211 +      reporting_thread("user-invoked poll") { PollManager.forced_poll }
   2212      when :recall_draft
   2213        case Index.num_results_for :label => :draft
   2214        when 0
   2215 diff --git a/bin/sup-add b/bin/sup-add
   2216 index 50bbb29..88705e1 100644
   2217 --- a/bin/sup-add
   2218 +++ b/bin/sup-add
   2219 @@ -39,6 +39,7 @@ EOS
   2220    opt :unusual, "Do not automatically poll these sources for new messages."
   2221    opt :labels, "A comma-separated set of labels to apply to all messages from this source", :type => String
   2222    opt :force_new, "Create a new account for this source, even if one already exists."
   2223 +  opt :poll_interval, "The interval (in seconds) between new message polls. The default is #{Redwood::DEFAULT_POLL_INTERVAL}.", :type => :int
   2224  end
   2225  
   2226  Trollop::die "require one or more sources" if ARGV.empty?
   2227 @@ -84,6 +85,9 @@ index.lock_or_die
   2228  begin
   2229    index.load_sources
   2230  
   2231 +  Trollop::die "The poll interval must be a positive integer." if $opts[:poll_interval] <= 0
   2232 +  poll_interval = $opts[:poll_interval] || Redwood::DEFAULT_POLL_INTERVAL
   2233 +
   2234    ARGV.each do |uri|
   2235      labels = $opts[:labels] ? $opts[:labels].split(/\s*,\s*/).uniq : []
   2236  
   2237 @@ -100,14 +104,14 @@ begin
   2238          say "For SSH connections, if you will use public key authentication, you may leave the username and password blank."
   2239          say ""
   2240          username, password = get_login_info uri, index.sources
   2241 -        Redwood::MBox::SSHLoader.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2242 +        Redwood::MBox::SSHLoader.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2243        when "imap", "imaps"
   2244          username, password = get_login_info uri, index.sources
   2245 -        Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2246 +        Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2247        when "maildir"
   2248 -        Redwood::Maildir.new uri, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2249 +        Redwood::Maildir.new uri, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2250        when "mbox"
   2251 -        Redwood::MBox::Loader.new uri, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2252 +        Redwood::MBox::Loader.new uri, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2253        when nil
   2254          Trollop::die "Sources must be specified with an URI"
   2255        else
   2256 diff --git a/lib/sup.rb b/lib/sup.rb
   2257 index 1946f3c..c27a4bc 100644
   2258 --- a/lib/sup.rb
   2259 +++ b/lib/sup.rb
   2260 @@ -50,6 +50,8 @@ module Redwood
   2261    YAML_DOMAIN = "masanjin.net"
   2262    YAML_DATE = "2006-10-01"
   2263  
   2264 +  DEFAULT_POLL_INTERVAL = 300
   2265 +
   2266  ## record exceptions thrown in threads nicely
   2267    def reporting_thread name
   2268      if $opts[:no_threads]
   2269 @@ -72,7 +74,7 @@ module Redwood
   2270    def save_yaml_obj object, fn, safe=false
   2271      if safe
   2272        safe_fn = "#{File.dirname fn}/safe_#{File.basename fn}"
   2273 -      mode = File.stat(fn) if File.exists? fn
   2274 +      mode = File.stat(fn).mode if File.exists? fn
   2275        File.open(safe_fn, "w", mode) { |f| f.puts object.to_yaml }
   2276        FileUtils.mv safe_fn, fn
   2277      else
   2278 diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
   2279 old mode 100755
   2280 new mode 100644
   2281 diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb
   2282 index 1d36976..8b58cba 100644
   2283 --- a/lib/sup/imap.rb
   2284 +++ b/lib/sup/imap.rb
   2285 @@ -51,13 +51,13 @@ class IMAP < Source
   2286  
   2287    attr_accessor :username, :password
   2288    yaml_properties :uri, :username, :password, :cur_offset, :usual,
   2289 -                  :archived, :id, :labels
   2290 +                  :archived, :id, :poll_interval, :labels
   2291  
   2292 -  def initialize uri, username, password, last_idate=nil, usual=true, archived=false, id=nil, labels=[]
   2293 +  def initialize uri, username, password, last_idate=nil, usual=true, archived=false, id=nil, poll_interval=nil, labels=[]
   2294      raise ArgumentError, "username and password must be specified" unless username && password
   2295      raise ArgumentError, "not an imap uri" unless uri =~ %r!imaps?://!
   2296  
   2297 -    super uri, last_idate, usual, archived, id
   2298 +    super uri, last_idate, usual, archived, id, [poll_interval, SCAN_INTERVAL].max
   2299  
   2300      @parsed_uri = URI(uri)
   2301      @username = username
   2302 diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
   2303 index 584e657..ef71e0b 100644
   2304 --- a/lib/sup/maildir.rb
   2305 +++ b/lib/sup/maildir.rb
   2306 @@ -12,9 +12,9 @@ class Maildir < Source
   2307    SCAN_INTERVAL = 30 # seconds
   2308  
   2309    ## remind me never to use inheritance again.
   2310 -  yaml_properties :uri, :cur_offset, :usual, :archived, :id, :labels
   2311 -  def initialize uri, last_date=nil, usual=true, archived=false, id=nil, labels=[]
   2312 -    super uri, last_date, usual, archived, id
   2313 +  yaml_properties :uri, :cur_offset, :usual, :archived, :id, :poll_interval, :labels
   2314 +  def initialize uri, last_date=nil, usual=true, archived=false, id=nil, poll_interval=nil, labels=[]
   2315 +    super uri, last_date, usual, archived, id, [poll_interval, SCAN_INTERVAL].max
   2316      uri = URI(Source.expand_filesystem_uri(uri))
   2317  
   2318      raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
   2319 diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
   2320 index 7fe9129..44317d5 100644
   2321 --- a/lib/sup/mbox/loader.rb
   2322 +++ b/lib/sup/mbox/loader.rb
   2323 @@ -9,7 +9,7 @@ class Loader < Source
   2324    attr_accessor :labels
   2325  
   2326    ## uri_or_fp is horrific. need to refactor.
   2327 -  def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil, labels=[]
   2328 +  def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil, poll_interval=nil, labels=[]
   2329      @mutex = Mutex.new
   2330      @labels = ((labels || []) - LabelManager::RESERVED_LABELS).uniq.freeze
   2331  
   2332 @@ -26,7 +26,7 @@ class Loader < Source
   2333        @path = uri_or_fp.path
   2334      end
   2335  
   2336 -    super uri_or_fp, start_offset, usual, archived, id
   2337 +    super uri_or_fp, start_offset, usual, archived, id, poll_interval
   2338    end
   2339  
   2340    def file_path; @path end
   2341 diff --git a/lib/sup/modes/poll-mode.rb b/lib/sup/modes/poll-mode.rb
   2342 index 5849f3e..5521cdc 100644
   2343 --- a/lib/sup/modes/poll-mode.rb
   2344 +++ b/lib/sup/modes/poll-mode.rb
   2345 @@ -10,11 +10,11 @@ class PollMode < LogMode
   2346      self << s + "\n"
   2347    end
   2348  
   2349 -  def poll
   2350 +  def poll sources
   2351      puts unless @new
   2352      @new = false
   2353      puts "Poll started at #{Time.now}"
   2354 -    PollManager.do_poll { |s| puts s }
   2355 +    PollManager.do_poll_sources(sources) { |s| puts s }
   2356    end
   2357  end
   2358  
   2359 diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
   2360 index d32c893..01db8e2 100644
   2361 --- a/lib/sup/poll.rb
   2362 +++ b/lib/sup/poll.rb
   2363 @@ -12,13 +12,22 @@ Variables:
   2364  EOS
   2365  
   2366    HookManager.register "before-poll", <<EOS
   2367 +Executes immediately before any poll for new messages commences.
   2368 +Variables:
   2369 +                 accts: an array of source URIs that will be polled
   2370 +EOS
   2371 +
   2372 +  HookManager.register "before-acct-poll", <<EOS
   2373  Executes immediately before a poll for new messages commences.
   2374 -No variables.
   2375 +Variables:
   2376 +                  acct: the URI of the account being polled
   2377  EOS
   2378  
   2379 -  HookManager.register "after-poll", <<EOS
   2380 -Executes immediately after a poll for new messages completes.
   2381 +  HookManager.register "after-acct-poll", <<EOS
   2382 +Executes immediately after a poll for new messages completes. The statistics are
   2383 +only for the account specified.
   2384  Variables:
   2385 +                  acct: the URI of the account being polled
   2386                     num: the total number of new messages added in this poll
   2387               num_inbox: the number of new messages added in this poll which
   2388                          appear in the inbox (i.e. were not auto-archived).
   2389 @@ -28,14 +37,25 @@ num_inbox_total_unread: the total number of unread messages in the inbox
   2390                          only those messages appearing in the inbox
   2391  EOS
   2392  
   2393 -  DELAY = 300
   2394 +  HookManager.register "after-poll", <<EOS
   2395 +Executes immediately after any poll for new messages completes. The statistics
   2396 +are for all sources polled.
   2397 +Variables:
   2398 +                 accts: an array of source URIs that were polled
   2399 +                   num: the total number of new messages added in this poll
   2400 +             num_inbox: the number of new messages added in this poll which
   2401 +                        appear in the inbox (i.e. were not auto-archived).
   2402 +num_inbox_total_unread: the total number of unread messages in the inbox
   2403 +         from_and_subj: an array of (from email address, subject) pairs
   2404 +   from_and_subj_inbox: an array of (from email address, subject) pairs for
   2405 +                        only those messages appearing in the inbox
   2406 +EOS
   2407  
   2408    def initialize
   2409      @mutex = Mutex.new
   2410      @thread = nil
   2411 -    @last_poll = nil
   2412      @polling = false
   2413 -    
   2414 +
   2415      self.class.i_am_the_instance self
   2416    end
   2417  
   2418 @@ -44,47 +64,113 @@ EOS
   2419      b
   2420    end
   2421  
   2422 -  def poll
   2423 +  def start
   2424 +    ## Periodically calls auto_poll, effectively automatically polling
   2425 +    ## in the background.
   2426 +    ##
   2427 +    ## auto_poll is called more frequently than the smallest poll
   2428 +    ## interval. auto_poll is not guaranteed to be called in multiples
   2429 +    ## of poll intervals. I.e., don't rely on auto_poll to be called
   2430 +    ## every x seconds: when auto_poll is called assume an
   2431 +    ## indeterminate amount of time has passed.
   2432 +    @min_poll_interval = Index.usual_sources.collect{|s| s.poll_interval}.select{|pi| !pi.nil?}.min || Redwood::DEFAULT_POLL_INTERVAL
   2433 +
   2434 +    Redwood::log "Background poll interval is #{@min_poll_interval} seconds."
   2435 +
   2436 +    @thread = Redwood::reporting_thread("periodic poll") do
   2437 +      while true
   2438 +        Redwood::log "Sleeping for #{@min_poll_interval / 2} seconds."
   2439 +
   2440 +        sleep @min_poll_interval / 2
   2441 +        auto_poll
   2442 +      end
   2443 +    end
   2444 +  end
   2445 +
   2446 +  def stop
   2447 +    @thread.kill if @thread
   2448 +    @thread = nil
   2449 +  end
   2450 +
   2451 +  def auto_poll
   2452 +    ## This method is called by the thread spawned in start. It
   2453 +    ## collects the sources that should be polled
   2454 +    ## (source.poll_interval has expired or the source has never been
   2455 +    ## polled) and polls them.
   2456 +    ##
   2457 +    ## Returns an array [# of new messages, # of new messages to
   2458 +    ## inbox, new message subject/name array pairs, subject/name array
   2459 +    ## pairs loaded to inbox]
   2460 +
   2461 +    sources_to_poll = []
   2462 +    @mutex.synchronize do # William, do we need to synchronize here?
   2463 +      begin
   2464 +        sources_to_poll = Index.usual_sources.select do |source|
   2465 +          begin
   2466 +            source.last_poll.nil? || (Time.now - source.last_poll) >= source.poll_interval
   2467 +          end
   2468 +        end
   2469 +      end
   2470 +    end
   2471 +
   2472 +    poll_sources sources_to_poll
   2473 +  end
   2474 +
   2475 +  def forced_poll
   2476 +    ## This method is called when the user explicitly requests a poll.
   2477 +    ##
   2478 +    ## Returns an array [# of new messages, # of new messages to
   2479 +    ## inbox, new message subject/name array pairs, subject/name array
   2480 +    ## pairs loaded to inbox]
   2481 +    poll_sources Index.usual_sources
   2482 +  end
   2483 +
   2484 +  def poll_sources sources
   2485 +    ## Polls the given sources. Clients of PollManager should call
   2486 +    ## this method, not do_poll_sources or poll_source. (Well, only
   2487 +    ## PollMode should call do_poll_sources)
   2488 +    ##
   2489 +    ## Returns an array [# of new messages, # of new messages to
   2490 +    ## inbox, new message subject/name array pairs, subject/name array
   2491 +    ## pairs loaded to inbox]
   2492      return if @polling
   2493      @polling = true
   2494 -    HookManager.run "before-poll"
   2495 +
   2496 +    source_uris = sources.map{|s| s.uri}
   2497 +
   2498 +    HookManager.run "before-acct-poll", :accts => source_uris
   2499  
   2500      BufferManager.flash "Polling for new messages..."
   2501 -    num, numi, from_and_subj, from_and_subj_inbox = buffer.mode.poll
   2502 +    num, numi, from_subj, from_subj_inbox = buffer.mode.poll sources
   2503      if num > 0
   2504        BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox." 
   2505      else
   2506        BufferManager.flash "No new messages." 
   2507      end
   2508  
   2509 -    HookManager.run "after-poll", :num => num, :num_inbox => numi, :from_and_subj => from_and_subj, :from_and_subj_inbox => from_and_subj_inbox, :num_inbox_total_unread => lambda { Index.num_results_for :labels => [:inbox, :unread] }
   2510 +    HookManager.run "after-poll", :accts => source_uris, :num => num, :num_inbox => numi, :from_and_subj => from_and_subj, :from_and_subj_inbox => from_and_subj_inbox, :num_inbox_total_unread => lambda { Index.num_results_for :labels => [:inbox, :unread] }
   2511  
   2512      @polling = false
   2513 -    [num, numi]
   2514 -  end
   2515 -
   2516 -  def start
   2517 -    @thread = Redwood::reporting_thread("periodic poll") do
   2518 -      while true
   2519 -        sleep DELAY / 2
   2520 -        poll if @last_poll.nil? || (Time.now - @last_poll) >= DELAY
   2521 -      end
   2522 -    end
   2523 +    [num, numi, from_subj, from_subj_inbox]
   2524    end
   2525  
   2526 -  def stop
   2527 -    @thread.kill if @thread
   2528 -    @thread = nil
   2529 -  end
   2530 +  def do_poll_sources sources, &block
   2531 +    ## Polls each source, keeping track of vital statistics (number
   2532 +    ## loaded, name/e-mail pairs, &c.) about the poll results.
   2533 +    ##
   2534 +    ## We need explicit access to the block so that we can pass it to
   2535 +    ## poll_source.
   2536 +    ##
   2537 +    ## Returns an array [total # of new messages, total # of new
   2538 +    ## messages to inbox, all new message subject/name array pairs,
   2539 +    ## all subject/name array pairs loaded to inbox]
   2540  
   2541 -  def do_poll
   2542      total_num = total_numi = 0
   2543 -    from_and_subj = []
   2544 -    from_and_subj_inbox = []
   2545 +    total_from_and_subj = []
   2546 +    total_from_and_subj_inbox = []
   2547  
   2548      @mutex.synchronize do
   2549 -      Index.usual_sources.each do |source|
   2550 -#        yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})"
   2551 +      sources.each do |source|
   2552          begin
   2553            yield "Loading from #{source}... " unless source.done? || source.has_errors?
   2554          rescue SourceError => e
   2555 @@ -93,32 +179,57 @@ EOS
   2556            next
   2557          end
   2558  
   2559 -        num = 0
   2560 -        numi = 0
   2561 -        add_messages_from source do |m, offset, entry|
   2562 -          ## always preserve the labels on disk.
   2563 -          m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry
   2564 -          yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
   2565 -          unless entry
   2566 -            num += 1
   2567 -            from_and_subj << [m.from.longname, m.subj]
   2568 -            if m.has_label?(:inbox) && ([:spam, :deleted, :killed] & m.labels).empty?
   2569 -              from_and_subj_inbox << [m.from.longname, m.subj]
   2570 -              numi += 1 
   2571 -            end
   2572 -          end
   2573 -          m
   2574 -        end
   2575 -        yield "Found #{num} messages, #{numi} to inbox." unless num == 0
   2576 +        HookManager.run "before-acct-poll", :acct => source.uri
   2577 +
   2578 +        BufferManager.flash "Polling #{source.uri} for new messages..."
   2579 +        num, numi, from_and_subj, from_and_subj_inbox = poll_source source, &block
   2580 +
   2581          total_num += num
   2582          total_numi += numi
   2583 +        total_from_and_subj += from_and_subj
   2584 +        total_from_and_subj_inbox += from_and_subj_inbox
   2585 +
   2586 +        HookManager.run "after-acct-poll", :acct => source.uri, :num => num, :num_inbox => numi, :from_and_subj => from_and_subj, :from_and_subj_inbox => from_and_subj_inbox, :num_inbox_total_unread => lambda { Index.num_results_for :labels => [:inbox, :unread] }
   2587        end
   2588 +    end
   2589 +
   2590 +    [total_num, total_numi, total_from_and_subj, total_from_and_subj_inbox]
   2591 +  end
   2592  
   2593 -      yield "Done polling; loaded #{total_num} new messages total"
   2594 -      @last_poll = Time.now
   2595 -      @polling = false
   2596 +  def poll_source source
   2597 +    ## Polls the given source for new messages.
   2598 +    ##
   2599 +    ## @mutex must be held before calling! See do_poll_sources.
   2600 +    ##
   2601 +    ## Returns an array [# of new messages, # of new messages to
   2602 +    ## inbox, new message subject/name array pairs, subject/name array
   2603 +    ## pairs loaded to inbox]
   2604 +
   2605 +    num = 0
   2606 +    numi = 0
   2607 +    from_and_subj = []
   2608 +    from_and_subj_inbox = []
   2609 +
   2610 +    add_messages_from source do |m, offset, entry|
   2611 +      ## always preserve the labels on disk.
   2612 +      m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry
   2613 +      yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
   2614 +      unless entry
   2615 +        num += 1
   2616 +        from_and_subj << [m.from.longname, m.subj]
   2617 +        if m.has_label?(:inbox) && ([:spam, :deleted, :killed] & m.labels).empty?
   2618 +          from_and_subj_inbox << [m.from.longname, m.subj]
   2619 +          numi += 1
   2620 +        end
   2621 +      end
   2622 +      m
   2623      end
   2624 -    [total_num, total_numi, from_and_subj, from_and_subj_inbox]
   2625 +
   2626 +    yield "For source #{source.uri}, found #{num} messages, #{numi} to inbox." unless num == 0
   2627 +
   2628 +    source.last_poll = Time.now
   2629 +
   2630 +    [num, numi, from_and_subj, from_and_subj_inbox]
   2631    end
   2632  
   2633    ## this is the main mechanism for adding new messages to the
   2634 diff --git a/lib/sup/source.rb b/lib/sup/source.rb
   2635 index 6510aae..fd8d381 100644
   2636 --- a/lib/sup/source.rb
   2637 +++ b/lib/sup/source.rb
   2638 @@ -62,10 +62,10 @@ class Source
   2639    ## dirty? means cur_offset has changed, so the source info needs to
   2640    ## be re-saved to sources.yaml.
   2641    bool_reader :usual, :archived, :dirty
   2642 -  attr_reader :uri, :cur_offset
   2643 -  attr_accessor :id
   2644 +  attr_reader :uri, :cur_offset, :poll_interval
   2645 +  attr_accessor :id, :last_poll
   2646  
   2647 -  def initialize uri, initial_offset=nil, usual=true, archived=false, id=nil
   2648 +  def initialize uri, initial_offset=nil, usual=true, archived=false, id=nil, poll_interval=nil
   2649      raise ArgumentError, "id must be an integer: #{id.inspect}" unless id.is_a? Fixnum if id
   2650  
   2651      @uri = uri
   2652 @@ -73,6 +73,8 @@ class Source
   2653      @usual = usual
   2654      @archived = archived
   2655      @id = id
   2656 +    @poll_interval = poll_interval || Redwood::DEFAULT_POLL_INTERVAL #seconds
   2657 +    @last_poll = nil
   2658      @dirty = false
   2659    end
   2660  
   2661 -- 
   2662 1.5.4
   2663 
   2664 
   2665 From chrisw@rice.edu  Sat Mar 29 05:59:31 2008
   2666 From: chrisw@rice.edu (Christopher Warrington)
   2667 Date: Sat, 29 Mar 2008 04:59:31 -0500
   2668 Subject: [sup-talk] [PATCH] polling is now done per source
   2669 In-Reply-To: <1206777471-1360-1-git-send-email-chrisw@rice.edu>
   2670 References: <1206724477-sup-3121@cabinet>
   2671 	<1206777471-1360-1-git-send-email-chrisw@rice.edu>
   2672 Message-ID: <1206784680-sup-3052@chris-tablet>
   2673 
   2674 Excerpts from Christopher Warrington's message of Sat Mar 29 02:57:51 -0500 2008:
   2675 > Each source has a poll_interval property. This property is used to
   2676 > determine whether the source should be polled. The user can still
   2677 > for a poll of all sources.
   2678 
   2679 There is a bug in this patch. Watch this space for an updated patch.
   2680 
   2681 -- 
   2682 Christopher Warrington <chrisw at rice.edu>
   2683 
   2684 From chrisw@rice.edu  Sat Mar 29 06:02:31 2008
   2685 From: chrisw@rice.edu (Christopher Warrington)
   2686 Date: Sat, 29 Mar 2008 05:02:31 -0500
   2687 Subject: [sup-talk] Newline Issues
   2688 In-Reply-To: <1206549226-sup-8056@south>
   2689 References: <1204536487-sup-9413@chris-tablet> <1206549226-sup-8056@south>
   2690 Message-ID: <1206784905-sup-8496@chris-tablet>
   2691 
   2692 Excerpts from William Morgan's message of Wed Mar 26 11:40:24 -0500 2008:
   2693 > Reformatted excerpts from Christopher Warrington's message of 2008-03-03:
   2694 > > When I use offlineimap under Cgywin, the messages are delivered with
   2695 > > CRLF. Sup cannot parse these: it thinks that the body is empty. I know
   2696 > > that sup is seeing the entire message. If I press H, I see all of the
   2697 > > message.
   2698 > 
   2699 > I've finally had a chance to look into this. I've just patched Sup to
   2700 > handle carriage returns in mbox files, but things are still broken
   2701 > because of RubyMail.
   2702 > 
   2703 > It looks like there's an outstanding RubyMail patch here:
   2704 > 
   2705 > http://rubyforge.org/tracker/index.php?func=detail&aid=2821&group_id=446&atid=17
   2706 > 56
   2707 > 
   2708 > If you apply that and get the latest git, I think things should work.
   2709 
   2710 That appears to have done it. All is well in Cygwin land, for now.
   2711 
   2712 -- 
   2713 Christopher Warrington <chrisw at rice.edu>
   2714 
   2715 
   2716 From chrisw@rice.edu  Sat Mar 29 06:32:05 2008
   2717 From: chrisw@rice.edu (Christopher Warrington)
   2718 Date: Sat, 29 Mar 2008 05:32:05 -0500
   2719 Subject: [sup-talk] [PATCH] polling is now done per source
   2720 In-Reply-To: <1206784680-sup-3052@chris-tablet>
   2721 References: <1206784680-sup-3052@chris-tablet>
   2722 Message-ID: <1206786725-5456-1-git-send-email-chrisw@rice.edu>
   2723 
   2724 Each source has a poll_interval property. This property is used to
   2725 determine whether the source should be polled. The user can still for a
   2726 poll of all sources.
   2727 ---
   2728  bin/sup                    |    4 +-
   2729  bin/sup-add                |   12 ++-
   2730  lib/sup.rb                 |    4 +-
   2731  lib/sup/imap.rb            |    6 +-
   2732  lib/sup/maildir.rb         |    6 +-
   2733  lib/sup/mbox/loader.rb     |    4 +-
   2734  lib/sup/modes/poll-mode.rb |    4 +-
   2735  lib/sup/poll.rb            |  211 +++++++++++++++++++++++++++++++++-----------
   2736  lib/sup/source.rb          |    8 +-
   2737  9 files changed, 189 insertions(+), 70 deletions(-)
   2738  mode change 100755 => 100644 lib/sup/buffer.rb
   2739 
   2740 diff --git a/bin/sup b/bin/sup
   2741 index 84fd77c..86a2d9f 100644
   2742 --- a/bin/sup
   2743 +++ b/bin/sup
   2744 @@ -197,7 +197,7 @@ begin
   2745      end
   2746    end unless $opts[:no_initial_poll]
   2747    
   2748 -  imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread("poll after loading inbox") { sleep 1; PollManager.poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
   2749 +  imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread("poll after loading inbox") { sleep 1; PollManager.auto_poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
   2750  
   2751    if $opts[:compose]
   2752      ComposeMode.spawn_nicely :to_default => $opts[:compose]
   2753 @@ -263,7 +263,7 @@ begin
   2754      when :compose
   2755        ComposeMode.spawn_nicely
   2756      when :poll
   2757 -      reporting_thread("user-invoked poll") { PollManager.poll }
   2758 +      reporting_thread("user-invoked poll") { PollManager.forced_poll }
   2759      when :recall_draft
   2760        case Index.num_results_for :label => :draft
   2761        when 0
   2762 diff --git a/bin/sup-add b/bin/sup-add
   2763 index 50bbb29..88705e1 100644
   2764 --- a/bin/sup-add
   2765 +++ b/bin/sup-add
   2766 @@ -39,6 +39,7 @@ EOS
   2767    opt :unusual, "Do not automatically poll these sources for new messages."
   2768    opt :labels, "A comma-separated set of labels to apply to all messages from this source", :type => String
   2769    opt :force_new, "Create a new account for this source, even if one already exists."
   2770 +  opt :poll_interval, "The interval (in seconds) between new message polls. The default is #{Redwood::DEFAULT_POLL_INTERVAL}.", :type => :int
   2771  end
   2772  
   2773  Trollop::die "require one or more sources" if ARGV.empty?
   2774 @@ -84,6 +85,9 @@ index.lock_or_die
   2775  begin
   2776    index.load_sources
   2777  
   2778 +  Trollop::die "The poll interval must be a positive integer." if $opts[:poll_interval] <= 0
   2779 +  poll_interval = $opts[:poll_interval] || Redwood::DEFAULT_POLL_INTERVAL
   2780 +
   2781    ARGV.each do |uri|
   2782      labels = $opts[:labels] ? $opts[:labels].split(/\s*,\s*/).uniq : []
   2783  
   2784 @@ -100,14 +104,14 @@ begin
   2785          say "For SSH connections, if you will use public key authentication, you may leave the username and password blank."
   2786          say ""
   2787          username, password = get_login_info uri, index.sources
   2788 -        Redwood::MBox::SSHLoader.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2789 +        Redwood::MBox::SSHLoader.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2790        when "imap", "imaps"
   2791          username, password = get_login_info uri, index.sources
   2792 -        Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2793 +        Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2794        when "maildir"
   2795 -        Redwood::Maildir.new uri, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2796 +        Redwood::Maildir.new uri, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2797        when "mbox"
   2798 -        Redwood::MBox::Loader.new uri, nil, !$opts[:unusual], $opts[:archive], nil, labels
   2799 +        Redwood::MBox::Loader.new uri, nil, !$opts[:unusual], $opts[:archive], nil, poll_interval, labels
   2800        when nil
   2801          Trollop::die "Sources must be specified with an URI"
   2802        else
   2803 diff --git a/lib/sup.rb b/lib/sup.rb
   2804 index 1946f3c..c27a4bc 100644
   2805 --- a/lib/sup.rb
   2806 +++ b/lib/sup.rb
   2807 @@ -50,6 +50,8 @@ module Redwood
   2808    YAML_DOMAIN = "masanjin.net"
   2809    YAML_DATE = "2006-10-01"
   2810  
   2811 +  DEFAULT_POLL_INTERVAL = 300
   2812 +
   2813  ## record exceptions thrown in threads nicely
   2814    def reporting_thread name
   2815      if $opts[:no_threads]
   2816 @@ -72,7 +74,7 @@ module Redwood
   2817    def save_yaml_obj object, fn, safe=false
   2818      if safe
   2819        safe_fn = "#{File.dirname fn}/safe_#{File.basename fn}"
   2820 -      mode = File.stat(fn) if File.exists? fn
   2821 +      mode = File.stat(fn).mode if File.exists? fn
   2822        File.open(safe_fn, "w", mode) { |f| f.puts object.to_yaml }
   2823        FileUtils.mv safe_fn, fn
   2824      else
   2825 diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
   2826 old mode 100755
   2827 new mode 100644
   2828 diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb
   2829 index 1d36976..8b58cba 100644
   2830 --- a/lib/sup/imap.rb
   2831 +++ b/lib/sup/imap.rb
   2832 @@ -51,13 +51,13 @@ class IMAP < Source
   2833  
   2834    attr_accessor :username, :password
   2835    yaml_properties :uri, :username, :password, :cur_offset, :usual,
   2836 -                  :archived, :id, :labels
   2837 +                  :archived, :id, :poll_interval, :labels
   2838  
   2839 -  def initialize uri, username, password, last_idate=nil, usual=true, archived=false, id=nil, labels=[]
   2840 +  def initialize uri, username, password, last_idate=nil, usual=true, archived=false, id=nil, poll_interval=nil, labels=[]
   2841      raise ArgumentError, "username and password must be specified" unless username && password
   2842      raise ArgumentError, "not an imap uri" unless uri =~ %r!imaps?://!
   2843  
   2844 -    super uri, last_idate, usual, archived, id
   2845 +    super uri, last_idate, usual, archived, id, [poll_interval, SCAN_INTERVAL].max
   2846  
   2847      @parsed_uri = URI(uri)
   2848      @username = username
   2849 diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
   2850 index 584e657..ef71e0b 100644
   2851 --- a/lib/sup/maildir.rb
   2852 +++ b/lib/sup/maildir.rb
   2853 @@ -12,9 +12,9 @@ class Maildir < Source
   2854    SCAN_INTERVAL = 30 # seconds
   2855  
   2856    ## remind me never to use inheritance again.
   2857 -  yaml_properties :uri, :cur_offset, :usual, :archived, :id, :labels
   2858 -  def initialize uri, last_date=nil, usual=true, archived=false, id=nil, labels=[]
   2859 -    super uri, last_date, usual, archived, id
   2860 +  yaml_properties :uri, :cur_offset, :usual, :archived, :id, :poll_interval, :labels
   2861 +  def initialize uri, last_date=nil, usual=true, archived=false, id=nil, poll_interval=nil, labels=[]
   2862 +    super uri, last_date, usual, archived, id, [poll_interval, SCAN_INTERVAL].max
   2863      uri = URI(Source.expand_filesystem_uri(uri))
   2864  
   2865      raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
   2866 diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
   2867 index 7fe9129..44317d5 100644
   2868 --- a/lib/sup/mbox/loader.rb
   2869 +++ b/lib/sup/mbox/loader.rb
   2870 @@ -9,7 +9,7 @@ class Loader < Source
   2871    attr_accessor :labels
   2872  
   2873    ## uri_or_fp is horrific. need to refactor.
   2874 -  def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil, labels=[]
   2875 +  def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil, poll_interval=nil, labels=[]
   2876      @mutex = Mutex.new
   2877      @labels = ((labels || []) - LabelManager::RESERVED_LABELS).uniq.freeze
   2878  
   2879 @@ -26,7 +26,7 @@ class Loader < Source
   2880        @path = uri_or_fp.path
   2881      end
   2882  
   2883 -    super uri_or_fp, start_offset, usual, archived, id
   2884 +    super uri_or_fp, start_offset, usual, archived, id, poll_interval
   2885    end
   2886  
   2887    def file_path; @path end
   2888 diff --git a/lib/sup/modes/poll-mode.rb b/lib/sup/modes/poll-mode.rb
   2889 index 5849f3e..5521cdc 100644
   2890 --- a/lib/sup/modes/poll-mode.rb
   2891 +++ b/lib/sup/modes/poll-mode.rb
   2892 @@ -10,11 +10,11 @@ class PollMode < LogMode
   2893      self << s + "\n"
   2894    end
   2895  
   2896 -  def poll
   2897 +  def poll sources
   2898      puts unless @new
   2899      @new = false
   2900      puts "Poll started at #{Time.now}"
   2901 -    PollManager.do_poll { |s| puts s }
   2902 +    PollManager.do_poll_sources(sources) { |s| puts s }
   2903    end
   2904  end
   2905  
   2906 diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
   2907 index d32c893..1ff8014 100644
   2908 --- a/lib/sup/poll.rb
   2909 +++ b/lib/sup/poll.rb
   2910 @@ -12,13 +12,22 @@ Variables:
   2911  EOS
   2912  
   2913    HookManager.register "before-poll", <<EOS
   2914 +Executes immediately before any poll for new messages commences.
   2915 +Variables:
   2916 +                 accts: an array of source URIs that will be polled
   2917 +EOS
   2918 +
   2919 +  HookManager.register "before-acct-poll", <<EOS
   2920  Executes immediately before a poll for new messages commences.
   2921 -No variables.
   2922 +Variables:
   2923 +                  acct: the URI of the account being polled
   2924  EOS
   2925  
   2926 -  HookManager.register "after-poll", <<EOS
   2927 -Executes immediately after a poll for new messages completes.
   2928 +  HookManager.register "after-acct-poll", <<EOS
   2929 +Executes immediately after a poll for new messages completes. The statistics are
   2930 +only for the account specified.
   2931  Variables:
   2932 +                  acct: the URI of the account being polled
   2933                     num: the total number of new messages added in this poll
   2934               num_inbox: the number of new messages added in this poll which
   2935                          appear in the inbox (i.e. were not auto-archived).
   2936 @@ -28,14 +37,25 @@ num_inbox_total_unread: the total number of unread messages in the inbox
   2937                          only those messages appearing in the inbox
   2938  EOS
   2939  
   2940 -  DELAY = 300
   2941 +  HookManager.register "after-poll", <<EOS
   2942 +Executes immediately after any poll for new messages completes. The statistics
   2943 +are for all sources polled.
   2944 +Variables:
   2945 +                 accts: an array of source URIs that were polled
   2946 +                   num: the total number of new messages added in this poll
   2947 +             num_inbox: the number of new messages added in this poll which
   2948 +                        appear in the inbox (i.e. were not auto-archived).
   2949 +num_inbox_total_unread: the total number of unread messages in the inbox
   2950 +         from_and_subj: an array of (from email address, subject) pairs
   2951 +   from_and_subj_inbox: an array of (from email address, subject) pairs for
   2952 +                        only those messages appearing in the inbox
   2953 +EOS
   2954  
   2955    def initialize
   2956      @mutex = Mutex.new
   2957      @thread = nil
   2958 -    @last_poll = nil
   2959      @polling = false
   2960 -    
   2961 +
   2962      self.class.i_am_the_instance self
   2963    end
   2964  
   2965 @@ -44,47 +64,113 @@ EOS
   2966      b
   2967    end
   2968  
   2969 -  def poll
   2970 +  def start
   2971 +    ## Periodically calls auto_poll, effectively automatically polling
   2972 +    ## in the background.
   2973 +    ##
   2974 +    ## auto_poll is called more frequently than the smallest poll
   2975 +    ## interval. auto_poll is not guaranteed to be called in multiples
   2976 +    ## of poll intervals. I.e., don't rely on auto_poll to be called
   2977 +    ## every x seconds: when auto_poll is called assume an
   2978 +    ## indeterminate amount of time has passed.
   2979 +    @min_poll_interval = Index.usual_sources.collect{|s| s.poll_interval}.select{|pi| !pi.nil?}.min || Redwood::DEFAULT_POLL_INTERVAL
   2980 +
   2981 +    Redwood::log "Background poll interval is #{@min_poll_interval} seconds."
   2982 +
   2983 +    @thread = Redwood::reporting_thread("periodic poll") do
   2984 +      while true
   2985 +        Redwood::log "Sleeping for #{@min_poll_interval / 2} seconds."
   2986 +
   2987 +        sleep @min_poll_interval / 2
   2988 +        auto_poll
   2989 +      end
   2990 +    end
   2991 +  end
   2992 +
   2993 +  def stop
   2994 +    @thread.kill if @thread
   2995 +    @thread = nil
   2996 +  end
   2997 +
   2998 +  def auto_poll
   2999 +    ## This method is called by the thread spawned in start. It
   3000 +    ## collects the sources that should be polled
   3001 +    ## (source.poll_interval has expired or the source has never been
   3002 +    ## polled) and polls them.
   3003 +    ##
   3004 +    ## Returns an array [# of new messages, # of new messages to
   3005 +    ## inbox, new message subject/name array pairs, subject/name array
   3006 +    ## pairs loaded to inbox]
   3007 +
   3008 +    sources_to_poll = []
   3009 +    @mutex.synchronize do # William, do we need to synchronize here?
   3010 +      begin
   3011 +        sources_to_poll = Index.usual_sources.select do |source|
   3012 +          begin
   3013 +            source.last_poll.nil? || (Time.now - source.last_poll) >= source.poll_interval
   3014 +          end
   3015 +        end
   3016 +      end
   3017 +    end
   3018 +
   3019 +    poll_sources sources_to_poll
   3020 +  end
   3021 +
   3022 +  def forced_poll
   3023 +    ## This method is called when the user explicitly requests a poll.
   3024 +    ##
   3025 +    ## Returns an array [# of new messages, # of new messages to
   3026 +    ## inbox, new message subject/name array pairs, subject/name array
   3027 +    ## pairs loaded to inbox]
   3028 +    poll_sources Index.usual_sources
   3029 +  end
   3030 +
   3031 +  def poll_sources sources
   3032 +    ## Polls the given sources. Clients of PollManager should call
   3033 +    ## this method, not do_poll_sources or poll_source. (Well, only
   3034 +    ## PollMode should call do_poll_sources)
   3035 +    ##
   3036 +    ## Returns an array [# of new messages, # of new messages to
   3037 +    ## inbox, new message subject/name array pairs, subject/name array
   3038 +    ## pairs loaded to inbox]
   3039      return if @polling
   3040      @polling = true
   3041 -    HookManager.run "before-poll"
   3042 +
   3043 +    source_uris = sources.map{|s| s.uri}
   3044 +
   3045 +    HookManager.run "before-acct-poll", :accts => source_uris
   3046  
   3047      BufferManager.flash "Polling for new messages..."
   3048 -    num, numi, from_and_subj, from_and_subj_inbox = buffer.mode.poll
   3049 +    num, numi, from_subj, from_subj_inbox = buffer.mode.poll sources
   3050      if num > 0
   3051        BufferManager.flash "Loaded #{num.pluralize 'new message'}, #{numi} to inbox." 
   3052      else
   3053        BufferManager.flash "No new messages." 
   3054      end
   3055  
   3056 -    HookManager.run "after-poll", :num => num, :num_inbox => numi, :from_and_subj => from_and_subj, :from_and_subj_inbox => from_and_subj_inbox, :num_inbox_total_unread => lambda { Index.num_results_for :labels => [:inbox, :unread] }
   3057 +    HookManager.run "after-poll", :accts => source_uris, :num => num, :num_inbox => numi, :from_and_subj => from_subj, :from_and_subj_inbox => from_subj_inbox, :num_inbox_total_unread => lambda { Index.num_results_for :labels => [:inbox, :unread] }
   3058  
   3059      @polling = false
   3060 -    [num, numi]
   3061 -  end
   3062 -
   3063 -  def start
   3064 -    @thread = Redwood::reporting_thread("periodic poll") do
   3065 -      while true
   3066 -        sleep DELAY / 2
   3067 -        poll if @last_poll.nil? || (Time.now - @last_poll) >= DELAY
   3068 -      end
   3069 -    end
   3070 +    [num, numi, from_subj, from_subj_inbox]
   3071    end
   3072  
   3073 -  def stop
   3074 -    @thread.kill if @thread
   3075 -    @thread = nil
   3076 -  end
   3077 +  def do_poll_sources sources, &block
   3078 +    ## Polls each source, keeping track of vital statistics (number
   3079 +    ## loaded, name/e-mail pairs, &c.) about the poll results.
   3080 +    ##
   3081 +    ## We need explicit access to the block so that we can pass it to
   3082 +    ## poll_source.
   3083 +    ##
   3084 +    ## Returns an array [total # of new messages, total # of new
   3085 +    ## messages to inbox, all new message subject/name array pairs,
   3086 +    ## all subject/name array pairs loaded to inbox]
   3087  
   3088 -  def do_poll
   3089      total_num = total_numi = 0
   3090 -    from_and_subj = []
   3091 -    from_and_subj_inbox = []
   3092 +    total_from_and_subj = []
   3093 +    total_from_and_subj_inbox = []
   3094  
   3095      @mutex.synchronize do
   3096 -      Index.usual_sources.each do |source|
   3097 -#        yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})"
   3098 +      sources.each do |source|
   3099          begin
   3100            yield "Loading from #{source}... " unless source.done? || source.has_errors?
   3101          rescue SourceError => e
   3102 @@ -93,32 +179,57 @@ EOS
   3103            next
   3104          end
   3105  
   3106 -        num = 0
   3107 -        numi = 0
   3108 -        add_messages_from source do |m, offset, entry|
   3109 -          ## always preserve the labels on disk.
   3110 -          m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry
   3111 -          yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
   3112 -          unless entry
   3113 -            num += 1
   3114 -            from_and_subj << [m.from.longname, m.subj]
   3115 -            if m.has_label?(:inbox) && ([:spam, :deleted, :killed] & m.labels).empty?
   3116 -              from_and_subj_inbox << [m.from.longname, m.subj]
   3117 -              numi += 1 
   3118 -            end
   3119 -          end
   3120 -          m
   3121 -        end
   3122 -        yield "Found #{num} messages, #{numi} to inbox." unless num == 0
   3123 +        HookManager.run "before-acct-poll", :acct => source.uri
   3124 +
   3125 +        BufferManager.flash "Polling #{source.uri} for new messages..."
   3126 +        num, numi, from_and_subj, from_and_subj_inbox = poll_source source, &block
   3127 +
   3128          total_num += num
   3129          total_numi += numi
   3130 +        total_from_and_subj += from_and_subj
   3131 +        total_from_and_subj_inbox += from_and_subj_inbox
   3132 +
   3133 +        HookManager.run "after-acct-poll", :acct => source.uri, :num => num, :num_inbox => numi, :from_and_subj => from_and_subj, :from_and_subj_inbox => from_and_subj_inbox, :num_inbox_total_unread => lambda { Index.num_results_for :labels => [:inbox, :unread] }
   3134        end
   3135 +    end
   3136 +
   3137 +    [total_num, total_numi, total_from_and_subj, total_from_and_subj_inbox]
   3138 +  end
   3139  
   3140 -      yield "Done polling; loaded #{total_num} new messages total"
   3141 -      @last_poll = Time.now
   3142 -      @polling = false
   3143 +  def poll_source source
   3144 +    ## Polls the given source for new messages.
   3145 +    ##
   3146 +    ## @mutex must be held before calling! See do_poll_sources.
   3147 +    ##
   3148 +    ## Returns an array [# of new messages, # of new messages to
   3149 +    ## inbox, new message subject/name array pairs, subject/name array
   3150 +    ## pairs loaded to inbox]
   3151 +
   3152 +    num = 0
   3153 +    numi = 0
   3154 +    from_and_subj = []
   3155 +    from_and_subj_inbox = []
   3156 +
   3157 +    add_messages_from source do |m, offset, entry|
   3158 +      ## always preserve the labels on disk.
   3159 +      m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry
   3160 +      yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
   3161 +      unless entry
   3162 +        num += 1
   3163 +        from_and_subj << [m.from.longname, m.subj]
   3164 +        if m.has_label?(:inbox) && ([:spam, :deleted, :killed] & m.labels).empty?
   3165 +          from_and_subj_inbox << [m.from.longname, m.subj]
   3166 +          numi += 1
   3167 +        end
   3168 +      end
   3169 +      m
   3170      end
   3171 -    [total_num, total_numi, from_and_subj, from_and_subj_inbox]
   3172 +
   3173 +    yield "For source #{source.uri}, found #{num} messages, #{numi} to inbox." unless num == 0
   3174 +
   3175 +    source.last_poll = Time.now
   3176 +
   3177 +    [num, numi, from_and_subj, from_and_subj_inbox]
   3178    end
   3179  
   3180    ## this is the main mechanism for adding new messages to the
   3181 diff --git a/lib/sup/source.rb b/lib/sup/source.rb
   3182 index 6510aae..fd8d381 100644
   3183 --- a/lib/sup/source.rb
   3184 +++ b/lib/sup/source.rb
   3185 @@ -62,10 +62,10 @@ class Source
   3186    ## dirty? means cur_offset has changed, so the source info needs to
   3187    ## be re-saved to sources.yaml.
   3188    bool_reader :usual, :archived, :dirty
   3189 -  attr_reader :uri, :cur_offset
   3190 -  attr_accessor :id
   3191 +  attr_reader :uri, :cur_offset, :poll_interval
   3192 +  attr_accessor :id, :last_poll
   3193  
   3194 -  def initialize uri, initial_offset=nil, usual=true, archived=false, id=nil
   3195 +  def initialize uri, initial_offset=nil, usual=true, archived=false, id=nil, poll_interval=nil
   3196      raise ArgumentError, "id must be an integer: #{id.inspect}" unless id.is_a? Fixnum if id
   3197  
   3198      @uri = uri
   3199 @@ -73,6 +73,8 @@ class Source
   3200      @usual = usual
   3201      @archived = archived
   3202      @id = id
   3203 +    @poll_interval = poll_interval || Redwood::DEFAULT_POLL_INTERVAL #seconds
   3204 +    @last_poll = nil
   3205      @dirty = false
   3206    end
   3207  
   3208 -- 
   3209 1.5.4
   3210 
   3211 
   3212 From 5srmspw02@sneakemail.com  Sat Mar 29 12:41:14 2008
   3213 From: 5srmspw02@sneakemail.com (Guarded Identity)
   3214 Date: Sat, 29 Mar 2008 11:41:14 -0500
   3215 Subject: [sup-talk] Different Key Bindings (was: New User Questions)
   3216 In-Reply-To: <1206699001-sup-9770@tomsk>
   3217 References: <1206662265-sup-7439@cabinet> <1206699001-sup-9770@tomsk>
   3218 Message-ID: <27382-65971@sneakemail.com>
   3219 
   3220 Excerpts from Marcus Williams marcus-sup-at-bar-coded.net |Sup_Talk|'s message of Fri Mar 28 05:33:45
   3221 > > 8. Is there any way to specify custom keybindings in a configuration
   3222 > > file, or would it require hacking the source?
   3223 >
   3224 > Hack the source afaik
   3225 
   3226 I know I'd /definitely/ be interested in this kind of thing.  For the most
   3227 part, I'm really happy with current key bindings, but there's a few that bug
   3228 me.  For instance.  I wish 'l' and 'L' were reversed.  My rationale is that I
   3229 don't like the unshifted characters to do persistent things (just in-case I hit
   3230 the wrong key).  Maybe it's just me, but I hit 'l' sometimes, briefly believe
   3231 that Sup is hung, and then realize that I'm editing labels, and then Ctrl-G'd
   3232 out before accidentally committing the junk labels.
   3233 
   3234 -Sukant
   3235 
   3236 From chrisw@rice.edu  Sat Mar 29 23:15:37 2008
   3237 From: chrisw@rice.edu (Christopher Warrington)
   3238 Date: Sat, 29 Mar 2008 22:15:37 -0500
   3239 Subject: [sup-talk] [PATCH] polling is now done per source
   3240 In-Reply-To: <1206786725-5456-1-git-send-email-chrisw@rice.edu>
   3241 References: <1206784680-sup-3052@chris-tablet>
   3242 	<1206786725-5456-1-git-send-email-chrisw@rice.edu>
   3243 Message-ID: <1206846791-sup-7998@chris-tablet>
   3244 
   3245 Excerpts from Christopher Warrington's message of Sat Mar 29 05:32:05 -0500 2008:
   3246 > Each source has a poll_interval property. This property is used to
   3247 > determine whether the source should be polled. The user can still
   3248 > for a poll of all sources.
   3249 
   3250 This is the fixed patch. I've been running it all day now with Maildir
   3251 sources and it seems to be working. I'd love some feedback, especially
   3252 from those who use mbox or IMAP.
   3253 
   3254 -- 
   3255 Christopher Warrington <chrisw at rice.edu>
   3256 
   3257