community/pipermail-archives/sup-talk/2009-06.txt (434267B) - raw
1 From ezyang@MIT.EDU Mon Jun 1 19:18:26 2009
2 From: ezyang@MIT.EDU (Edward Z. Yang)
3 Date: Mon, 01 Jun 2009 19:18:26 -0400
4 Subject: [sup-talk] Attempt at reply-from hook
5 Message-ID: <1243898254-sup-7513@javelin>
6
7 Hello,
8
9 I'm attempting to create a reply-from.rb hook that looks like this:
10
11 if message.has_label? 'twp':
12 Person.from_address "Edward Z. Yang <edwardzyang at thewritingpot.com>"
13 end
14
15 Unfortunately, it doesn't seem to work. I'm running sup v0.7.
16
17 Cheers,
18 Edward
19
20 From dom.lobue@gmail.com Mon Jun 1 21:54:58 2009
21 From: dom.lobue@gmail.com (Dominic LoBue)
22 Date: Mon, 1 Jun 2009 18:54:58 -0700
23 Subject: [sup-talk] Need help with OfflineIMAP integration and Iconv errors
24 Message-ID: <93de24940906011854m70b8511cv139d0c7a830fc914@mail.gmail.com>
25
26 Hello,
27
28 Let me start off by saying that I am incredibly impressed with sup.
29 I'm really looking forward to being able to replace Outlook with Sup,
30 but I'm running into some problems that are preventing a complete
31 transition.
32
33 The first problem I'm having is when ferret is parsing through my
34 emails to build its indicies I get numerous "warning: error
35 (Iconv::IllegalSequence) decoding message body from X" errors, This
36 prevents a lot of my email from showing up at all. Iconv has this
37 problem from attempting to convert from Windows-1252, UTF-8, and
38 iso-8859-1. While I doubt its the cause of the problem, I am
39 downloading my email from the Exchange 2003 server at work via
40 OfflineIMAP.
41
42 The other major problem I'm running into is I can't figure out how to
43 get Sup and OfflineIMAP talking together correctly so that labels and
44 Seen flags are uploaded back to the Exchange server. I read that there
45 were no plans to support uploading meta-data back to IMAP servers, so
46 I was hoping that OfflineIMAP would sidestep the problem entirely. I
47 searched the archives but I didn't find any examples of working
48 configs. If anyone can point me to a working example I'd greatly
49 appreciate it.
50
51 I've tried both the latest official release and the latest revision
52 uploaded to github as of 20 minutes ago.
53
54 Any help would be greatly appreciated!
55 Dominic LoBue
56
57 From wmorgan-sup@masanjin.net Tue Jun 2 10:54:23 2009
58 From: wmorgan-sup@masanjin.net (William Morgan)
59 Date: Tue, 02 Jun 2009 07:54:23 -0700
60 Subject: [sup-talk] utf patch needs work, i think
61 In-Reply-To: <1243731497-sup-5619@entry>
62 References: <1243539136-sup-9008@ntdws12.chass.utoronto.ca>
63 <1243553511-sup-472@ntdws12.chass.utoronto.ca>
64 <1243731497-sup-5619@entry>
65 Message-ID: <1243954348-sup-1644@entry>
66
67 Reformatted excerpts from William Morgan's message of 2009-05-30:
68 > I suspect there's something like a tab or a weird character coming out
69 > of the decoding (which appears to be some non-utf16 text claiming a
70 > utf16 big-endian encoding) that is screwing with Ncurses.
71
72 I've committed some changes that should remove invalid characters
73 for your encoding before display. I think this should help. Also
74 various display tweaks to account for multibyte characters. I still
75 see some inconsistencies but I think it's getting better.
76
77 That message renders "fine" for me now. (A bunch of nonsense Chinese
78 characters mixed with some boxes.) I'm using utf8 in a gnome-terminal.
79 --
80 William <wmorgan-sup at masanjin.net>
81
82 From marka@pobox.com Tue Jun 2 12:29:13 2009
83 From: marka@pobox.com (Mark Alexander)
84 Date: Tue, 02 Jun 2009 09:29:13 -0700
85 Subject: [sup-talk] [PATCH] Handle nil charset on attachments.
86 Message-ID: <1243959935-sup-8233@r50p>
87
88 I updated to the latest 'next' branch of sup
89 this morning, and immediately ran into a crash
90 when viewing a message with an attachement, which
91 was probably sent by an Outlook user. The crash
92 was due to a nil charset; this patch fixes the crash.
93 ---
94 lib/sup/message-chunks.rb | 2 +-
95 1 files changed, 1 insertions(+), 1 deletions(-)
96
97 diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
98 index 3f57346..41d924b 100644
99 --- a/lib/sup/message-chunks.rb
100 +++ b/lib/sup/message-chunks.rb
101 @@ -98,7 +98,7 @@ EOS
102 text =
103 case @content_type
104 when /^text\/plain\b/
105 - Iconv.easy_decode $encoding, encoded_content.charset, @raw_content
106 + Iconv.easy_decode $encoding, encoded_content.charset || $encoding, @raw_content
107 else
108 HookManager.run "mime-decode", :content_type => content_type,
109 :filename => lambda { write_to_disk },
110
111 From wmorgan-sup@masanjin.net Tue Jun 2 12:46:00 2009
112 From: wmorgan-sup@masanjin.net (William Morgan)
113 Date: Tue, 02 Jun 2009 09:46:00 -0700
114 Subject: [sup-talk] [PATCH] Handle nil charset on attachments.
115 In-Reply-To: <1243959935-sup-8233@r50p>
116 References: <1243959935-sup-8233@r50p>
117 Message-ID: <1243961075-sup-6760@entry>
118
119 Reformatted excerpts from Mark Alexander's message of 2009-06-02:
120 > I updated to the latest 'next' branch of sup this morning, and
121 > immediately ran into a crash when viewing a message with an
122 > attachement, which was probably sent by an Outlook user. The crash
123 > was due to a nil charset; this patch fixes the crash.
124
125 Sloppy of me. Applied, thanks!
126 --
127 William <wmorgan-sup at masanjin.net>
128
129 From ingmar.stdin@gmail.com Tue Jun 2 18:09:16 2009
130 From: ingmar.stdin@gmail.com (Ingmar Vanhassel)
131 Date: Wed, 03 Jun 2009 00:09:16 +0200
132 Subject: [sup-talk] Attempt at reply-from hook
133 In-Reply-To: <1243898254-sup-7513@javelin>
134 References: <1243898254-sup-7513@javelin>
135 Message-ID: <1243980495-sup-7229@cannonball>
136
137 Excerpts from Edward Z. Yang's message of Tue Jun 02 01:18:26 +0200 2009:
138 > Hello,
139 >
140 > I'm attempting to create a reply-from.rb hook that looks like this:
141 >
142 > if message.has_label? 'twp':
143 > Person.from_address "Edward Z. Yang <edwardzyang at thewritingpot.com>"
144 > end
145
146 if message.has_label? twp
147 Person.from_address "Edward Z. Yang <edwardzyang at thewritingpot.com>"
148 end
149
150 > Unfortunately, it doesn't seem to work. I'm running sup v0.7.
151
152 If the above doesn't work, post some relevant error output.
153
154 > Cheers,
155 > Edward
156
157 Regards,
158 Ingmar
159
160 From ezyang@MIT.EDU Tue Jun 2 22:54:02 2009
161 From: ezyang@MIT.EDU (Edward Z. Yang)
162 Date: Tue, 02 Jun 2009 22:54:02 -0400
163 Subject: [sup-talk] Attempt at reply-from hook
164 In-Reply-To: <1243980495-sup-7229@cannonball>
165 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
166 Message-ID: <1243997614-sup-7485@javelin>
167
168 Excerpts from Ingmar Vanhassel's message of Tue Jun 02 18:09:16 -0400 2009:
169 > If the above doesn't work, post some relevant error output.
170
171 It silently fails. Is there any Sup way of making debug messages in
172 hooks?
173
174 Cheers,
175 Edward
176
177 From bwalton@artsci.utoronto.ca Wed Jun 3 07:44:24 2009
178 From: bwalton@artsci.utoronto.ca (Ben Walton)
179 Date: Wed, 03 Jun 2009 07:44:24 -0400
180 Subject: [sup-talk] Attempt at reply-from hook
181 In-Reply-To: <1243997614-sup-7485@javelin>
182 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
183 <1243997614-sup-7485@javelin>
184 Message-ID: <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
185
186 Excerpts from Edward Z. Yang's message of Tue Jun 02 22:54:02 -0400 2009:
187
188 > It silently fails. Is there any Sup way of making debug messages in
189 > hooks?
190
191 Redwood::log "my message"
192
193 Then, look in the log buffer.
194
195 HTH.
196 -Ben
197
198 --
199 Ben Walton
200 Systems Programmer - CHASS
201 University of Toronto
202 C:416.407.5610 | W:416.978.4302
203
204 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
205 Contact me to arrange for a CAcert assurance meeting.
206 -------------- next part --------------
207 A non-text attachment was scrubbed...
208 Name: signature.asc
209 Type: application/pgp-signature
210 Size: 189 bytes
211 Desc: not available
212 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090603/2d66ef11/attachment.bin>
213
214 From ezyang@MIT.EDU Wed Jun 3 13:39:40 2009
215 From: ezyang@MIT.EDU (Edward Z. Yang)
216 Date: Wed, 03 Jun 2009 13:39:40 -0400
217 Subject: [sup-talk] Sup is hanging
218 Message-ID: <1244050695-sup-5990@javelin>
219
220 Hey all,
221
222 Somehow, I messed something up really bad, and now, whenever Sup
223 attempts to poll for new messages, it hang completely, spinning the
224 CPU. I've let it run for an appreciable amount of time, and haven't
225 seen any change. I was wondering how I could fix this, or go about
226 debugging it. There also seems to be a single mail source at fault,
227 but I can't remove it without having Sup complain at me. Right now,
228 I'm running sup as -no.
229
230 Thanks,
231 Edward
232
233 From wmorgan-sup@masanjin.net Wed Jun 3 14:11:28 2009
234 From: wmorgan-sup@masanjin.net (William Morgan)
235 Date: Wed, 03 Jun 2009 11:11:28 -0700
236 Subject: [sup-talk] Sup is hanging
237 In-Reply-To: <1244050695-sup-5990@javelin>
238 References: <1244050695-sup-5990@javelin>
239 Message-ID: <1244052318-sup-6595@entry>
240
241 Reformatted excerpts from Edward Z. Yang's message of 2009-06-03:
242 > Somehow, I messed something up really bad, and now, whenever Sup
243 > attempts to poll for new messages, it hang completely, spinning the
244 > CPU. I've let it run for an appreciable amount of time, and haven't
245 > seen any change. I was wondering how I could fix this, or go about
246 > debugging it.
247
248 Is the curses interface hung? If not, can you see if there's activity in
249 the poll mode or the log mode buffers? (Hit ; if you're running from
250 git, or B if you're running 0.7.) It might be that you've somehow reset
251 the recorded offset for a very large source, so Sup is polling a lot of
252 stuff in the background.
253
254 If it's completely hung (which would be weird), try first disabling your
255 hooks (move them from ~/.sup/hooks to another directory) and see if that
256 helps. If not, please describe the behavior of running sup-sync.
257
258 --
259 William <wmorgan-sup at masanjin.net>
260
261 From ezyang@MIT.EDU Wed Jun 3 14:21:35 2009
262 From: ezyang@MIT.EDU (Edward Z. Yang)
263 Date: Wed, 03 Jun 2009 14:21:35 -0400
264 Subject: [sup-talk] Sup is hanging
265 In-Reply-To: <1244050695-sup-5990@javelin>
266 References: <1244050695-sup-5990@javelin>
267 Message-ID: <1244053108-sup-4982@javelin>
268
269 The current working theory (based on strace'ing and lsof) is that Sup
270 is hanging on a select() call that doesn't have any timeout. The reason
271 why this is hanging is because between opening the connection and
272 closing it, Sup does some ridiculously slow message parsing code (that
273 really thrashes the CPU) and by the time it's done the server has
274 closed the connection (but we don't know about it). The fix would probably
275 be to always set a timeout, but I don't know what code needs to be fixed
276 for that.
277
278 Cheers,
279 Edward
280
281 From ezyang@MIT.EDU Wed Jun 3 14:26:44 2009
282 From: ezyang@MIT.EDU (Edward Z. Yang)
283 Date: Wed, 3 Jun 2009 14:26:44 -0400 (EDT)
284 Subject: [sup-talk] Sup is hanging
285 In-Reply-To: <1244052318-sup-6595@entry>
286 References: <1244050695-sup-5990@javelin> <1244052318-sup-6595@entry>
287 Message-ID: <alpine.DEB.2.00.0906031425430.6338@javelin>
288
289 On Wed, 3 Jun 2009, William Morgan wrote:
290 > Is the curses interface hung?>
291
292 Yep.
293
294 > If it's completely hung (which would be weird), try first disabling your
295 > hooks (move them from ~/.sup/hooks to another directory) and see if that
296 > helps. If not, please describe the behavior of running sup-sync.
297
298 I can try that. I've described the behavior of sup-sync in my other
299 email.
300
301 Cheers,
302 Edward
303
304 From ezyang@MIT.EDU Wed Jun 3 14:45:59 2009
305 From: ezyang@MIT.EDU (Edward Z. Yang)
306 Date: Wed, 3 Jun 2009 14:45:59 -0400 (EDT)
307 Subject: [sup-talk] Sup is hanging
308 In-Reply-To: <1244053108-sup-4982@javelin>
309 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
310 Message-ID: <alpine.DEB.2.00.0906031445190.6338@javelin>
311
312 Also, if it helps, here's the backtrace for when it's hanging on the
313 select:
314
315 /usr/lib/ruby/1.8/monitor.rb:102:in `stop': Interrupt
316 from /usr/lib/ruby/1.8/monitor.rb:102:in `wait'
317 from /usr/lib/ruby/1.8/net/imap.rb:972:in `get_tagged_response'
318 from /usr/lib/ruby/1.8/net/imap.rb:1032:in `send_command'
319 from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
320 from /usr/lib/ruby/1.8/net/imap.rb:1017:in `send_command'
321 from /usr/lib/ruby/1.8/net/imap.rb:409:in `examine'
322 from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
323 from /usr/lib/ruby/1.8/net/imap.rb:407:in `examine'
324 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/imap.rb:145:in `unsynchronized_scan_mailbox'
325 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/imap.rb:322:in `safely'
326 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/imap.rb:144:in `unsynchronized_scan_mailbox'
327 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/imap.rb:192:in `unsynchronized_start_offset'
328 from (eval):3:in `start_offset'
329 from (eval):3:in `synchronize'
330 from (eval):3:in `start_offset'
331 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:544:in `send'
332 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:544:in `__pass'
333 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:531:in `method_missing'
334 from /usr/lib/ruby/gems/1.8/gems/sup-999/bin/sup-sync:147
335 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/poll.rb:160:in `add_messages_from'
336 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/imap.rb:187:in `each'
337 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/imap.rb:175:in `upto'
338 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/imap.rb:175:in `each'
339 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:544:in `send'
340 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:544:in `__pass'
341 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:531:in `method_missing'
342 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/poll.rb:141:in `add_messages_from'
343 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:505:in `send'
344 from /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:505:in `method_missing'
345 from /usr/lib/ruby/gems/1.8/gems/sup-999/bin/sup-sync:140
346 from /usr/lib/ruby/gems/1.8/gems/sup-999/bin/sup-sync:135:in `each'
347 from /usr/lib/ruby/gems/1.8/gems/sup-999/bin/sup-sync:135
348 from /var/lib/gems/1.8/bin/sup-sync:19:in `load'
349 from /var/lib/gems/1.8/bin/sup-sync:19
350
351 Cheers,
352 Edward
353
354 From wmorgan-sup@masanjin.net Wed Jun 3 17:36:15 2009
355 From: wmorgan-sup@masanjin.net (William Morgan)
356 Date: Wed, 03 Jun 2009 14:36:15 -0700
357 Subject: [sup-talk] Sup is hanging
358 In-Reply-To: <1244053108-sup-4982@javelin>
359 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
360 Message-ID: <1244064889-sup-9506@entry>
361
362 Reformatted excerpts from Edward Z. Yang's message of 2009-06-03:
363 > The current working theory (based on strace'ing and lsof) is that Sup
364 > is hanging on a select() call that doesn't have any timeout. The
365 > reason why this is hanging is because between opening the connection
366 > and closing it, Sup does some ridiculously slow message parsing code
367 > (that really thrashes the CPU) and by the time it's done the server
368 > has closed the connection (but we don't know about it).
369
370 That may all be true, but I'd be surprised if a) Sup didn't know that
371 the server had closed the connection, and b) that this would cause the
372 whole thing to hang.
373
374 When you don't use -n, does Sup still lock up?
375 --
376 William <wmorgan-sup at masanjin.net>
377
378 From ezyang@MIT.EDU Wed Jun 3 17:48:56 2009
379 From: ezyang@MIT.EDU (Edward Z. Yang)
380 Date: Wed, 3 Jun 2009 17:48:56 -0400 (EDT)
381 Subject: [sup-talk] Sup is hanging
382 In-Reply-To: <1244064889-sup-9506@entry>
383 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
384 <1244064889-sup-9506@entry>
385 Message-ID: <alpine.DEB.2.00.0906031740370.22220@javelin>
386
387 On Wed, 3 Jun 2009, William Morgan wrote:
388 > Reformatted excerpts from Edward Z. Yang's message of 2009-06-03:
389 >> The current working theory (based on strace'ing and lsof) is that Sup
390 >> is hanging on a select() call that doesn't have any timeout. The
391 >> reason why this is hanging is because between opening the connection
392 >> and closing it, Sup does some ridiculously slow message parsing code
393 >> (that really thrashes the CPU) and by the time it's done the server
394 >> has closed the connection (but we don't know about it).
395 >
396 > That may all be true, but I'd be surprised if a) Sup didn't know that
397 > the server had closed the connection, and
398
399 It doesn't have anything to do with Sup: the system select() call is
400 hanging; Sup (and Ruby for that matter) is out of the equation. This
401 might be IMAP server weirdness, but that shouldn't cause Sup to
402 freeze.
403
404 > b) that this would cause the
405 > whole thing to hang.
406
407 That's what I find surprising, since Sup is multithreaded. I suppose
408 all of the threads are blocking on the select.
409
410 Sup hangs without -n. (it always hangs after it's "done fetching IMAP
411 headers"). "done fetching IMAP headers" is the last message we get.
412
413 The behavior seems to be:
414
415 1. Log reports "done fetching IMAP headers"
416
417 2. Sup begins malloc'ing like crazy. sup-sync still is able to catch
418 signals and if you kill it you find that it's somewhere in
419 lib/sup/message.rb, message_to_chunks. sup doesn't respond to Ctrl+C
420
421 3. After some minutes, CPU usage dies off, but Sup doesn't unfreeze.
422 strace indicates that sup/sup-sync is waiting on a select(), and that
423 the descriptors are TCP connections to the IMAP server.
424
425 Cheers,
426 Edward
427
428
429 From ezyang@MIT.EDU Wed Jun 3 18:00:06 2009
430 From: ezyang@MIT.EDU (Edward Z. Yang)
431 Date: Wed, 3 Jun 2009 18:00:06 -0400 (EDT)
432 Subject: [sup-talk] Sup is hangingy
433 In-Reply-To: <1244064889-sup-9506@entry>
434 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
435 <1244064889-sup-9506@entry>
436 Message-ID: <alpine.DEB.2.00.0906031758290.24343@javelin>
437
438 Oh hey, I managed to kill Sup:
439
440 ezyang at javelin:~$ sup
441 [Wed Jun 03 17:42:43 -0400 2009] using character set encoding "UTF-8"
442 [Wed Jun 03 17:42:44 -0400 2009] dynamically loading setlocale() from
443 libc.so.6
444 [Wed Jun 03 17:42:44 -0400 2009] setting locale...
445 [Wed Jun 03 17:42:44 -0400 2009] locking /home/ezyang/.sup/lock...
446 [Wed Jun 03 17:42:44 -0400 2009] crypto: detected gpg binary in
447 /usr/bin/gpg
448 [Wed Jun 03 17:42:44 -0400 2009] loading index...
449 [Wed Jun 03 17:42:44 -0400 2009] loaded index of 20188 messages
450 [Wed Jun 03 17:42:44 -0400 2009] starting curses
451 [Wed Jun 03 17:54:47 -0400 2009] stopped cursing
452 [Wed Jun 03 17:54:47 -0400 2009] oh crap, an exception
453 [Wed Jun 03 17:54:47 -0400 2009] unlocking /home/ezyang/.sup/lock...
454 ----------------------------------------------------------------
455 I'm very sorry. It seems that an error occurred in Sup. Please
456 accept my sincere apologies. If you don't mind, please send the
457 contents of ~/.sup/exception-log.txt and a brief report of the
458 circumstances to sup-talk at rubyforge dot orgs so that I might
459 address this problem. Thank you!
460
461 Sincerely,
462 William
463 ----------------------------------------------------------------
464 --- Interrupt from thread: main
465
466 /usr/lib/ruby/gems/1.8/gems/ncurses-0.9.1/lib/ncurses.rb:71:in
467 `method_missing'
468 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:109:in `write'
469 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:245:in
470 `draw_line_from_string'
471 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:182:in
472 `draw_line'
473 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:48:in
474 `draw'
475 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:48:in
476 `each'
477 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:48:in
478 `draw'
479 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:99:in `draw'
480 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:303:in
481 `draw_screen'
482 /usr/lib/ruby/gems/1.8/gems/sup-999/bin/sup:308
483 /var/lib/gems/1.8/bin/sup:19:in `load'
484 /var/lib/gems/1.8/bin/sup:19
485
486 This seems... unrelated.
487
488 Cheers,
489 Edward
490
491 From ezyang@MIT.EDU Wed Jun 3 21:26:01 2009
492 From: ezyang@MIT.EDU (Edward Z. Yang)
493 Date: Wed, 03 Jun 2009 21:26:01 -0400
494 Subject: [sup-talk] Sup is hangingy
495 In-Reply-To: <alpine.DEB.2.00.0906031758290.24343@javelin>
496 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
497 <1244064889-sup-9506@entry>
498 <alpine.DEB.2.00.0906031758290.24343@javelin>
499 Message-ID: <1244078482-sup-4986@javelin>
500
501 Ok, after a bit of fiddling, I've managed to figure out that this is
502 two problems, not one.
503
504 The first is related to a naughty IMAP server which simply stops responding
505 after a certain number of seconds. Unfortunately, this is my workplace's
506 IMAP server, so I can't give you a test environment. Furthermore, the code
507 that would be appropriate to change is in Net::Imap, and thus is not
508 easily accessible by Sup. I've worked around this by making it an unusual
509 source.
510
511 The second is a large amount of CPU thrashing as Sup parses messages. This
512 is something we can fix, and I hope to do some more poking to help make
513 Sup run faster in this respect. The basic behavior is Sup repeatedly
514 allocates some amount of memory, reallocates it twice (quadrupling it
515 in size to about 4MB), deallocates, and then does it again. I'm running
516 ruby-prof in hopes of tickling this again. Unlike the hung IMAP server,
517 this eventually finishes, but it is extremely obnoxious when it happens
518 and blocks everything else. It commonly occurs when I open an email message.
519
520 Cheers,
521 Edward
522
523 From ezyang@MIT.EDU Wed Jun 3 21:53:12 2009
524 From: ezyang@MIT.EDU (Edward Z. Yang)
525 Date: Wed, 3 Jun 2009 21:53:12 -0400 (EDT)
526 Subject: [sup-talk] Sup is hangingyy
527 In-Reply-To: <1244078482-sup-4986@javelin>
528 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
529 <1244064889-sup-9506@entry>
530 <alpine.DEB.2.00.0906031758290.24343@javelin>
531 <1244078482-sup-4986@javelin>
532 Message-ID: <alpine.DEB.2.00.0906032152200.6894@javelin>
533
534 On Wed, 3 Jun 2009, Edward Z. Yang wrote:
535 > The second is a large amount of CPU thrashing as Sup parses messages. This
536 > is something we can fix, and I hope to do some more poking to help make
537 > Sup run faster in this respect. The basic behavior is Sup repeatedly
538 > allocates some amount of memory, reallocates it twice (quadrupling it
539 > in size to about 4MB), deallocates, and then does it again. I'm running
540 > ruby-prof in hopes of tickling this again. Unlike the hung IMAP server,
541 > this eventually finishes, but it is extremely obnoxious when it happens
542 > and blocks everything else. It commonly occurs when I open an email message.
543
544 Here we go:
545
546 http://web.mit.edu/~ezyang/Public/sup-performance.png
547
548 Look at String::=~. Definitely not acceptable.
549
550 Cheers,
551 Edward
552
553
554 From ross.macduff@gmail.com Wed Jun 3 22:04:32 2009
555 From: ross.macduff@gmail.com (Ross Macduff)
556 Date: Wed, 3 Jun 2009 22:04:32 -0400
557 Subject: [sup-talk] (no subject)
558 In-Reply-To: <200906010101.n5111ADJ007928@ntdws12.chass.utoronto.ca>
559 References: <200906010101.n5111ADJ007928@ntdws12.chass.utoronto.ca>
560 Message-ID: <b689a800906031904s7a0606f3m229e1c726a2a83b1@mail.gmail.com>
561
562 I merged this patch into the mainline from gitorius. Works as
563 expected. Definitely a nice addition.
564
565 Ross
566
567 On Sun, May 31, 2009 at 9:01 PM, Ben Walton <bwalton at cquest.utoronto.ca> wrote:
568 > >From 702b2cc1e652c1f20f4280b11355cb337291df87 Mon Sep 17 00:00:00 2001
569 > From: Ben Walton <bwalton at artsci.utoronto.ca>
570 > Date: Sun, 31 May 2009 20:37:11 -0400
571 > Subject: [PATCH] Add bounce message feature
572 >
573 > By pressing ! in thread view mode, a message can be re-injected to the
574 > mail system without any modification. ?The interesting/useful property
575 > of this feature is that, because only the envelope sender changes, the
576 > mail will show up at the new destination with the original From:
577 > header. ?A use case for this is redirecting mail sent to an individual
578 > into a ticket system such that the original sender gets the
579 > auto-response.
580 >
581 > Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca>
582 > ---
583 > ?lib/sup/modes/thread-view-mode.rb | ? 19 +++++++++++++++++++
584 > ?1 files changed, 19 insertions(+), 0 deletions(-)
585 >
586 > diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
587 > index 42c6280..4737dde 100644
588 > --- a/lib/sup/modes/thread-view-mode.rb
589 > +++ b/lib/sup/modes/thread-view-mode.rb
590 > @@ -41,6 +41,7 @@ EOS
591 > ?# ? ?k.add :collapse_non_new_messages, "Collapse all but unread messages", 'N'
592 > ? ? k.add :reply, "Reply to a message", 'r'
593 > ? ? k.add :forward, "Forward a message or attachment", 'f'
594 > + ? ?k.add :bounce, "Bounce message to other recipient(s)", '!'
595 > ? ? k.add :alias, "Edit alias/nickname for a person", 'i'
596 > ? ? k.add :edit_as_new, "Edit message as new", 'D'
597 > ? ? k.add :save_to_disk, "Save message/attachment to disk", 's'
598 > @@ -172,6 +173,24 @@ EOS
599 > ? ? end
600 > ? end
601 >
602 > + ?def bounce
603 > + ? ?m = @message_lines[curpos] or return
604 > + ? ?to = BufferManager.ask_for_contacts(:people, "Bounce To: ") or return
605 > +
606 > + ? ?if BufferManager.ask_yes_or_no "Really bounce to #{to.join(', ')}?"
607 > + ? ? ?cmd = "sendmail -oem -i #{to.map { |t| t.email}.join(' ')}"
608 > + ? ? ?begin
609 > + ? ? ? ?IO.popen(cmd, 'w') do |sm|
610 > + ? ? ? ? ?sm.puts m.raw_message
611 > + ? ? ? ?end
612 > + ? ? ? ?raise SendmailCommandFailed, "Couldn't execute #{cmd}" unless $? == 0
613 > + ? ? ?rescue SystemCallError, SendmailCommandFailed => e
614 > + ? ? ? ?Redwood::log "Problem sending mail: #{e.message}"
615 > + ? ? ? ?BufferManager.flash "Problem sending mail: #{e.message}"
616 > + ? ? ?end
617 > + ? ?end
618 > + ?end
619 > +
620 > ? include CanAliasContacts
621 > ? def alias
622 > ? ? p = @person_lines[curpos] or return
623 > --
624 > 1.6.3
625 >
626 > _______________________________________________
627 > sup-talk mailing list
628 > sup-talk at rubyforge.org
629 > http://rubyforge.org/mailman/listinfo/sup-talk
630 >
631
632 From wmorgan-sup@masanjin.net Wed Jun 3 22:11:31 2009
633 From: wmorgan-sup@masanjin.net (William Morgan)
634 Date: Wed, 03 Jun 2009 19:11:31 -0700
635 Subject: [sup-talk] Sup is hanging
636 In-Reply-To: <alpine.DEB.2.00.0906031740370.22220@javelin>
637 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
638 <1244064889-sup-9506@entry>
639 <alpine.DEB.2.00.0906031740370.22220@javelin>
640 Message-ID: <1244081477-sup-4133@entry>
641
642 [resent to list]
643
644 Reformatted excerpts from Edward Z. Yang's message of 2009-06-03:
645 > That's what I find surprising, since Sup is multithreaded. I suppose
646 > all of the threads are blocking on the select.
647
648 It's possible... Ruby does use green threads and a GIL, so there's
649 always the possibility that something in C land will block all Ruby
650 threads, but my impression was that that was an issue mainly with
651 third-party libraries. I believe that Net::IMAP is pure Ruby, thus using
652 the core Ruby IO mechanisms, and I thought those were pretty good about
653 being preemptible. Curious!
654 --
655 William <wmorgan-sup at masanjin.net>
656
657 From wmorgan-sup@masanjin.net Wed Jun 3 22:12:25 2009
658 From: wmorgan-sup@masanjin.net (William Morgan)
659 Date: Wed, 03 Jun 2009 19:12:25 -0700
660 Subject: [sup-talk] Sup is hangingy
661 In-Reply-To: <alpine.DEB.2.00.0906031758290.24343@javelin>
662 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
663 <1244064889-sup-9506@entry>
664 <alpine.DEB.2.00.0906031758290.24343@javelin>
665 Message-ID: <1244081540-sup-7695@entry>
666
667 Reformatted excerpts from Edward Z. Yang's message of 2009-06-03:
668 > Oh hey, I managed to kill Sup:
669 >
670 > ezyang at javelin:~$ sup
671 > [Wed Jun 03 17:42:43 -0400 2009] using character set encoding "UTF-8"
672 > [Wed Jun 03 17:42:44 -0400 2009] dynamically loading setlocale() from
673 > libc.so.6
674 > [Wed Jun 03 17:42:44 -0400 2009] setting locale...
675 > [Wed Jun 03 17:42:44 -0400 2009] locking /home/ezyang/.sup/lock...
676 > [Wed Jun 03 17:42:44 -0400 2009] crypto: detected gpg binary in
677 > /usr/bin/gpg
678 > [Wed Jun 03 17:42:44 -0400 2009] loading index...
679 > [Wed Jun 03 17:42:44 -0400 2009] loaded index of 20188 messages
680 > [Wed Jun 03 17:42:44 -0400 2009] starting curses
681 > [Wed Jun 03 17:54:47 -0400 2009] stopped cursing
682 > [Wed Jun 03 17:54:47 -0400 2009] oh crap, an exception
683 > [Wed Jun 03 17:54:47 -0400 2009] unlocking /home/ezyang/.sup/lock...
684 > ----------------------------------------------------------------
685 > I'm very sorry. It seems that an error occurred in Sup. Please
686 > accept my sincere apologies. If you don't mind, please send the
687 > contents of ~/.sup/exception-log.txt and a brief report of the
688 > circumstances to sup-talk at rubyforge dot orgs so that I might
689 > address this problem. Thank you!
690 >
691 > Sincerely,
692 > William
693 > ----------------------------------------------------------------
694 > --- Interrupt from thread: main
695 >
696 > /usr/lib/ruby/gems/1.8/gems/ncurses-0.9.1/lib/ncurses.rb:71:in
697 > `method_missing'
698 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:109:in `write'
699 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:245:in
700 > `draw_line_from_string'
701 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:182:in
702 > `draw_line'
703 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:48:in
704 > `draw'
705 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:48:in
706 > `each'
707 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/scroll-mode.rb:48:in
708 > `draw'
709 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:99:in `draw'
710 > /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:303:in
711 > `draw_screen'
712 > /usr/lib/ruby/gems/1.8/gems/sup-999/bin/sup:308
713 > /var/lib/gems/1.8/bin/sup:19:in `load'
714 > /var/lib/gems/1.8/bin/sup:19
715 >
716 > This seems... unrelated.
717 >
718 > Cheers,
719 > Edward
720 --
721 William <wmorgan-sup at masanjin.net>
722
723 From wmorgan-sup@masanjin.net Wed Jun 3 22:13:58 2009
724 From: wmorgan-sup@masanjin.net (William Morgan)
725 Date: Wed, 03 Jun 2009 19:13:58 -0700
726 Subject: [sup-talk] Sup is hangingy
727 In-Reply-To: <alpine.DEB.2.00.0906031758290.24343@javelin>
728 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
729 <1244064889-sup-9506@entry>
730 <alpine.DEB.2.00.0906031758290.24343@javelin>
731 Message-ID: <1244081553-sup-5115@entry>
732
733 [sorry about that last one. really not doing too well with the ol' email
734 today.]
735
736 Reformatted excerpts from Edward Z. Yang's message of 2009-06-03:
737 > --- Interrupt from thread: main
738 >
739 > /usr/lib/ruby/gems/1.8/gems/ncurses-0.9.1/lib/ncurses.rb:71:in `method_missing'
740 [snip]
741 >
742 > This seems... unrelated.
743
744 This looks like a ctrl-c that got caught by an ncurses thread. I agree,
745 seems unrelated.
746 --
747 William <wmorgan-sup at masanjin.net>
748
749 From wmorgan-sup@masanjin.net Wed Jun 3 23:05:07 2009
750 From: wmorgan-sup@masanjin.net (William Morgan)
751 Date: Wed, 03 Jun 2009 20:05:07 -0700
752 Subject: [sup-talk] Need help with OfflineIMAP integration and Iconv
753 errors
754 In-Reply-To: <93de24940906011854m70b8511cv139d0c7a830fc914@mail.gmail.com>
755 References: <93de24940906011854m70b8511cv139d0c7a830fc914@mail.gmail.com>
756 Message-ID: <1244084554-sup-6080@entry>
757
758 Hi Dominic,
759
760 Reformatted excerpts from Dominic LoBue's message of 2009-06-01:
761 > Let me start off by saying that I am incredibly impressed with sup.
762
763 Great! That's nice to hear.
764
765 > The first problem I'm having is when ferret is parsing through my
766 > emails to build its indicies I get numerous "warning: error
767 > (Iconv::IllegalSequence) decoding message body from X" errors, This
768 > prevents a lot of my email from showing up at all.
769
770 This is just a warning when iconv gets finnicky. It shouldn't prevent
771 email from being indexed or from appearing.
772
773 > I read that there were no plans to support uploading meta-data back to
774 > IMAP servers, so I was hoping that OfflineIMAP would sidestep the
775 > problem entirely. I searched the archives but I didn't find any
776 > examples of working configs. If anyone can point me to a working
777 > example I'd greatly appreciate it.
778
779 Maildir doesn't help you either. Sup doesn't export its message state
780 back to the source for any source type, except for certain limited cases
781 with sup-sync-back.
782 --
783 William <wmorgan-sup at masanjin.net>
784
785 From bwalton@artsci.utoronto.ca Thu Jun 4 12:03:10 2009
786 From: bwalton@artsci.utoronto.ca (Ben Walton)
787 Date: Thu, 4 Jun 2009 12:03:10 -0400
788 Subject: [sup-talk] [PATCH] Add V to view a raw message (headers and body).
789 Message-ID: <1244131390-25769-1-git-send-email-bwalton@artsci.utoronto.ca>
790
791 This is an augment of the already existing view header (H) command,
792 but allows viewing of all mime parts in their raw form, etc.
793
794 Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca>
795 ---
796 lib/sup/modes/thread-view-mode.rb | 8 ++++++++
797 1 files changed, 8 insertions(+), 0 deletions(-)
798
799 diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
800 index 42c6280..8de7ab0 100644
801 --- a/lib/sup/modes/thread-view-mode.rb
802 +++ b/lib/sup/modes/thread-view-mode.rb
803 @@ -27,6 +27,7 @@ EOS
804 register_keymap do |k|
805 k.add :toggle_detailed_header, "Toggle detailed header", 'h'
806 k.add :show_header, "Show full message header", 'H'
807 + k.add :show_message, "Show full message (raw form)", 'V'
808 k.add :activate_chunk, "Expand/collapse or activate item", :enter
809 k.add :expand_all_messages, "Expand/collapse all messages", 'E'
810 k.add :edit_draft, "Edit draft", 'e'
811 @@ -134,6 +135,13 @@ EOS
812 end
813 end
814
815 + def show_message
816 + m = @message_lines[curpos] or return
817 + BufferManager.spawn_unless_exists("Raw message for #{m.id}") do
818 + TextMode.new m.raw_message
819 + end
820 + end
821 +
822 def toggle_detailed_header
823 m = @message_lines[curpos] or return
824 @layout[m].state = (@layout[m].state == :detailed ? :open : :detailed)
825 --
826 1.6.3
827
828
829 From wmorgan-sup@masanjin.net Thu Jun 4 12:09:40 2009
830 From: wmorgan-sup@masanjin.net (William Morgan)
831 Date: Thu, 04 Jun 2009 09:09:40 -0700
832 Subject: [sup-talk] Sup is hanging
833 In-Reply-To: <alpine.DEB.2.00.0906032152200.6894@javelin>
834 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
835 <1244064889-sup-9506@entry>
836 <alpine.DEB.2.00.0906031758290.24343@javelin>
837 <1244078482-sup-4986@javelin>
838 <alpine.DEB.2.00.0906032152200.6894@javelin>
839 Message-ID: <1244130722-sup-4496@entry>
840
841 Reformatted excerpts from Edward Z. Yang's message of 2009-06-03:
842 > http://web.mit.edu/~ezyang/Public/sup-performance.png
843 >
844 > Look at String::=~. Definitely not acceptable.
845
846 Doing some profiling on my end, it looks like the majority of IMAP
847 syncing time is spent in these five methods:
848
849 Redwood::Index#load_entry_for_id (22%)
850 Redwood::IMAP#load_message (25%)
851 Redwood::Message#message_to_chunks (16.5%)
852 Redwood::IMAP#load_header (14%)
853 Redwood::Index#sync_message (13%)
854
855 Four of those are essentially wrappers around IMAP or Ferret methods.
856 The Sup-specific one is Message#message_to_chunks. But message_to_chunks
857 and its callee text_to_chunks doesn't seem to have a major culprits.
858 String#=~ only takes 2.3% of the CPU time, and a chunk of that is coming
859 from RubyMail.
860
861 Just for good measure, I "manually" measured the individual regexen in
862 text_to_chunks. After parsing 100 messages from an IMAP server, which
863 took 1m27s for me, I got:
864
865 time (s) calls
866 bqp = 0.00854 / 1789 = 209411.2 calls/second
867 n1 = 0.00218 / 313 = 143709.8 calls/second
868 qsp = 0.03212 / 1923 = 59873.0 calls/second
869 n2 = 0.00202 / 312 = 154226.4 calls/second
870 empty = 0.00061 / 90 = 146341.5 calls/second
871 sp = 0.02570 / 1927 = 74995.1 calls/second
872 qp = 0.03392 / 4459 = 131452.5 calls/second
873
874 The names are abbreviations for the various regexen in that method. You
875 can see that the cumulative time spent on any one regex is at most .034
876 seconds (qp, which is QUERY_PATTERN), and that the slowest one is qsp,
877 QUERY_START_PATTERN.
878
879 Incidentally, I can parse IMAP mailboxes at a little over 1 message/s,
880 and mbox files at ~50 messages/second, which also suggests that the IMAP
881 libraries are the biggest time sink here.
882
883 This is all with ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]), Sup
884 git next.
885
886 Now that's all CPU stuff. There might be memory blowup issues. If
887 nothing else, Sup leaks memory over time, but fixing that involves the
888 getting into the hellish world of Ruby<->C land or the even more hellish
889 internals of MRI, so I've been loathe to start down that path.
890
891 You might be able to speed up sup-sync runs on IMAP by threading the
892 network access and the parsing. But the IMAP connection seems pretty
893 CPU-heavy so who knows.
894
895 None of this answers the original question of why all Ruby threads block
896 when Sup waits for a response from IMAP. Since I'm pretty sure the IMAP
897 libraries are all Ruby (why they're so slow!), and that core Ruby IO
898 should be nonblocking, this might be an interpreter bug. Are you able to
899 pinpoint what part of MRI is blocking?
900 --
901 William <wmorgan-sup at masanjin.net>
902
903 From mailinglist@flasht.de Thu Jun 4 17:28:58 2009
904 From: mailinglist@flasht.de (Christopher Bertels)
905 Date: Thu, 04 Jun 2009 23:28:58 +0200
906 Subject: [sup-talk] Toggle expand/collapse of a message in threadview
907 Message-ID: <1244150874-sup-6554@thinkpad-ubuntu>
908
909 Hi!
910 I've been wondering:
911 Is there a way to expand/collsape the current message I'm reading when in the
912 middle of it?
913 I know I can press ENTER to toggle it when I'm hovering the message's header,
914 but is it possible when I'm in the middle of a message?
915 When reading long threads with long messages, this would really be handy, as
916 for now I always have to go up or toggle all messages and
917 work my way through a thread like that.
918 It would be nice if I could simply press a key to toggle the current message
919 I'm looking at (where the current highlighted line belongs to).
920
921 Maybe I'm blind and simply haven't found this feature? Can't find it in the
922 help menu.
923
924
925 Thanks,
926 Christopher.
927 --
928 ================================
929 Christopher Bertels
930 http://www.adztec-independent.de
931
932 From wmorgan-sup@masanjin.net Thu Jun 4 23:38:23 2009
933 From: wmorgan-sup@masanjin.net (William Morgan)
934 Date: Thu, 04 Jun 2009 20:38:23 -0700
935 Subject: [sup-talk] Toggle expand/collapse of a message in threadview
936 In-Reply-To: <1244150874-sup-6554@thinkpad-ubuntu>
937 References: <1244150874-sup-6554@thinkpad-ubuntu>
938 Message-ID: <1244172932-sup-1101@entry>
939
940 Reformatted excerpts from Christopher Bertels's message of 2009-06-04:
941 > Is there a way to expand/collsape the current message I'm reading when
942 > in the middle of it?
943
944 Good idea. I've changed this in git. Pressing enter on a text region now
945 collapses the message. Behavior of enter on quotes, signatures,
946 attachments, etc. is unchanged.
947
948 Also, collapsing a message will make the cursor jump to the next open
949 message. So you should be able to scan rapidly through a thread one
950 message at a time by hitting enter to collapse it or 'n' to leave open.
951 (And then 'p' and 'n' to review all open messages.)
952 --
953 William <wmorgan-sup at masanjin.net>
954
955 From ezyang@MIT.EDU Fri Jun 5 01:08:10 2009
956 From: ezyang@MIT.EDU (Edward Z. Yang)
957 Date: Fri, 05 Jun 2009 01:08:10 -0400
958 Subject: [sup-talk] Sup is hanging
959 In-Reply-To: <1244130722-sup-4496@entry>
960 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
961 <1244064889-sup-9506@entry>
962 <alpine.DEB.2.00.0906031758290.24343@javelin>
963 <1244078482-sup-4986@javelin>
964 <alpine.DEB.2.00.0906032152200.6894@javelin>
965 <1244130722-sup-4496@entry>
966 Message-ID: <1244177820-sup-6051@javelin>
967
968 Hi William,
969
970 I tickled the bug and took a more careful look at the message that had
971 triggered it, and noticed that it was an auto-generated commit message
972 that was really long. So one possible stop-gap would be just to detect
973 if a message is long and disable quoting if that was the case (a long
974 message would be, say, one over 100KB). There is also a possibility
975 that the commit message had some pathological backtracking built into
976 it.
977
978 Excerpts from William Morgan's message of Thu Jun 04 12:09:40 -0400 2009:
979 > Redwood::Index#load_entry_for_id (22%)
980 > Redwood::IMAP#load_message (25%)
981 > Redwood::Message#message_to_chunks (16.5%)
982 > Redwood::IMAP#load_header (14%)
983 > Redwood::Index#sync_message (13%)
984
985 Ok, so this isn't the same spread as when I managed to make Sup hang,
986 so this isn't quite the same.
987
988 > Now that's all CPU stuff. There might be memory blowup issues. If
989 > nothing else, Sup leaks memory over time, but fixing that involves the
990 > getting into the hellish world of Ruby<->C land or the even more hellish
991 > internals of MRI, so I've been loathe to start down that path.
992
993 Sup memory leakage has not been a problem; Sup will hang on a poll
994 asynchronously (as in, UI is still responsive, but I get no more
995 new messages) often enough that I have to quit and start sup up again.
996
997 > None of this answers the original question of why all Ruby threads block
998 > when Sup waits for a response from IMAP. Since I'm pretty sure the IMAP
999 > libraries are all Ruby (why they're so slow!), and that core Ruby IO
1000 > should be nonblocking, this might be an interpreter bug. Are you able to
1001 > pinpoint what part of MRI is blocking?
1002
1003 Not yet. I don't know Ruby threads well enough to know how to get more
1004 fine-grained information on thread mutex/blocking interaction.
1005
1006 To summarize:
1007
1008 1. If I thrash message_to_chunks() with a very long message, I cause
1009 sup to hang.
1010
1011 * If this case is only caused by long messages, implement a hueristic
1012 to prevent quoting from happening to long messages.
1013
1014 * If there is something specific about the message that causes massive
1015 back-tracking, fix the regex.
1016
1017 In either case, message_to_chunks() should not block the rest of the
1018 interface (although if we fix either or the two sub-points, this
1019 may not be a noticeable problem).
1020
1021 2. If an IMAP connection hangs, it occasionally causes all of Sup to
1022 block (this is rare, and comes from a pathological IMAP server. I
1023 think the ops administering the naughty IMAP server fixed it, so
1024 I am no longer seeing this hang).
1025
1026 3. Under less pathological cases, an IMAP connection can hang, and
1027 asynchronously blocks any further polling from taking place, resulting
1028 in no new messages. This happens commonly for me.
1029
1030 Cheers,
1031 Edward
1032
1033 From ezyang@MIT.EDU Fri Jun 5 01:24:36 2009
1034 From: ezyang@MIT.EDU (Edward Z. Yang)
1035 Date: Fri, 05 Jun 2009 01:24:36 -0400
1036 Subject: [sup-talk] Attempt at reply-from hook
1037 In-Reply-To: <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
1038 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
1039 <1243997614-sup-7485@javelin>
1040 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
1041 Message-ID: <1244179379-sup-6675@javelin>
1042
1043 Excerpts from Ben Walton's message of Wed Jun 03 07:44:24 -0400 2009:
1044 > Redwood::log "my message"
1045 >
1046 > Then, look in the log buffer.
1047
1048 I tried probing several ways.
1049
1050 - The reply-from.rb hook is being called.
1051 - The message variable does exist.
1052 - The message.has_label? "mylabel" returns false, as the body of the if
1053 statement never gets logged. (My contention is that the message very
1054 clearly has that label, so wtf).
1055 - It is difficult to get a str representation of the message
1056
1057 I am still stymied.
1058
1059 Cheers,
1060 Edward
1061
1062 From nicolas.pouillard@gmail.com Fri Jun 5 03:15:02 2009
1063 From: nicolas.pouillard@gmail.com (Nicolas Pouillard)
1064 Date: Fri, 05 Jun 2009 09:15:02 +0200
1065 Subject: [sup-talk] [PATCH] Add V to view a raw message (headers and
1066 body).
1067 In-Reply-To: <1244131390-25769-1-git-send-email-bwalton@artsci.utoronto.ca>
1068 References: <1244131390-25769-1-git-send-email-bwalton@artsci.utoronto.ca>
1069 Message-ID: <1244186006-sup-1399@ausone.inria.fr>
1070
1071 Excerpts from Ben Walton's message of Thu Jun 04 18:03:10 +0200 2009:
1072 > This is an augment of the already existing view header (H) command,
1073 > but allows viewing of all mime parts in their raw form, etc.
1074
1075 I usually use '|' followed by "cat" or "less" for this purpose, but maybe a
1076 dedicated key-binding is better.
1077
1078 --
1079 Nicolas Pouillard
1080 http://nicolaspouillard.fr
1081
1082 From mailinglist@flasht.de Fri Jun 5 07:02:13 2009
1083 From: mailinglist@flasht.de (Christopher Bertels)
1084 Date: Fri, 05 Jun 2009 13:02:13 +0200
1085 Subject: [sup-talk] Toggle expand/collapse of a message in threadview
1086 In-Reply-To: <1244172932-sup-1101@entry>
1087 References: <1244150874-sup-6554@thinkpad-ubuntu> <1244172932-sup-1101@entry>
1088 Message-ID: <1244199699-sup-8610@thinkpad-ubuntu>
1089
1090 Oh cool!
1091 Thanks, works great and exactly what I wanted! :)
1092
1093 Excerpts from William Morgan's message of Fr Jun 05 05:38:23 +0200 2009:
1094 > Reformatted excerpts from Christopher Bertels's message of 2009-06-04:
1095 > > Is there a way to expand/collsape the current message I'm reading when
1096 > > in the middle of it?
1097 >
1098 > Good idea. I've changed this in git. Pressing enter on a text region now
1099 > collapses the message. Behavior of enter on quotes, signatures,
1100 > attachments, etc. is unchanged.
1101 >
1102 > Also, collapsing a message will make the cursor jump to the next open
1103 > message. So you should be able to scan rapidly through a thread one
1104 > message at a time by hitting enter to collapse it or 'n' to leave open.
1105 > (And then 'p' and 'n' to review all open messages.)
1106 --
1107 ================================
1108 Christopher Bertels
1109 http://www.adztec-independent.de
1110
1111 From mailinglist@flasht.de Fri Jun 5 07:09:34 2009
1112 From: mailinglist@flasht.de (Christopher Bertels)
1113 Date: Fri, 05 Jun 2009 13:09:34 +0200
1114 Subject: [sup-talk] Toggle expand/collapse of a message in threadview
1115 In-Reply-To: <1244172932-sup-1101@entry>
1116 References: <1244150874-sup-6554@thinkpad-ubuntu> <1244172932-sup-1101@entry>
1117 Message-ID: <1244199822-sup-1224@thinkpad-ubuntu>
1118
1119 Actually, now that I've been using it a little more, I think it would be nicer
1120 that when pressing enter on a collapsed message, the cursor would stay at the
1121 header of that expanded message instead of moving to the next message header.
1122 Right now, it's always moving to the next message, even when expanding a collapsed
1123 message to read it.
1124
1125 Excerpts from William Morgan's message of Fr Jun 05 05:38:23 +0200 2009:
1126 > Reformatted excerpts from Christopher Bertels's message of 2009-06-04:
1127 > > Is there a way to expand/collsape the current message I'm reading when
1128 > > in the middle of it?
1129 >
1130 > Good idea. I've changed this in git. Pressing enter on a text region now
1131 > collapses the message. Behavior of enter on quotes, signatures,
1132 > attachments, etc. is unchanged.
1133 >
1134 > Also, collapsing a message will make the cursor jump to the next open
1135 > message. So you should be able to scan rapidly through a thread one
1136 > message at a time by hitting enter to collapse it or 'n' to leave open.
1137 > (And then 'p' and 'n' to review all open messages.)
1138 --
1139 ================================
1140 Christopher Bertels
1141 http://www.adztec-independent.de
1142
1143 From mailinglist@flasht.de Fri Jun 5 07:24:07 2009
1144 From: mailinglist@flasht.de (Christopher Bertels)
1145 Date: Fri, 05 Jun 2009 13:24:07 +0200
1146 Subject: [sup-talk] Toggle expand/collapse of a message in threadview
1147 In-Reply-To: <1244199822-sup-1224@thinkpad-ubuntu>
1148 References: <1244150874-sup-6554@thinkpad-ubuntu> <1244172932-sup-1101@entry>
1149 <1244199822-sup-1224@thinkpad-ubuntu>
1150 Message-ID: <1244200965-sup-607@thinkpad-ubuntu>
1151
1152
1153 Ok, wasn't so hard.
1154 Here's the patch:
1155
1156 diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
1157 index 2b6c58b..1e014c3 100644
1158 --- a/lib/sup/modes/thread-view-mode.rb
1159 +++ b/lib/sup/modes/thread-view-mode.rb
1160 @@ -234,10 +234,12 @@ EOS
1161 ## view.
1162 def activate_chunk
1163 chunk = @chunk_lines[curpos] or return
1164 + move_to_next = false
1165 if chunk.is_a? Chunk::Text
1166 ## if the cursor is over a text region, expand/collapse the
1167 ## entire message
1168 chunk = @message_lines[curpos]
1169 + move_to_next = true
1170 end
1171 layout = if chunk.is_a?(Message)
1172 @layout[chunk]
1173 @@ -253,7 +255,7 @@ EOS
1174 end
1175 if chunk.is_a?(Message)
1176 jump_to_message chunk
1177 - jump_to_next_open
1178 + jump_to_next_open if move_to_next
1179 end
1180 end
1181
1182
1183
1184 Excerpts from Christopher Bertels's message of Fr Jun 05 13:09:34 +0200 2009:
1185 > Actually, now that I've been using it a little more, I think it would be nicer
1186 > that when pressing enter on a collapsed message, the cursor would stay at the
1187 > header of that expanded message instead of moving to the next message header.
1188 > Right now, it's always moving to the next message, even when expanding a
1189 > collapsed
1190 > message to read it.
1191 >
1192 > Excerpts from William Morgan's message of Fr Jun 05 05:38:23 +0200 2009:
1193 > > Reformatted excerpts from Christopher Bertels's message of 2009-06-04:
1194 > > > Is there a way to expand/collsape the current message I'm reading when
1195 > > > in the middle of it?
1196 > >
1197 > > Good idea. I've changed this in git. Pressing enter on a text region now
1198 > > collapses the message. Behavior of enter on quotes, signatures,
1199 > > attachments, etc. is unchanged.
1200 > >
1201 > > Also, collapsing a message will make the cursor jump to the next open
1202 > > message. So you should be able to scan rapidly through a thread one
1203 > > message at a time by hitting enter to collapse it or 'n' to leave open.
1204 > > (And then 'p' and 'n' to review all open messages.)
1205 --
1206 ================================
1207 Christopher Bertels
1208 http://www.adztec-independent.de
1209
1210 From bwalton@artsci.utoronto.ca Fri Jun 5 07:30:51 2009
1211 From: bwalton@artsci.utoronto.ca (Ben Walton)
1212 Date: Fri, 05 Jun 2009 07:30:51 -0400
1213 Subject: [sup-talk] [PATCH] Add V to view a raw message (headers and
1214 body).
1215 In-Reply-To: <1244186006-sup-1399@ausone.inria.fr>
1216 References: <1244131390-25769-1-git-send-email-bwalton@artsci.utoronto.ca>
1217 <1244186006-sup-1399@ausone.inria.fr>
1218 Message-ID: <1244201417-sup-2549@ntdws12.chass.utoronto.ca>
1219
1220 Excerpts from Nicolas Pouillard's message of Fri Jun 05 03:15:02 -0400 2009:
1221 > Excerpts from Ben Walton's message of Thu Jun 04 18:03:10 +0200 2009:
1222 > > This is an augment of the already existing view header (H) command,
1223 > > but allows viewing of all mime parts in their raw form, etc.
1224
1225 > I usually use '|' followed by "cat" or "less" for this purpose, but maybe a
1226 > dedicated key-binding is better.
1227
1228 Yah, I was aiming for less typing...it's something I do often enough.
1229
1230 -Ben
1231
1232 --
1233 Ben Walton
1234 Systems Programmer - CHASS
1235 University of Toronto
1236 C:416.407.5610 | W:416.978.4302
1237
1238 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
1239 Contact me to arrange for a CAcert assurance meeting.
1240 -------------- next part --------------
1241 A non-text attachment was scrubbed...
1242 Name: signature.asc
1243 Type: application/pgp-signature
1244 Size: 189 bytes
1245 Desc: not available
1246 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090605/0f741833/attachment.bin>
1247
1248 From dom.lobue@gmail.com Fri Jun 5 08:35:15 2009
1249 From: dom.lobue@gmail.com (Dominic LoBue)
1250 Date: Fri, 5 Jun 2009 05:35:15 -0700
1251 Subject: [sup-talk] sup crash while attempting to load next email after
1252 deleting previous
1253 Message-ID: <93de24940906050535p7178dedctc9f9f8c166acdf2e@mail.gmail.com>
1254
1255 Hello,
1256
1257 Sup just crashed on me. The last thing I did was do ,d to delete the
1258 email I was viewing and move on to the next. I had deleted several
1259 other emails previously in the exact same way with no problems.
1260
1261 The only thing that may matter is that I had over 1000 threads loaded
1262 in the index view (I get a _lot_ of email at work :( ).
1263
1264 I'm using a git release made from the below commit:
1265 commit a8869f951cf8ec3a4a50492290c9ca757c968f49
1266 Author: William Morgan <wmorgan-sup at masanjin.net>
1267 Date: Sun May 31 08:58:16 2009 -0700
1268
1269 yet another utf8 bugfix: fix string subsetting
1270
1271 ... with a HORRIBLE SLOW HACK!
1272
1273
1274
1275 And here is the exception-log:
1276 --- NoMethodError from thread: load messages for thread-view-mode
1277 undefined method `date' for nil:NilClass
1278 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:783:in
1279 `text_for_thread_at'
1280 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:752:in
1281 `regen_text'
1282 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:346:in `map_with_index'
1283 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:641:in `each_with_index'
1284 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:346:in `each'
1285 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:346:in `each_with_index'
1286 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:346:in `map_with_index'
1287 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:752:in
1288 `regen_text'
1289 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:228:in
1290 `update'
1291 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:202:in
1292 `handle_deleted_update'
1293 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/update.rb:27:in `send'
1294 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/update.rb:27:in `relay'
1295 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/update.rb:27:in `each'
1296 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/update.rb:27:in `relay'
1297 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:505:in `send'
1298 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:505:in `method_missing'
1299 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-view-mode.rb:431:in
1300 `delete_and_then'
1301 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-view-mode.rb:451:in
1302 `dispatch'
1303 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:119:in
1304 `call'
1305 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:119:in
1306 `select'
1307 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup.rb:71:in `reporting_thread'
1308 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup.rb:69:in `initialize'
1309 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup.rb:69:in `new'
1310 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup.rb:69:in `reporting_thread'
1311 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:99:in
1312 `select'
1313 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:149:in
1314 `launch_another_thread'
1315 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:131:in
1316 `launch_next_thread_after'
1317 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-view-mode.rb:457:in
1318 `dispatch'
1319 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-view-mode.rb:429:in
1320 `delete_and_then'
1321 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/modes/thread-view-mode.rb:404:in
1322 `delete_and_next'
1323 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/mode.rb:50:in `send'
1324 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/mode.rb:50:in `handle_input'
1325 /usr/lib/ruby/gems/1.8/gems/sup-999/lib/sup/buffer.rb:249:in `handle_input'
1326 /usr/lib/ruby/gems/1.8/gems/sup-999/bin/sup:238
1327 /usr/bin/sup:19:in `load'
1328 /usr/bin/sup:19
1329
1330
1331
1332
1333 Dominic
1334
1335 From wmorgan-sup@masanjin.net Fri Jun 5 09:23:50 2009
1336 From: wmorgan-sup@masanjin.net (William Morgan)
1337 Date: Fri, 05 Jun 2009 06:23:50 -0700
1338 Subject: [sup-talk] Sup is hanging
1339 In-Reply-To: <1244177820-sup-6051@javelin>
1340 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
1341 <1244064889-sup-9506@entry>
1342 <alpine.DEB.2.00.0906031758290.24343@javelin>
1343 <1244078482-sup-4986@javelin>
1344 <alpine.DEB.2.00.0906032152200.6894@javelin>
1345 <1244130722-sup-4496@entry> <1244177820-sup-6051@javelin>
1346 Message-ID: <1244206531-sup-5503@entry>
1347
1348 Reformatted excerpts from Edward Z. Yang's message of 2009-06-04:
1349 > I tickled the bug and took a more careful look at the message that had
1350 > triggered it
1351
1352 This is good stuff. I think we're getting somewhere. I was hoping to
1353 have this this fixed by 0.8 but I think it's going to have to wait till
1354 0.9.
1355
1356 > and noticed that it was an auto-generated commit message that was
1357 > really long. So one possible stop-gap would be just to detect if a
1358 > message is long and disable quoting if that was the case (a long
1359 > message would be, say, one over 100KB).
1360
1361 Yep, I bet that's the problem.
1362
1363 Not parsing long messages would be fine as far as I'm concerned. Heck
1364 even 25k might be a reasonable limit (per MIME part).
1365
1366 > There is also a possibility that the commit message had some
1367 > pathological backtracking built into it.
1368
1369 It's possible... but I'm willing to bet that it's the sheer size. If
1370 we're still seeing this performance on smaller messages (e.g. when you
1371 start sending me emails carefully constructed to induce worst-case
1372 performance in Sup's regexen) we can wrap a timeout around the whole
1373 parse as well.
1374
1375 > Excerpts from William Morgan's message of Thu Jun 04 12:09:40 -0400 2009:
1376 > > Redwood::Index#load_entry_for_id (22%)
1377 > > Redwood::IMAP#load_message (25%)
1378 > > Redwood::Message#message_to_chunks (16.5%)
1379 > > Redwood::IMAP#load_header (14%)
1380 > > Redwood::Index#sync_message (13%)
1381 >
1382 > Ok, so this isn't the same spread as when I managed to make Sup hang,
1383 > so this isn't quite the same.
1384
1385 That makes sense.
1386
1387 > 1. If I thrash message_to_chunks() with a very long message, I cause
1388 > sup to hang.
1389
1390 This is still weird. It only makes sense if Ruby regexen block the whole
1391 interpreter when evaluating. I guess that might be the case if they're
1392 they haven't taken the (what I imagine must be trivial) step of allowing
1393 preemption during the DFA execution (or however the hell they're
1394 implemented). I guess an experiment would show this.
1395
1396 > 2. If an IMAP connection hangs, it occasionally causes all of Sup to
1397 > block (this is rare, and comes from a pathological IMAP server. I
1398 > think the ops administering the naughty IMAP server fixed it, so
1399 > I am no longer seeing this hang).
1400
1401 This is also still weird, and I wonder if it's not just problems 1 and 3
1402 combining. If it comes back we will have to do some more investigation.
1403
1404 > 3. Under less pathological cases, an IMAP connection can hang, and
1405 > asynchronously blocks any further polling from taking place, resulting
1406 > in no new messages. This happens commonly for me.
1407
1408 This one we can fix. (Though it's something the IMAP libraries should've
1409 done for us.) If we put a timeout block around that #examine call, we
1410 should be able to reset the connection if it hangs.
1411 --
1412 William <wmorgan-sup at masanjin.net>
1413
1414 From wmorgan-sup@masanjin.net Fri Jun 5 09:37:02 2009
1415 From: wmorgan-sup@masanjin.net (William Morgan)
1416 Date: Fri, 05 Jun 2009 06:37:02 -0700
1417 Subject: [sup-talk] Attempt at reply-from hook
1418 In-Reply-To: <1244179379-sup-6675@javelin>
1419 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
1420 <1243997614-sup-7485@javelin>
1421 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
1422 <1244179379-sup-6675@javelin>
1423 Message-ID: <1244208597-sup-4979@entry>
1424
1425 Reformatted excerpts from Edward Z. Yang's message of 2009-06-04:
1426 > The message.has_label? "mylabel" returns false, as the body of the if
1427 > statement never gets logged. (My contention is that the message very
1428 > clearly has that label, so wtf).
1429
1430 Try has_label? :mylabel. Sup represents labels as symbols instead of as
1431 strings.
1432
1433 Sorry about that. The hook system is in need of much documentation.
1434
1435 A good environment for playing around with this stuff is to run the console:
1436
1437 w at drspaceman:~/devel/sup$ sh devel/console.sh
1438 [...]
1439 >> Index.run_query "label:potato"
1440 => [1000]
1441 >> m = Index.build_message 1000
1442 => #<Redwood::Message:0x7f187b394ac8 [...]>
1443 >> m.labels
1444 => [:inbox, :unread, :potato]
1445 >> m.has_label? :potato
1446 => true
1447 >> m.has_label? "potato"
1448 => false
1449
1450 HTH.
1451 --
1452 William <wmorgan-sup at masanjin.net>
1453
1454 From wmorgan-sup@masanjin.net Fri Jun 5 11:31:07 2009
1455 From: wmorgan-sup@masanjin.net (William Morgan)
1456 Date: Fri, 05 Jun 2009 08:31:07 -0700
1457 Subject: [sup-talk] [PATCH] Add V to view a raw message (headers and
1458 body).
1459 In-Reply-To: <1244201417-sup-2549@ntdws12.chass.utoronto.ca>
1460 References: <1244131390-25769-1-git-send-email-bwalton@artsci.utoronto.ca>
1461 <1244186006-sup-1399@ausone.inria.fr>
1462 <1244201417-sup-2549@ntdws12.chass.utoronto.ca>
1463 Message-ID: <1244215854-sup-9273@entry>
1464
1465 Reformatted excerpts from Ben Walton's message of 2009-06-05:
1466 > Yah, I was aiming for less typing...it's something I do often enough.
1467
1468 Good enough for me. Applied directly to master. Thanks!
1469 --
1470 William <wmorgan-sup at masanjin.net>
1471
1472 From wmorgan-sup@masanjin.net Fri Jun 5 11:31:31 2009
1473 From: wmorgan-sup@masanjin.net (William Morgan)
1474 Date: Fri, 05 Jun 2009 08:31:31 -0700
1475 Subject: [sup-talk] Toggle expand/collapse of a message in threadview
1476 In-Reply-To: <1244200965-sup-607@thinkpad-ubuntu>
1477 References: <1244150874-sup-6554@thinkpad-ubuntu> <1244172932-sup-1101@entry>
1478 <1244199822-sup-1224@thinkpad-ubuntu>
1479 <1244200965-sup-607@thinkpad-ubuntu>
1480 Message-ID: <1244215876-sup-1528@entry>
1481
1482 Reformatted excerpts from Christopher Bertels's message of 2009-06-05:
1483 > Ok, wasn't so hard. Here's the patch:
1484
1485 I've applied a similar change to master. Thanks!
1486 --
1487 William <wmorgan-sup at masanjin.net>
1488
1489 From wmorgan-sup@masanjin.net Fri Jun 5 11:36:55 2009
1490 From: wmorgan-sup@masanjin.net (William Morgan)
1491 Date: Fri, 05 Jun 2009 08:36:55 -0700
1492 Subject: [sup-talk] [PATCH] Prettier printing of enclosed messages
1493 In-Reply-To: <4a1fe5cd.0a04d00a.1d89.ffffe1b2@mx.google.com>
1494 References: <4a1fe5cd.0a04d00a.1d89.ffffe1b2@mx.google.com>
1495 Message-ID: <1244216191-sup-6520@entry>
1496
1497 Reformatted excerpts from Israel Herraiz's message of 2009-05-29:
1498 > this patch prints enclosed messages with only some selected headers
1499 > instead of the full headers, just as "normal" messages.
1500
1501 Branch enclosed-message-display-tweaks, merged into next. Thanks!
1502 --
1503 William <wmorgan-sup at masanjin.net>
1504
1505 From wmorgan-sup@masanjin.net Fri Jun 5 12:02:17 2009
1506 From: wmorgan-sup@masanjin.net (William Morgan)
1507 Date: Fri, 05 Jun 2009 09:02:17 -0700
1508 Subject: [sup-talk] [RFC] Bounce messages
1509 In-Reply-To: <1243817649-7642-1-git-send-email-bwalton@artsci.utoronto.ca>
1510 References: <1243817649-7642-1-git-send-email-bwalton@artsci.utoronto.ca>
1511 Message-ID: <1244217075-sup-4385@entry>
1512
1513 Hi Ben,
1514
1515 I'm definitely interested in having this feature. But it does open up
1516 some complications because we have to be able to call the MTA in two
1517 different modes.
1518
1519 But this might not be such a big deal because most MTAs have basic
1520 sendmail compatibility. Judging from the entries on the Sup Wiki for
1521 msmtp, ssmtp, and putmail, we should be fine just calling the account's
1522 sendmail command without -t and with the recipient email addresses.
1523
1524 Reformatted excerpts from Ben Walton's message of 2009-05-31:
1525 > The other thing that I don't like presently is the confirmation UI.
1526 > Without resorting to a whole bounce-mode, is there a better way to
1527 > handle this in the face of (potentially) multiple recipients that may
1528 > make the question stretch outside the viewable area?
1529
1530 You could just make it say "Bounce to #{to.size} recipients?". :)
1531 --
1532 William <wmorgan-sup at masanjin.net>
1533
1534 From bwalton@artsci.utoronto.ca Fri Jun 5 12:20:32 2009
1535 From: bwalton@artsci.utoronto.ca (Ben Walton)
1536 Date: Fri, 05 Jun 2009 12:20:32 -0400
1537 Subject: [sup-talk] [RFC] Bounce messages
1538 In-Reply-To: <1244217075-sup-4385@entry>
1539 References: <1243817649-7642-1-git-send-email-bwalton@artsci.utoronto.ca>
1540 <1244217075-sup-4385@entry>
1541 Message-ID: <1244218650-sup-2427@ntdws12.chass.utoronto.ca>
1542
1543 Excerpts from William Morgan's message of Fri Jun 05 12:02:17 -0400 2009:
1544
1545 > I'm definitely interested in having this feature. But it does open
1546 > up
1547
1548 Great.
1549
1550 > some complications because we have to be able to call the MTA in two
1551 > different modes.
1552
1553 Nothing is free! :)
1554
1555 > But this might not be such a big deal because most MTAs have basic
1556 > sendmail compatibility. Judging from the entries on the Sup Wiki for
1557 > msmtp, ssmtp, and putmail, we should be fine just calling the account's
1558 > sendmail command without -t and with the recipient email addresses.
1559
1560 Ok, I'll rework the patch to call the default account's sendmail
1561 command with any -t stripped out.
1562
1563 > You could just make it say "Bounce to #{to.size} recipients?". :)
1564
1565 That would work. Still gives a chance to back out if things don't
1566 look right but not too heavy either.
1567
1568 I'll rework this tonight. I looked at refactoring against the
1569 EditMessageMode send function the other night and that's not straight
1570 forward since the shared code is a few classes up the object tree.
1571 Moving the send message code higher in the tree isn't ideal, as it
1572 doesn't really belong there...suggestions on that?
1573
1574 Thanks
1575 -Ben
1576 --
1577 Ben Walton
1578 Systems Programmer - CHASS
1579 University of Toronto
1580 C:416.407.5610 | W:416.978.4302
1581
1582 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
1583 Contact me to arrange for a CAcert assurance meeting.
1584 -------------- next part --------------
1585 A non-text attachment was scrubbed...
1586 Name: signature.asc
1587 Type: application/pgp-signature
1588 Size: 189 bytes
1589 Desc: not available
1590 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090605/17101870/attachment.bin>
1591
1592 From wmorgan-sup@masanjin.net Fri Jun 5 15:02:37 2009
1593 From: wmorgan-sup@masanjin.net (William Morgan)
1594 Date: Fri, 05 Jun 2009 12:02:37 -0700
1595 Subject: [sup-talk] [ANN] Sup 0.8 released
1596 Message-ID: <1244228405-sup-4363@entry>
1597
1598 I'm pleased to announce the release of Sup 0.8.
1599
1600 Sup is a console-based email client for people with a lot of email.
1601 It supports tagging, very fast full-text search, automatic contact-
1602 list management, and more. If you're the type of person who treats
1603 email as an extension of your long-term memory, Sup is for you.
1604
1605 Get it: gem install sup
1606 Learn it: http://sup.rubyforge.org
1607 Love it: sup-talk at rubyforge.org
1608
1609 Excitement in 0.8:
1610 * Undo support on many operations. Yay!
1611 * Mbox splitting fixes. No more "From "-line problems.
1612 * Mail parsing speedups.
1613 * Many utf8 and widechar fixes. Display of crazy characters should be pretty
1614 close.
1615 * Outgoing email with non-ASCII headers is now properly encoded.
1616 * Email addresses are no longer permanently attached to names. This was
1617 causing problems with automated email systems that used different names
1618 with the same address.
1619 * Curses background now retains the terminal default color. This also makes
1620 Sup work better on transparent terminals.
1621 * Improve dynamic loading of setlocale for Cygwin and BSD systems.
1622 * Labels can now be removed from multiple tagged threads.
1623 * Applying operations to tagged threads is now invoked with '='.
1624 * Buffer list is betterified and is now invoked with ';'.
1625 * Zsh autocompletion support.
1626 * As always, many bugfixes and tweaks.
1627 --
1628 William <wmorgan-sup at masanjin.net>
1629
1630 From ezyang@MIT.EDU Fri Jun 5 17:47:00 2009
1631 From: ezyang@MIT.EDU (Edward Z. Yang)
1632 Date: Fri, 05 Jun 2009 17:47:00 -0400
1633 Subject: [sup-talk] Sup is hanging
1634 In-Reply-To: <1244227108-sup-3123@cabinet>
1635 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
1636 <1244064889-sup-9506@entry>
1637 <alpine.DEB.2.00.0906031758290.24343@javelin>
1638 <1244078482-sup-4986@javelin>
1639 <alpine.DEB.2.00.0906032152200.6894@javelin>
1640 <1244130722-sup-4496@entry> <1244177820-sup-6051@javelin>
1641 <1244227108-sup-3123@cabinet>
1642 Message-ID: <1244238388-sup-760@javelin>
1643
1644 Excerpts from Marc Hartstein's message of Fri Jun 05 14:43:59 -0400 2009:
1645 > I noticed that one feature of the messages was that they contained one
1646 > extremely long line. Not sure if this information will in any way help
1647 > figure out what's going on there.
1648
1649 Now that you mention it, the messages that tickle this bug on my side also
1650 have one extremely long line. That's very interesting.
1651
1652 Cheers,
1653 Edward
1654
1655 From ezyang@MIT.EDU Fri Jun 5 20:09:13 2009
1656 From: ezyang@MIT.EDU (Edward Z. Yang)
1657 Date: Fri, 05 Jun 2009 20:09:13 -0400
1658 Subject: [sup-talk] Attempt at reply-from hook
1659 In-Reply-To: <1244208597-sup-4979@entry>
1660 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
1661 <1243997614-sup-7485@javelin>
1662 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
1663 <1244179379-sup-6675@javelin> <1244208597-sup-4979@entry>
1664 Message-ID: <1244246896-sup-4529@javelin>
1665
1666 Excerpts from William Morgan's message of Fri Jun 05 09:37:02 -0400 2009:
1667 > Try has_label? :mylabel. Sup represents labels as symbols instead of as
1668 > strings.
1669
1670 Great! My hook works now. This is the sort of functionality that I think
1671 is worth generalizing and implementing as a configuration twiddle (one,
1672 I think, that should be on by default.)
1673
1674 > A good environment for playing around with this stuff is to run the console:
1675 >
1676 > w at drspaceman:~/devel/sup$ sh devel/console.sh
1677 > [...]
1678 > >> Index.run_query "label:potato"
1679 > => [1000]
1680 > >> m = Index.build_message 1000
1681 > => #<Redwood::Message:0x7f187b394ac8 [...]>
1682 > >> m.labels
1683 > => [:inbox, :unread, :potato]
1684 > >> m.has_label? :potato
1685 > => true
1686 > >> m.has_label? "potato"
1687 > => false
1688
1689 Nice!
1690
1691 Cheers,
1692 Edward
1693
1694 From ezyang@MIT.EDU Sat Jun 6 02:20:25 2009
1695 From: ezyang@MIT.EDU (Edward Z. Yang)
1696 Date: Sat, 06 Jun 2009 02:20:25 -0400
1697 Subject: [sup-talk] Sup is hanging
1698 In-Reply-To: <1244238388-sup-760@javelin>
1699 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
1700 <1244064889-sup-9506@entry>
1701 <alpine.DEB.2.00.0906031758290.24343@javelin>
1702 <1244078482-sup-4986@javelin>
1703 <alpine.DEB.2.00.0906032152200.6894@javelin>
1704 <1244130722-sup-4496@entry> <1244177820-sup-6051@javelin>
1705 <1244227108-sup-3123@cabinet> <1244238388-sup-760@javelin>
1706 Message-ID: <1244267416-sup-3720@javelin>
1707
1708 Excerpts from Edward Z. Yang's message of Fri Jun 05 17:47:00 -0400 2009:
1709 > Now that you mention it, the messages that tickle this bug on my side also
1710 > have one extremely long line. That's very interesting.
1711
1712 Here is the culprit, laid out to bear its full shame:
1713
1714 /\w.*:$/
1715
1716 I thought this was a suspicious looking regexen; a simple test confirmed my
1717 belief:
1718
1719 line = ":a" * 10000
1720 line =~ /\w.*:$/
1721
1722 Ba boom ba boom ba boom. This is a textbook case of catastrophic backtracking.
1723
1724 I have two possible fixes, they end up being about the same time for regular
1725 cases, but the second one is more optimal for really long strings:
1726
1727 First, the simple one:
1728
1729 diff --git a/lib/sup/message.rb b/lib/sup/message.rb
1730 index 5993729..0ddd3af 100644
1731 --- a/lib/sup/message.rb
1732 +++ b/lib/sup/message.rb
1733 @@ -26,7 +26,7 @@ class Message
1734
1735 QUOTE_PATTERN = /^\s{0,4}[>|\}]/
1736 BLOCK_QUOTE_PATTERN = /^-----\s*Original Message\s*----+$/
1737 - QUOTE_START_PATTERN = /\w.*:$/
1738 + QUOTE_START_PATTERN = /\w\W*:$/
1739 SIG_PATTERN = /(^-- ?$)|(^\s*----------+\s*$)|(^\s*_________+\s*$)|(^\s*--~--~-)|(^\s*--\+\+\*\*==)/
1740
1741 MAX_SIG_DISTANCE = 15 # lines from the end
1742
1743 And the slightly more complicated one (but optimal for large n):
1744
1745 diff --git a/lib/sup/message.rb b/lib/sup/message.rb
1746 index 5993729..c5481a6 100644
1747 --- a/lib/sup/message.rb
1748 +++ b/lib/sup/message.rb
1749 @@ -26,7 +26,6 @@ class Message
1750
1751 QUOTE_PATTERN = /^\s{0,4}[>|\}]/
1752 BLOCK_QUOTE_PATTERN = /^-----\s*Original Message\s*----+$/
1753 - QUOTE_START_PATTERN = /\w.*:$/
1754 SIG_PATTERN = /(^-- ?$)|(^\s*----------+\s*$)|(^\s*_________+\s*$)|(^\s*--~--~-)|
1755
1756 MAX_SIG_DISTANCE = 15 # lines from the end
1757 @@ -449,7 +448,7 @@ private
1758 when :text
1759 newstate = nil
1760
1761 - if line =~ QUOTE_PATTERN || (line =~ QUOTE_START_PATTERN && nextline =~ QUO
1762 + if line =~ QUOTE_PATTERN || (line =~ /:$/ && line =~ /\w/ && nextline =~ QU
1763 newstate = :quote
1764 elsif line =~ SIG_PATTERN && (lines.length - i) < MAX_SIG_DISTANCE
1765 newstate = :sig
1766
1767 There are number of micro-optimizations that could be made to message
1768 parsing, but this will basically fix the egregious problem.
1769
1770 Cheers,
1771 Edward
1772
1773 From ezyang@MIT.EDU Sat Jun 6 02:54:01 2009
1774 From: ezyang@MIT.EDU (Edward Z. Yang)
1775 Date: Sat, 06 Jun 2009 02:54:01 -0400
1776 Subject: [sup-talk] Sup annoyances
1777 Message-ID: <1244270435-sup-9288@javelin>
1778
1779 Having just submitted my first patch, I feel entitled to gripe and
1780 moan about certain aspects of Sup. The hope is that I'll get some
1781 pointers on what code to look at to fix these gripes. These gripes
1782 are independent of the hanging/other behavior in my other monster
1783 thread. (I'd say the asynchronous polling hang is my other biggest
1784 gripe, but that's not an issue for here).
1785
1786 1. Threads should be lazy-loaded (possibly in the background), with
1787 visible messages first. If a conversation got a new message, Sup
1788 should only take its time to load that message, and not the frickin'
1789 24 other messages that were also incidentally there. I suspect
1790 this will require some pretty major refactoring. As a stop-gap,
1791 I should have the option of cancelling when I open a long thread
1792 (right now, I think it causes sup to crash).
1793
1794 2. Auto-completion sucks and should be improved. I should be able
1795 to press "c", type two letters, and then mash tab. If auto-completion
1796 actually works, then I'll blame it on dismal contacts.txt support
1797 (if I send mail to someone, there should be a configuration twiddle
1798 that saves it to contacts.txt. And then remembers it the next
1799 time I want to compose mail to them).
1800
1801 3. Polling and loading of threads should started, asynchronously, at
1802 the same time. Loading of threads should not hose my CPU. Loading
1803 of threads should do smart things, instead of doing an O(n) time warp.
1804 It takes forever for a mail from two months ago that is still in my
1805 inbox, because it still hasn't been addressed, to show up. This could
1806 probably be fixed with a cache file. This isn't as big of a deal
1807 if asynchronous polling hang and crashing is fixed.
1808
1809 4. Sup should prompt me whether or not I want to Reply All or Reply on
1810 appropriate cases, like pine.
1811
1812 Cheers,
1813 Edward
1814
1815 From ezyang@MIT.EDU Sat Jun 6 02:56:11 2009
1816 From: ezyang@MIT.EDU (Edward Z. Yang)
1817 Date: Sat, 06 Jun 2009 02:56:11 -0400
1818 Subject: [sup-talk] Sup annoyances
1819 In-Reply-To: <1244270435-sup-9288@javelin>
1820 References: <1244270435-sup-9288@javelin>
1821 Message-ID: <1244271263-sup-3881@javelin>
1822
1823 Excerpts from Edward Z. Yang's message of Sat Jun 06 02:54:01 -0400 2009:
1824 > 4. Sup should prompt me whether or not I want to Reply All or Reply on
1825 > appropriate cases, like pine.
1826
1827 To be clear, this should be a configuration twiddle.
1828
1829 I think I also have just remembered one more thing:
1830
1831 5. Killing a thread should kill it *now*, not "when Sup next restarts".
1832
1833 Cheers,
1834 Edward
1835
1836 From nicolas.pouillard@gmail.com Sat Jun 6 06:16:55 2009
1837 From: nicolas.pouillard@gmail.com (Nicolas Pouillard)
1838 Date: Sat, 06 Jun 2009 12:16:55 +0200
1839 Subject: [sup-talk] [RFC] Bounce messages
1840 In-Reply-To: <1244217075-sup-4385@entry>
1841 References: <1243817649-7642-1-git-send-email-bwalton@artsci.utoronto.ca>
1842 <1244217075-sup-4385@entry>
1843 Message-ID: <1244283371-sup-2895@ausone.local>
1844
1845 Excerpts from William Morgan's message of Fri Jun 05 18:02:17 +0200 2009:
1846 > Hi Ben,
1847 >
1848 > I'm definitely interested in having this feature. But it does open up
1849 > some complications because we have to be able to call the MTA in two
1850 > different modes.
1851
1852 I don't get the purpose of this, how it is different from hitting 'D' to send
1853 again the same message?
1854
1855 --
1856 Nicolas Pouillard
1857 http://nicolaspouillard.fr
1858
1859 From bwalton@artsci.utoronto.ca Sat Jun 6 08:44:15 2009
1860 From: bwalton@artsci.utoronto.ca (Ben Walton)
1861 Date: Sat, 06 Jun 2009 08:44:15 -0400
1862 Subject: [sup-talk] [RFC] Bounce messages
1863 In-Reply-To: <1244283371-sup-2895@ausone.local>
1864 References: <1243817649-7642-1-git-send-email-bwalton@artsci.utoronto.ca>
1865 <1244217075-sup-4385@entry> <1244283371-sup-2895@ausone.local>
1866 Message-ID: <1244291795-sup-1695@ntdws12.chass.utoronto.ca>
1867
1868 Excerpts from Nicolas Pouillard's message of Sat Jun 06 06:16:55 -0400 2009:
1869 > I don't get the purpose of this, how it is different from hitting 'D' to send
1870 > again the same message?
1871
1872 Look at the From: header when you do that. It gets set to _your_
1873 address. You could use D, edit the from address to that of the
1874 original sender and then fire to achieve the same effect (although I'm
1875 not sure how it handles attachments, etc), but that's a lot of typing
1876 for a common action. I also believe that with D, since you're
1877 injecting a new message with original content, that you'd lose much of
1878 the original header info.
1879
1880 The idea is that when you 'bounce' the message, it's akin to you
1881 having had a .forward in place at MTA delivery time. Redirect, not
1882 forward.
1883
1884 My biggest use case for this is bouncing mail sent to me personally
1885 asking for support into our ticket system. The original sender will
1886 see the autoreply with the ticket id, etc because the From: header
1887 contained their address. Colleagues using other mail clients lacking
1888 this feature will forward mail to the ticket system which sees them
1889 get the replies. They then have to go into the ticket and set a
1890 proper 'requester' address for further correspondence on the ticket.
1891
1892 I remember when I discovered this feature in mutt how weird I thought
1893 it was. It wasn't long before it was in common use for me though.
1894
1895 Does that make sense?
1896
1897 Thanks
1898 -Ben
1899 --
1900 Ben Walton
1901 Systems Programmer - CHASS
1902 University of Toronto
1903 C:416.407.5610 | W:416.978.4302
1904
1905 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
1906 Contact me to arrange for a CAcert assurance meeting.
1907 -------------- next part --------------
1908 A non-text attachment was scrubbed...
1909 Name: signature.asc
1910 Type: application/pgp-signature
1911 Size: 189 bytes
1912 Desc: not available
1913 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090606/6730fbb2/attachment.bin>
1914
1915 From nicolas.pouillard@gmail.com Sat Jun 6 10:36:12 2009
1916 From: nicolas.pouillard@gmail.com (Nicolas Pouillard)
1917 Date: Sat, 06 Jun 2009 16:36:12 +0200
1918 Subject: [sup-talk] [RFC] Bounce messages
1919 In-Reply-To: <1244291795-sup-1695@ntdws12.chass.utoronto.ca>
1920 References: <1243817649-7642-1-git-send-email-bwalton@artsci.utoronto.ca>
1921 <1244217075-sup-4385@entry> <1244283371-sup-2895@ausone.local>
1922 <1244291795-sup-1695@ntdws12.chass.utoronto.ca>
1923 Message-ID: <1244298935-sup-5932@ausone.local>
1924
1925 Excerpts from Ben Walton's message of Sat Jun 06 14:44:15 +0200 2009:
1926 > Excerpts from Nicolas Pouillard's message of Sat Jun 06 06:16:55 -0400 2009:
1927 > > I don't get the purpose of this, how it is different from hitting 'D' to send
1928 > > again the same message?
1929 >
1930 > Look at the From: header when you do that. It gets set to _your_
1931 > address. You could use D, edit the from address to that of the
1932 > original sender and then fire to achieve the same effect (although I'm
1933 > not sure how it handles attachments, etc), but that's a lot of typing
1934 > for a common action. I also believe that with D, since you're
1935 > injecting a new message with original content, that you'd lose much of
1936 > the original header info.
1937 >
1938 > The idea is that when you 'bounce' the message, it's akin to you
1939 > having had a .forward in place at MTA delivery time. Redirect, not
1940 > forward.
1941 >
1942 > My biggest use case for this is bouncing mail sent to me personally
1943 > asking for support into our ticket system. The original sender will
1944 > see the autoreply with the ticket id, etc because the From: header
1945 > contained their address. Colleagues using other mail clients lacking
1946 > this feature will forward mail to the ticket system which sees them
1947 > get the replies. They then have to go into the ticket and set a
1948 > proper 'requester' address for further correspondence on the ticket.
1949 >
1950 > I remember when I discovered this feature in mutt how weird I thought
1951 > it was. It wasn't long before it was in common use for me though.
1952 >
1953 > Does that make sense?
1954
1955 It does! Thanks for the explanation.
1956
1957 --
1958 Nicolas Pouillard
1959 http://nicolaspouillard.fr
1960
1961 From helgedt@tihlde.org Sat Jun 6 08:03:14 2009
1962 From: helgedt@tihlde.org (Helge Titlestad)
1963 Date: Sat, 06 Jun 2009 14:03:14 +0200
1964 Subject: [sup-talk] [RFC] Bounce messages
1965 In-Reply-To: <1244283371-sup-2895@ausone.local>
1966 References: <1243817649-7642-1-git-send-email-bwalton@artsci.utoronto.ca>
1967 <1244217075-sup-4385@entry> <1244283371-sup-2895@ausone.local>
1968 Message-ID: <1244289688-sup-9384@colargol.tihlde.org>
1969
1970 Excerpts from Nicolas Pouillard's message of Sat Jun 06 12:16:55 +0200 2009:
1971 > I don't get the purpose of this, how it is different from hitting 'D' to send
1972 > again the same message?
1973
1974 One out of several differences: D doesn't include attachments.
1975
1976 My personal use case: I have a couple of mail accounts - this one for all my
1977 normal private stuff, one gmail account mostly for sharing documents and so on.
1978 If I get a mail with an attachment that I can't read in a terminal (typically
1979 pdf) to my private account, I will bounce it to my gmail account. That
1980 preserves the whole message, and is different from both "D" (which I use
1981 to re-send mail) and forward (which I use to forward interesting stuff to
1982 other people).
1983 --
1984 alge
1985
1986 From ezyang@MIT.EDU Sat Jun 6 14:17:29 2009
1987 From: ezyang@MIT.EDU (Edward Z. Yang)
1988 Date: Sat, 06 Jun 2009 14:17:29 -0400
1989 Subject: [sup-talk] Sup annoyances
1990 In-Reply-To: <1244308338-sup-4735@cabinet>
1991 References: <1244270435-sup-9288@javelin> <1244271263-sup-3881@javelin>
1992 <1244308338-sup-4735@cabinet>
1993 Message-ID: <1244312041-sup-9128@javelin>
1994
1995 Excerpts from Marc Hartstein's message of Sat Jun 06 13:16:39 -0400 2009:
1996 > sup gives you a menu to select whether to reply to Sender, Recipient,
1997 > List, or All. It's right up near the top of the reply-mode screen. Use
1998 > regular vertical movement keys to select the Reply to: line, then
1999 > horizontal movement to select an option.
2000
2001 Yep, I know about this.
2002
2003 > You can improve the default selection using the reply-to hook. See `sup
2004 > --list-hooks` for documentation.
2005
2006 I didn't know about that.
2007
2008 > I found it a little weird getting used to (coming from mutt, where I
2009 > actually used a different reply key for each mode), but the default
2010 > behavior is generally correct, and selecting from the menu isn't too
2011 > bad.
2012
2013 The trouble is I always forget to check the To: header on my mails, and
2014 there is a ~large class of mailing list emails that don't actually do
2015 the right thing by default. Improving the heuristic may be an alternate
2016 possibility.
2017
2018 Cheers,
2019 Edward
2020
2021 From bwalton@artsci.utoronto.ca Sat Jun 6 15:06:49 2009
2022 From: bwalton@artsci.utoronto.ca (Ben Walton)
2023 Date: Sat, 06 Jun 2009 15:06:49 -0400
2024 Subject: [sup-talk] sup/gpg
2025 In-Reply-To: <1244314253-sup-6338@cabinet>
2026 References: <1243463452-sup-1174@cabinet>
2027 <1243466444-sup-3672@ntdws12.chass.utoronto.ca>
2028 <1243622801-sup-6484@cabinet>
2029 <1243819025-sup-136@ntdws12.chass.utoronto.ca>
2030 <1244037417-sup-8346@cabinet>
2031 <1244313900-sup-578@ntdws12.chass.utoronto.ca>
2032 <1244314253-sup-6338@cabinet>
2033 Message-ID: <1244314983-sup-482@ntdws12.chass.utoronto.ca>
2034
2035 Excerpts from Marc Hartstein's message of Sat Jun 06 14:53:55 -0400 2009:
2036 > Excerpts from Ben Walton's message of Sat Jun 06 14:45:56 -0400 2009:
2037 > >
2038 > > This just got stranger, which makes me think it may be a sup issue
2039 > > still. The thread you replied twice to earlier today has one message
2040 > > validating and the other not. See attached.
2041 >
2042 > Ok, that's totally bizarre.
2043 >
2044 > Things I can think of:
2045 >
2046 > Those were two different sup instances (I'd quit, created a branch, and
2047 > applied the discussed patch in between sending the two replies)
2048
2049 Well, if the patch altered the behaviour, that's a possibility.
2050
2051 > I might well have typoed my passphrase for one of the messages and not
2052 > the other, though I'm not sure which. I think it's slightly more likely
2053 > that the BAD message was the one where I made a typo, though. [I then
2054 > proceeded to enter it correctly the second time, though, so...]
2055
2056 When I enter a bad passphrase into pinentry, sup detects this and
2057 won't send the message...to my knowledge, I'm not able to get a
2058 multipart/gpg message sent if I don't enter a proper passphrase.
2059
2060 > Think we should move the discussion to the sup list to see if anybody
2061 > has thoughts?
2062
2063 I think that's reasonable. My next thought is that there is a small
2064 bug in the mime parsing (or creating) code...
2065
2066 Does anyone else have thoughts on what would cause broken gpg
2067 signatures? I've previously had issues when using gpg2 instead of
2068 gpg1, but that was completely the fault of gpg2 (or my use of it,
2069 anyway). Switching to gpg1 resolved the problem at that time. In
2070 this instance, Mark isn't able to validate my signatures and I was
2071 able to validate his until just recently...I'm now hit-and-miss with
2072 his.
2073
2074 Thoughts?
2075
2076 Thanks
2077 -Ben
2078 --
2079 Ben Walton
2080 Systems Programmer - CHASS
2081 University of Toronto
2082 C:416.407.5610 | W:416.978.4302
2083
2084 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
2085 Contact me to arrange for a CAcert assurance meeting.
2086 -------------- next part --------------
2087 A non-text attachment was scrubbed...
2088 Name: signature.asc
2089 Type: application/pgp-signature
2090 Size: 189 bytes
2091 Desc: not available
2092 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090606/ff5e9ca6/attachment.bin>
2093
2094 From ingmar@exherbo.org Fri Jun 5 20:35:50 2009
2095 From: ingmar@exherbo.org (Ingmar Vanhassel)
2096 Date: Sat, 06 Jun 2009 02:35:50 +0200
2097 Subject: [sup-talk] [PATCH] Use terminal width instead of hardcoded 80
2098 as the wrap length.
2099 In-Reply-To: <1243439667-sup-3947@entry>
2100 References: <1243102667-sup-6007@r50p>
2101 <4c4248150905231318kab3819dw68e3a3a614241c0d@mail.gmail.com>
2102 <1243123134-sup-8032@ntdws12.chass.utoronto.ca>
2103 <1243439667-sup-3947@entry>
2104 Message-ID: <1244248537-sup-5155@cannonball>
2105
2106 Excerpts from William Morgan's message of Wed May 27 17:58:23 +0200 2009:
2107 > Reformatted excerpts from Ben Walton's message of 2009-05-23:
2108 > > But if you leave sup's "we dont' force wrapping" rules alone, this
2109 > > makes reading mail scroll free if your terminal is wide enough and
2110 > > doesn't change the behaviour if the terminal is narrower. (Not that
2111 > > I'm against making it an option either.)
2112 >
2113 > Seems like there are three main modes of operation that would be
2114 > desirable:
2115 >
2116 > 1. wrap at 80 chars;
2117 > 2. wrap at current terminal width;
2118 > 3. don't wrap.
2119 >
2120 > (In all cases, existing line breaks in the message are left alone.)
2121 >
2122 > Would a three-way toggle irritate anyone?
2123
2124 Works for me.
2125
2126 From bwalton@artsci.utoronto.ca Sun Jun 7 08:33:49 2009
2127 From: bwalton@artsci.utoronto.ca (Ben Walton)
2128 Date: Sun, 07 Jun 2009 08:33:49 -0400
2129 Subject: [sup-talk] exception with undomanager
2130 Message-ID: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
2131
2132
2133 Hi All,
2134
2135 I bumped into this this morning. I've not used the undo stuff much,
2136 but I tried it today. The (rough) sequence of events leading to this
2137 was: I archived two threads separately and then decided I wanted to
2138 undo the first of two actions. I hit u once and got the latest thread
2139 back and when I hit it again, sup crashed. If I get a chance I'll
2140 look into it myself, but I'm tossing it out for people more familiar
2141 with these bits to see also.
2142
2143 Thanks
2144 -Ben
2145
2146
2147 $ less ~/.sup/exception-log.txt
2148 --- NoMethodError from thread: main
2149 undefined method `content_width' for nil:NilClass
2150 ./sup/modes/thread-index-mode.rb:868:in `from_width'
2151 ./sup/modes/thread-index-mode.rb:793:in `text_for_thread_at'
2152 /local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
2153 `each_with_index'
2154 ./sup/modes/thread-index-mode.rb:792:in `each'
2155 ./sup/modes/thread-index-mode.rb:792:in `each_with_index'
2156 ./sup/modes/thread-index-mode.rb:792:in `text_for_thread_at'
2157 ./sup/modes/thread-index-mode.rb:753:in `regen_text'
2158 ./sup/util.rb:346:in `map_with_index'
2159 /local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
2160 `each_with_index'
2161 ./sup/util.rb:346:in `each'
2162 ./sup/util.rb:346:in `each_with_index'
2163 ./sup/util.rb:346:in `map_with_index'
2164 ./sup/modes/thread-index-mode.rb:753:in `regen_text'
2165 ./sup/modes/thread-index-mode.rb:228:in `update'
2166 ./sup/modes/thread-index-mode.rb:697:in `add_or_unhide'
2167 ./sup/modes/thread-index-mode.rb:319:in `actually_toggle_spammed'
2168 ./sup/undo.rb:28:in `call'
2169 ./sup/undo.rb:28:in `undo'
2170 ./sup/undo.rb:28:in `each'
2171 ./sup/undo.rb:28:in `undo'
2172 ./sup/util.rb:505:in `send'
2173 ./sup/util.rb:505:in `method_missing'
2174 ./sup/modes/thread-index-mode.rb:217:in `undo'
2175 ./sup/mode.rb:50:in `send'
2176 ./sup/mode.rb:50:in `handle_input'
2177 ./sup/buffer.rb:249:in `handle_input'
2178 ../bin/sup:237
2179 --
2180 Ben Walton
2181 Systems Programmer - CHASS
2182 University of Toronto
2183 C:416.407.5610 | W:416.978.4302
2184
2185 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
2186 Contact me to arrange for a CAcert assurance meeting.
2187 -------------- next part --------------
2188 A non-text attachment was scrubbed...
2189 Name: signature.asc
2190 Type: application/pgp-signature
2191 Size: 189 bytes
2192 Desc: not available
2193 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090607/3fcc2660/attachment.bin>
2194
2195 From sup@davekap.com Sun Jun 7 19:52:10 2009
2196 From: sup@davekap.com (David L.Kaplan)
2197 Date: Sun, 07 Jun 2009 19:52:10 -0400
2198 Subject: [sup-talk] crash with .8 on save ($)
2199 Message-ID: <1244418650-sup-3064@ubuntu>
2200
2201 To the best of my recollection, I had archived a few messages and then
2202 hit $ to save state. Exception file attached.
2203
2204 Thanks for sup.
2205
2206 Dave
2207 --- RuntimeError from thread: periodic poll
2208 trying to delete non-corresponding entry 47607 with index message-id
2209 "2ca9fdfb2b3c1c3c3981de95447977b2 at www.facebook.com" and parameter message id
2210 "988542971151613.JXQSVJUEOLXELKD at 187-45-0-136.clientes.cilnet.com.br"
2211 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/index.rb:191:in `sync_message'
2212 /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
2213 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/index.rb:190:in `sync_message'
2214 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `send'
2215 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `method_missing'
2216 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:161:in `add_messages_from'
2217 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/maildir.rb:130:in `each'
2218 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/maildir.rb:127:in `upto'
2219 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/maildir.rb:127:in `each'
2220 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:544:in `send'
2221 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:544:in `__pass'
2222 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:531:in `method_missing'
2223 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:141:in `add_messages_from'
2224 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:98:in `do_poll'
2225 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:86:in `each'
2226 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:86:in `do_poll'
2227 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:85:in `synchronize'
2228 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:85:in `do_poll'
2229 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `send'
2230 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `method_missing'
2231 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/modes/poll-mode.rb:17:in `poll'
2232 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:53:in `poll'
2233 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:70:in `start'
2234 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup.rb:71:in `reporting_thread'
2235 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup.rb:69:in `initialize'
2236 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup.rb:69:in `new'
2237 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup.rb:69:in `reporting_thread'
2238 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/poll.rb:67:in `start'
2239 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `send'
2240 /home/dave/.gem/ruby/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `method_missing'
2241 /home/dave/.gem/ruby/1.8/gems/sup-0.8/bin/sup:213
2242 /usr/bin/sup:19:in `load'
2243 /usr/bin/sup:19
2244
2245 From bwalton@artsci.utoronto.ca Sun Jun 7 20:02:25 2009
2246 From: bwalton@artsci.utoronto.ca (Ben Walton)
2247 Date: Sun, 7 Jun 2009 20:02:25 -0400
2248 Subject: [sup-talk] (no subject)
2249 Message-ID: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
2250
2251 Hi All,
2252
2253 Here's a stab at implementing a message bouncing functionality worthy
2254 of being included on mainline.
2255
2256 The first patch adds the basic functionality with the ability to
2257 supply a command in the :bounce_sendmail option that overrides the
2258 default command used. The default is to use the sendmail command of
2259 the default account with -t removed.
2260
2261 The second patch takes this a step further and strips the
2262 configuration option in favour of a hook named bounce-command. This
2263 hooks gets the From header of the message being bounced and an array
2264 of recipient addresses supplied by the user.
2265
2266 I think these are in good shape, with the caveat that the mail sending
2267 (IO.popen) part could still be refactored with the code in
2268 edit-message-mode.
2269
2270 Anyone interested can grab this code from the bw/bounce_message branch
2271 of git://code.chass.utoronto.ca/bwalton-sup.git. It merges cleanly
2272 into next as of now.
2273
2274 Feedback welcome.
2275
2276 Thanks
2277 -Ben
2278
2279
2280 From bwalton@artsci.utoronto.ca Sun Jun 7 20:02:26 2009
2281 From: bwalton@artsci.utoronto.ca (Ben Walton)
2282 Date: Sun, 7 Jun 2009 20:02:26 -0400
2283 Subject: [sup-talk] [PATCH 1/2] Add message bouncing capability
2284 In-Reply-To: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
2285 References: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
2286 Message-ID: <1244419347-11330-2-git-send-email-bwalton@artsci.utoronto.ca>
2287
2288 Bouncing a message is akin to redirecting a mail with a .forward
2289 entry. It is passed back to the mail system as it sits on disk.
2290
2291 By pressing ! while viewing a message, you can now re-inject it to the
2292 mail system using either the command defined in bounce_sendmail or the
2293 sendmail command for the default account with any instance of -t
2294 removed. The user is prompted for the recipients of the message and is
2295 offered a chance to confirm the bounce before it is sent.
2296
2297 The message is _not_ stored in the sent box, as this doesn't make
2298 sense with bounced messages (and would not show up uniquely anyway).
2299
2300 The bounce_sendmail configuration item allows users that require
2301 different sendmail commands depending on where the bounce is destined
2302 to write a wrapper around their local mail tools to pick and choose
2303 the appropriate injection method for the message based on the
2304 addresses passed in. Most systems can likely use: sendmail -oem -i
2305
2306 Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca>
2307 ---
2308 lib/sup.rb | 1 +
2309 lib/sup/modes/thread-view-mode.rb | 33 +++++++++++++++++++++++++++++++++
2310 2 files changed, 34 insertions(+), 0 deletions(-)
2311
2312 diff --git a/lib/sup.rb b/lib/sup.rb
2313 index 96510b2..76444c9 100644
2314 --- a/lib/sup.rb
2315 +++ b/lib/sup.rb
2316 @@ -207,6 +207,7 @@ else
2317 :confirm_top_posting => true,
2318 :discard_snippets_from_encrypted_messages => false,
2319 :default_attachment_save_dir => "",
2320 + :bounce_sendmail => "",
2321 }
2322 begin
2323 FileUtils.mkdir_p Redwood::BASE_DIR
2324 diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
2325 index 42c6280..8842e59 100644
2326 --- a/lib/sup/modes/thread-view-mode.rb
2327 +++ b/lib/sup/modes/thread-view-mode.rb
2328 @@ -41,6 +41,7 @@ EOS
2329 # k.add :collapse_non_new_messages, "Collapse all but unread messages", 'N'
2330 k.add :reply, "Reply to a message", 'r'
2331 k.add :forward, "Forward a message or attachment", 'f'
2332 + k.add :bounce, "Bounce message to other recipient(s)", '!'
2333 k.add :alias, "Edit alias/nickname for a person", 'i'
2334 k.add :edit_as_new, "Edit message as new", 'D'
2335 k.add :save_to_disk, "Save message/attachment to disk", 's'
2336 @@ -172,6 +173,38 @@ EOS
2337 end
2338 end
2339
2340 + def bounce
2341 + m = @message_lines[curpos] or return
2342 + to = BufferManager.ask_for_contacts(:people, "Bounce To: ") or return
2343 +
2344 + defcmd = AccountManager.default_account.sendmail.sub(/\s(\-(ti|it|t))\b/) do |match|
2345 + case "$1"
2346 + when '-t' then ''
2347 + else ' -i'
2348 + end
2349 + end
2350 +
2351 + cmd = case $config[:bounce_sendmail]
2352 + when nil, /^$/ then defcmd
2353 + else $config[:bounce_sendmail]
2354 + end + ' ' + to.map { |t| t.email }.join(' ')
2355 +
2356 + bt = to.size > 1 ? "#{to.size} recipients" : to.to_s
2357 +
2358 + if BufferManager.ask_yes_or_no "Really bounce to #{bt}?"
2359 + Redwood::log "Bounce Command: #{cmd}"
2360 + begin
2361 + IO.popen(cmd, 'w') do |sm|
2362 + sm.puts m.raw_message
2363 + end
2364 + raise SendmailCommandFailed, "Couldn't execute #{cmd}" unless $? == 0
2365 + rescue SystemCallError, SendmailCommandFailed => e
2366 + Redwood::log "Problem sending mail: #{e.message}"
2367 + BufferManager.flash "Problem sending mail: #{e.message}"
2368 + end
2369 + end
2370 + end
2371 +
2372 include CanAliasContacts
2373 def alias
2374 p = @person_lines[curpos] or return
2375 --
2376 1.6.3
2377
2378
2379 From bwalton@artsci.utoronto.ca Sun Jun 7 20:02:27 2009
2380 From: bwalton@artsci.utoronto.ca (Ben Walton)
2381 Date: Sun, 7 Jun 2009 20:02:27 -0400
2382 Subject: [sup-talk] [PATCH 2/2] Bounce Message Hook
2383 In-Reply-To: <1244419347-11330-2-git-send-email-bwalton@artsci.utoronto.ca>
2384 References: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
2385 <1244419347-11330-2-git-send-email-bwalton@artsci.utoronto.ca>
2386 Message-ID: <1244419347-11330-3-git-send-email-bwalton@artsci.utoronto.ca>
2387
2388 Determine the command used to bounce a message based on a Hook instead
2389 of a configuration option. Instead of writing an external script that
2390 can send the message properly based on the recipient addresses, rely
2391 on a hook that can return the command based on the From header in the
2392 mail being bounced as well as the intended recipients. This is more
2393 in line with the sup philosophy.
2394
2395 The default is still to strip any -t from the sendmail command of the
2396 default account.
2397
2398 Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca>
2399 ---
2400 lib/sup.rb | 1 -
2401 lib/sup/modes/thread-view-mode.rb | 16 ++++++++++++++--
2402 2 files changed, 14 insertions(+), 3 deletions(-)
2403
2404 diff --git a/lib/sup.rb b/lib/sup.rb
2405 index 76444c9..96510b2 100644
2406 --- a/lib/sup.rb
2407 +++ b/lib/sup.rb
2408 @@ -207,7 +207,6 @@ else
2409 :confirm_top_posting => true,
2410 :discard_snippets_from_encrypted_messages => false,
2411 :default_attachment_save_dir => "",
2412 - :bounce_sendmail => "",
2413 }
2414 begin
2415 FileUtils.mkdir_p Redwood::BASE_DIR
2416 diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
2417 index 8842e59..76a1d1e 100644
2418 --- a/lib/sup/modes/thread-view-mode.rb
2419 +++ b/lib/sup/modes/thread-view-mode.rb
2420 @@ -24,6 +24,18 @@ Return value:
2421 None. The variable 'headers' should be modified in place.
2422 EOS
2423
2424 + HookManager.register "bounce-command", <<EOS
2425 +Determines the command used to bounce a message.
2426 +Variables:
2427 + from: The From header of the message being bounced
2428 + (eg: likely _not_ your address).
2429 + to: The addresses you asked the message to be bounced to as an array.
2430 +Return value:
2431 + A string representing the command to pipe the mail into. This
2432 + should include the entire command except for the destination addresses,
2433 + which will be appended by sup.
2434 +EOS
2435 +
2436 register_keymap do |k|
2437 k.add :toggle_detailed_header, "Toggle detailed header", 'h'
2438 k.add :show_header, "Show full message header", 'H'
2439 @@ -184,9 +196,9 @@ EOS
2440 end
2441 end
2442
2443 - cmd = case $config[:bounce_sendmail]
2444 + cmd = case HookManager.run "bounce-command", :from => m.from, :to => to
2445 when nil, /^$/ then defcmd
2446 - else $config[:bounce_sendmail]
2447 + else hookcmd
2448 end + ' ' + to.map { |t| t.email }.join(' ')
2449
2450 bt = to.size > 1 ? "#{to.size} recipients" : to.to_s
2451 --
2452 1.6.3
2453
2454
2455 From garoth@gmail.com Mon Jun 8 08:55:14 2009
2456 From: garoth@gmail.com (Andrei Thorp)
2457 Date: Mon, 8 Jun 2009 08:55:14 -0400
2458 Subject: [sup-talk] Fwd: [REQUEST] reply-to-list
2459 In-Reply-To: <80055d7c0906080553t41909b18j6c4a0f8fd119fa36@mail.gmail.com>
2460 References: <80055d7c0906080553t41909b18j6c4a0f8fd119fa36@mail.gmail.com>
2461 Message-ID: <80055d7c0906080555h37e2b551i606e60dbdd5414f2@mail.gmail.com>
2462
2463 Hello there,
2464
2465 Today I was told to read
2466 http://liw.iki.fi/liw/log/2003-Enemies-of-Carlotta.html.
2467
2468 It suggests that a good mailing client should have a reply-to-list
2469 button since mailing lists should not add themselves as a reply-to.
2470 The reply-to-list uses the standard List-ID header to know where to
2471 reply to.
2472
2473 As far as I can tell from ?-ing around the client, sup does not have
2474 this feature (though kudos for having a button for unsubscribe, which
2475 I find mildly curious but cool).
2476
2477 I'm told that the mutt key for this is l (ell), which I guess is reasonable.
2478
2479 Also, hello to the mailing list :)
2480
2481 Cheers,
2482
2483 -AT
2484
2485 From bwalton@artsci.utoronto.ca Mon Jun 8 09:03:11 2009
2486 From: bwalton@artsci.utoronto.ca (Ben Walton)
2487 Date: Mon, 08 Jun 2009 09:03:11 -0400
2488 Subject: [sup-talk] Fwd: [REQUEST] reply-to-list
2489 In-Reply-To: <80055d7c0906080555h37e2b551i606e60dbdd5414f2@mail.gmail.com>
2490 References: <80055d7c0906080553t41909b18j6c4a0f8fd119fa36@mail.gmail.com>
2491 <80055d7c0906080555h37e2b551i606e60dbdd5414f2@mail.gmail.com>
2492 Message-ID: <1244466128-sup-135@ntdws12.chass.utoronto.ca>
2493
2494 Excerpts from Andrei Thorp's message of Mon Jun 08 08:55:14 -0400 2009:
2495 > As far as I can tell from ?-ing around the client, sup does not have
2496 > this feature (though kudos for having a button for unsubscribe, which
2497 > I find mildly curious but cool).
2498 >
2499 > I'm told that the mutt key for this is l (ell), which I guess is reasonable.
2500
2501 Sup handles this in a smarter way. When you hit r to reply to a
2502 message, if it's detected as a list post, the 'reply to' menu
2503 selection defaults to 'Mailing list.' You can toggle this selection
2504 with the arrow keys.
2505
2506 HTH.
2507 -Ben
2508
2509 --
2510 Ben Walton
2511 Systems Programmer - CHASS
2512 University of Toronto
2513 C:416.407.5610 | W:416.978.4302
2514
2515 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
2516 Contact me to arrange for a CAcert assurance meeting.
2517 -------------- next part --------------
2518 A non-text attachment was scrubbed...
2519 Name: signature.asc
2520 Type: application/pgp-signature
2521 Size: 189 bytes
2522 Desc: not available
2523 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090608/00bf4f2d/attachment.bin>
2524
2525 From joe@talkhouse.com Mon Jun 8 11:21:52 2009
2526 From: joe@talkhouse.com (=?ISO-8859-1?Q?Joe_W=F6lfel?=)
2527 Date: Mon, 8 Jun 2009 11:21:52 -0400
2528 Subject: [sup-talk] Can't seem to send mail
2529 Message-ID: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2530
2531 First, Sup awesome. It's saves an incredible amount of time
2532 searching through mail!
2533
2534 I haven't been able to send messages with it yet though. I can only
2535 search and read. I used sup-config to configure imap. According to
2536 the config.yaml file it's using sendmail -oem -ti to send. If I try
2537 to send a message it claims it's sent, but no such luck. Do I need
2538 to do something else in addition? Actually, I'd like to be able to
2539 send from multiple accounts and I'm not sure how to setup Sup to do
2540 that.
2541
2542
2543
2544 From garoth@gmail.com Mon Jun 8 11:50:47 2009
2545 From: garoth@gmail.com (Andrei Thorp)
2546 Date: Mon, 8 Jun 2009 11:50:47 -0400
2547 Subject: [sup-talk] Can't seem to send mail
2548 In-Reply-To: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2549 References: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2550 Message-ID: <80055d7c0906080850o2f861903v5b3a51effb215e0b@mail.gmail.com>
2551
2552 Well, as far as I can tell, sup doesn't actually send mail itself, and can't.
2553
2554 As such, it uses sendmail by default. Therefore, if you want it to
2555 send mail properly, you want to set up sendmail to send your mail.
2556
2557 If you're sending through something sane, it probably uses smtp.
2558 Today, I installed msmtp and am using it with sup successfully to
2559 accomplish this, though you have to change the sendmail command to
2560 /usr/bin/msmtp -t.
2561
2562 Alternatively, you could run your own mail server and use the sendmail
2563 that comes with that.
2564
2565 From bwalton@artsci.utoronto.ca Mon Jun 8 11:52:51 2009
2566 From: bwalton@artsci.utoronto.ca (Ben Walton)
2567 Date: Mon, 08 Jun 2009 11:52:51 -0400
2568 Subject: [sup-talk] Can't seem to send mail
2569 In-Reply-To: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2570 References: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2571 Message-ID: <1244476264-sup-5281@ntdws12.chass.utoronto.ca>
2572
2573 Excerpts from Joe W?lfel's message of Mon Jun 08 11:21:52 -0400 2009:
2574 > I haven't been able to send messages with it yet though. I can only
2575 > search and read. I used sup-config to configure imap. According to
2576 > the config.yaml file it's using sendmail -oem -ti to send. If I try
2577 > to send a message it claims it's sent, but no such luck. Do I need
2578 > to do something else in addition? Actually, I'd like to be able to
2579 > send from multiple accounts and I'm not sure how to setup Sup to do
2580 > that.
2581
2582 Check the log buffer first to see if sup reports errors interacting
2583 with (whatever is masquerading as) sendmail on your system...if there
2584 aren't errors there, check the mail logs on your system, since it has
2585 left the land of sup...If it doesn't make it to your index as a sent
2586 item, I suspect that the sendmail command may not be working
2587 correctly.
2588
2589 HTH
2590 -Ben
2591
2592 --
2593 Ben Walton
2594 Systems Programmer - CHASS
2595 University of Toronto
2596 C:416.407.5610 | W:416.978.4302
2597
2598 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
2599 Contact me to arrange for a CAcert assurance meeting.
2600 -------------- next part --------------
2601 A non-text attachment was scrubbed...
2602 Name: signature.asc
2603 Type: application/pgp-signature
2604 Size: 189 bytes
2605 Desc: not available
2606 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090608/67753431/attachment.bin>
2607
2608 From wmorgan-sup@masanjin.net Mon Jun 8 13:18:30 2009
2609 From: wmorgan-sup@masanjin.net (William Morgan)
2610 Date: Mon, 08 Jun 2009 10:18:30 -0700
2611 Subject: [sup-talk] exception with undomanager
2612 In-Reply-To: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
2613 References: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
2614 Message-ID: <1244481362-sup-970@entry>
2615
2616 Reformatted excerpts from Ben Walton's message of 2009-06-07:
2617 > I bumped into this this morning. I've not used the undo stuff much,
2618 > but I tried it today. The (rough) sequence of events leading to this
2619 > was: I archived two threads separately and then decided I wanted to
2620 > undo the first of two actions. I hit u once and got the latest thread
2621 > back and when I hit it again, sup crashed. If I get a chance I'll
2622 > look into it myself, but I'm tossing it out for people more familiar
2623 > with these bits to see also.
2624
2625 Something like this seems to happen fairly frequently. I think it's a
2626 (shudder) threading issue. Something is killing a buffer (possibly the
2627 user) while it's being redrawn and this happens. I need to stick another
2628 mutex in there somewhere. Or rewrite Sup for Ruby 1.9 with fibers
2629 instead of threads.
2630 --
2631 William <wmorgan-sup at masanjin.net>
2632
2633 From wmorgan-sup@masanjin.net Mon Jun 8 13:23:43 2009
2634 From: wmorgan-sup@masanjin.net (William Morgan)
2635 Date: Mon, 08 Jun 2009 10:23:43 -0700
2636 Subject: [sup-talk] sup/gpg
2637 In-Reply-To: <1244314983-sup-482@ntdws12.chass.utoronto.ca>
2638 References: <1243463452-sup-1174@cabinet>
2639 <1243466444-sup-3672@ntdws12.chass.utoronto.ca>
2640 <1243622801-sup-6484@cabinet>
2641 <1243819025-sup-136@ntdws12.chass.utoronto.ca>
2642 <1244037417-sup-8346@cabinet>
2643 <1244313900-sup-578@ntdws12.chass.utoronto.ca>
2644 <1244314253-sup-6338@cabinet>
2645 <1244314983-sup-482@ntdws12.chass.utoronto.ca>
2646 Message-ID: <1244481592-sup-4821@entry>
2647
2648 Reformatted excerpts from Ben Walton's message of 2009-06-06:
2649 > Excerpts from Marc Hartstein's message of Sat Jun 06 14:53:55 -0400 2009:
2650 > > Excerpts from Ben Walton's message of Sat Jun 06 14:45:56 -0400 2009:
2651 > > Those were two different sup instances (I'd quit, created a branch, and
2652 > > applied the discussed patch in between sending the two replies)
2653 >
2654 > Well, if the patch altered the behaviour, that's a possibility.
2655
2656 What was the patch?
2657
2658 > > I might well have typoed my passphrase for one of the messages and not
2659 > > the other, though I'm not sure which. I think it's slightly more likely
2660 > > that the BAD message was the one where I made a typo, though. [I then
2661 > > proceeded to enter it correctly the second time, though, so...]
2662 >
2663 > When I enter a bad passphrase into pinentry, sup detects this and
2664 > won't send the message...to my knowledge, I'm not able to get a
2665 > multipart/gpg message sent if I don't enter a proper passphrase.
2666
2667 Yeah, an incorrect passphrase will error out, it won't produce a bad
2668 message.
2669
2670 > I think that's reasonable. My next thought is that there is a small
2671 > bug in the mime parsing (or creating) code...
2672
2673 That is where I would start looking. If you tweak crypto.rb so that it
2674 dumps the payload somewhere (look in #format_payload), you can then
2675 compare that to what ends up in your sent.mbox.
2676
2677 Also you can look at encrypting messages to yourself. Are you able to
2678 decrypt them reliably? If not, is there a pattern? (Non-ASCII in the
2679 headers, body, etc.?)
2680 --
2681 William <wmorgan-sup at masanjin.net>
2682
2683 From wmorgan-sup@masanjin.net Mon Jun 8 14:00:23 2009
2684 From: wmorgan-sup@masanjin.net (William Morgan)
2685 Date: Mon, 08 Jun 2009 11:00:23 -0700
2686 Subject: [sup-talk] Sup annoyances
2687 In-Reply-To: <1244270435-sup-9288@javelin>
2688 References: <1244270435-sup-9288@javelin>
2689 Message-ID: <1244481844-sup-9094@entry>
2690
2691 Hi Edward,
2692
2693 I think these are by and large legitimate gripes and I'd be delighted to
2694 have someone motivated to fix them!
2695
2696 Reformatted excerpts from Edward Z. Yang's message of 2009-06-05:
2697 > 1. Threads should be lazy-loaded (possibly in the background), with
2698 > visible messages first.
2699
2700 FWIW, this is particularly egregious in a direct IMAP connection, and
2701 those of us who have switched to Maildir or who use mbox aren't
2702 punished. But it would be very cool to have this.
2703
2704 > If a conversation got a new message, Sup should only take its time to
2705 > load that message, and not the frickin' 24 other messages that were
2706 > also incidentally there. I suspect this will require some pretty
2707 > major refactoring.
2708
2709 It might not be too bad. Turn off the call to m.load_from_source! on
2710 line 106 of thread-index-mode.rb, add a Queue to ThreadViewMode
2711 containing messages to call #load_from_source! on, don't call m.chunks
2712 in ThreadViewMode#regen_text unless the message has been loaded, start a
2713 thread that pops messages from the queue, calls #load_from_source! on
2714 them, and then calls regen_text when an open message has been loaded...
2715 and you're 90% of the way there.
2716
2717 > 2. Auto-completion sucks and should be improved. I should be able
2718 > to press "c", type two letters, and then mash tab. If auto-completion
2719 > actually works, then I'll blame it on dismal contacts.txt support
2720
2721 The auto-completion is awesome. Adding a recipient to the contacts list is
2722 a good idea.
2723
2724 > 3. Polling and loading of threads should started, asynchronously, at
2725 > the same time.
2726
2727 > Loading of threads should not hose my CPU.
2728
2729 Agreed. Please fix.
2730
2731 > Loading of threads should do smart things, instead of doing an O(n)
2732 > time warp.
2733
2734 It's definitely worse than O(n). Loading threads could be sped up
2735 dramatically by storing the thread structure somewhere (either cached or
2736 just for every thread), since Sup does a lot of extra work rethreading
2737 everything every time you start it up. FWIW I'm doing this the right way
2738 in Sup 2.0.
2739
2740 > 4. Sup should prompt me whether or not I want to Reply All or Reply on
2741 > appropriate cases, like pine.
2742
2743 There have been a couple similar requests like this recently, though
2744 it's not clear if everyone has known about the ability to change the
2745 reply mode and about the reply-to hook. Since hitting 'r' defaults to
2746 replying to the sender alone (except for mailing list messages), I'd be
2747 ok with adding a Mutt-style reply-to-all key that starts up reply-mode
2748 with the 'reply to all' mode active.
2749 --
2750 William <wmorgan-sup at masanjin.net>
2751
2752 From wmorgan-sup@masanjin.net Mon Jun 8 14:09:52 2009
2753 From: wmorgan-sup@masanjin.net (William Morgan)
2754 Date: Mon, 08 Jun 2009 11:09:52 -0700
2755 Subject: [sup-talk] Sup is hanging
2756 In-Reply-To: <1244267416-sup-3720@javelin>
2757 References: <1244050695-sup-5990@javelin> <1244053108-sup-4982@javelin>
2758 <1244064889-sup-9506@entry>
2759 <alpine.DEB.2.00.0906031758290.24343@javelin>
2760 <1244078482-sup-4986@javelin>
2761 <alpine.DEB.2.00.0906032152200.6894@javelin>
2762 <1244130722-sup-4496@entry> <1244177820-sup-6051@javelin>
2763 <1244227108-sup-3123@cabinet> <1244238388-sup-760@javelin>
2764 <1244267416-sup-3720@javelin>
2765 Message-ID: <1244484134-sup-5651@entry>
2766
2767 Reformatted excerpts from Edward Z. Yang's message of 2009-06-05:
2768 > - if line =~ QUOTE_PATTERN || (line =~ QUOTE_START_PATTERN && nextline =~ QUO
2769 > + if line =~ QUOTE_PATTERN || (line =~ /:$/ && line =~ /\w/ && nextline =~ QU
2770
2771 Seems fine to me. I've applied that change directly to master. Not only
2772 are there millions of optimiziations for this stuff, there are millions
2773 of tweaks to improve detection precision and recall.
2774
2775 Thanks for your help with this, Edward!
2776 --
2777 William <wmorgan-sup at masanjin.net>
2778
2779 From joe@talkhouse.com Mon Jun 8 14:05:34 2009
2780 From: joe@talkhouse.com (=?ISO-8859-1?Q?Joe_W=F6lfel?=)
2781 Date: Mon, 8 Jun 2009 14:05:34 -0400
2782 Subject: [sup-talk] Can't seem to send mail
2783 In-Reply-To: <1244476264-sup-5281@ntdws12.chass.utoronto.ca>
2784 References: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2785 <1244476264-sup-5281@ntdws12.chass.utoronto.ca>
2786 Message-ID: <AAB8FA5E-9E58-4C24-9290-F3C80155E55D@talkhouse.com>
2787
2788
2789 On Jun 8, 2009, at 11:52 AM, Ben Walton wrote:
2790
2791 > Excerpts from Joe W?lfel's message of Mon Jun 08 11:21:52 -0400 2009:
2792 >> I haven't been able to send messages with it yet though. I can only
2793 >> search and read. I used sup-config to configure imap. According
2794 >> to
2795 >> the config.yaml file it's using sendmail -oem -ti to send. If I try
2796 >> to send a message it claims it's sent, but no such luck. Do I need
2797 >> to do something else in addition? Actually, I'd like to be able to
2798 >> send from multiple accounts and I'm not sure how to setup Sup to do
2799 >> that.
2800 >
2801 > Check the log buffer first to see if sup reports errors interacting
2802 > with (whatever is masquerading as) sendmail on your system...if there
2803 > aren't errors there, check the mail logs on your system, since it has
2804 > left the land of sup...If it doesn't make it to your index as a sent
2805 > item, I suspect that the sendmail command may not be working
2806 > correctly.
2807 >
2808 > HTH
2809 > -Ben
2810 >
2811 > --
2812 > Ben Walton
2813 > Systems Programmer - CHASS
2814 > University of Toronto
2815 > C:416.407.5610 | W:416.978.4302
2816 >
2817 > GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
2818 > Contact me to arrange for a CAcert assurance meeting.
2819 > _______________________________________________
2820 > sup-talk mailing list
2821 > sup-talk at rubyforge.org
2822 > http://rubyforge.org/mailman/listinfo/sup-talk
2823
2824 It looks like sendmail isn't functioning and doesn't generate any
2825 errors. Maybe it's a mac problem. I haven't tried it on anything
2826 else yet.
2827
2828
2829 From ezyang@MIT.EDU Mon Jun 8 14:18:41 2009
2830 From: ezyang@MIT.EDU (Edward Z. Yang)
2831 Date: Mon, 08 Jun 2009 14:18:41 -0400
2832 Subject: [sup-talk] exception with undomanager
2833 In-Reply-To: <1244481362-sup-970@entry>
2834 References: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
2835 <1244481362-sup-970@entry>
2836 Message-ID: <1244485084-sup-973@javelin>
2837
2838 Excerpts from William Morgan's message of Mon Jun 08 13:18:30 -0400 2009:
2839 > Something like this seems to happen fairly frequently. I think it's a
2840 > (shudder) threading issue. Something is killing a buffer (possibly the
2841 > user) while it's being redrawn and this happens. I need to stick another
2842 > mutex in there somewhere. Or rewrite Sup for Ruby 1.9 with fibers
2843 > instead of threads.
2844
2845 The unfortunate bit about Ruby 1.9 is that the majority of libraries sup uses
2846 aren't on 1.9 yet...
2847
2848 Cheers,
2849 Edward
2850
2851 From wmorgan-sup@masanjin.net Mon Jun 8 14:25:10 2009
2852 From: wmorgan-sup@masanjin.net (William Morgan)
2853 Date: Mon, 08 Jun 2009 11:25:10 -0700
2854 Subject: [sup-talk] sup/gpg
2855 In-Reply-To: <1244483397-sup-3035@cabinet>
2856 References: <1243463452-sup-1174@cabinet>
2857 <1243466444-sup-3672@ntdws12.chass.utoronto.ca>
2858 <1243622801-sup-6484@cabinet>
2859 <1243819025-sup-136@ntdws12.chass.utoronto.ca>
2860 <1244037417-sup-8346@cabinet>
2861 <1244313900-sup-578@ntdws12.chass.utoronto.ca>
2862 <1244314253-sup-6338@cabinet>
2863 <1244314983-sup-482@ntdws12.chass.utoronto.ca>
2864 <1244481592-sup-4821@entry> <1244483397-sup-3035@cabinet>
2865 Message-ID: <1244485140-sup-1973@entry>
2866
2867 Reformatted excerpts from Marc Hartstein's message of 2009-06-08:
2868 > The regexp fix for messages with very long lines.
2869
2870 Yeah, that shouldn't change anything. Doesn't even change Sup's output!
2871
2872 > Yeah, it bounces me back to pinentry, where I proceeded to enter it
2873 > correctly. It *shouldn't* produce a bad message, it was just one of
2874 > the only things I could think of that had changed between the two
2875 > messages which might have led to different behavior.
2876
2877 Except the message content, I guess. :)
2878
2879 > > Also you can look at encrypting messages to yourself. Are you able
2880 > > to decrypt them reliably? If not, is there a pattern? (Non-ASCII in
2881 > > the headers, body, etc.?)
2882 >
2883 > I expect this will have the same behavior as checking signatures on
2884 > messages I send, no?
2885
2886 It should; I was just suggesting it as an alternative approach to
2887 figuring out what was causing the problem. Then Ben isn't in the loop
2888 any more and you can spend all night happily debuggin this. :)
2889
2890 > Ben is using gpg 1 after correspondents complained the switch to gpg 2
2891 > caused his messages to have bad signatures.
2892
2893 Was he using Sup the entire time?
2894
2895 > I am using gpg 2.0.11
2896 >
2897 > I see *all* Ben's messages as having bad signatures, and see all my
2898 > own (either in sent.mbox or bounced back to me from the list) as good.
2899 > I also see Ben's signatures as bad when looking at the same messages
2900 > through mutt. I see the same thing going back to his first signed
2901 > message to sup-talk, and also in his direct emails to me.
2902 >
2903 > Ben sees most of my signatures as good, but has recently experienced
2904 > an intermittent issue where my signatures are bad.
2905
2906 It sounds like there might be some possibility that it's a GPG version
2907 incompatibility, though I'd be a little surprised if that were really
2908 the case. It might be helpful if you guys could do a control experiment
2909 with Mutt, since I have a fair amount of faith in its GPG
2910 implementation.
2911
2912 --
2913 William <wmorgan-sup at masanjin.net>
2914
2915 From garoth@gmail.com Mon Jun 8 14:42:28 2009
2916 From: garoth@gmail.com (Andrei Thorp)
2917 Date: Mon, 8 Jun 2009 14:42:28 -0400
2918 Subject: [sup-talk] Can't seem to send mail
2919 In-Reply-To: <AAB8FA5E-9E58-4C24-9290-F3C80155E55D@talkhouse.com>
2920 References: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2921 <1244476264-sup-5281@ntdws12.chass.utoronto.ca>
2922 <AAB8FA5E-9E58-4C24-9290-F3C80155E55D@talkhouse.com>
2923 Message-ID: <80055d7c0906081142w63a5ddf3w2d7c06fd174b3740@mail.gmail.com>
2924
2925 Heh.
2926
2927 # file /usr/sbin/sendmail
2928 /usr/sbin/sendmail: symbolic link to `/bin/true'
2929
2930 Fail.
2931
2932 (or it would be ;)
2933
2934 -AT
2935
2936 From bwalton@artsci.utoronto.ca Mon Jun 8 14:44:50 2009
2937 From: bwalton@artsci.utoronto.ca (Ben Walton)
2938 Date: Mon, 08 Jun 2009 14:44:50 -0400
2939 Subject: [sup-talk] Can't seem to send mail
2940 In-Reply-To: <AAB8FA5E-9E58-4C24-9290-F3C80155E55D@talkhouse.com>
2941 References: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
2942 <1244476264-sup-5281@ntdws12.chass.utoronto.ca>
2943 <AAB8FA5E-9E58-4C24-9290-F3C80155E55D@talkhouse.com>
2944 Message-ID: <1244486438-sup-3501@ntdws12.chass.utoronto.ca>
2945
2946 Excerpts from Joe W?lfel's message of Mon Jun 08 14:05:34 -0400 2009:
2947 > It looks like sendmail isn't functioning and doesn't generate any
2948 > errors. Maybe it's a mac problem. I haven't tried it on anything
2949 > else yet.
2950
2951 Personally, I don't think sendmail has _ever_ been functional, but
2952 that's just the grumpy side of me that has to configure it on clunky
2953 old boxes still! :)
2954
2955 It's likely working, but has a local delivery setup configured. Try
2956 using `mailq` to see if anything is sitting in the outbound queue.
2957 You may also want to look in /var/spool/mail for mbox files sitting
2958 there with the messages (or bounces) sent from sup.
2959
2960 If you want to get your hands dirty, I recommend exim as the
2961 replacment for sendmail. I like it's configuration and acl setup
2962 better than postfix, but that would also work. If you just want to
2963 send mail quickly and easily, try msmtp or a similar package.
2964
2965 HTH.
2966 -Ben
2967 --
2968 Ben Walton
2969 Systems Programmer - CHASS
2970 University of Toronto
2971 C:416.407.5610 | W:416.978.4302
2972
2973 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
2974 Contact me to arrange for a CAcert assurance meeting.
2975 -------------- next part --------------
2976 A non-text attachment was scrubbed...
2977 Name: signature.asc
2978 Type: application/pgp-signature
2979 Size: 189 bytes
2980 Desc: not available
2981 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090608/1f82e67c/attachment.bin>
2982
2983 From bwalton@artsci.utoronto.ca Mon Jun 8 14:50:19 2009
2984 From: bwalton@artsci.utoronto.ca (Ben Walton)
2985 Date: Mon, 08 Jun 2009 14:50:19 -0400
2986 Subject: [sup-talk] exception with undomanager
2987 In-Reply-To: <1244485084-sup-973@javelin>
2988 References: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
2989 <1244481362-sup-970@entry> <1244485084-sup-973@javelin>
2990 Message-ID: <1244486944-sup-293@ntdws12.chass.utoronto.ca>
2991
2992 Excerpts from Edward Z. Yang's message of Mon Jun 08 14:18:41 -0400 2009:
2993 > The unfortunate bit about Ruby 1.9 is that the majority of libraries sup uses
2994 > aren't on 1.9 yet...
2995
2996 ...and some platforms don't have packages for it yet, which puts more
2997 onus on the user to get it up and going...
2998
2999 -Ben
3000
3001 --
3002 Ben Walton
3003 Systems Programmer - CHASS
3004 University of Toronto
3005 C:416.407.5610 | W:416.978.4302
3006
3007 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
3008 Contact me to arrange for a CAcert assurance meeting.
3009 -------------- next part --------------
3010 A non-text attachment was scrubbed...
3011 Name: signature.asc
3012 Type: application/pgp-signature
3013 Size: 189 bytes
3014 Desc: not available
3015 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090608/836af547/attachment.bin>
3016
3017 From wmorgan-sup@masanjin.net Mon Jun 8 14:59:04 2009
3018 From: wmorgan-sup@masanjin.net (William Morgan)
3019 Date: Mon, 08 Jun 2009 11:59:04 -0700
3020 Subject: [sup-talk] exception with undomanager
3021 In-Reply-To: <1244485084-sup-973@javelin>
3022 References: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
3023 <1244481362-sup-970@entry> <1244485084-sup-973@javelin>
3024 Message-ID: <1244487518-sup-3141@entry>
3025
3026 Reformatted excerpts from Edward Z. Yang's message of 2009-06-08:
3027 > The unfortunate bit about Ruby 1.9 is that the majority of libraries
3028 > sup uses aren't on 1.9 yet...
3029
3030 Not a serious suggestion. One rewrite going at a time is my rule. :)
3031 --
3032 William <wmorgan-sup at masanjin.net>
3033
3034 From ezyang@MIT.EDU Mon Jun 8 15:02:28 2009
3035 From: ezyang@MIT.EDU (Edward Z. Yang)
3036 Date: Mon, 08 Jun 2009 15:02:28 -0400
3037 Subject: [sup-talk] exception with undomanager
3038 In-Reply-To: <1244486944-sup-293@ntdws12.chass.utoronto.ca>
3039 References: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
3040 <1244481362-sup-970@entry> <1244485084-sup-973@javelin>
3041 <1244486944-sup-293@ntdws12.chass.utoronto.ca>
3042 Message-ID: <1244487681-sup-5778@javelin>
3043
3044 Excerpts from Ben Walton's message of Mon Jun 08 14:50:19 -0400 2009:
3045 > ...and some platforms don't have packages for it yet, which puts more
3046 > onus on the user to get it up and going...
3047
3048 Ruby is basically not usable with your package manager. You *have* to
3049 roll the gems yourself.
3050
3051 Cheers,
3052 Edward
3053
3054 From bwalton@artsci.utoronto.ca Mon Jun 8 15:20:31 2009
3055 From: bwalton@artsci.utoronto.ca (Ben Walton)
3056 Date: Mon, 08 Jun 2009 15:20:31 -0400
3057 Subject: [sup-talk] exception with undomanager
3058 In-Reply-To: <1244487681-sup-5778@javelin>
3059 References: <1244377876-sup-7845@ntdws12.chass.utoronto.ca>
3060 <1244481362-sup-970@entry> <1244485084-sup-973@javelin>
3061 <1244486944-sup-293@ntdws12.chass.utoronto.ca>
3062 <1244487681-sup-5778@javelin>
3063 Message-ID: <1244488618-sup-3388@ntdws12.chass.utoronto.ca>
3064
3065 Excerpts from Edward Z. Yang's message of Mon Jun 08 15:02:28 -0400 2009:
3066 > Ruby is basically not usable with your package manager. You *have* to
3067 > roll the gems yourself.
3068
3069 I realize this. Gems are awesome and gems suck. I'm talking about
3070 the matz ruby interpreter itself. In some instances, not only would
3071 the user need all of the gems, but they'd need a 1.9 ruby too...that a
3072 big commitment to run a mail client.
3073
3074 [As a side note, Debian/Ubuntu do package many of the gems, but it's a
3075 round hole, square peg affair.]
3076
3077 Thanks
3078 -Ben
3079 --
3080 Ben Walton
3081 Systems Programmer - CHASS
3082 University of Toronto
3083 C:416.407.5610 | W:416.978.4302
3084
3085 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
3086 Contact me to arrange for a CAcert assurance meeting.
3087 -------------- next part --------------
3088 A non-text attachment was scrubbed...
3089 Name: signature.asc
3090 Type: application/pgp-signature
3091 Size: 189 bytes
3092 Desc: not available
3093 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090608/33159422/attachment.bin>
3094
3095 From joe@talkhouse.com Mon Jun 8 16:03:58 2009
3096 From: joe@talkhouse.com (=?ISO-8859-1?Q?Joe_W=F6lfel?=)
3097 Date: Mon, 8 Jun 2009 16:03:58 -0400
3098 Subject: [sup-talk] Can't seem to send mail
3099 In-Reply-To: <1244486438-sup-3501@ntdws12.chass.utoronto.ca>
3100 References: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
3101 <1244476264-sup-5281@ntdws12.chass.utoronto.ca>
3102 <AAB8FA5E-9E58-4C24-9290-F3C80155E55D@talkhouse.com>
3103 <1244486438-sup-3501@ntdws12.chass.utoronto.ca>
3104 Message-ID: <B9FE7468-E096-4E40-A6E8-37372F266EA2@talkhouse.com>
3105
3106
3107 On Jun 8, 2009, at 2:44 PM, Ben Walton wrote:
3108
3109 > Excerpts from Joe W?lfel's message of Mon Jun 08 14:05:34 -0400 2009:
3110 >> It looks like sendmail isn't functioning and doesn't generate any
3111 >> errors. Maybe it's a mac problem. I haven't tried it on anything
3112 >> else yet.
3113 >
3114 > Personally, I don't think sendmail has _ever_ been functional, but
3115 > that's just the grumpy side of me that has to configure it on clunky
3116 > old boxes still! :)
3117 >
3118 > It's likely working, but has a local delivery setup configured. Try
3119 > using `mailq` to see if anything is sitting in the outbound queue.
3120 > You may also want to look in /var/spool/mail for mbox files sitting
3121 > there with the messages (or bounces) sent from sup.
3122 >
3123 > If you want to get your hands dirty, I recommend exim as the
3124 > replacment for sendmail. I like it's configuration and acl setup
3125 > better than postfix, but that would also work. If you just want to
3126 > send mail quickly and easily, try msmtp or a similar package.
3127
3128 Thanks. Looks like msmtp did the trick. Debugging sendmail was more
3129 than I cared to take on.
3130
3131
3132 From garoth@gmail.com Mon Jun 8 16:53:42 2009
3133 From: garoth@gmail.com (Andrei Thorp)
3134 Date: Mon, 8 Jun 2009 16:53:42 -0400
3135 Subject: [sup-talk] Can't seem to send mail
3136 In-Reply-To: <B9FE7468-E096-4E40-A6E8-37372F266EA2@talkhouse.com>
3137 References: <5A0B9D69-9D14-4E57-8BB1-1CE4E3AF4E65@talkhouse.com>
3138 <1244476264-sup-5281@ntdws12.chass.utoronto.ca>
3139 <AAB8FA5E-9E58-4C24-9290-F3C80155E55D@talkhouse.com>
3140 <1244486438-sup-3501@ntdws12.chass.utoronto.ca>
3141 <B9FE7468-E096-4E40-A6E8-37372F266EA2@talkhouse.com>
3142 Message-ID: <80055d7c0906081353s276ed18o156f12d8df981e28@mail.gmail.com>
3143
3144 > Thanks. ?Looks like msmtp did the trick. ?Debugging sendmail was more than I
3145
3146 Yeah, it sure is scary. Glad that helped.
3147
3148 Cheers,
3149
3150 -AT
3151
3152 From wmorgan-sup@masanjin.net Mon Jun 8 17:34:31 2009
3153 From: wmorgan-sup@masanjin.net (William Morgan)
3154 Date: Mon, 08 Jun 2009 14:34:31 -0700
3155 Subject: [sup-talk] Attempt at reply-from hook
3156 In-Reply-To: <1244246896-sup-4529@javelin>
3157 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
3158 <1243997614-sup-7485@javelin>
3159 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
3160 <1244179379-sup-6675@javelin> <1244208597-sup-4979@entry>
3161 <1244246896-sup-4529@javelin>
3162 Message-ID: <1244496654-sup-5759@entry>
3163
3164 Reformatted excerpts from Edward Z. Yang's message of 2009-06-05:
3165 > Great! My hook works now. This is the sort of functionality that I
3166 > think is worth generalizing and implementing as a configuration
3167 > twiddle (one, I think, that should be on by default.)
3168
3169 I have a strong preference for hooks over configuration variables. Look
3170 at the .muttrc documentation for why.
3171 --
3172 William <wmorgan-sup at masanjin.net>
3173
3174 From ezyang@MIT.EDU Mon Jun 8 17:59:39 2009
3175 From: ezyang@MIT.EDU (Edward Z. Yang)
3176 Date: Mon, 08 Jun 2009 17:59:39 -0400
3177 Subject: [sup-talk] Attempt at reply-from hook
3178 In-Reply-To: <1244496654-sup-5759@entry>
3179 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
3180 <1243997614-sup-7485@javelin>
3181 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
3182 <1244179379-sup-6675@javelin> <1244208597-sup-4979@entry>
3183 <1244246896-sup-4529@javelin> <1244496654-sup-5759@entry>
3184 Message-ID: <1244498316-sup-1297@javelin>
3185
3186 Excerpts from William Morgan's message of Mon Jun 08 17:34:31 -0400 2009:
3187 > I have a strong preference for hooks over configuration variables. Look
3188 > at the .muttrc documentation for why.
3189
3190 There's an interesting usability argument there. Right now, I still (possibly
3191 naively) believe that if you organize your configuration properly, you can
3192 have an arbitrarily large amount of it.
3193
3194 What's your opinion on making this default behavior, with no configuration
3195 twiddle?
3196
3197 Cheers,
3198 Edward
3199
3200 From ezyang@MIT.EDU Mon Jun 8 19:14:32 2009
3201 From: ezyang@MIT.EDU (Edward Z. Yang)
3202 Date: Mon, 08 Jun 2009 19:14:32 -0400
3203 Subject: [sup-talk] Sup annoyances
3204 In-Reply-To: <1244481844-sup-9094@entry>
3205 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3206 Message-ID: <1244502545-sup-9840@javelin>
3207
3208 Excerpts from William Morgan's message of Mon Jun 08 14:00:23 -0400 2009:
3209 > It might not be too bad. Turn off the call to m.load_from_source! on
3210 > line 106 of thread-index-mode.rb, add a Queue to ThreadViewMode
3211 > containing messages to call #load_from_source! on, don't call m.chunks
3212 > in ThreadViewMode#regen_text unless the message has been loaded, start a
3213 > thread that pops messages from the queue, calls #load_from_source! on
3214 > them, and then calls regen_text when an open message has been loaded...
3215 > and you're 90% of the way there.
3216
3217 A few questions:
3218
3219 * How do I tell if a message is shown on the screen or not?
3220
3221 * The implementation you describe still downloads the messages
3222 sequentially, which are usually not the messages we want to download
3223 first. I don't mind sup blocking on downloading a message, as long
3224 as it's one or two, which means I don't strictly need threads: I
3225 just need some API for, when a new message is opened, downloading it
3226 and then rendering it. What do you think of this?
3227
3228 > The auto-completion is awesome. Adding a recipient to the contacts list is
3229 > a good idea.
3230
3231 Does contacts.rb apply to people.txt or contacts.txt?
3232
3233 > It's definitely worse than O(n). Loading threads could be sped up
3234 > dramatically by storing the thread structure somewhere (either cached or
3235 > just for every thread), since Sup does a lot of extra work rethreading
3236 > everything every time you start it up. FWIW I'm doing this the right way
3237 > in Sup 2.0.
3238
3239 Can you backport it easily to Sup 1.0?
3240
3241 > There have been a couple similar requests like this recently, though
3242 > it's not clear if everyone has known about the ability to change the
3243 > reply mode and about the reply-to hook. Since hitting 'r' defaults to
3244 > replying to the sender alone (except for mailing list messages), I'd be
3245 > ok with adding a Mutt-style reply-to-all key that starts up reply-mode
3246 > with the 'reply to all' mode active.
3247
3248 The explicit prompt makes me think about who I want to send the message
3249 to. I frequently forget to move the little knob with Sup's behavior.
3250
3251 Cheers,
3252 Edward
3253
3254 From wmorgan-sup@masanjin.net Mon Jun 8 19:46:39 2009
3255 From: wmorgan-sup@masanjin.net (William Morgan)
3256 Date: Mon, 08 Jun 2009 16:46:39 -0700
3257 Subject: [sup-talk] Sup annoyances
3258 In-Reply-To: <1244502545-sup-9840@javelin>
3259 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3260 <1244502545-sup-9840@javelin>
3261 Message-ID: <1244503985-sup-8587@entry>
3262
3263 Reformatted excerpts from Edward Z. Yang's message of 2009-06-08:
3264 > * How do I tell if a message is shown on the screen or not?
3265
3266 If m is the message, @layout[m].state will be :open, :detailed or
3267 :closed. If it's not :closed, it is visible.
3268
3269 > * The implementation you describe still downloads the messages
3270 > sequentially, which are usually not the messages we want to download
3271 > first.
3272
3273 Only if you add them to the Queue sequentially. You could instead add
3274 the ones with :unread or :starred labels first. And ideally if you
3275 expand a collapsed unloaded message, that should be pushed to the head
3276 of the Queue.
3277
3278 > I don't mind sup blocking on downloading a message, as long
3279 > as it's one or two, which means I don't strictly need threads: I
3280 > just need some API for, when a new message is opened, downloading it
3281 > and then rendering it. What do you think of this?
3282
3283 So you would only preload the new/starred ones, and load the others only
3284 when they're expanded? I think that simply removing that call in
3285 thread-index-mode.rb would accomplish this.
3286
3287 I'd rather have the threaded version, since loading a thread of 100 new
3288 messages sucks, but either way would be an improvement.
3289
3290 > > The auto-completion is awesome. Adding a recipient to the contacts
3291 > > list is a good idea.
3292 >
3293 > Does contacts.rb apply to people.txt or contacts.txt?
3294
3295 contacts.txt. people.txt is deprecated. In fact I'm surprised you have
3296 one.
3297
3298 > > It's definitely worse than O(n). Loading threads could be sped up
3299 > > dramatically by storing the thread structure somewhere (either
3300 > > cached or just for every thread), since Sup does a lot of extra work
3301 > > rethreading everything every time you start it up. FWIW I'm doing
3302 > > this the right way in Sup 2.0.
3303 >
3304 > Can you backport it easily to Sup 1.0?
3305
3306 No, it's completely different. It would be easier to rewrite from
3307 scratch for the existing Sup.
3308
3309 > The explicit prompt makes me think about who I want to send the
3310 > message to. I frequently forget to move the little knob with Sup's
3311 > behavior.
3312
3313 When do you want it to prompt you? Is this a yes/no prompt?
3314 --
3315 William <wmorgan-sup at masanjin.net>
3316
3317 From ezyang@MIT.EDU Mon Jun 8 20:12:44 2009
3318 From: ezyang@MIT.EDU (Edward Z. Yang)
3319 Date: Mon, 08 Jun 2009 20:12:44 -0400
3320 Subject: [sup-talk] Attempt at reply-from hook
3321 In-Reply-To: <1244502124-sup-7043@cabinet>
3322 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
3323 <1243997614-sup-7485@javelin>
3324 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
3325 <1244179379-sup-6675@javelin> <1244208597-sup-4979@entry>
3326 <1244246896-sup-4529@javelin> <1244496654-sup-5759@entry>
3327 <1244498316-sup-1297@javelin> <1244502124-sup-7043@cabinet>
3328 Message-ID: <1244506097-sup-8895@javelin>
3329
3330 Excerpts from Marc Hartstein's message of Mon Jun 08 19:09:16 -0400 2009:
3331 > Reading the thread, it's not clear exactly what your hook does, or what
3332 > behavior you want as the default. I didn't see anything which said what
3333 > you were trying to accomplish.
3334
3335 My apologies.
3336
3337 My sup email comes from three distinct sources, and as part of my
3338 configuration they get a label as such (mit, twp or ita). This label
3339 is the most visible way of telling me which source my mail came from.
3340
3341 I am subscribed to numerous mailing lists, however, which do not
3342 explicitly list my mail address in To or CC. As a result, Sup defaults
3343 to my "main address".
3344
3345 What I would like Sup to do is look at the label, find the appropriate
3346 source, and use the email in the source to populate the From field.
3347 This is different from what you describe below.
3348
3349 > Attempting to figure it out from your code samples, I'm guessing that
3350 > you're trying to get sup to always reply with a from address of the
3351 > known address of yours found in the recipient list of the email being
3352 > relied to, if any?
3353
3354 If Sup doesn't do the correct thing in this case, this additional hook
3355 would be useful.
3356
3357 > I do get the sense that there might be a lot of people out there who
3358 > want to use the default (always use default account) behavior, so I'm
3359 > not sure about switching the default. I wouldn't exactly be against it,
3360 > though.
3361
3362 I would argue that most people have at least a personal and a work
3363 email account, and that it is not appropriate to conflate the two.
3364 They can write a hook that overrides an address (or, horror horror,
3365 a twiddle in sources) to do it.
3366
3367 Cheers,
3368 Edward
3369
3370 From garoth@gmail.com Mon Jun 8 20:37:53 2009
3371 From: garoth@gmail.com (Andrei Thorp)
3372 Date: Mon, 8 Jun 2009 17:37:53 -0700
3373 Subject: [sup-talk] Gmail Labels Sidebar
3374 Message-ID: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3375
3376 Hello there,
3377
3378 As some of you probably remember, there is a handy sidebar in Gmail
3379 which lists your tags and how many e-mails you have in each one.
3380
3381 What I do with this is have e-mail skip my inbox, get a mailing list
3382 tag applied to it, and then get archived, at which point it shows up
3383 in my labels sidebar. I have my "important" mail in my inbox, and the
3384 mailing lists with updates are clearly marked.
3385
3386 Any suggestions as to what sup users do to have this kind of workflow?
3387 It's preferable for me because it keeps things tidy, I can see the new
3388 mails, and I get >50 e-mails per day. It'd be a shame to have them all
3389 fall into my inbox and spam it up, which I prefer to keep clean for
3390 "needs to be taken care of immediately" type e-mail.
3391
3392 Thanks,
3393
3394 -AT
3395
3396 From bwalton@artsci.utoronto.ca Mon Jun 8 21:05:06 2009
3397 From: bwalton@artsci.utoronto.ca (Ben Walton)
3398 Date: Mon, 08 Jun 2009 21:05:06 -0400
3399 Subject: [sup-talk] Gmail Labels Sidebar
3400 In-Reply-To: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3401 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3402 Message-ID: <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3403
3404 Excerpts from Andrei Thorp's message of Mon Jun 08 20:37:53 -0400 2009:
3405 > Any suggestions as to what sup users do to have this kind of workflow?
3406 > It's preferable for me because it keeps things tidy, I can see the new
3407 > mails, and I get >50 e-mails per day. It'd be a shame to have them all
3408 > fall into my inbox and spam it up, which I prefer to keep clean for
3409 > "needs to be taken care of immediately" type e-mail.
3410
3411 Use the Label view. Hit L followed by enter.
3412
3413 HTH
3414 -Ben
3415 --
3416 Ben Walton
3417 Systems Programmer - CHASS
3418 University of Toronto
3419 C:416.407.5610 | W:416.978.4302
3420
3421 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
3422 Contact me to arrange for a CAcert assurance meeting.
3423 -------------- next part --------------
3424 A non-text attachment was scrubbed...
3425 Name: signature.asc
3426 Type: application/pgp-signature
3427 Size: 235 bytes
3428 Desc: not available
3429 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090608/563b1ece/attachment.bin>
3430
3431 From ezyang@MIT.EDU Mon Jun 8 22:13:17 2009
3432 From: ezyang@MIT.EDU (Edward Z. Yang)
3433 Date: Mon, 08 Jun 2009 22:13:17 -0400
3434 Subject: [sup-talk] Sup annoyances
3435 In-Reply-To: <1244503985-sup-8587@entry>
3436 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3437 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
3438 Message-ID: <1244506405-sup-5117@javelin>
3439
3440 Thanks for the answers to the technical questions.
3441
3442 Excerpts from William Morgan's message of Mon Jun 08 19:46:39 -0400 2009:
3443 > So you would only preload the new/starred ones, and load the others only
3444 > when they're expanded? I think that simply removing that call in
3445 > thread-index-mode.rb would accomplish this.
3446 >
3447 > I'd rather have the threaded version, since loading a thread of 100 new
3448 > messages sucks, but either way would be an improvement.
3449
3450 I am somewhat skeptical of your described change, but I will try it
3451 out and report back. The threaded version would certainly be a nice
3452 thing.
3453
3454 > contacts.txt. people.txt is deprecated. In fact I'm surprised you have
3455 > one.
3456
3457 Um... my contacts.txt is empty, and people.txt has lots of entries in it.
3458
3459 > No, it's completely different. It would be easier to rewrite from
3460 > scratch for the existing Sup.
3461
3462 Savvy.
3463
3464 > > The explicit prompt makes me think about who I want to send the
3465 > > message to. I frequently forget to move the little knob with Sup's
3466 > > behavior.
3467 >
3468 > When do you want it to prompt you? Is this a yes/no prompt?
3469
3470 Yes. (to yes/no).
3471
3472 Cheers,
3473 Edward
3474
3475 From ezyang@MIT.EDU Mon Jun 8 22:14:30 2009
3476 From: ezyang@MIT.EDU (Edward Z. Yang)
3477 Date: Mon, 08 Jun 2009 22:14:30 -0400
3478 Subject: [sup-talk] Gmail Labels Sidebar
3479 In-Reply-To: <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3480 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3481 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3482 Message-ID: <1244513641-sup-360@javelin>
3483
3484 Excerpts from Ben Walton's message of Mon Jun 08 21:05:06 -0400 2009:
3485 > Use the Label view. Hit L followed by enter.
3486
3487 I think what he's looking for is the information about his labels
3488 to always be present, as opposed to something he has to remind
3489 himself to check.
3490
3491 Cheers,
3492 Edward
3493
3494 From ezyang@MIT.EDU Mon Jun 8 22:23:44 2009
3495 From: ezyang@MIT.EDU (Edward Z. Yang)
3496 Date: Mon, 08 Jun 2009 22:23:44 -0400
3497 Subject: [sup-talk] Sup annoyances
3498 In-Reply-To: <1244506405-sup-5117@javelin>
3499 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3500 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
3501 <1244506405-sup-5117@javelin>
3502 Message-ID: <1244514081-sup-2943@javelin>
3503
3504 Excerpts from Edward Z. Yang's message of Mon Jun 08 22:13:17 -0400 2009:
3505 > I am somewhat skeptical of your described change, but I will try it
3506 > out and report back. The threaded version would certainly be a nice
3507 > thing.
3508
3509 It works, although it acts a bit strangely when there are still
3510 threads loading into memory.
3511
3512
3513 >From b2518f113118e489e22a1c2085b33a9c18721f97 Mon Sep 17 00:00:00 2001
3514 From: Edward Z. Yang <edwardzyang at thewritingpot.com>
3515 Date: Mon, 8 Jun 2009 22:21:01 -0400
3516 Subject: [PATCH] Remove message pre-loading; optimizes for the common case.
3517 Signed-off-by: Edward Z. Yang <edwardzyang at thewritingpot.com>
3518
3519 ---
3520 lib/sup/modes/thread-index-mode.rb | 1 -
3521 1 files changed, 0 insertions(+), 1 deletions(-)
3522
3523 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
3524 index 9b44ee3..29de39a 100644
3525 --- a/lib/sup/modes/thread-index-mode.rb
3526 +++ b/lib/sup/modes/thread-index-mode.rb
3527 @@ -103,7 +103,6 @@ EOS
3528 t.each_with_index do |(m, *o), i|
3529 next unless m
3530 BufferManager.say "#{message} (#{i}/#{num})", sid if t.size > 1
3531 - m.load_from_source!
3532 end
3533 end
3534 mode = ThreadViewMode.new t, @hidden_labels, self
3535 --
3536 1.6.0.4
3537
3538 From bwalton@artsci.utoronto.ca Mon Jun 8 22:24:42 2009
3539 From: bwalton@artsci.utoronto.ca (Ben Walton)
3540 Date: Mon, 08 Jun 2009 22:24:42 -0400
3541 Subject: [sup-talk] Gmail Labels Sidebar
3542 In-Reply-To: <1244513641-sup-360@javelin>
3543 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3544 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3545 <1244513641-sup-360@javelin>
3546 Message-ID: <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3547
3548 Excerpts from Edward Z. Yang's message of Mon Jun 08 22:14:30 -0400 2009:
3549 > I think what he's looking for is the information about his labels
3550 > to always be present, as opposed to something he has to remind
3551 > himself to check.
3552
3553 So something similar to the folder view hack/patch for mutt? That
3554 doesn't exist in sup. The closest you get is having the 'All Labels'
3555 buffer open. You can jump to a view of all messages with that label
3556 by hitting enter on the selected label. Moving back to it is simple
3557 with the buffer rolling keys. I believe that some people operate from
3558 this buffer instead of the inbox one. Not my cup of tea though.
3559
3560 HTH.
3561 -Ben
3562
3563
3564
3565
3566 --
3567 Ben Walton
3568 Systems Programmer - CHASS
3569 University of Toronto
3570 C:416.407.5610 | W:416.978.4302
3571
3572 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
3573 Contact me to arrange for a CAcert assurance meeting.
3574 -------------- next part --------------
3575 A non-text attachment was scrubbed...
3576 Name: signature.asc
3577 Type: application/pgp-signature
3578 Size: 189 bytes
3579 Desc: not available
3580 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090608/a9e55e8a/attachment.bin>
3581
3582 From ezyang@MIT.EDU Mon Jun 8 22:35:04 2009
3583 From: ezyang@MIT.EDU (Edward Z. Yang)
3584 Date: Mon, 08 Jun 2009 22:35:04 -0400
3585 Subject: [sup-talk] Sup annoyances
3586 In-Reply-To: <1244514081-sup-2943@javelin>
3587 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3588 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
3589 <1244506405-sup-5117@javelin> <1244514081-sup-2943@javelin>
3590 Message-ID: <1244514851-sup-1414@javelin>
3591
3592 Excerpts from Edward Z. Yang's message of Mon Jun 08 22:23:44 -0400 2009:
3593 > It works, although it acts a bit strangely when there are still
3594 > threads loading into memory.
3595
3596 I think I've been able to pin down this behavior more precisely,
3597 and it's not just this patches fault: displaying messages seems to
3598 block on having all of the threads present. Does this ring a bell?
3599
3600 Cheers,
3601 Edward
3602
3603 From ezyang@MIT.EDU Mon Jun 8 22:38:08 2009
3604 From: ezyang@MIT.EDU (Edward Z. Yang)
3605 Date: Mon, 08 Jun 2009 22:38:08 -0400
3606 Subject: [sup-talk] Sup annoyances
3607 In-Reply-To: <1244481844-sup-9094@entry>
3608 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3609 Message-ID: <1244515056-sup-4758@javelin>
3610
3611 Excerpts from William Morgan's message of Mon Jun 08 14:00:23 -0400 2009:
3612 > > 3. Polling and loading of threads should started, asynchronously, at
3613 > > the same time.
3614 >
3615 > > Loading of threads should not hose my CPU.
3616 >
3617 > Agreed. Please fix.
3618
3619 It appears that polling blocks on loading threads, so it doesn't help
3620 to fix that until we fix the thread loading code.
3621
3622 Cheers,
3623 Edward
3624
3625 From ezyang@MIT.EDU Mon Jun 8 23:00:55 2009
3626 From: ezyang@MIT.EDU (Edward Z. Yang)
3627 Date: Mon, 08 Jun 2009 23:00:55 -0400
3628 Subject: [sup-talk] Sup annoyances
3629 In-Reply-To: <1244481844-sup-9094@entry>
3630 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3631 Message-ID: <1244515897-sup-539@javelin>
3632
3633 Excerpts from William Morgan's message of Mon Jun 08 14:00:23 -0400 2009:
3634 > It's definitely worse than O(n). Loading threads could be sped up
3635 > dramatically by storing the thread structure somewhere (either cached or
3636 > just for every thread), since Sup does a lot of extra work rethreading
3637 > everything every time you start it up. FWIW I'm doing this the right way
3638 > in Sup 2.0.
3639
3640 I'm thinking about how to do this, and one of the first I'm blockers
3641 I'm running against is that it's not quite obvious what's invoking
3642 the thread building code thread.rb.
3643
3644 As for caching the thread, I'm thinking of generating a unique
3645 ID for each thread and sticking that on every message. Whether or
3646 not this will actually help depends a lot on what the answer to the
3647 above question is.
3648
3649 Cheers,
3650 Edward
3651
3652 From ezyang@MIT.EDU Tue Jun 9 00:06:40 2009
3653 From: ezyang@MIT.EDU (Edward Z. Yang)
3654 Date: Tue, 09 Jun 2009 00:06:40 -0400
3655 Subject: [sup-talk] Attempt at reply-from hook
3656 In-Reply-To: <1244518550-sup-6361@cabinet>
3657 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
3658 <1243997614-sup-7485@javelin>
3659 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
3660 <1244179379-sup-6675@javelin> <1244208597-sup-4979@entry>
3661 <1244246896-sup-4529@javelin> <1244496654-sup-5759@entry>
3662 <1244498316-sup-1297@javelin> <1244502124-sup-7043@cabinet>
3663 <1244506097-sup-8895@javelin> <1244518550-sup-6361@cabinet>
3664 Message-ID: <1244519893-sup-7418@javelin>
3665
3666 Excerpts from Marc Hartstein's message of Mon Jun 08 23:46:48 -0400 2009:
3667 > I think that's beyond what I'd personally think of as a "configuration
3668 > twiddle", though...
3669
3670 Perhaps.
3671
3672 > You'd do it by, what, having a 1:1 mapping between email addresses and
3673 > labels somewhere in the configuration, anything coming to the email
3674 > address gets the label, and any reply to a message with the label
3675 > (however it got it) gets the email address?
3676
3677 Yes.
3678
3679 > (It's also not as though the hook to only use your default address is
3680 > hard to write.)
3681
3682 Indeed.
3683
3684 Cheers,
3685 Edward
3686
3687 From tarko@lanparty.ee Tue Jun 9 06:00:13 2009
3688 From: tarko@lanparty.ee (Tarko Tikan)
3689 Date: Tue, 09 Jun 2009 13:00:13 +0300
3690 Subject: [sup-talk] display_length issue with special-characters on non-UTF8
3691 terminal
3692 Message-ID: <1244536704-sup-7027@valgus>
3693
3694 hey,
3695
3696 When String.display_length was introduced in recent update, it broke the length for non-UTF8 strings that contain the special characters. Wrong length results corrupted display (line ends chopped off).
3697
3698 Terminal is iso-8859-15 and it's detected by sup correctly.
3699
3700 I've tracked it down to /./u regexp. Here are some examples:
3701
3702 irb(main):001:0> "asd".scan(/./u)
3703 => ["a", "s", "d"]
3704 irb(main):002:0> "asd????".scan(/./u)
3705 => ["a", "s", "d", "\365\374\344\366"]
3706 irb(main):017:0> "asd???".scan(/./u)
3707 => ["a", "s", "d"]
3708
3709 irb(main):008:0* "asd".scan(/./)
3710 => ["a", "s", "d"]
3711 irb(main):009:0> "asd????".scan(/./)
3712 => ["a", "s", "d", "\365", "\374", "\344", "\366"]
3713
3714 Expecting UTF8 gives unexpected results :) Also, old behaviour of String.length gives correct results with these test cases.
3715
3716 --
3717 tarko
3718
3719 From garoth@gmail.com Tue Jun 9 09:33:15 2009
3720 From: garoth@gmail.com (Andrei Thorp)
3721 Date: Tue, 9 Jun 2009 09:33:15 -0400
3722 Subject: [sup-talk] Gmail Labels Sidebar
3723 In-Reply-To: <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3724 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3725 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3726 <1244513641-sup-360@javelin>
3727 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3728 Message-ID: <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3729
3730 Yeah, I guess that makes sense. It is a rather nice interface
3731 actually, I didn't really think about it for some reason.
3732
3733 And I guess there are probably some configuration options to skip
3734 inbox and attach labels to stuff matching stuff automatically, with
3735 procmail. I think I saw a page about that somewhere.
3736
3737 I guess there is probably a way to programatically access this kind of
3738 information also, but are there any command line tools I can use to
3739 query for this kind of stuff? If so, I can hack my window manager's
3740 panels to display the mails in these labels, which would be pretty
3741 rad. (My WM is "Awesome" btw -- that's the name.)
3742
3743 Any suggestions for quickly getting this labels-has-unread-messages
3744 info outside of sup?
3745
3746 Thanks guys! :)
3747
3748 -AT
3749
3750 From garoth@gmail.com Tue Jun 9 09:42:29 2009
3751 From: garoth@gmail.com (Andrei Thorp)
3752 Date: Tue, 9 Jun 2009 09:42:29 -0400
3753 Subject: [sup-talk] Gmail Labels Sidebar
3754 In-Reply-To: <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3755 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3756 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3757 <1244513641-sup-360@javelin>
3758 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3759 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3760 Message-ID: <80055d7c0906090642h421964f2t41d52290042469bc@mail.gmail.com>
3761
3762 On Tue, Jun 9, 2009 at 9:33 AM, Andrei Thorp<garoth at gmail.com> wrote:
3763 > Yeah, I guess that makes sense. It is a rather nice interface
3764 > actually, I didn't really think about it for some reason.
3765
3766 I just actually ran a quick test (with 0.8) and it looks like the
3767 label-list-mode fails to update automatically D:
3768
3769 What I did was put on the label-list-mode, manually send myself an
3770 e-mail, re-run fetchmail to grab it (I get a notification via procmail
3771 saying it came in). Then I remember that sup polls at intervals, so I
3772 wait.
3773
3774 Eventually, the status bar at the bottom says that there is a new
3775 message in the inbox, but the Inbox label does not get updated in my
3776 view. It still says 0/0.
3777
3778 I press x to go back to the inbox screen, it has the mail. I go back
3779 to label-list-mode, and now it registers it.
3780
3781 So I guess I'd call that a bug actually, and it's unlikely that people
3782 operate out of this mode habitually or else this would have probably
3783 been found.
3784
3785 (Unless it already has?)
3786
3787 Cheers,
3788
3789 -AT
3790
3791 From marcus-sup@bar-coded.net Tue Jun 9 10:11:08 2009
3792 From: marcus-sup@bar-coded.net (Marcus Williams)
3793 Date: Tue, 09 Jun 2009 15:11:08 +0100
3794 Subject: [sup-talk] Gmail Labels Sidebar
3795 In-Reply-To: <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3796 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3797 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3798 <1244513641-sup-360@javelin>
3799 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3800 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3801 Message-ID: <1244556424-sup-1426@tomsk>
3802
3803 On 9.6.2009, Andrei Thorp wrote:
3804 > Any suggestions for quickly getting this labels-has-unread-messages
3805 > info outside of sup?
3806
3807 Attached is a labels mode outside of sup... Useful for conky etc. Just
3808 pipe the output to a file (warnings errors etc wont go to the file)
3809
3810 William - if you want to add this to sup/bin feel free. Its basically
3811 the regen_text method lifted and edited slightly from the
3812 label-list-mode
3813
3814 It might need a few more tweaks - I'm not sure it needs to
3815 load/save/unlock the index really. They're there because they came for
3816 free with the copy and paste of bin/sup-tweak-labels :)
3817
3818 Marcus
3819 -------------- next part --------------
3820 A non-text attachment was scrubbed...
3821 Name: sup-list-labels
3822 Type: application/octet-stream
3823 Size: 1773 bytes
3824 Desc: not available
3825 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090609/344b333b/attachment.obj>
3826
3827 From marcus-sup@bar-coded.net Tue Jun 9 10:24:35 2009
3828 From: marcus-sup@bar-coded.net (Marcus Williams)
3829 Date: Tue, 09 Jun 2009 15:24:35 +0100
3830 Subject: [sup-talk] Gmail Labels Sidebar
3831 In-Reply-To: <1244556424-sup-1426@tomsk>
3832 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3833 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3834 <1244513641-sup-360@javelin>
3835 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3836 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3837 <1244556424-sup-1426@tomsk>
3838 Message-ID: <1244557461-sup-4140@tomsk>
3839
3840 On 9.6.2009, I wrote:
3841 > On 9.6.2009, Andrei Thorp wrote:
3842 > > Any suggestions for quickly getting this labels-has-unread-messages
3843 > > info outside of sup?
3844 >
3845 > Attached is a labels mode outside of sup... Useful for conky etc. Just
3846 > pipe the output to a file (warnings errors etc wont go to the file)
3847
3848 Oh and I forgot - if you want to kick off sup from a click on one of
3849 these labels (assuming you can do something like that in your WM) you
3850 can call sup with --search "label:somelabel" to get that label
3851 displayed.
3852
3853 Marcus
3854
3855 From marcus-sup@bar-coded.net Tue Jun 9 10:29:55 2009
3856 From: marcus-sup@bar-coded.net (Marcus Williams)
3857 Date: Tue, 09 Jun 2009 15:29:55 +0100
3858 Subject: [sup-talk] Gmail Labels Sidebar
3859 In-Reply-To: <1244556424-sup-1426@tomsk>
3860 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3861 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3862 <1244513641-sup-360@javelin>
3863 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3864 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3865 <1244556424-sup-1426@tomsk>
3866 Message-ID: <1244557672-sup-7417@tomsk>
3867
3868 On 9.6.2009, I wrote:
3869 > William - if you want to add this to sup/bin feel free. Its basically
3870 > the regen_text method lifted and edited slightly from the
3871 > label-list-mode
3872
3873 You might want to delete lines 24-26 as well to save the warning about
3874 uninitialised variable. At some point I'll post my version with a
3875 query which is a little less hurried, but doesnt work quite how I want
3876 yet.
3877
3878 Marcus
3879
3880 From garoth@gmail.com Tue Jun 9 10:37:54 2009
3881 From: garoth@gmail.com (Andrei Thorp)
3882 Date: Tue, 9 Jun 2009 10:37:54 -0400
3883 Subject: [sup-talk] Fwd: Gmail Labels Sidebar
3884 In-Reply-To: <80055d7c0906090735x581d27a2pfeb3ca2d470bb099@mail.gmail.com>
3885 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
3886 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
3887 <1244513641-sup-360@javelin>
3888 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
3889 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
3890 <1244556424-sup-1426@tomsk> <1244557461-sup-4140@tomsk>
3891 <80055d7c0906090735x581d27a2pfeb3ca2d470bb099@mail.gmail.com>
3892 Message-ID: <80055d7c0906090737g46f9f3b3y7ee00b91dbe08f22@mail.gmail.com>
3893
3894 > Oh and I forgot - if you want to kick off sup from a click on one of
3895 > these labels (assuming you can do something like that in your WM) you
3896 > can call sup with --search "label:somelabel" to get that label
3897 > displayed.
3898
3899 Damn, that's a great idea! I didn't even think about that.
3900
3901 /me checks up on what else sup has in its cli flags.
3902
3903 Cheers,
3904
3905 -AT
3906
3907 PS.
3908
3909 Well, while I'm here, I guess I'll also mention this fairly obvious
3910 script line that just outputs the unread messages in a filtered list:
3911 sup-list-labels 2> /dev/null | grep -E "Inbox|Sent" | sed -r "s/^
3912 *([A-Za-z]*).* ([0-9]+) unread/\1: \2/"
3913
3914 So to go through this:
3915 ?- Pipe the stderr to /dev/null (we don't want to see the messages)
3916 ?- grep for either "Inbox" or "Sent" -- you can put lots more |blah|blah there
3917 ?- sed magic to extract and reformat the data
3918
3919 This might be useful for outputting somewhere like in a shell prompt or panel.
3920
3921 PPS. argh, still not using sup for this mailing list so I replied to
3922 an individual. Forwarded D:
3923
3924 PPPS. Sorry that it wrapped my sed command there, but I'm sure you get the idea.
3925
3926 PPPPS. Sorry about the unfashionable amount of PSes ;)
3927
3928 From wmorgan-sup@masanjin.net Tue Jun 9 12:52:37 2009
3929 From: wmorgan-sup@masanjin.net (William Morgan)
3930 Date: Tue, 09 Jun 2009 09:52:37 -0700
3931 Subject: [sup-talk] Attempt at reply-from hook
3932 In-Reply-To: <1244518550-sup-6361@cabinet>
3933 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
3934 <1243997614-sup-7485@javelin>
3935 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
3936 <1244179379-sup-6675@javelin> <1244208597-sup-4979@entry>
3937 <1244246896-sup-4529@javelin> <1244496654-sup-5759@entry>
3938 <1244498316-sup-1297@javelin> <1244502124-sup-7043@cabinet>
3939 <1244506097-sup-8895@javelin> <1244518550-sup-6361@cabinet>
3940 Message-ID: <1244565962-sup-4211@entry>
3941
3942 Reformatted excerpts from Marc Hartstein's message of 2009-06-08:
3943 > I think that's beyond what I'd personally think of as a "configuration
3944 > twiddle", though...
3945
3946 I tend to agree. I completely understand the use case, and I agree it's
3947 probably a common one, but this is exactly the kind of thing I want to
3948 address with hooks instead of with configuration. (Not that there's
3949 *really* a distinction between these two things in the first place.)
3950
3951 Then when the next guy comes along and says, "I like this but I want my
3952 from address based on X instead of the label", I can also avoid having
3953 to do any work.
3954
3955 Edward, if you want to invest time on making this particular scheme easy
3956 for users, I would be happy to include contributed hooks as part of the
3957 Sup distribution, and you can supply one that reads a simple
3958 configuration file and produces this behavior.
3959 --
3960 William <wmorgan-sup at masanjin.net>
3961
3962 From wmorgan-sup@masanjin.net Tue Jun 9 13:32:53 2009
3963 From: wmorgan-sup@masanjin.net (William Morgan)
3964 Date: Tue, 09 Jun 2009 10:32:53 -0700
3965 Subject: [sup-talk] Sup annoyances
3966 In-Reply-To: <1244506405-sup-5117@javelin>
3967 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
3968 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
3969 <1244506405-sup-5117@javelin>
3970 Message-ID: <1244567126-sup-1563@entry>
3971
3972 Reformatted excerpts from Edward Z. Yang's message of 2009-06-08:
3973 > Excerpts from William Morgan's message of Mon Jun 08 19:46:39 -0400 2009:
3974 > > contacts.txt. people.txt is deprecated. In fact I'm surprised you have
3975 > > one.
3976 >
3977 > Um... my contacts.txt is empty, and people.txt has lots of entries in it.
3978
3979 Does your people.txt have a really old timestamp? That file doesn't get
3980 touched by any version of Sup later less than three months old.
3981 Do you add people to your contact list with 'i'? If not, contacts.txt
3982 will be empty.
3983
3984 > > When do you want it to prompt you? Is this a yes/no prompt?
3985 >
3986 > Yes. (to yes/no).
3987
3988 So... once you write the email and you press 'y' it prompts you whether
3989 you want to send it? Or when you press 'r' it prompts you whether you
3990 really want to reply?
3991 --
3992 William <wmorgan-sup at masanjin.net>
3993
3994 From wmorgan-sup@masanjin.net Tue Jun 9 13:40:38 2009
3995 From: wmorgan-sup@masanjin.net (William Morgan)
3996 Date: Tue, 09 Jun 2009 10:40:38 -0700
3997 Subject: [sup-talk] Sup annoyances
3998 In-Reply-To: <1244514851-sup-1414@javelin>
3999 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
4000 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
4001 <1244506405-sup-5117@javelin> <1244514081-sup-2943@javelin>
4002 <1244514851-sup-1414@javelin>
4003 Message-ID: <1244569129-sup-4112@entry>
4004
4005 Reformatted excerpts from Edward Z. Yang's message of 2009-06-08:
4006 > I think I've been able to pin down this behavior more precisely,
4007 > and it's not just this patches fault: displaying messages seems to
4008 > block on having all of the threads present. Does this ring a bell?
4009
4010 Not entirely sure what you mean by "having all the threads present", but
4011 opening a thread-view-mode buffer doesn't block on anything, at least
4012 with that patch applied. Without the patch, it blocks on loading the
4013 message body for every message in that particular thread from the
4014 server.
4015 --
4016 William <wmorgan-sup at masanjin.net>
4017
4018 From wmorgan-sup@masanjin.net Tue Jun 9 13:45:45 2009
4019 From: wmorgan-sup@masanjin.net (William Morgan)
4020 Date: Tue, 09 Jun 2009 10:45:45 -0700
4021 Subject: [sup-talk] Sup annoyances
4022 In-Reply-To: <1244515056-sup-4758@javelin>
4023 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
4024 <1244515056-sup-4758@javelin>
4025 Message-ID: <1244569341-sup-7836@entry>
4026
4027 Reformatted excerpts from Edward Z. Yang's message of 2009-06-08:
4028 > Excerpts from William Morgan's message of Mon Jun 08 14:00:23 -0400 2009:
4029 > > > 3. Polling and loading of threads should started, asynchronously,
4030 > > > at the same time.
4031 > >
4032 > > > Loading of threads should not hose my CPU.
4033 > >
4034 > > Agreed. Please fix.
4035 >
4036 > It appears that polling blocks on loading threads, so it doesn't help
4037 > to fix that until we fix the thread loading code.
4038
4039 My "agreed, please fix" was in response to "loading of threads should
4040 not hose my CPU".
4041
4042 Polling currently blocks on loading threads, but that's an explicit
4043 block. I forget why I did that now. You can unblock it and see if it
4044 makes life better. (bin/sup circa line 205.)
4045 --
4046 William <wmorgan-sup at masanjin.net>
4047
4048 From wmorgan-sup@masanjin.net Tue Jun 9 13:48:59 2009
4049 From: wmorgan-sup@masanjin.net (William Morgan)
4050 Date: Tue, 09 Jun 2009 10:48:59 -0700
4051 Subject: [sup-talk] Sup annoyances
4052 In-Reply-To: <1244514081-sup-2943@javelin>
4053 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
4054 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
4055 <1244506405-sup-5117@javelin> <1244514081-sup-2943@javelin>
4056 Message-ID: <1244569567-sup-7515@entry>
4057
4058 Reformatted excerpts from Edward Z. Yang's message of 2009-06-08:
4059 > From: Edward Z. Yang <edwardzyang at thewritingpot.com>
4060 > Date: Mon, 8 Jun 2009 22:21:01 -0400
4061 > Subject: [PATCH] Remove message pre-loading; optimizes for the common case.
4062
4063 The problem with this patch as is is that loading a large thread
4064 composed of entirely new messages still requires loading all the message
4065 bodies from the server, which can take a couple seconds, but now there's
4066 no indication of what's happening. So either the fancy background
4067 loading needs to happen, or somehow a message needs to be displayed when
4068 the bodies are being loaded.
4069 --
4070 William <wmorgan-sup at masanjin.net>
4071
4072 From bwalton@artsci.utoronto.ca Tue Jun 9 20:55:45 2009
4073 From: bwalton@artsci.utoronto.ca (Ben Walton)
4074 Date: Tue, 09 Jun 2009 20:55:45 -0400
4075 Subject: [sup-talk] lockmanager
4076 Message-ID: <1244595206-sup-6689@ntdws12.chass.utoronto.ca>
4077
4078
4079 Hi William,
4080
4081 I've attached the base LockManager class that I'm envisioning for
4082 sup. It's still rough, but the basic functionality is in place. I
4083 think it should stand up to the potential contention between
4084 PollManager and SentManager. If it looks reasonable, I'll flesh it
4085 out with some timeouts and exception handling.
4086
4087 Let me know.
4088
4089 Thanks
4090 -Ben
4091 --
4092 Ben Walton
4093 Systems Programmer - CHASS
4094 University of Toronto
4095 C:416.407.5610 | W:416.978.4302
4096
4097 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
4098 Contact me to arrange for a CAcert assurance meeting.
4099 -------------- next part --------------
4100 A non-text attachment was scrubbed...
4101 Name: lock.rb
4102 Type: application/octet-stream
4103 Size: 3575 bytes
4104 Desc: not available
4105 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090609/e56ad52c/attachment.obj>
4106 -------------- next part --------------
4107 A non-text attachment was scrubbed...
4108 Name: signature.asc
4109 Type: application/pgp-signature
4110 Size: 189 bytes
4111 Desc: not available
4112 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090609/e56ad52c/attachment.bin>
4113
4114 From ezyang@MIT.EDU Wed Jun 10 01:44:54 2009
4115 From: ezyang@MIT.EDU (Edward Z. Yang)
4116 Date: Wed, 10 Jun 2009 01:44:54 -0400
4117 Subject: [sup-talk] [PATCH] before-search hook
4118 Message-ID: <1244612627-sup-982@javelin>
4119
4120 >From a5c72844e8195df7a8eabd5ea592507599de72cb Mon Sep 17 00:00:00 2001
4121 From: Edward Z. Yang <edwardzyang at thewritingpot.com>
4122 Date: Wed, 10 Jun 2009 01:42:50 -0400
4123 Subject: [PATCH] Add before-search hook, for shortcuts for custom search queries.
4124 Signed-off-by: Edward Z. Yang <edwardzyang at thewritingpot.com>
4125
4126 ---
4127 lib/sup/hook.rb | 4 ++++
4128 lib/sup/index.rb | 12 +++++++++++-
4129 2 files changed, 15 insertions(+), 1 deletions(-)
4130
4131 diff --git a/lib/sup/hook.rb b/lib/sup/hook.rb
4132 index 0a0a2f6..d446aa3 100644
4133 --- a/lib/sup/hook.rb
4134 +++ b/lib/sup/hook.rb
4135 @@ -19,6 +19,10 @@ class HookManager
4136
4137 attr_writer :__locals
4138
4139 + ## an annoying gotcha here is that if you try something
4140 + ## like var = var.foo(), var will magically get allocated
4141 + ## to Nil and method_missing will never get called. Stick
4142 + ## to mutation, kiddos!
4143 def method_missing m, *a
4144 case @__locals[m]
4145 when Proc
4146 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
4147 index e403570..19556f0 100644
4148 --- a/lib/sup/index.rb
4149 +++ b/lib/sup/index.rb
4150 @@ -25,6 +25,13 @@ class Index
4151
4152 include Singleton
4153
4154 + HookManager.register "before-search", <<EOS
4155 +Executes before a string search is applied to the index.
4156 +Variables:
4157 + subs: The string being searched, use gsub! to change the
4158 + search (you must use mutation!)
4159 +EOS
4160 +
4161 ## these two accessors should ONLY be used by single-threaded programs.
4162 ## otherwise you will have a naughty ferret on your hands.
4163 attr_reader :index
4164 @@ -508,7 +515,10 @@ protected
4165 def parse_user_query_string s
4166 extraopts = {}
4167
4168 - subs = s.gsub(/\b(to|from):(\S+)\b/) do
4169 + subs = String.new s
4170 + HookManager.run("before-search", :subs => subs)
4171 +
4172 + subs = subs.gsub(/\b(to|from):(\S+)\b/) do
4173 field, name = $1, $2
4174 if(p = ContactManager.contact_for(name))
4175 [field, p.email]
4176 --
4177 1.6.0.4
4178
4179 From joe@talkhouse.com Wed Jun 10 13:21:58 2009
4180 From: joe@talkhouse.com (=?utf-8?q?Joe_W=C3=B6lfel?=)
4181 Date: Wed, 10 Jun 2009 13:21:58 -0400
4182 Subject: [sup-talk] IMAP alternative for Sup?
4183 Message-ID: <1244654260-sup-7022@joe-wolfels-power-mac-g5.local>
4184
4185 I am using sup with IMAP. I connect via multiple accounts using multiple
4186 machines. This is not surprisingly very slow. Is there an IMAP alternative
4187 that caches all messages locally that is not too complicated to setup with Sup?
4188
4189 Thanks,
4190 Joe
4191
4192 From ezyang@MIT.EDU Wed Jun 10 13:25:08 2009
4193 From: ezyang@MIT.EDU (Edward Z. Yang)
4194 Date: Wed, 10 Jun 2009 13:25:08 -0400
4195 Subject: [sup-talk] IMAP alternative for Sup?
4196 In-Reply-To: <1244654260-sup-7022@joe-wolfels-power-mac-g5.local>
4197 References: <1244654260-sup-7022@joe-wolfels-power-mac-g5.local>
4198 Message-ID: <1244654688-sup-4183@javelin>
4199
4200 Excerpts from Joe W?lfel's message of Wed Jun 10 13:21:58 -0400 2009:
4201 > I am using sup with IMAP. I connect via multiple accounts using multiple
4202 > machines. This is not surprisingly very slow. Is there an IMAP alternative
4203 > that caches all messages locally that is not too complicated to setup with Sup?
4204
4205 The solution commonly recommended is OfflineImap. I have not tried this myself.
4206
4207 Cheers,
4208 Edward
4209
4210 From joe@talkhouse.com Wed Jun 10 10:42:34 2009
4211 From: joe@talkhouse.com (=?utf-8?q?Joe_W=C3=B6lfel?=)
4212 Date: Wed, 10 Jun 2009 10:42:34 -0400
4213 Subject: [sup-talk] IMAP alternative works well with sup?
4214 Message-ID: <1244644197-sup-9224@joe-wolfels-power-mac-g5.local>
4215
4216 I've been using sup with IMAP and retrieving messages from 3rd party providers
4217 is not surprisingly slow. Is there a good alternative that will cache messages
4218 locally that isn't complicated to setup with sup? I use multiple machines with
4219 multiple accounts.
4220
4221 Thanks,
4222 Joe
4223
4224 From bachjh@googlemail.com Wed Jun 10 13:50:49 2009
4225 From: bachjh@googlemail.com (=?UTF-8?B?SsO2cmctSGVuZHJpayBCYWNo?=)
4226 Date: Wed, 10 Jun 2009 19:50:49 +0200
4227 Subject: [sup-talk] sup and ncursesw
4228 Message-ID: <91de50e10906101050p2d23a74cy1bbfe2e80e69cca2@mail.gmail.com>
4229
4230 Hi all,
4231
4232 I recently installed sup 0.8 and find I am having problems with umlauts and
4233 accented characters. There is a patch for the ncurses-0.9.1 gem on the sup
4234 wiki ("utf8-issues") which allows the characters to be displayed correctly,
4235 but after applying the patch I can't enter proper text. Hitting 'c' for
4236 compose works, but entering '123' for subject ends in a subject line such
4237 as:
4238
4239 Subject: P<85>??P<85>???C" ?C"
4240
4241 (it's a different set of confused characters each time)
4242 Similar when searching for messages using '\' or 'L'.
4243
4244 I am on ubuntu 9.04 with libncursesw5{,-dev} version 5.7+20090207, sup 0.8.
4245 Any hints?
4246
4247 cheers,
4248 - J?rg-Hendrik
4249 -------------- next part --------------
4250 An HTML attachment was scrubbed...
4251 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090610/aa0a2b51/attachment.html>
4252
4253 From ezyang@MIT.EDU Wed Jun 10 17:51:01 2009
4254 From: ezyang@MIT.EDU (Edward Z. Yang)
4255 Date: Wed, 10 Jun 2009 17:51:01 -0400
4256 Subject: [sup-talk] [PATCH] before-search hook
4257 In-Reply-To: <1244612627-sup-982@javelin>
4258 References: <1244612627-sup-982@javelin>
4259 Message-ID: <1244670591-sup-7078@javelin>
4260
4261 For the curious, here is the hook that I'm using with this:
4262
4263 subs.gsub!(/\bmy:unread\b/) do
4264 "is:unread !label:inbox"
4265 end
4266
4267 Cheers,
4268 Edward
4269
4270 From ezyang@MIT.EDU Wed Jun 10 23:18:46 2009
4271 From: ezyang@MIT.EDU (Edward Z. Yang)
4272 Date: Wed, 10 Jun 2009 23:18:46 -0400
4273 Subject: [sup-talk] Sup annoyances
4274 In-Reply-To: <1244569129-sup-4112@entry>
4275 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
4276 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
4277 <1244506405-sup-5117@javelin> <1244514081-sup-2943@javelin>
4278 <1244514851-sup-1414@javelin> <1244569129-sup-4112@entry>
4279 Message-ID: <1244690240-sup-884@javelin>
4280
4281 Excerpts from William Morgan's message of Tue Jun 09 13:40:38 -0400 2009:
4282 > Not entirely sure what you mean by "having all the threads present", but
4283 > opening a thread-view-mode buffer doesn't block on anything, at least
4284 > with that patch applied. Without the patch, it blocks on loading the
4285 > message body for every message in that particular thread from the
4286 > server.
4287
4288 Yeah. I mean what I mean: it *shouldn't* block on anything, but as
4289 far as I can tell from manual testing, thread-view-mode doesn't open
4290 up until I'm done threading the index. Maybe that's why.
4291
4292 Cheers,
4293 Edward
4294
4295 From ezyang@MIT.EDU Wed Jun 10 23:19:32 2009
4296 From: ezyang@MIT.EDU (Edward Z. Yang)
4297 Date: Wed, 10 Jun 2009 23:19:32 -0400
4298 Subject: [sup-talk] Sup annoyances
4299 In-Reply-To: <1244569567-sup-7515@entry>
4300 References: <1244270435-sup-9288@javelin> <1244481844-sup-9094@entry>
4301 <1244502545-sup-9840@javelin> <1244503985-sup-8587@entry>
4302 <1244506405-sup-5117@javelin> <1244514081-sup-2943@javelin>
4303 <1244569567-sup-7515@entry>
4304 Message-ID: <1244690337-sup-2840@javelin>
4305
4306 Excerpts from William Morgan's message of Tue Jun 09 13:48:59 -0400 2009:
4307 > The problem with this patch as is is that loading a large thread
4308 > composed of entirely new messages still requires loading all the message
4309 > bodies from the server, which can take a couple seconds, but now there's
4310 > no indication of what's happening. So either the fancy background
4311 > loading needs to happen, or somehow a message needs to be displayed when
4312 > the bodies are being loaded.
4313
4314 Understood. There's also another odd bug where the headers for the open
4315 messages "blow up" (get split into three lines each) which gets fixed
4316 when you collapse and the expand the headers again.
4317
4318 Cheers,
4319 Edward
4320
4321 From ezyang@MIT.EDU Wed Jun 10 23:38:12 2009
4322 From: ezyang@MIT.EDU (Edward Z. Yang)
4323 Date: Wed, 10 Jun 2009 23:38:12 -0400
4324 Subject: [sup-talk] Attempt at reply-from hook
4325 In-Reply-To: <1244565962-sup-4211@entry>
4326 References: <1243898254-sup-7513@javelin> <1243980495-sup-7229@cannonball>
4327 <1243997614-sup-7485@javelin>
4328 <1244029436-sup-6141@ntdws12.chass.utoronto.ca>
4329 <1244179379-sup-6675@javelin> <1244208597-sup-4979@entry>
4330 <1244246896-sup-4529@javelin> <1244496654-sup-5759@entry>
4331 <1244498316-sup-1297@javelin> <1244502124-sup-7043@cabinet>
4332 <1244506097-sup-8895@javelin> <1244518550-sup-6361@cabinet>
4333 <1244565962-sup-4211@entry>
4334 Message-ID: <1244691413-sup-727@javelin>
4335
4336 Excerpts from William Morgan's message of Tue Jun 09 12:52:37 -0400 2009:
4337 > Edward, if you want to invest time on making this particular scheme easy
4338 > for users, I would be happy to include contributed hooks as part of the
4339 > Sup distribution, and you can supply one that reads a simple
4340 > configuration file and produces this behavior.
4341
4342 The thing is that this needs no configuration: sources.yaml will
4343 tell us the correspondence between label and email. If anything,
4344 I would bill this as an improvement to the "From" detection algorithm.
4345
4346 Cheers,
4347 Edward
4348
4349 From marcus-sup@bar-coded.net Thu Jun 11 05:05:38 2009
4350 From: marcus-sup@bar-coded.net (Marcus Williams)
4351 Date: Thu, 11 Jun 2009 10:05:38 +0100
4352 Subject: [sup-talk] Sup locking up
4353 Message-ID: <1244710855-sup-1368@tomsk>
4354
4355 Hi -
4356
4357 Something new has started happening in sup ? I think this is what
4358 Edward was talking about, but it appears to lock up every now and
4359 again in a way that it never used to.
4360
4361 Once its locked up it doesnt come back and I dont seem to be able to
4362 ctrl-c/d/z out of it. Its only started in the last few days and I dont
4363 think its my IMAP server.
4364
4365 Oddly its breaking my screen session as well which is odder still -
4366 the screen with sup running is locked completely (I can create new
4367 shells from screen and use them fine, its just the sup session within
4368 screen).
4369
4370 Anyone else seeing this (running next branch)?
4371
4372 Marcus
4373
4374 From bwalton@artsci.utoronto.ca Thu Jun 11 07:23:49 2009
4375 From: bwalton@artsci.utoronto.ca (Ben Walton)
4376 Date: Thu, 11 Jun 2009 07:23:49 -0400
4377 Subject: [sup-talk] Sup locking up
4378 In-Reply-To: <1244710855-sup-1368@tomsk>
4379 References: <1244710855-sup-1368@tomsk>
4380 Message-ID: <1244719333-sup-9770@ntdws12.chass.utoronto.ca>
4381
4382 Excerpts from Marcus Williams's message of Thu Jun 11 05:05:38 -0400 2009:
4383
4384 > Anyone else seeing this (running next branch)?
4385
4386 No...and I'm running from the most recent next with a few local
4387 patches (message bouncing, currently). I run in screen as well.
4388
4389 Is there anything constant about when the lockup occurs? Has anything
4390 else about your system/setup changed that could impact this?
4391
4392 Thanks
4393 -Ben
4394 --
4395 Ben Walton
4396 Systems Programmer - CHASS
4397 University of Toronto
4398 C:416.407.5610 | W:416.978.4302
4399
4400 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
4401 Contact me to arrange for a CAcert assurance meeting.
4402 -------------- next part --------------
4403 A non-text attachment was scrubbed...
4404 Name: signature.asc
4405 Type: application/pgp-signature
4406 Size: 189 bytes
4407 Desc: not available
4408 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090611/8810e1f0/attachment.bin>
4409
4410 From usul@aruba.it Thu Jun 11 07:39:29 2009
4411 From: usul@aruba.it (Fabio Riga)
4412 Date: Thu, 11 Jun 2009 13:39:29 +0200
4413 Subject: [sup-talk] Crash after sending a message
4414 In-Reply-To: <1244717279-sup-5999@viajero>
4415 References: <1244717279-sup-5999@viajero>
4416 Message-ID: <1244719933-sup-4261@viajero>
4417
4418 Excerpts from Fabio Riga's message of Thu Jun 11 12:48:59 +0200 2009:
4419 > a sup-sync, there are no Sent messages in index. Maybe it's a problem
4420 > with locale (it) as sup-sync -a sup://sent gives me a lot of lines like:
4421 >
4422 > [Thu Jun 11 12:32:36 +0200 2009] found invalid date in potential mbox
4423 > split line, not splitting: "From usul at aruba.it Thu Jun 11 11:45:37 +0200
4424 > 2009\n"
4425 > Scanned 14, added 0, updated 14 messages from sup://sent.
4426 >
4427
4428 Hello again,
4429
4430 I translated with a script names of days and months in ~/.sup/sent.mbox,
4431 then made a sup-sync -a sup://sent.mbox and run
4432 $ LANG=C sup
4433
4434 All is fine, I just need to remember to launch sup this way. Maybe it
4435 needs some work on localization?
4436
4437 Cheers,
4438 Fabio
4439 --
4440 Fabio Riga
4441
4442 348 4458014 - fabio at comunicattiva.it
4443
4444 ComunicAttiva S.a.s. di Silvana D'Agata & C.
4445 via Campestre,189 - Sesto San Giovanni (MI) - Italia
4446 tel. 02 97373202 - fax 02 97373474
4447
4448 From garoth@gmail.com Thu Jun 11 09:17:12 2009
4449 From: garoth@gmail.com (Andrei Thorp)
4450 Date: Thu, 11 Jun 2009 09:17:12 -0400
4451 Subject: [sup-talk] [BUG?] label-list-mode doesn't update
4452 Message-ID: <80055d7c0906110617j2b9a33cene229c1dd28170003@mail.gmail.com>
4453
4454 This is forwarded from the middle of another thread. I figured it got lost.
4455
4456 On Tue, Jun 9, 2009 at 9:33 AM, Andrei Thorp<garoth at gmail.com> wrote:
4457 > Yeah, I guess that makes sense. It is a rather nice interface
4458 > actually, I didn't really think about it for some reason.
4459
4460 I just actually ran a quick test (with 0.8) and it looks like the
4461 label-list-mode fails to update automatically D:
4462
4463 What I did was put on the label-list-mode, manually send myself an
4464 e-mail, re-run fetchmail to grab it (I get a notification via procmail
4465 saying it came in). Then I remember that sup polls at intervals, so I
4466 wait.
4467
4468 Eventually, the status bar at the bottom says that there is a new
4469 message in the inbox, but the Inbox label does not get updated in my
4470 view. It still says 0/0.
4471
4472 I press x to go back to the inbox screen, it has the mail. I go back
4473 to label-list-mode, and now it registers it.
4474
4475 So I guess I'd call that a bug actually, and it's unlikely that people
4476 operate out of this mode habitually or else this would have probably
4477 been found.
4478
4479 (Unless it already has?)
4480
4481 Cheers,
4482
4483 -AT
4484
4485 From marcus-sup@bar-coded.net Thu Jun 11 10:23:28 2009
4486 From: marcus-sup@bar-coded.net (Marcus Williams)
4487 Date: Thu, 11 Jun 2009 15:23:28 +0100
4488 Subject: [sup-talk] Sup locking up
4489 In-Reply-To: <1244719333-sup-9770@ntdws12.chass.utoronto.ca>
4490 References: <1244710855-sup-1368@tomsk>
4491 <1244719333-sup-9770@ntdws12.chass.utoronto.ca>
4492 Message-ID: <1244730053-sup-6905@tomsk>
4493
4494 On 11.6.2009, Ben Walton wrote:
4495 > No...and I'm running from the most recent next with a few local
4496 > patches (message bouncing, currently). I run in screen as well.
4497
4498 Mmmmm. Strange.
4499
4500 > Is there anything constant about when the lockup occurs? Has anything
4501 > else about your system/setup changed that could impact this?
4502
4503 I _think_ it occurs during a poll for new messages. Its difficult to
4504 tell though because like I say that "window" in screen gets completely
4505 blocked, only killing sup will get out of it (kill -9 rather than a
4506 ctrl-c/z/d). Its very odd.
4507
4508 Nothing has changed on my box bar sup in recent weeks.
4509
4510 Marcus
4511
4512 From bwalton@artsci.utoronto.ca Thu Jun 11 11:46:19 2009
4513 From: bwalton@artsci.utoronto.ca (Ben Walton)
4514 Date: Thu, 11 Jun 2009 11:46:19 -0400
4515 Subject: [sup-talk] Sup locking up
4516 In-Reply-To: <1244730053-sup-6905@tomsk>
4517 References: <1244710855-sup-1368@tomsk>
4518 <1244719333-sup-9770@ntdws12.chass.utoronto.ca>
4519 <1244730053-sup-6905@tomsk>
4520 Message-ID: <1244735117-sup-6933@ntdws12.chass.utoronto.ca>
4521
4522 Excerpts from Marcus Williams's message of Thu Jun 11 10:23:28 -0400 2009:
4523 > I _think_ it occurs during a poll for new messages. Its difficult to
4524 > tell though because like I say that "window" in screen gets completely
4525 > blocked, only killing sup will get out of it (kill -9 rather than a
4526 > ctrl-c/z/d). Its very odd.
4527
4528 Can you strace/truss/whatever the ruby process running sup to see what
4529 it's doing?
4530
4531 > Nothing has changed on my box bar sup in recent weeks.
4532
4533 ...ok. At least that rules out most external interference.
4534
4535 Thanks
4536 -Ben
4537
4538 --
4539 Ben Walton
4540 Systems Programmer - CHASS
4541 University of Toronto
4542 C:416.407.5610 | W:416.978.4302
4543
4544 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
4545 Contact me to arrange for a CAcert assurance meeting.
4546 -------------- next part --------------
4547 A non-text attachment was scrubbed...
4548 Name: signature.asc
4549 Type: application/pgp-signature
4550 Size: 189 bytes
4551 Desc: not available
4552 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090611/7f2e26e6/attachment.bin>
4553
4554 From garoth@gmail.com Thu Jun 11 13:58:26 2009
4555 From: garoth@gmail.com (Andrei Thorp)
4556 Date: Thu, 11 Jun 2009 13:58:26 -0400
4557 Subject: [sup-talk] Sup locking up
4558 In-Reply-To: <1244735117-sup-6933@ntdws12.chass.utoronto.ca>
4559 References: <1244710855-sup-1368@tomsk>
4560 <1244719333-sup-9770@ntdws12.chass.utoronto.ca>
4561 <1244730053-sup-6905@tomsk>
4562 <1244735117-sup-6933@ntdws12.chass.utoronto.ca>
4563 Message-ID: <80055d7c0906111058q128b5eb7na8931a8b75b0d0bf@mail.gmail.com>
4564
4565 Yeah...
4566
4567 I have a theory. Have you learned some new stuff about screen lately?
4568 Screen has this binding that pretty much makes it freeze up. I guess
4569 I'm talking about http://savannah.gnu.org/bugs/?11610 which applies to
4570 screen 4.0.0, which is the one people have.
4571
4572 Try maybe running sup out of screen for a while and see if it can happen then.
4573
4574 Another test: if screen locks up but sup respects regular kill (not
4575 -9), sup's not locked up itself.
4576
4577 -AT
4578
4579 From marcus-sup@bar-coded.net Thu Jun 11 15:09:19 2009
4580 From: marcus-sup@bar-coded.net (Marcus Williams)
4581 Date: Thu, 11 Jun 2009 20:09:19 +0100
4582 Subject: [sup-talk] Sup locking up
4583 In-Reply-To: <80055d7c0906111058q128b5eb7na8931a8b75b0d0bf@mail.gmail.com>
4584 References: <1244710855-sup-1368@tomsk>
4585 <1244719333-sup-9770@ntdws12.chass.utoronto.ca>
4586 <1244730053-sup-6905@tomsk>
4587 <1244735117-sup-6933@ntdws12.chass.utoronto.ca>
4588 <80055d7c0906111058q128b5eb7na8931a8b75b0d0bf@mail.gmail.com>
4589 Message-ID: <1244747053-sup-4797@tomsk>
4590
4591 On 11.6.2009, Andrei Thorp wrote:
4592 > I have a theory. Have you learned some new stuff about screen lately?
4593 > Screen has this binding that pretty much makes it freeze up. I guess
4594 > I'm talking about http://savannah.gnu.org/bugs/?11610 which applies to
4595 > screen 4.0.0, which is the one people have.
4596
4597 I dont think debian has this problem, although I may have hit ctrl-a
4598 and then s by accident (I actually tried ctrl-q thinking that I had
4599 hit ctrl-s by accident when it hung but nothing happened... forgetting
4600 that I was in screen so would need to prepend ctrl-a). Its a bit wierd
4601 that its happened to me recently and not before though if this is what
4602 it was - I leave sup running in screen as it makes imap bearable and
4603 havnt run into this problem until recently when its happened a couple
4604 of times. I'll keep an eye on it and see if it happens again.
4605
4606 Marcus
4607
4608 From bwalton@artsci.utoronto.ca Thu Jun 11 19:50:33 2009
4609 From: bwalton@artsci.utoronto.ca (Ben Walton)
4610 Date: Thu, 11 Jun 2009 19:50:33 -0400
4611 Subject: [sup-talk] (no subject)
4612 In-Reply-To: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
4613 References: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
4614 Message-ID: <1244764138-sup-2909@ntdws12.chass.utoronto.ca>
4615
4616 Excerpts from Ben Walton's message of Sun Jun 07 20:02:25 -0400 2009:
4617
4618 Hi William,
4619
4620 > Here's a stab at implementing a message bouncing functionality worthy
4621 > of being included on mainline.
4622
4623 Is there something you don't like about these patches or have you just
4624 been too busy to look at them? I could collapse them into a single
4625 patch, thus removing any trace of using $config instead of a Hook, to
4626 keep the history cleaner if you'd prefer.
4627
4628 If there is something else you'd like to see changed before picking it
4629 up, let me know.
4630
4631 Thanks
4632 -Ben
4633 --
4634 Ben Walton
4635 Systems Programmer - CHASS
4636 University of Toronto
4637 C:416.407.5610 | W:416.978.4302
4638
4639 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
4640 Contact me to arrange for a CAcert assurance meeting.
4641
4642 From usul@aruba.it Thu Jun 11 06:48:59 2009
4643 From: usul@aruba.it (Fabio Riga)
4644 Date: Thu, 11 Jun 2009 12:48:59 +0200
4645 Subject: [sup-talk] Crash after sending a message
4646 Message-ID: <1244717279-sup-5999@viajero>
4647
4648 Hi all,
4649
4650 First of all, Sup is a great peace of software because it's a superior and
4651 simplified Mutt, it's fast, it isn't web-based (I hate web-based
4652 client...) and... Well, great job!
4653
4654 I started using 0.7, with no problems at all, excepting those crappy
4655 character on screen... Since upgrading to 0.8 my screen looks very nice,
4656 but when I send a message, Sup crashes badly. It seems a problem
4657 with Ferret failing indexing my Sent box (attached exception-log). After
4658 a sup-sync, there are no Sent messages in index. Maybe it's a problem
4659 with locale (it) as sup-sync -a sup://sent gives me a lot of lines like:
4660
4661 [Thu Jun 11 12:32:36 +0200 2009] found invalid date in potential mbox
4662 split line, not splitting: "From usul at aruba.it gio giu 11 11:45:37 +0200
4663 2009\n"
4664 Scanned 14, added 0, updated 14 messages from sup://sent.
4665
4666 _My sent messages are much more then 14!_
4667
4668 Anyway, messages are sent before the crash.. like this one!
4669
4670 Ideas?
4671
4672 Thanks,
4673 Fabio
4674 --
4675 Fabio Riga
4676
4677 348 4458014 - fabio at comunicattiva.it
4678
4679 ComunicAttiva S.a.s. di Silvana D'Agata & C.
4680 via Campestre,189 - Sesto San Giovanni (MI) - Italia
4681 tel. 02 97373202 - fax 02 97373474
4682 -------------- next part --------------
4683 An embedded and charset-unspecified text was scrubbed...
4684 Name: exception-log.txt
4685 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090611/fc505855/attachment.txt>
4686
4687 From wmorgan-sup@masanjin.net Thu Jun 11 23:44:41 2009
4688 From: wmorgan-sup@masanjin.net (William Morgan)
4689 Date: Thu, 11 Jun 2009 20:44:41 -0700
4690 Subject: [sup-talk] (no subject)
4691 In-Reply-To: <1244764138-sup-2909@ntdws12.chass.utoronto.ca>
4692 References: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
4693 <1244764138-sup-2909@ntdws12.chass.utoronto.ca>
4694 Message-ID: <1244778083-sup-4566@entry>
4695
4696 Reformatted excerpts from Ben Walton's message of 2009-06-11:
4697 > Is there something you don't like about these patches or have you just
4698 > been too busy to look at them?
4699
4700 Just been busy. Sorry! My Sup time tends to be very bursty. I realize
4701 that's not great for contributors. Please have patience with your poor
4702 maintainer and feel free to keep bugging me.
4703 --
4704 William <wmorgan-sup at masanjin.net>
4705
4706 From ezyang@MIT.EDU Fri Jun 12 00:38:42 2009
4707 From: ezyang@MIT.EDU (Edward Z. Yang)
4708 Date: Fri, 12 Jun 2009 00:38:42 -0400
4709 Subject: [sup-talk] Sup locking up
4710 In-Reply-To: <1244735117-sup-6933@ntdws12.chass.utoronto.ca>
4711 References: <1244710855-sup-1368@tomsk>
4712 <1244719333-sup-9770@ntdws12.chass.utoronto.ca>
4713 <1244730053-sup-6905@tomsk>
4714 <1244735117-sup-6933@ntdws12.chass.utoronto.ca>
4715 Message-ID: <1244781466-sup-4096@javelin>
4716
4717 Excerpts from Ben Walton's message of Thu Jun 11 11:46:19 -0400 2009:
4718 > Can you strace/truss/whatever the ruby process running sup to see what
4719 > it's doing?
4720
4721 Seconded. You can attach strace to Sup while it's running, and it
4722 will give you a good fingerprint for what the process is doing when
4723 it locks up.
4724
4725 Cheers,
4726 Edward
4727
4728 From bwalton@artsci.utoronto.ca Fri Jun 12 09:15:05 2009
4729 From: bwalton@artsci.utoronto.ca (Ben Walton)
4730 Date: Fri, 12 Jun 2009 09:15:05 -0400
4731 Subject: [sup-talk] (no subject)
4732 In-Reply-To: <1244778083-sup-4566@entry>
4733 References: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
4734 <1244764138-sup-2909@ntdws12.chass.utoronto.ca>
4735 <1244778083-sup-4566@entry>
4736 Message-ID: <1244812410-sup-2627@ntdws12.chass.utoronto.ca>
4737
4738 Excerpts from William Morgan's message of Thu Jun 11 23:44:41 -0400 2009:
4739 > Reformatted excerpts from Ben Walton's message of 2009-06-11:
4740 > > Is there something you don't like about these patches or have you just
4741 > > been too busy to look at them?
4742 >
4743 > Just been busy. Sorry! My Sup time tends to be very bursty. I realize
4744 > that's not great for contributors. Please have patience with your poor
4745 > maintainer and feel free to keep bugging me.
4746
4747 No problem. You're just very quick to respond typically, so I wanted
4748 to make sure that it hadn't fallen through the cracks...
4749
4750 Thanks
4751 -Ben
4752
4753 --
4754 Ben Walton
4755 Systems Programmer - CHASS
4756 University of Toronto
4757 C:416.407.5610 | W:416.978.4302
4758
4759 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
4760 Contact me to arrange for a CAcert assurance meeting.
4761 -------------- next part --------------
4762 A non-text attachment was scrubbed...
4763 Name: signature.asc
4764 Type: application/pgp-signature
4765 Size: 189 bytes
4766 Desc: not available
4767 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090612/0803c72a/attachment.bin>
4768
4769 From joe@talkhouse.com Fri Jun 12 09:21:11 2009
4770 From: joe@talkhouse.com (=?utf-8?q?Joe_W=C3=B6lfel?=)
4771 Date: Fri, 12 Jun 2009 09:21:11 -0400
4772 Subject: [sup-talk] IMAP alternative for Sup?
4773 In-Reply-To: <1244654688-sup-4183@javelin>
4774 References: <1244654260-sup-7022@joe-wolfels-power-mac-g5.local>
4775 <1244654688-sup-4183@javelin>
4776 Message-ID: <1244812462-sup-9446@joe-wolfels-power-mac-g5.local>
4777
4778 Excerpts from Edward Z. Yang's message of Wed Jun 10 13:25:08 -0400 2009:
4779 > Excerpts from Joe W?lfel's message of Wed Jun 10 13:21:58 -0400 2009:
4780 > > I am using sup with IMAP. I connect via multiple accounts using multiple
4781 > > machines. This is not surprisingly very slow. Is there an IMAP alternative
4782 > > that caches all messages locally that is not too complicated to setup with Sup?
4783 >
4784 > The solution commonly recommended is OfflineImap. I have not tried this myself.
4785 >
4786 > Cheers,
4787 > Edward
4788
4789 That did the trick. Now everything is instantaneous.
4790
4791 Also, I noticed that Sup's polling mechanism no longer locks up. With IMAP I
4792 used to have to restart Sup on occasion. Now that doesn't seem to happen. I'm
4793 not sure if that's relevant to the that other sup-talk thread on locking but
4794 maybe it's helpful info .
4795
4796 Thanks,
4797 Joe
4798
4799 From ezyang@MIT.EDU Fri Jun 12 10:14:26 2009
4800 From: ezyang@MIT.EDU (Edward Z. Yang)
4801 Date: Fri, 12 Jun 2009 10:14:26 -0400
4802 Subject: [sup-talk] IMAP alternative for Sup?
4803 In-Reply-To: <1244812462-sup-9446@joe-wolfels-power-mac-g5.local>
4804 References: <1244654260-sup-7022@joe-wolfels-power-mac-g5.local>
4805 <1244654688-sup-4183@javelin>
4806 <1244812462-sup-9446@joe-wolfels-power-mac-g5.local>
4807 Message-ID: <1244815945-sup-5020@javelin>
4808
4809 Excerpts from Joe W?lfel's message of Fri Jun 12 09:21:11 -0400 2009:
4810 > Also, I noticed that Sup's polling mechanism no longer locks up. With IMAP I
4811 > used to have to restart Sup on occasion. Now that doesn't seem to happen. I'm
4812 > not sure if that's relevant to the that other sup-talk thread on locking but
4813 > maybe it's helpful info .
4814
4815 This is probably because OfflineIMAP polls more frequently. I've had good
4816 results getting rid of the lock up by decreasing Sup's polling time (unfortunately
4817 it's hard-coded in Sup).
4818
4819 Cheers,
4820 Edward
4821
4822 From bwalton@artsci.utoronto.ca Fri Jun 12 10:34:48 2009
4823 From: bwalton@artsci.utoronto.ca (Ben Walton)
4824 Date: Fri, 12 Jun 2009 10:34:48 -0400
4825 Subject: [sup-talk] IMAP alternative for Sup?
4826 In-Reply-To: <1244815945-sup-5020@javelin>
4827 References: <1244654260-sup-7022@joe-wolfels-power-mac-g5.local>
4828 <1244654688-sup-4183@javelin>
4829 <1244812462-sup-9446@joe-wolfels-power-mac-g5.local>
4830 <1244815945-sup-5020@javelin>
4831 Message-ID: <1244817210-sup-9892@ntdws12.chass.utoronto.ca>
4832
4833 Excerpts from Edward Z. Yang's message of Fri Jun 12 10:14:26 -0400 2009:
4834
4835 > This is probably because OfflineIMAP polls more frequently. I've
4836 > had good results getting rid of the lock up by decreasing Sup's
4837 > polling time (unfortunately it's hard-coded in Sup).
4838
4839 This is one thing that would be a good candiate for a $config setting,
4840 or maybe even a per-source value if you're in the unfortunate position
4841 of polling multiple imap servers. Fortunately, I don't have to deal
4842 with imap myself.
4843
4844 -Ben
4845 --
4846 Ben Walton
4847 Systems Programmer - CHASS
4848 University of Toronto
4849 C:416.407.5610 | W:416.978.4302
4850
4851 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
4852 Contact me to arrange for a CAcert assurance meeting.
4853 -------------- next part --------------
4854 A non-text attachment was scrubbed...
4855 Name: signature.asc
4856 Type: application/pgp-signature
4857 Size: 189 bytes
4858 Desc: not available
4859 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090612/1b0a66e2/attachment.bin>
4860
4861 From wmorgan-sup@masanjin.net Fri Jun 12 14:23:05 2009
4862 From: wmorgan-sup@masanjin.net (William Morgan)
4863 Date: Fri, 12 Jun 2009 11:23:05 -0700
4864 Subject: [sup-talk] (no subject)
4865 In-Reply-To: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
4866 References: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
4867 Message-ID: <1244830970-sup-1069@entry>
4868
4869 Reformatted excerpts from Ben Walton's message of 2009-06-07:
4870 > Here's a stab at implementing a message bouncing functionality worthy
4871 > of being included on mainline.
4872
4873 Looks good. I've merged this into next. Thanks!
4874 --
4875 William <wmorgan-sup at masanjin.net>
4876
4877 From wmorgan-sup@masanjin.net Fri Jun 12 14:56:09 2009
4878 From: wmorgan-sup@masanjin.net (William Morgan)
4879 Date: Fri, 12 Jun 2009 11:56:09 -0700
4880 Subject: [sup-talk] Gmail Labels Sidebar
4881 In-Reply-To: <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
4882 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
4883 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
4884 <1244513641-sup-360@javelin>
4885 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
4886 Message-ID: <1244832722-sup-9953@entry>
4887
4888 Reformatted excerpts from Ben Walton's message of 2009-06-08:
4889 > So something similar to the folder view hack/patch for mutt? That
4890 > doesn't exist in sup. The closest you get is having the 'All Labels'
4891 > buffer open. You can jump to a view of all messages with that label
4892 > by hitting enter on the selected label.
4893
4894 FWIW, there is some preliminary support for having multiple Sup buffers
4895 sharing the screen. (There's a notion of focus, and x/y/w/h values for
4896 each buffer.) If someone is very excited about having this behavior from
4897 mutt, that's how I'd try and implement it.
4898 --
4899 William <wmorgan-sup at masanjin.net>
4900
4901 From garoth@gmail.com Fri Jun 12 15:03:38 2009
4902 From: garoth@gmail.com (Andrei Thorp)
4903 Date: Fri, 12 Jun 2009 15:03:38 -0400
4904 Subject: [sup-talk] Gmail Labels Sidebar
4905 In-Reply-To: <1244832722-sup-9953@entry>
4906 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
4907 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
4908 <1244513641-sup-360@javelin>
4909 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
4910 <1244832722-sup-9953@entry>
4911 Message-ID: <80055d7c0906121203g53b1e428q8abd035548331e49@mail.gmail.com>
4912
4913 On Fri, Jun 12, 2009 at 2:56 PM, William Morgan<wmorgan-sup at masanjin.net> wrote:
4914 > Reformatted excerpts from Ben Walton's message of 2009-06-08:
4915 >> So something similar to the folder view hack/patch for mutt? ?That
4916 >> doesn't exist in sup. ?The closest you get is having the 'All Labels'
4917 >> buffer open. ?You can jump to a view of all messages with that label
4918 >> by hitting enter on the selected label.
4919 >
4920 > FWIW, there is some preliminary support for having multiple Sup buffers
4921 > sharing the screen. (There's a notion of focus, and x/y/w/h values for
4922 > each buffer.) If someone is very excited about having this behavior from
4923 > mutt, that's how I'd try and implement it.
4924
4925 That is indeed very exciting. Mutt's sidebar is actually very poor and
4926 limiting. If this could
4927 handle it with arbitrary splitting, this would be amazingly amazing.
4928
4929 Thanks :)
4930
4931 -AT
4932
4933 From wmorgan-sup@masanjin.net Fri Jun 12 15:10:27 2009
4934 From: wmorgan-sup@masanjin.net (William Morgan)
4935 Date: Fri, 12 Jun 2009 12:10:27 -0700
4936 Subject: [sup-talk] Gmail Labels Sidebar
4937 In-Reply-To: <1244556424-sup-1426@tomsk>
4938 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
4939 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
4940 <1244513641-sup-360@javelin>
4941 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
4942 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
4943 <1244556424-sup-1426@tomsk>
4944 Message-ID: <1244833003-sup-9212@entry>
4945
4946 Reformatted excerpts from Marcus Williams's message of 2009-06-09:
4947 > William - if you want to add this to sup/bin feel free. Its basically
4948 > the regen_text method lifted and edited slightly from the
4949 > label-list-mode
4950
4951 Nice idea. I'd add such a thing, but I think you can make it
4952 significantly simpler. (As you point out, locking the index is not
4953 necessary.)
4954
4955 Something like:
4956
4957 #!/usr/bin/env ruby
4958
4959 require 'sup'
4960 i = Redwood::Index.new; i.load
4961 l = Redwood::LabelManager.new File.join(ENV["HOME"], ".sup", "labels.txt")
4962
4963 l.all_labels.
4964 map { |label| [label, l.string_for(label)] }.
4965 sort_by { |label, name| name }.
4966 each do |label, name|
4967 total = i.num_results_for :label => label
4968 unread = (label == :unread)? total : i.num_results_for(:labels => [label, :unread])
4969 printf "%20s: %6d messages, %6d unread\n", name, total, unread
4970 end
4971
4972 puts "yay"
4973 --
4974 William <wmorgan-sup at masanjin.net>
4975
4976 From wmorgan-sup@masanjin.net Fri Jun 12 15:14:31 2009
4977 From: wmorgan-sup@masanjin.net (William Morgan)
4978 Date: Fri, 12 Jun 2009 12:14:31 -0700
4979 Subject: [sup-talk] Gmail Labels Sidebar
4980 In-Reply-To: <80055d7c0906090642h421964f2t41d52290042469bc@mail.gmail.com>
4981 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
4982 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
4983 <1244513641-sup-360@javelin>
4984 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
4985 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
4986 <80055d7c0906090642h421964f2t41d52290042469bc@mail.gmail.com>
4987 Message-ID: <1244833856-sup-5874@entry>
4988
4989 Reformatted excerpts from Andrei Thorp's message of 2009-06-09:
4990 > What I did was put on the label-list-mode, manually send myself an
4991 > e-mail, re-run fetchmail to grab it (I get a notification via procmail
4992 > saying it came in). Then I remember that sup polls at intervals, so I
4993 > wait.
4994
4995 You can press "P" to force a poll.
4996
4997 > Eventually, the status bar at the bottom says that there is a new
4998 > message in the inbox, but the Inbox label does not get updated in my
4999 > view. It still says 0/0.
5000
5001 Yep, currently label-list-mode only updates when one of three things
5002 happens:
5003 - it gets created
5004 - it gets focus (you switch to it from another buffer)
5005 - you press '@'
5006
5007 Also, it only reflects the index state, so if you read a new message
5008 something and don't press "$", it won't reflect that change.
5009
5010 I'd happily accept patches for any of those issues. :)
5011 --
5012 William <wmorgan-sup at masanjin.net>
5013
5014 From wmorgan-sup@masanjin.net Fri Jun 12 15:18:11 2009
5015 From: wmorgan-sup@masanjin.net (William Morgan)
5016 Date: Fri, 12 Jun 2009 12:18:11 -0700
5017 Subject: [sup-talk] display_length issue with special-characters on
5018 non-UTF8 terminal
5019 In-Reply-To: <1244536704-sup-7027@valgus>
5020 References: <1244536704-sup-7027@valgus>
5021 Message-ID: <1244834230-sup-1200@entry>
5022
5023 Reformatted excerpts from Tarko Tikan's message of 2009-06-09:
5024 > When String.display_length was introduced in recent update, it broke
5025 > the length for non-UTF8 strings that contain the special characters.
5026 > Wrong length results corrupted display (line ends chopped off).
5027
5028 That's a good point. I got a little utf8-centric with those changes.
5029 (I'm assuming that your terminal encoding is not UTF-8.)
5030
5031 Does this patch fix the issue? If so, I will release an 0.8.1.
5032
5033 --- cut here ---
5034 diff --git a/lib/sup.rb b/lib/sup.rb
5035 index 4f59eaa..20835ae 100644
5036 --- a/lib/sup.rb
5037 +++ b/lib/sup.rb
5038 @@ -244,7 +244,7 @@ end
5039 Redwood::log "using character set encoding #{$encoding.inspect}"
5040 else
5041 Redwood::log "warning: can't find character set by using locale, defaulting
5042 - $encoding = "utf-8"
5043 + $encoding = "UTF-8"
5044 end
5045
5046 ## now everything else (which can feel free to call Redwood::log at load time)
5047 diff --git a/lib/sup/util.rb b/lib/sup/util.rb
5048 index 8a3004f..d5310bc 100644
5049 --- a/lib/sup/util.rb
5050 +++ b/lib/sup/util.rb
5051 @@ -172,7 +172,13 @@ class Object
5052 end
5053
5054 class String
5055 - def display_length; scan(/./u).size end
5056 + def display_length
5057 + if $encoding == "UTF-8"
5058 + scan(/./u).size
5059 + else
5060 + size
5061 + end
5062 + end
5063
5064 def camel_to_hyphy
5065 self.gsub(/([a-z])([A-Z0-9])/, '\1-\2').downcase
5066
5067 --
5068 William <wmorgan-sup at masanjin.net>
5069
5070 From wmorgan-sup@masanjin.net Fri Jun 12 15:29:46 2009
5071 From: wmorgan-sup@masanjin.net (William Morgan)
5072 Date: Fri, 12 Jun 2009 12:29:46 -0700
5073 Subject: [sup-talk] [PATCH] Use terminal width instead of hardcoded 80
5074 as the wrap length.
5075 In-Reply-To: <1244392518-sup-9746@cabinet>
5076 References: <1243102667-sup-6007@r50p>
5077 <4c4248150905231318kab3819dw68e3a3a614241c0d@mail.gmail.com>
5078 <1243123134-sup-8032@ntdws12.chass.utoronto.ca>
5079 <1243439667-sup-3947@entry> <1244392518-sup-9746@cabinet>
5080 Message-ID: <1244834906-sup-7818@entry>
5081
5082 Reformatted excerpts from Marc Hartstein's message of 2009-06-07:
5083 > Do we currently honor format=flowed email?
5084
5085 No.
5086
5087 > If we don't, it would be desirable to take this into account when
5088 > designing the display wrapping options, and it seems like it would be
5089 > worth implementing down the road.
5090
5091 Yes, I suppose so.
5092
5093 > It might be useful to be able to specify the wrap margin to something
5094 > other than 80. I don't know if anybody would actually use this,
5095 > though.
5096
5097 I will leave that kind of thing for the Sup GUI clients. :)
5098 --
5099 William <wmorgan-sup at masanjin.net>
5100
5101 From rlane@club.cc.cmu.edu Fri Jun 12 15:35:52 2009
5102 From: rlane@club.cc.cmu.edu (Rich Lane)
5103 Date: Fri, 12 Jun 2009 12:35:52 -0700
5104 Subject: [sup-talk] [PATCH] fixes for ruby1.9
5105 Message-ID: <1244835352-10370-1-git-send-email-rlane@club.cc.cmu.edu>
5106
5107 Change colons in case statements to 'then'
5108 Fix a block that didn't take enough arguments
5109 Rename variables to avoid shadowing warnings
5110 Use String.ord (and define it for 1.8)
5111 Use DL::Importer on 1.9
5112 Make require 'fastthread' optional
5113 Copy in RE_UTF8
5114 ---
5115 bin/sup | 5 +--
5116 lib/sup.rb | 4 +++
5117 lib/sup/index.rb | 1 -
5118 lib/sup/keymap.rb | 52 ++++++++++++++++++------------------
5119 lib/sup/message-chunks.rb | 4 +-
5120 lib/sup/message.rb | 4 +-
5121 lib/sup/modes/edit-message-mode.rb | 5 +++-
5122 lib/sup/util.rb | 46 ++++++++++++++++++--------------
5123 8 files changed, 66 insertions(+), 55 deletions(-)
5124
5125 diff --git a/bin/sup b/bin/sup
5126 index 9abe1b5..302ad7c 100755
5127 --- a/bin/sup
5128 +++ b/bin/sup
5129 @@ -5,7 +5,6 @@ require 'ncurses'
5130 require 'curses'
5131 require 'fileutils'
5132 require 'trollop'
5133 -require 'fastthread'
5134 require "sup"
5135
5136 BIN_VERSION = "git"
5137 @@ -89,7 +88,7 @@ end
5138 ## BSD users: if libc.so.6 is not found, try installing compat6x.
5139 require 'dl/import'
5140 module LibC
5141 - extend DL::Importable
5142 + extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable
5143 setlocale_lib = case Config::CONFIG['arch']
5144 when /darwin/; "libc.dylib"
5145 when /cygwin/; "cygwin1.dll"
5146 @@ -202,7 +201,7 @@ begin
5147 end
5148 end unless $opts[:no_initial_poll]
5149
5150 - 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] }
5151 + imode.load_threads :num => ibuf.content_height, :when_done => lambda { |num| reporting_thread("poll after loading inbox") { sleep 1; PollManager.poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
5152
5153 if $opts[:compose]
5154 ComposeMode.spawn_nicely :to_default => $opts[:compose]
5155 diff --git a/lib/sup.rb b/lib/sup.rb
5156 index 4f59eaa..dea9355 100644
5157 --- a/lib/sup.rb
5158 +++ b/lib/sup.rb
5159 @@ -5,6 +5,10 @@ require 'thread'
5160 require 'fileutils'
5161 require 'gettext'
5162 require 'curses'
5163 +begin
5164 + require 'fastthread'
5165 +rescue LoadError
5166 +end
5167
5168 class Object
5169 ## this is for debugging purposes because i keep calling #id on the
5170 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
5171 index e403570..ca01ee7 100644
5172 --- a/lib/sup/index.rb
5173 +++ b/lib/sup/index.rb
5174 @@ -2,7 +2,6 @@
5175
5176 require 'fileutils'
5177 require 'ferret'
5178 -require 'fastthread'
5179
5180 begin
5181 require 'chronic'
5182 diff --git a/lib/sup/keymap.rb b/lib/sup/keymap.rb
5183 index 76c7139..cb039e4 100644
5184 --- a/lib/sup/keymap.rb
5185 +++ b/lib/sup/keymap.rb
5186 @@ -9,22 +9,22 @@ class Keymap
5187
5188 def self.keysym_to_keycode k
5189 case k
5190 - when :down: Curses::KEY_DOWN
5191 - when :up: Curses::KEY_UP
5192 - when :left: Curses::KEY_LEFT
5193 - when :right: Curses::KEY_RIGHT
5194 - when :page_down: Curses::KEY_NPAGE
5195 - when :page_up: Curses::KEY_PPAGE
5196 - when :backspace: Curses::KEY_BACKSPACE
5197 - when :home: Curses::KEY_HOME
5198 - when :end: Curses::KEY_END
5199 - when :ctrl_l: "\f"[0]
5200 - when :ctrl_g: "\a"[0]
5201 - when :tab: "\t"[0]
5202 - when :enter, :return: 10 #Curses::KEY_ENTER
5203 + when :down then Curses::KEY_DOWN
5204 + when :up then Curses::KEY_UP
5205 + when :left then Curses::KEY_LEFT
5206 + when :right then Curses::KEY_RIGHT
5207 + when :page_down then Curses::KEY_NPAGE
5208 + when :page_up then Curses::KEY_PPAGE
5209 + when :backspace then Curses::KEY_BACKSPACE
5210 + when :home then Curses::KEY_HOME
5211 + when :end then Curses::KEY_END
5212 + when :ctrl_l then "\f".ord
5213 + when :ctrl_g then "\a".ord
5214 + when :tab then "\t".ord
5215 + when :enter, :return then 10 #Curses::KEY_ENTER
5216 else
5217 if k.is_a?(String) && k.length == 1
5218 - k[0]
5219 + k.ord
5220 else
5221 raise ArgumentError, "unknown key name '#{k}'"
5222 end
5223 @@ -33,18 +33,18 @@ class Keymap
5224
5225 def self.keysym_to_string k
5226 case k
5227 - when :down: "<down arrow>"
5228 - when :up: "<up arrow>"
5229 - when :left: "<left arrow>"
5230 - when :right: "<right arrow>"
5231 - when :page_down: "<page down>"
5232 - when :page_up: "<page up>"
5233 - when :backspace: "<backspace>"
5234 - when :home: "<home>"
5235 - when :end: "<end>"
5236 - when :enter, :return: "<enter>"
5237 - when :tab: "tab"
5238 - when " ": "<space>"
5239 + when :down then "<down arrow>"
5240 + when :up then "<up arrow>"
5241 + when :left then "<left arrow>"
5242 + when :right then "<right arrow>"
5243 + when :page_down then "<page down>"
5244 + when :page_up then "<page up>"
5245 + when :backspace then "<backspace>"
5246 + when :home then "<home>"
5247 + when :end then "<end>"
5248 + when :enter, :return then "<enter>"
5249 + when :tab then "tab"
5250 + when " " then "<space>"
5251 else
5252 Curses::keyname(keysym_to_keycode(k))
5253 end
5254 diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
5255 index ba07d35..a9f1a77 100644
5256 --- a/lib/sup/message-chunks.rb
5257 +++ b/lib/sup/message-chunks.rb
5258 @@ -252,8 +252,8 @@ EOS
5259
5260 def patina_color
5261 case status
5262 - when :valid: :cryptosig_valid_color
5263 - when :invalid: :cryptosig_invalid_color
5264 + when :valid then :cryptosig_valid_color
5265 + when :invalid then :cryptosig_invalid_color
5266 else :cryptosig_unknown_color
5267 end
5268 end
5269 diff --git a/lib/sup/message.rb b/lib/sup/message.rb
5270 index 805c2f7..8525fdf 100644
5271 --- a/lib/sup/message.rb
5272 +++ b/lib/sup/message.rb
5273 @@ -414,8 +414,8 @@ private
5274 elsif m.header["Content-Type"] && m.header["Content-Type"] !~ /^text\/plain/
5275 extension =
5276 case m.header["Content-Type"]
5277 - when /text\/html/: "html"
5278 - when /image\/(.*)/: $1
5279 + when /text\/html/ then "html"
5280 + when /image\/(.*)/ then $1
5281 end
5282
5283 ["sup-attachment-#{Time.now.to_i}-#{rand 10000}", extension].join(".")
5284 diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
5285 index d7bd41c..74bdfb7 100644
5286 --- a/lib/sup/modes/edit-message-mode.rb
5287 +++ b/lib/sup/modes/edit-message-mode.rb
5288 @@ -2,7 +2,10 @@ require 'tempfile'
5289 require 'socket' # just for gethostname!
5290 require 'pathname'
5291 require 'rmail'
5292 -require 'jcode' # for RE_UTF8
5293 +
5294 +# from jcode.rb, not included in ruby 1.9
5295 +PATTERN_UTF8 = '[\xc0-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf][\x80-\xbf]'
5296 +RE_UTF8 = Regexp.new(PATTERN_UTF8, 0, 'n')
5297
5298 module Redwood
5299
5300 diff --git a/lib/sup/util.rb b/lib/sup/util.rb
5301 index 8a3004f..1513c42 100644
5302 --- a/lib/sup/util.rb
5303 +++ b/lib/sup/util.rb
5304 @@ -133,8 +133,8 @@ class Object
5305 ## clone of java-style whole-method synchronization
5306 ## assumes a @mutex variable
5307 ## TODO: clean up, try harder to avoid namespace collisions
5308 - def synchronized *meth
5309 - meth.each do
5310 + def synchronized *methods
5311 + methods.each do |meth|
5312 class_eval <<-EOF
5313 alias unsynchronized_#{meth} #{meth}
5314 def #{meth}(*a, &b)
5315 @@ -144,8 +144,8 @@ class Object
5316 end
5317 end
5318
5319 - def ignore_concurrent_calls *meth
5320 - meth.each do
5321 + def ignore_concurrent_calls *methods
5322 + methods.each do |meth|
5323 mutex = "@__concurrent_protector_#{meth}"
5324 flag = "@__concurrent_flag_#{meth}"
5325 oldmeth = "__unprotected_#{meth}"
5326 @@ -205,7 +205,7 @@ class String
5327 region_start = 0
5328 while pos <= length
5329 newpos = case state
5330 - when :escaped_instring, :escaped_outstring: pos
5331 + when :escaped_instring, :escaped_outstring then pos
5332 else index(/[,"\\]/, pos)
5333 end
5334
5335 @@ -219,26 +219,26 @@ class String
5336 case char
5337 when ?"
5338 state = case state
5339 - when :outstring: :instring
5340 - when :instring: :outstring
5341 - when :escaped_instring: :instring
5342 - when :escaped_outstring: :outstring
5343 + when :outstring then :instring
5344 + when :instring then :outstring
5345 + when :escaped_instring then :instring
5346 + when :escaped_outstring then :outstring
5347 end
5348 when ?,, nil
5349 state = case state
5350 - when :outstring, :escaped_outstring:
5351 + when :outstring, :escaped_outstring then
5352 ret << self[region_start ... newpos].gsub(/^\s+|\s+$/, "")
5353 region_start = newpos + 1
5354 :outstring
5355 - when :instring: :instring
5356 - when :escaped_instring: :instring
5357 + when :instring then :instring
5358 + when :escaped_instring then :instring
5359 end
5360 when ?\\
5361 state = case state
5362 - when :instring: :escaped_instring
5363 - when :outstring: :escaped_outstring
5364 - when :escaped_instring: :instring
5365 - when :escaped_outstring: :outstring
5366 + when :instring then :escaped_instring
5367 + when :outstring then :escaped_outstring
5368 + when :escaped_instring then :instring
5369 + when :escaped_outstring then :outstring
5370 end
5371 end
5372 pos = newpos + 1
5373 @@ -274,6 +274,12 @@ class String
5374 gsub(/\t/, " ").gsub(/\r/, "")
5375 end
5376
5377 + if not defined? ord
5378 + def ord
5379 + self[0]
5380 + end
5381 + end
5382 +
5383 ## takes a space-separated list of words, and returns an array of symbols.
5384 ## typically used in Sup for translating Ferret's representation of a list
5385 ## of labels (a string) to an array of label symbols.
5386 @@ -628,10 +634,10 @@ class Iconv
5387 def self.easy_decode target, charset, text
5388 return text if charset =~ /^(x-unknown|unknown[-_ ]?8bit|ascii[-_ ]?7[-_ ]?bit)$/i
5389 charset = case charset
5390 - when /UTF[-_ ]?8/i: "utf-8"
5391 - when /(iso[-_ ])?latin[-_ ]?1$/i: "ISO-8859-1"
5392 - when /iso[-_ ]?8859[-_ ]?15/i: 'ISO-8859-15'
5393 - when /unicode[-_ ]1[-_ ]1[-_ ]utf[-_]7/i: "utf-7"
5394 + when /UTF[-_ ]?8/i then "utf-8"
5395 + when /(iso[-_ ])?latin[-_ ]?1$/i then "ISO-8859-1"
5396 + when /iso[-_ ]?8859[-_ ]?15/i then 'ISO-8859-15'
5397 + when /unicode[-_ ]1[-_ ]1[-_ ]utf[-_]7/i then "utf-7"
5398 else charset
5399 end
5400
5401 --
5402 1.6.0.4
5403
5404
5405 From wmorgan-sup@masanjin.net Fri Jun 12 15:54:26 2009
5406 From: wmorgan-sup@masanjin.net (William Morgan)
5407 Date: Fri, 12 Jun 2009 12:54:26 -0700
5408 Subject: [sup-talk] sup -c while sup is running?
5409 In-Reply-To: <1244646784-sup-7039@cabinet>
5410 References: <1244646784-sup-7039@cabinet>
5411 Message-ID: <1244835514-sup-3886@entry>
5412
5413 Reformatted excerpts from Marc Hartstein's message of 2009-06-10:
5414 > How difficult would it be to allow sup -c to be run while sup is
5415 > already running? The goal would be to be able to use sup as a mailto:
5416 > handler effectively.
5417
5418 Not that difficult. In general, N Sup processes should be able to run as
5419 long as N-1 of them are readonly wrt the index and sources file. (I
5420 think!) So sup -c could launch either with a readonly inbox buffer, or
5421 without one at all. (Which would be faster, if the intention is just to
5422 quit after sending.)
5423
5424 However, to be safe, locking should be added to the sent.mbox to prevent
5425 multiple Sup processing from overwriting each other's sent messages. Ben
5426 Walton's lock manager I think will be perfect for this.
5427 --
5428 William <wmorgan-sup at masanjin.net>
5429
5430 From wmorgan-sup@masanjin.net Fri Jun 12 16:03:22 2009
5431 From: wmorgan-sup@masanjin.net (William Morgan)
5432 Date: Fri, 12 Jun 2009 13:03:22 -0700
5433 Subject: [sup-talk] sup and ncursesw
5434 In-Reply-To: <91de50e10906101050p2d23a74cy1bbfe2e80e69cca2@mail.gmail.com>
5435 References: <91de50e10906101050p2d23a74cy1bbfe2e80e69cca2@mail.gmail.com>
5436 Message-ID: <1244836517-sup-5520@entry>
5437
5438 Hi J?rg-Hendrik,
5439
5440 Reformatted excerpts from J?rg-Hendrik Bach's message of 2009-06-10:
5441 > I recently installed sup 0.8 and find I am having problems with
5442 > umlauts and accented characters. There is a patch for the
5443 > ncurses-0.9.1 gem on the sup wiki ("utf8-issues") which allows the
5444 > characters to be displayed correctly, but after applying the patch I
5445 > can't enter proper text.
5446
5447 What is your environment's character set? (Should be the first line of
5448 output logged by Sup.) What is your terminal emulator? Do other widechar
5449 ncurses programs work? And what's the behavior without the patch to
5450 ncurses.so?
5451 --
5452 William <wmorgan-sup at masanjin.net>
5453
5454 From marcus-sup@bar-coded.net Fri Jun 12 16:18:10 2009
5455 From: marcus-sup@bar-coded.net (Marcus Williams)
5456 Date: Fri, 12 Jun 2009 21:18:10 +0100
5457 Subject: [sup-talk] Gmail Labels Sidebar
5458 In-Reply-To: <1244833003-sup-9212@entry>
5459 References: <80055d7c0906081737s4dd3e205t2f3e69423ef48e17@mail.gmail.com>
5460 <1244509454-sup-1208@ntdws12.chass.utoronto.ca>
5461 <1244513641-sup-360@javelin>
5462 <1244514031-sup-2335@ntdws12.chass.utoronto.ca>
5463 <80055d7c0906090633t2a7aecd6i30578a9976697e4e@mail.gmail.com>
5464 <1244556424-sup-1426@tomsk> <1244833003-sup-9212@entry>
5465 Message-ID: <1244837827-sup-6632@tomsk>
5466
5467 On 12.6.2009, William Morgan wrote:
5468 > Nice idea. I'd add such a thing, but I think you can make it
5469 > significantly simpler. (As you point out, locking the index is not
5470 > necessary.)
5471
5472 Simpler is good - it was a quick hack anyway :) You version works out
5473 of the box so it would be a nice addition to sup/bin
5474
5475 Marcus
5476
5477 From marcus-sup@bar-coded.net Fri Jun 12 16:46:32 2009
5478 From: marcus-sup@bar-coded.net (Marcus Williams)
5479 Date: Fri, 12 Jun 2009 21:46:32 +0100
5480 Subject: [sup-talk] [PATCH] Minimalist view
5481 Message-ID: <1244839497-sup-547@tomsk>
5482
5483 Adds a keypress to toggle to a minimalist view in thread index mode.
5484 This removes the date, authors and number of threads from the view
5485 leaving more room for labels/snippets
5486 ---
5487 lib/sup/modes/thread-index-mode.rb | 34 +++++++++++++++++++++++++++-------
5488 1 files changed, 27 insertions(+), 7 deletions(-)
5489
5490 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
5491 index 0bd8110..5fa4f4c 100644
5492 --- a/lib/sup/modes/thread-index-mode.rb
5493 +++ b/lib/sup/modes/thread-index-mode.rb
5494 @@ -45,6 +45,7 @@ EOS
5495 k.add :apply_to_tagged, "Apply next command to all tagged threads", '+', '='
5496 k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
5497 k.add :undo, "Undo the previous action", 'u'
5498 + k.add :toggle_minimalist, "Toggle minimalist view", '~'
5499 end
5500
5501 def initialize hidden_labels=[], load_thread_opts={}
5502 @@ -62,6 +63,8 @@ EOS
5503 @hidden_labels = hidden_labels + LabelManager::HIDDEN_RESERVED_LABELS
5504 @date_width = DATE_WIDTH
5505
5506 + @minimal = false
5507 +
5508 @interrupt_search = false
5509
5510 initialize_threads # defines @ts and @ts_mutex
5511 @@ -261,6 +264,11 @@ EOS
5512 end
5513 end
5514
5515 + def toggle_minimalist
5516 + @minimal = !@minimal
5517 + regen_text
5518 + end
5519 +
5520 def toggle_starred
5521 t = cursor_thread or return
5522 undo = actually_toggle_starred t
5523 @@ -833,13 +841,25 @@ protected
5524
5525 size_widget_text = sprintf "%#{ @size_widget_width}s", size_widget
5526
5527 - [
5528 - [:tagged_color, @tags.tagged?(t) ? ">" : " "],
5529 - [:none, sprintf("%#{@date_width}s", date)],
5530 - (starred ? [:starred_color, "*"] : [:none, " "]),
5531 - ] +
5532 - from +
5533 - [
5534 +
5535 + if @minimal
5536 + if size_widget!=""
5537 + size_widget_text = "+"
5538 + else
5539 + size_widget_text = " "
5540 + end
5541 + line = []
5542 + else
5543 + line = [
5544 + [:tagged_color, @tags.tagged?(t) ? ">" : " "],
5545 + [:none, sprintf("%#{@date_width}s", date)],
5546 + (starred ? [:starred_color, "*"] : [:none, " "]),
5547 + ] + from
5548 + end
5549 +
5550 +
5551 + line +
5552 + [
5553 [subj_color, size_widget_text],
5554 [:to_me_color, t.labels.member?(:attachment) ? "@" : " "],
5555 [:to_me_color, dp ? ">" : (p ? '+' : " ")],
5556 --
5557 1.5.4.1
5558
5559 From me@nicholasbs.net Fri Jun 12 18:14:55 2009
5560 From: me@nicholasbs.net (Nicholas Bergson-Shilcock)
5561 Date: Fri, 12 Jun 2009 18:14:55 -0400
5562 Subject: [sup-talk] Transitioning to OfflineIMAP
5563 Message-ID: <1244844014-sup-6606@twoface>
5564
5565 Hi,
5566
5567 I've been using sup for the past year and love it. In an attempt to
5568 speed things up, I'm hoping to switch to using OfflineIMAP and a maildir
5569 source (I'm currently using straight IMAP). I've installed and
5570 configured OfflineIMAP and have downloaded all of my messages.
5571
5572 Before I go any further, I wanted to know if sup supported any sort of
5573 "graceful" account transitioning -- I'd ideally like to switch to
5574 my new maildir source without losing the index information I have for my
5575 IMAP source. The obvious way of switching over (removing my old source
5576 and adding the new one) would mean essentially starting over. Is this
5577 what I have to do or is there another way for me to switch?
5578
5579 Thanks! (And thanks for making sup such a joy to use!)
5580
5581 -Nick
5582
5583 From wmorgan-sup@masanjin.net Fri Jun 12 20:24:44 2009
5584 From: wmorgan-sup@masanjin.net (William Morgan)
5585 Date: Fri, 12 Jun 2009 17:24:44 -0700
5586 Subject: [sup-talk] Transitioning to OfflineIMAP
5587 In-Reply-To: <1244844014-sup-6606@twoface>
5588 References: <1244844014-sup-6606@twoface>
5589 Message-ID: <1244852427-sup-5831@entry>
5590
5591 Reformatted excerpts from Nicholas Bergson-Shilcock's message of 2009-06-12:
5592 > Before I go any further, I wanted to know if sup supported any sort of
5593 > "graceful" account transitioning -- I'd ideally like to switch to my
5594 > new maildir source without losing the index information I have for my
5595 > IMAP source. The obvious way of switching over (removing my old source
5596 > and adding the new one) would mean essentially starting over. Is this
5597 > what I have to do or is there another way for me to switch?
5598
5599 I wouldn't call it graceful, exactly, but you should be able to preserve
5600 state by running sup-dump on the original source, drop the index (move
5601 your ~/.sup/ferret directory somewhere else), edit your source.yaml
5602 file, and use sup-sync --restored --restore <dumpfile> to scan over the
5603 new source and restore the state for each message.
5604
5605 It will take a while. Try it on a subset of messages first if possible
5606 to make sure it's working. Post any questions and I'll try and help you.
5607 --
5608 William <wmorgan-sup at masanjin.net>
5609
5610 From tarko@lanparty.ee Sat Jun 13 07:13:06 2009
5611 From: tarko@lanparty.ee (Tarko Tikan)
5612 Date: Sat, 13 Jun 2009 14:13:06 +0300
5613 Subject: [sup-talk] display_length issue with special-characters on
5614 non-UTF8 terminal
5615 In-Reply-To: <1244834230-sup-1200@entry>
5616 References: <1244536704-sup-7027@valgus> <1244834230-sup-1200@entry>
5617 Message-ID: <1244891132-sup-2424@valgus>
5618
5619 > (I'm assuming that your terminal encoding is not UTF-8.)
5620
5621 No, it's not.
5622
5623 > Does this patch fix the issue? If so, I will release an 0.8.1.
5624
5625 Yes it does. To me, this approach felt "hackish" so I didn't come up with a patch :) But I still don't have better idea how to fix it so it'll have to stay like this.
5626
5627 > + if $encoding == "UTF-8"
5628 > + scan(/./u).size
5629 > + else
5630 > + size
5631 > + end
5632
5633 It would probably be correct to use:
5634
5635 if $encoding == "UTF-8"
5636 scan(/./u).size
5637 else
5638 length
5639 end
5640
5641 Thats because scan returns a array (hence using the size), without scan you are just invoking on string and it's correct to use length (for some reason size works too, backward compatibility?)
5642
5643 --
5644 tarko
5645
5646 From bachjh@googlemail.com Sat Jun 13 10:17:51 2009
5647 From: bachjh@googlemail.com (=?UTF-8?B?SsO2cmctSGVuZHJpayBCYWNo?=)
5648 Date: Sat, 13 Jun 2009 16:17:51 +0200
5649 Subject: [sup-talk] sup and ncursesw
5650 In-Reply-To: <1244836517-sup-5520@entry>
5651 References: <91de50e10906101050p2d23a74cy1bbfe2e80e69cca2@mail.gmail.com>
5652 <1244836517-sup-5520@entry>
5653 Message-ID: <91de50e10906130717x3a6d6097g5249ed6bb17fbfcf@mail.gmail.com>
5654
5655 2009/6/12 William Morgan <wmorgan-sup at masanjin.net>
5656
5657 >
5658 > What is your environment's character set? (Should be the first line of
5659 > output logged by Sup.) What is your terminal emulator? And what's the
5660 > behavior without the patch to ncurses.so?
5661
5662
5663 After playing around a bit i think the behaviour might be related to a
5664 problem with locale.
5665 I reinstalled ruby, rubygems, ncurses and sup. No patch to ncurses this
5666 time. Using gnome-terminal or xterm with "TERM=xterm" now lets umlauts etc
5667 look like, e.g. "JM-CM-6rg-Hendrik"). The reported character set is "utf8".
5668 The same happens when using urxvt with TERM=rxvt-unicode.
5669
5670 However, calling sup like this:
5671 $ LC_ALL=en_GB.iso-8859-15 sup
5672
5673 results in different behaviour in the two emulators: xterm looks OK when
5674 viewing the inbox, but inserts boxed question marks in thread-view.
5675 rxvt-unicode displays everything correctly, but drops the last character of
5676 a line when a non-ASCII element is somewhere in the line. In both variants
5677 sup reports the character set correctly as iso-8859-15.
5678 So I guess I could simply work in urxvt and that's OK, then.
5679
5680 Do other widechar ncurses programs work?
5681
5682
5683 The only other ncurses-based program I am aware of using is midnight
5684 commander, and it seems to be working fine. But I don't know whether it uses
5685 the widechar variant.
5686
5687 cheers,
5688 - J?rg-Hendrik
5689 -------------- next part --------------
5690 An HTML attachment was scrubbed...
5691 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090613/c8c73902/attachment.html>
5692
5693 From aep@exys.org Sun Jun 14 00:37:13 2009
5694 From: aep@exys.org (Arvid Picciani)
5695 Date: Sat, 13 Jun 2009 21:37:13 -0700
5696 Subject: [sup-talk] Sup won't save state
5697 Message-ID: <1244954212-sup-8783@andariel>
5698
5699
5700 Hi,
5701 I'm trying out sup and I totally like the concept so far, unfortunately it
5702 doesn't work correctly for me.
5703
5704 1) It doesn't save its state. The next time I open it up, read messages
5705 are new again.
5706
5707 2) when pressing c, to compose a new message, it asks for a Subject.
5708 Later in vim I see the Subject field contains random characters instead.
5709
5710 3) Most input "dialogs" (?) can't be killed. Pressing ESC does nothing.
5711 The only to chancel such an operation is to kill sup.
5712
5713 4) It behaves very odd when two clients are using the same imap account.
5714 Yes, the docs state that, but not how to work around that when you
5715 _have_ to use two clients. Currently I'm trying to use offlineimap,
5716 unfortunately that's broken.
5717
5718 Thank you,
5719 Arvid
5720
5721 From bwalton@artsci.utoronto.ca Sat Jun 13 21:36:41 2009
5722 From: bwalton@artsci.utoronto.ca (Ben Walton)
5723 Date: Sat, 13 Jun 2009 21:36:41 -0400
5724 Subject: [sup-talk] [PATCH] Minimalist view
5725 In-Reply-To: <1244839497-sup-547@tomsk>
5726 References: <1244839497-sup-547@tomsk>
5727 Message-ID: <1244943297-sup-5509@ntdws12.chass.utoronto.ca>
5728
5729 Excerpts from Marcus Williams's message of Fri Jun 12 16:46:32 -0400 2009:
5730 > Adds a keypress to toggle to a minimalist view in thread index mode.
5731 > This removes the date, authors and number of threads from the view
5732 > leaving more room for labels/snippets
5733
5734 This patch looks sound, but I wonder if a Hook might be in order to
5735 make the alternate display customizable? Not a bad idea at all
5736 though.
5737
5738 -Ben
5739 --
5740 Ben Walton
5741 Systems Programmer - CHASS
5742 University of Toronto
5743 C:416.407.5610 | W:416.978.4302
5744
5745 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
5746 Contact me to arrange for a CAcert assurance meeting.
5747 -------------- next part --------------
5748 A non-text attachment was scrubbed...
5749 Name: signature.asc
5750 Type: application/pgp-signature
5751 Size: 189 bytes
5752 Desc: not available
5753 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090613/4467445f/attachment.bin>
5754
5755 From marcus-sup@bar-coded.net Sun Jun 14 09:17:38 2009
5756 From: marcus-sup@bar-coded.net (Marcus Williams)
5757 Date: Sun, 14 Jun 2009 14:17:38 +0100
5758 Subject: [sup-talk] [PATCH] Minimalist view
5759 In-Reply-To: <1244943297-sup-5509@ntdws12.chass.utoronto.ca>
5760 References: <1244839497-sup-547@tomsk>
5761 <1244943297-sup-5509@ntdws12.chass.utoronto.ca>
5762 Message-ID: <1244985302-sup-9505@tomsk>
5763
5764 On 14.6.2009, Ben Walton wrote:
5765 > This patch looks sound, but I wonder if a Hook might be in order to
5766 > make the alternate display customizable? Not a bad idea at all
5767 > though.
5768
5769 Slightly ahead of you :) This is the default view for my next patch
5770 which implements exactly that hook.
5771
5772 I'm just wandering through my local commits and cleaning stuff up for
5773 submission so hopefully a few more to come as well.
5774
5775 Marcus
5776
5777 From aep@exys.org Sun Jun 14 20:51:18 2009
5778 From: aep@exys.org (Arvid Picciani)
5779 Date: Sun, 14 Jun 2009 17:51:18 -0700
5780 Subject: [sup-talk] Sup won't save state
5781 In-Reply-To: <1244954212-sup-8783@andariel>
5782 References: <1244954212-sup-8783@andariel>
5783 Message-ID: <1245026779-sup-3938@andariel>
5784
5785 Sorry, still takes a little to get used to sup. I have no clue what
5786 was on and off list, but I assume this was off, so I'm going to repost
5787 it:
5788
5789
5790 > $ in inbox mode to save, or at intervals. does clean shutdown not do
5791 > this automatically?
5792
5793 "clean shutdown" is one of the reasons I went away from Gui crap.
5794 It almost never works for me.
5795 I don't even know how to shut down a Linux computer "cleanly" other then
5796 by clicking some button on some Gui menu, which I don't have,
5797 so most Gui programs just crash and leave me next time with some
5798 ridiculous "recovery assistant".
5799 Sup does exactly that and it's highly annoying. It doesn't even work.
5800 Why the hell are you trying to kill a non existent sup instance?
5801 Maybe I should just alias sup="rm .sup/lock;sup"
5802
5803 End of rant.
5804
5805 So how do I configure sup to save automatically?
5806
5807
5808 PS: the encrypt/reply to menu on the reply view is pretty cool :)
5809
5810 From aep@exys.org Sun Jun 14 20:58:31 2009
5811 From: aep@exys.org (Arvid Picciani)
5812 Date: Sun, 14 Jun 2009 17:58:31 -0700
5813 Subject: [sup-talk] Wrong messages in thread
5814 Message-ID: <1245027174-sup-4117@andariel>
5815
5816 Two more questions :P
5817
5818
5819 1) Some messages end up in the wrong thread. When there is no other
5820 useful info, sup appears to guess a thread by the Subject similarity.
5821 Unfortunately that ends up being very wrong for my university mailing
5822 list, since they have no List-Id, but the full university name in the
5823 Subject and people won't learn to write meaningful Subjects.
5824
5825 [blablablalblalbafooomal uni blabla] hi
5826 is displayed in the same thread with
5827 [blablablalblalbafooomal uni blabla] hello
5828 although those are two different threads.
5829
5830 Can I manually fix those?
5831
5832
5833 2) how's that address book generated?
5834 I have sup-talk-request and sup-talk-something
5835 but not sup-talk.
5836
5837
5838
5839 thanks
5840 --
5841 Arvid
5842
5843
5844 From ezyang@MIT.EDU Sun Jun 14 13:36:08 2009
5845 From: ezyang@MIT.EDU (Edward Z. Yang)
5846 Date: Sun, 14 Jun 2009 13:36:08 -0400
5847 Subject: [sup-talk] Wrong messages in thread
5848 In-Reply-To: <1245027174-sup-4117@andariel>
5849 References: <1245027174-sup-4117@andariel>
5850 Message-ID: <1245000912-sup-6454@javelin>
5851
5852 Excerpts from Arvid Picciani's message of Sun Jun 14 20:58:31 -0400 2009:
5853 > 2) how's that address book generated?
5854 > I have sup-talk-request and sup-talk-something
5855 > but not sup-talk.
5856
5857 When you edit an address in thread-view-mode using i it gets added
5858 to your address book. Ideally, stuff should get added when you compose
5859 and email the first time. This is a patch I want to make at some point.
5860
5861 Cheers,
5862 Edward
5863
5864 From garoth@gmail.com Sun Jun 14 16:35:57 2009
5865 From: garoth@gmail.com (Andrei Thorp)
5866 Date: Sun, 14 Jun 2009 13:35:57 -0700
5867 Subject: [sup-talk] Sup won't save state
5868 In-Reply-To: <1245026779-sup-3938@andariel>
5869 References: <1244954212-sup-8783@andariel> <1245026779-sup-3938@andariel>
5870 Message-ID: <80055d7c0906141335r31848e05ydfc8557b0d1d9ca6@mail.gmail.com>
5871
5872 Yeah, sorry, I replied to person accidentally while on handheld.
5873 Thanks for forwarding.
5874
5875 Anyway, yeah, wish saving in sup was better. Don't really know
5876 anything better than sup-sync.
5877
5878 -AT
5879
5880 From nicolas.pouillard@gmail.com Mon Jun 15 08:03:58 2009
5881 From: nicolas.pouillard@gmail.com (Nicolas Pouillard)
5882 Date: Mon, 15 Jun 2009 14:03:58 +0200
5883 Subject: [sup-talk] Wrong messages in thread
5884 In-Reply-To: <1245000912-sup-6454@javelin>
5885 References: <1245027174-sup-4117@andariel> <1245000912-sup-6454@javelin>
5886 Message-ID: <1245067390-sup-2318@ausone.inria.fr>
5887
5888 Excerpts from Edward Z. Yang's message of Sun Jun 14 19:36:08 +0200 2009:
5889 > Excerpts from Arvid Picciani's message of Sun Jun 14 20:58:31 -0400 2009:
5890 > > 2) how's that address book generated?
5891 > > I have sup-talk-request and sup-talk-something
5892 > > but not sup-talk.
5893 >
5894 > When you edit an address in thread-view-mode using i it gets added
5895 > to your address book. Ideally, stuff should get added when you compose
5896 > and email the first time. This is a patch I want to make at some point.
5897
5898 Yes it would be great to automatically prompt for adding the contact when
5899 we send a message to someone not yet in contacts.
5900
5901 --
5902 Nicolas Pouillard
5903 http://nicolaspouillard.fr
5904
5905 From wmorgan-sup@masanjin.net Mon Jun 15 09:34:29 2009
5906 From: wmorgan-sup@masanjin.net (William Morgan)
5907 Date: Mon, 15 Jun 2009 06:34:29 -0700
5908 Subject: [sup-talk] Wrong messages in thread
5909 In-Reply-To: <1245027174-sup-4117@andariel>
5910 References: <1245027174-sup-4117@andariel>
5911 Message-ID: <1245072716-sup-829@entry>
5912
5913 Reformatted excerpts from Arvid Picciani's message of 2009-06-14:
5914 > 1) Some messages end up in the wrong thread. When there is no other
5915 > useful info, sup appears to guess a thread by the Subject similarity.
5916
5917 Sup does not do this. If you're seeing messages with different subjects
5918 in the same thread, a later one contains a reference to an earlier one.
5919 Sometimes this happens if people reply to a mailing list message and
5920 change the subject as a way of starting a new message. You can confirm
5921 this by examining the in-reply-to and references headers of the later
5922 message.
5923
5924 > 2) how's that address book generated?
5925 > I have sup-talk-request and sup-talk-something
5926 > but not sup-talk.
5927
5928 By manually adding contacts, e.g. with 'i' in thread-view-mode, plus a
5929 couple recent contacts automatically drawn from the index.
5930 --
5931 William <wmorgan-sup at masanjin.net>
5932
5933 From wmorgan-sup@masanjin.net Mon Jun 15 09:37:15 2009
5934 From: wmorgan-sup@masanjin.net (William Morgan)
5935 Date: Mon, 15 Jun 2009 06:37:15 -0700
5936 Subject: [sup-talk] Sup won't save state
5937 In-Reply-To: <1244954212-sup-8783@andariel>
5938 References: <1244954212-sup-8783@andariel>
5939 Message-ID: <1245072900-sup-2799@entry>
5940
5941 Reformatted excerpts from Arvid Picciani's message of 2009-06-13:
5942 > 1) It doesn't save its state. The next time I open it up, read
5943 > messages are new again.
5944
5945 How are you quitting Sup?
5946
5947 > 2) when pressing c, to compose a new message, it asks for a Subject.
5948 > Later in vim I see the Subject field contains random characters
5949 > instead.
5950
5951 Strange. Are they related in any way? Can you give an example?
5952
5953
5954 > 3) Most input "dialogs" (?) can't be killed. Pressing ESC does
5955 > nothing. The only to chancel such an operation is to kill sup.
5956
5957 Ctrl-g.
5958
5959 > 4) It behaves very odd when two clients are using the same imap
5960 > account. Yes, the docs state that, but not how to work around that
5961 > when you _have_ to use two clients.
5962
5963 If you change the IMAP folder via another client, you'll have to run
5964 sup-sync --changed on that source before running Sup. Sup should detect
5965 this and tell you. What "odd" behavior are you seeing?
5966 --
5967 William <wmorgan-sup at masanjin.net>
5968
5969 From wmorgan-sup@masanjin.net Mon Jun 15 09:42:04 2009
5970 From: wmorgan-sup@masanjin.net (William Morgan)
5971 Date: Mon, 15 Jun 2009 06:42:04 -0700
5972 Subject: [sup-talk] Sup won't save state
5973 In-Reply-To: <1245026779-sup-3938@andariel>
5974 References: <1244954212-sup-8783@andariel> <1245026779-sup-3938@andariel>
5975 Message-ID: <1245073093-sup-5388@entry>
5976
5977 Reformatted excerpts from Arvid Picciani's message of 2009-06-14:
5978 > "clean shutdown" is one of the reasons I went away from Gui crap.
5979
5980 Clean shutdown has nothing to do with GUI vs not GUI.
5981
5982 > I don't even know how to shut down a Linux computer "cleanly" other
5983 > then by clicking some button on some Gui menu, which I don't have,
5984 > so most Gui programs just crash and leave me next time with some
5985 > ridiculous "recovery assistant".
5986 > Sup does exactly that and it's highly annoying. It doesn't even work.
5987
5988 It's hard to guess what you're doing here, but it sounds like you're
5989 pressing ctrl-c to kill Sup and then pressing y at the "die ungracefully
5990 now?" prompt. You may want to read the new user guide:
5991 http://sup.rubyforge.org/NewUserGuide.txt.
5992 --
5993 William <wmorgan-sup at masanjin.net>
5994
5995 From wmorgan-sup@masanjin.net Mon Jun 15 09:50:37 2009
5996 From: wmorgan-sup@masanjin.net (William Morgan)
5997 Date: Mon, 15 Jun 2009 06:50:37 -0700
5998 Subject: [sup-talk] [PATCH] Minimalist view
5999 In-Reply-To: <1244943297-sup-5509@ntdws12.chass.utoronto.ca>
6000 References: <1244839497-sup-547@tomsk>
6001 <1244943297-sup-5509@ntdws12.chass.utoronto.ca>
6002 Message-ID: <1245073371-sup-3704@entry>
6003
6004 Reformatted excerpts from Ben Walton's message of 2009-06-13:
6005 > This patch looks sound, but I wonder if a Hook might be in order to
6006 > make the alternate display customizable? Not a bad idea at all
6007 > though.
6008
6009 Yeah, I would generally like to have this type of thing done through
6010 hooks, but if a lot of people like this mode then I could integrate it
6011 directly.
6012 --
6013 William <wmorgan-sup at masanjin.net>
6014
6015 From bwalton@artsci.utoronto.ca Mon Jun 15 09:54:01 2009
6016 From: bwalton@artsci.utoronto.ca (Ben Walton)
6017 Date: Mon, 15 Jun 2009 09:54:01 -0400
6018 Subject: [sup-talk] [PATCH] Minimalist view
6019 In-Reply-To: <1245073371-sup-3704@entry>
6020 References: <1244839497-sup-547@tomsk>
6021 <1244943297-sup-5509@ntdws12.chass.utoronto.ca>
6022 <1245073371-sup-3704@entry>
6023 Message-ID: <1245073954-sup-8198@ntdws12.chass.utoronto.ca>
6024
6025 Excerpts from William Morgan's message of Mon Jun 15 09:50:37 -0400 2009:
6026
6027 > Yeah, I would generally like to have this type of thing done through
6028 > hooks, but if a lot of people like this mode then I could integrate it
6029 > directly.
6030
6031 What about a Hook with this as the default alternate view if the Hook
6032 isn't set? I'd also suggest changing the name from minimalist to
6033 alternate, since if there is a hook available, it may not actually be
6034 a minimal view?
6035
6036 Thanks
6037 -Ben
6038 --
6039 Ben Walton
6040 Systems Programmer - CHASS
6041 University of Toronto
6042 C:416.407.5610 | W:416.978.4302
6043
6044 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
6045 Contact me to arrange for a CAcert assurance meeting.
6046 -------------- next part --------------
6047 A non-text attachment was scrubbed...
6048 Name: signature.asc
6049 Type: application/pgp-signature
6050 Size: 189 bytes
6051 Desc: not available
6052 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090615/82450fd6/attachment.bin>
6053
6054 From wmorgan-sup@masanjin.net Mon Jun 15 10:04:52 2009
6055 From: wmorgan-sup@masanjin.net (William Morgan)
6056 Date: Mon, 15 Jun 2009 07:04:52 -0700
6057 Subject: [sup-talk] sup and ncursesw
6058 In-Reply-To: <91de50e10906130717x3a6d6097g5249ed6bb17fbfcf@mail.gmail.com>
6059 References: <91de50e10906101050p2d23a74cy1bbfe2e80e69cca2@mail.gmail.com>
6060 <1244836517-sup-5520@entry>
6061 <91de50e10906130717x3a6d6097g5249ed6bb17fbfcf@mail.gmail.com>
6062 Message-ID: <1245074133-sup-9338@entry>
6063
6064 Reformatted excerpts from J?rg-Hendrik Bach's message of 2009-06-13:
6065 > After playing around a bit i think the behaviour might be related to a
6066 > problem with locale.
6067
6068 Yeah, this stuff is all tricky to get working right. I recommend first
6069 trying to get to the point where you can cat and less files with funny
6070 characters in them, and then introduce something like Sup. (And that's
6071 typically the point where you see the difference between ncurses.so with
6072 and without the patch.)
6073
6074 > Using gnome-terminal or xterm with "TERM=xterm" now lets umlauts etc
6075 > look like, e.g. "JM-CM-6rg-Hendrik"). The reported character set is
6076 > "utf8".
6077
6078 Probably the umlauts themselves aren't in utf8. I have had success with
6079 gnome-terminal and TERM=xterm, so I bet you can get this combo to work.
6080 Try changing your locale from utf8 to en_GB.iso-8859-15 here (if you're
6081 using Ubuntu, you can edit /etc/default/locale an re-log in, then
6082 `locale` to check.)
6083 --
6084 William <wmorgan-sup at masanjin.net>
6085
6086 From wmorgan-sup@masanjin.net Mon Jun 15 10:10:30 2009
6087 From: wmorgan-sup@masanjin.net (William Morgan)
6088 Date: Mon, 15 Jun 2009 07:10:30 -0700
6089 Subject: [sup-talk] display_length issue with special-characters on
6090 non-UTF8 terminal
6091 In-Reply-To: <1244891132-sup-2424@valgus>
6092 References: <1244536704-sup-7027@valgus> <1244834230-sup-1200@entry>
6093 <1244891132-sup-2424@valgus>
6094 Message-ID: <1245074739-sup-3954@entry>
6095
6096 Reformatted excerpts from Tarko Tikan's message of 2009-06-13:
6097 > Yes it does. To me, this approach felt "hackish" so I didn't come up
6098 > with a patch :) But I still don't have better idea how to fix it so
6099 > it'll have to stay like this.
6100
6101 It's hackish because Ruby 1.8 has shitty multibyte support. The only
6102 reason it works at all is because byte length is character length (at
6103 least most of the time) in your encoding.
6104
6105 There is a multibyte gem out there that I'm keeping an eye on. Also Ruby
6106 1.9.1 allegedgly fixes this problem.
6107
6108 > Thats because scan returns a array (hence using the size), without
6109 > scan you are just invoking on string and it's correct to use length
6110 > (for some reason size works too, backward compatibility?)
6111
6112 Size and length are synonmys for both arrays and strings. I used size
6113 there for symmetry.
6114 --
6115 William <wmorgan-sup at masanjin.net>
6116
6117 From garoth@gmail.com Mon Jun 15 11:20:58 2009
6118 From: garoth@gmail.com (Andrei Thorp)
6119 Date: Mon, 15 Jun 2009 11:20:58 -0400
6120 Subject: [sup-talk] Sup won't save state
6121 In-Reply-To: <1245072900-sup-2799@entry>
6122 References: <1244954212-sup-8783@andariel> <1245072900-sup-2799@entry>
6123 Message-ID: <80055d7c0906150820o3ef05759j23a54e0f889594b7@mail.gmail.com>
6124
6125 >> 2) when pressing c, to compose a new message, it asks for a Subject.
6126 >> Later in vim I see the Subject field contains random characters
6127 >> instead.
6128 >
6129 > Strange. Are they related in any way? Can you give an example?
6130
6131 When this happened to me, they were absolutely unrelated, looked like
6132 trying to vim a bit of a binary file...
6133
6134 But went away randomly a few days later.
6135
6136 -AT
6137
6138 From wmorgan-sup@masanjin.net Mon Jun 15 12:32:42 2009
6139 From: wmorgan-sup@masanjin.net (William Morgan)
6140 Date: Mon, 15 Jun 2009 09:32:42 -0700
6141 Subject: [sup-talk] [PATCH] fixes for ruby1.9
6142 In-Reply-To: <1244835352-10370-1-git-send-email-rlane@club.cc.cmu.edu>
6143 References: <1244835352-10370-1-git-send-email-rlane@club.cc.cmu.edu>
6144 Message-ID: <1245083484-sup-9468@entry>
6145
6146 Reformatted excerpts from Rich Lane's message of 2009-06-12:
6147 > Change colons in case statements to 'then'
6148 > Fix a block that didn't take enough arguments
6149 > Rename variables to avoid shadowing warnings
6150 > Use String.ord (and define it for 1.8)
6151 > Use DL::Importer on 1.9
6152 > Make require 'fastthread' optional
6153
6154 Thanks for this. I've applied it directly to master. Now if someone
6155 would just upgrade Ferret to 1.9, we might be able to actually run Sup!
6156 --
6157 William <wmorgan-sup at masanjin.net>
6158
6159 From wmorgan-sup@masanjin.net Mon Jun 15 12:53:47 2009
6160 From: wmorgan-sup@masanjin.net (William Morgan)
6161 Date: Mon, 15 Jun 2009 09:53:47 -0700
6162 Subject: [sup-talk] Crash after sending a message
6163 In-Reply-To: <1244719933-sup-4261@viajero>
6164 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6165 Message-ID: <1245084718-sup-1647@entry>
6166
6167 Reformatted excerpts from Fabio Riga's message of 2009-06-11:
6168 > All is fine, I just need to remember to launch sup this way. Maybe it
6169 > needs some work on localization?
6170
6171 Sorry about that. The problem is that Sup was writing an invalid
6172 sent.mbox file in certain locales, including yours, and then dying when
6173 it couldn't parse its own file. If you update to the latest git, this
6174 should be fixed for new messages, and you shouldn't need the LANG=C
6175 hack.
6176
6177 Please let me know if you have any more problems.
6178 --
6179 William <wmorgan-sup at masanjin.net>
6180
6181 From wmorgan-sup@masanjin.net Mon Jun 15 13:24:08 2009
6182 From: wmorgan-sup@masanjin.net (William Morgan)
6183 Date: Mon, 15 Jun 2009 10:24:08 -0700
6184 Subject: [sup-talk] lockmanager
6185 In-Reply-To: <1244595206-sup-6689@ntdws12.chass.utoronto.ca>
6186 References: <1244595206-sup-6689@ntdws12.chass.utoronto.ca>
6187 Message-ID: <1245084879-sup-6794@entry>
6188
6189 Hi Ben,
6190
6191 Reformatted excerpts from Ben Walton's message of 2009-06-09:
6192 > I've attached the base LockManager class that I'm envisioning for sup.
6193
6194 Sorry for the delay. This looks good. Using a mutex to protect the
6195 file-locking seems like the right idea. Carry on!
6196 --
6197 William <wmorgan-sup at masanjin.net>
6198
6199 From bwalton@artsci.utoronto.ca Mon Jun 15 13:39:15 2009
6200 From: bwalton@artsci.utoronto.ca (Ben Walton)
6201 Date: Mon, 15 Jun 2009 13:39:15 -0400
6202 Subject: [sup-talk] lockmanager
6203 In-Reply-To: <1245084879-sup-6794@entry>
6204 References: <1244595206-sup-6689@ntdws12.chass.utoronto.ca>
6205 <1245084879-sup-6794@entry>
6206 Message-ID: <1245087383-sup-5205@ntdws12.chass.utoronto.ca>
6207
6208 Excerpts from William Morgan's message of Mon Jun 15 13:24:08 -0400 2009:
6209
6210 > Sorry for the delay. This looks good. Using a mutex to protect the
6211 > file-locking seems like the right idea. Carry on!
6212
6213 Yah, now that 'stupid Kobe' beat the Magic last night, my evenings
6214 should have more time for completing this. I'm just about finished
6215 integrating it with the mbox code.
6216
6217 I've branched this from bw/flexible_sent, since I thought it made more
6218 sense to go from that than from master w/o the flexible sent
6219 parts...it should still merge decently for you, I think.
6220
6221 The next hurdle will be testing, which I'll need help for, since my
6222 only mbox is sup://sent, which is now legacy only (and at some point
6223 when I'm bored will disappear completely).
6224
6225 Thanks
6226 -Ben
6227 --
6228 Ben Walton
6229 Systems Programmer - CHASS
6230 University of Toronto
6231 C:416.407.5610 | W:416.978.4302
6232
6233 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
6234 Contact me to arrange for a CAcert assurance meeting.
6235 -------------- next part --------------
6236 A non-text attachment was scrubbed...
6237 Name: signature.asc
6238 Type: application/pgp-signature
6239 Size: 189 bytes
6240 Desc: not available
6241 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090615/499ca4b3/attachment.bin>
6242
6243 From wmorgan-sup@masanjin.net Mon Jun 15 13:44:25 2009
6244 From: wmorgan-sup@masanjin.net (William Morgan)
6245 Date: Mon, 15 Jun 2009 10:44:25 -0700
6246 Subject: [sup-talk] [PATCH] before-search hook
6247 In-Reply-To: <1244612627-sup-982@javelin>
6248 References: <1244612627-sup-982@javelin>
6249 Message-ID: <1245087294-sup-6276@entry>
6250
6251 Hi Edward,
6252
6253 Thanks for the patch. I'm interested in integrating it into Sup
6254 mainline. A couple comments:
6255
6256 1. Can you rename it to custom-search? I think that's a better
6257 description.
6258
6259 2. I would rather have the hook return a value. So this:
6260 > - subs = s.gsub(/\b(to|from):(\S+)\b/) do
6261 > + subs = String.new s
6262 > + HookManager.run("before-search", :subs => subs)
6263 I would rather see as:
6264 subs = HookManager.run("before-search", :subs => s) || s
6265
6266 3. It's not really an issue of mutation vs no mutation. The problem is
6267 that the parameter names in hooks are method calls, not variables. So
6268 while "subs = subs.gsub(...)" causes a 'subs' local variable to be
6269 created and initialized to nil, both "x = subs.gsub(...)" and "subs =
6270 self.subs.gsub(...)" work fine.
6271
6272 This is probably less of an issue when the hook is returning a
6273 values, but if you could change the comments to be a warning about
6274 shadowing method calls instead that would be better.
6275
6276 Thanks!
6277 --
6278 William <wmorgan-sup at masanjin.net>
6279
6280 From wmorgan-sup@masanjin.net Mon Jun 15 13:50:21 2009
6281 From: wmorgan-sup@masanjin.net (William Morgan)
6282 Date: Mon, 15 Jun 2009 10:50:21 -0700
6283 Subject: [sup-talk] lockmanager
6284 In-Reply-To: <1245087383-sup-5205@ntdws12.chass.utoronto.ca>
6285 References: <1244595206-sup-6689@ntdws12.chass.utoronto.ca>
6286 <1245084879-sup-6794@entry>
6287 <1245087383-sup-5205@ntdws12.chass.utoronto.ca>
6288 Message-ID: <1245088148-sup-5245@entry>
6289
6290 Reformatted excerpts from Ben Walton's message of 2009-06-15:
6291 > I've branched this from bw/flexible_sent, since I thought it made more
6292 > sense to go from that than from master w/o the flexible sent
6293 > parts...it should still merge decently for you, I think.
6294
6295 That's fine. As long as it doesn't branch from next, I'm happy.
6296
6297 > The next hurdle will be testing, which I'll need help for, since my
6298 > only mbox is sup://sent, which is now legacy only (and at some point
6299 > when I'm bored will disappear completely).
6300
6301 Although the addressess are (trivially) mangled, you can use something
6302 like http://rubyforge.org/pipermail/sup-talk/2009-June.txt.
6303 --
6304 William <wmorgan-sup at masanjin.net>
6305
6306 From garoth@gmail.com Mon Jun 15 14:45:35 2009
6307 From: garoth@gmail.com (Andrei Thorp)
6308 Date: Mon, 15 Jun 2009 14:45:35 -0400
6309 Subject: [sup-talk] [BUG] Sup Overload
6310 Message-ID: <80055d7c0906151145r493c07c2h7a68d776f49ce91a@mail.gmail.com>
6311
6312 Hello there!
6313
6314 Exciting fresh new sup crash. What's happened is that I just imported
6315 a zillion new messages from several new sources. I downloaded all the
6316 mail from 4 mailing lists in my gmail account. Anyway, so they all
6317 appeared as new in my inbox. I started holding a as they appeared to
6318 archive them. Sup blew up. See attached exception log.
6319
6320 Cheers.
6321
6322 -AT
6323 -------------- next part --------------
6324 --- RuntimeError from thread: poll after loading inbox
6325 unknown drawable object: nil in #<Redwood::InboxMode:0xb745fc4c> for line 35
6326 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/scroll-mode.rb:200:in `draw_line'
6327 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/line-cursor-mode.rb:39:in `draw_line'
6328 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/scroll-mode.rb:48:in `draw'
6329 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/scroll-mode.rb:48:in `each'
6330 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/scroll-mode.rb:48:in `draw'
6331 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/line-cursor-mode.rb:24:in `draw'
6332 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/buffer.rb:99:in `draw'
6333 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/buffer.rb:83:in `redraw'
6334 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/buffer.rb:303:in `draw_screen'
6335 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `send'
6336 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `method_missing'
6337 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/thread-index-mode.rb:187:in `handle_added_update'
6338 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/update.rb:27:in `send'
6339 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/update.rb:27:in `relay'
6340 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/update.rb:27:in `each'
6341 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/update.rb:27:in `relay'
6342 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `send'
6343 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `method_missing'
6344 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:162:in `add_messages_from'
6345 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/maildir.rb:130:in `each'
6346 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/maildir.rb:127:in `upto'
6347 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/maildir.rb:127:in `each'
6348 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:544:in `send'
6349 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:544:in `__pass'
6350 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:531:in `method_missing'
6351 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:141:in `add_messages_from'
6352 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:98:in `do_poll'
6353 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:86:in `each'
6354 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:86:in `do_poll'
6355 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:85:in `synchronize'
6356 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:85:in `do_poll'
6357 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `send'
6358 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `method_missing'
6359 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/poll-mode.rb:17:in `poll'
6360 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/poll.rb:53:in `poll'
6361 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `send'
6362 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/util.rb:505:in `method_missing'
6363 /usr/lib/ruby/gems/1.8/gems/sup-0.8/bin/sup:206
6364 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:71:in `reporting_thread'
6365 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:69:in `initialize'
6366 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:69:in `new'
6367 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:69:in `reporting_thread'
6368 /usr/lib/ruby/gems/1.8/gems/sup-0.8/bin/sup:206
6369 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/thread-index-mode.rb:663:in `call'
6370 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/thread-index-mode.rb:663:in `__unprotected_load_threads'
6371 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/thread-index-mode.rb:605:in `call'
6372 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/thread-index-mode.rb:605:in `load_n_threads_background'
6373 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:71:in `reporting_thread'
6374 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:69:in `initialize'
6375 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:69:in `new'
6376 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup.rb:69:in `reporting_thread'
6377 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/thread-index-mode.rb:603:in `load_n_threads_background'
6378 /usr/lib/ruby/gems/1.8/gems/sup-0.8/lib/sup/modes/thread-index-mode.rb:673:in `__unprotected_load_threads'
6379 (eval):12:in `load_threads'
6380 /usr/lib/ruby/gems/1.8/gems/sup-0.8/bin/sup:206
6381 /usr/bin/sup:19:in `load'
6382 /usr/bin/sup:19
6383
6384 From garoth@gmail.com Mon Jun 15 14:47:22 2009
6385 From: garoth@gmail.com (Andrei Thorp)
6386 Date: Mon, 15 Jun 2009 14:47:22 -0400
6387 Subject: [sup-talk] [BUG] Can't handle spaces in paths
6388 Message-ID: <80055d7c0906151147h826d5beg7e5c56092149cd54@mail.gmail.com>
6389
6390 Hey there,
6391
6392 I just downloaded a whole lot of mail from my gmail account via
6393 offlineimap, and tried to add a source with a space. In short, sup
6394 doesn't like this. It tries to do a split somewhere and it doesn't
6395 work out for it so well :)
6396
6397 Not much of a bug, I ln -s'd around it. Maybe something that could be
6398 handled somehow though? I tried quotes and whitespace backslashing in
6399 shell, but no go.
6400
6401 Cheers!
6402
6403 -AT
6404
6405 From guillaume.quintard@gmail.com Mon Jun 15 15:05:37 2009
6406 From: guillaume.quintard@gmail.com (Guillaume Quintard)
6407 Date: Mon, 15 Jun 2009 21:05:37 +0200
6408 Subject: [sup-talk] [BUG] Can't handle spaces in paths
6409 In-Reply-To: <80055d7c0906151147h826d5beg7e5c56092149cd54@mail.gmail.com>
6410 References: <80055d7c0906151147h826d5beg7e5c56092149cd54@mail.gmail.com>
6411 Message-ID: <1245092672-sup-7673@altis>
6412
6413 Excerpts from Andrei Thorp's message of Mon Jun 15 20:47:22 +0200 2009:
6414 > Not much of a bug, I ln -s'd around it. Maybe something that could be
6415 > handled somehow though? I tried quotes and whitespace backslashing in
6416 > shell, but no go.
6417 >
6418 Did you put a '\' before the spaces?
6419
6420 --
6421 Guillaume
6422
6423 From garoth@gmail.com Mon Jun 15 15:07:50 2009
6424 From: garoth@gmail.com (Andrei Thorp)
6425 Date: Mon, 15 Jun 2009 15:07:50 -0400
6426 Subject: [sup-talk] [BUG] Can't handle spaces in paths
6427 In-Reply-To: <1245092672-sup-7673@altis>
6428 References: <80055d7c0906151147h826d5beg7e5c56092149cd54@mail.gmail.com>
6429 <1245092672-sup-7673@altis>
6430 Message-ID: <80055d7c0906151207p95bbae4w5846acb8f03044da@mail.gmail.com>
6431
6432 >> I tried quotes and whitespace backslashing in shell, but no go.
6433 >>
6434 > Did you put a '\' before the spaces?
6435 >
6436 > --
6437 > Guillaume
6438
6439 That's what I was referring to ^
6440
6441 Also, I should mention that I tried sup-add as well as sup-config for
6442 this operation.
6443
6444 -AT
6445
6446 From guillaume.quintard@gmail.com Mon Jun 15 15:11:04 2009
6447 From: guillaume.quintard@gmail.com (Guillaume Quintard)
6448 Date: Mon, 15 Jun 2009 21:11:04 +0200
6449 Subject: [sup-talk] Crash after sending a message
6450 In-Reply-To: <1245084718-sup-1647@entry>
6451 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6452 <1245084718-sup-1647@entry>
6453 Message-ID: <1245092885-sup-1794@altis>
6454
6455 Excerpts from William Morgan's message of Mon Jun 15 18:53:47 +0200 2009:
6456 > Please let me know if you have any more problems.
6457
6458 Still have it here, arg., with next.
6459
6460 There is a sense of tragic in the fact that I know that after sending
6461 that mail to get help, sup will inevitably crash :-)
6462
6463 --
6464 Guillaume
6465
6466 From wmorgan-sup@masanjin.net Mon Jun 15 15:17:20 2009
6467 From: wmorgan-sup@masanjin.net (William Morgan)
6468 Date: Mon, 15 Jun 2009 12:17:20 -0700
6469 Subject: [sup-talk] Crash after sending a message
6470 In-Reply-To: <1245092885-sup-1794@altis>
6471 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6472 <1245084718-sup-1647@entry> <1245092885-sup-1794@altis>
6473 Message-ID: <1245093278-sup-4366@entry>
6474
6475 Reformatted excerpts from Guillaume Quintard's message of 2009-06-15:
6476 > Still have it here, arg., with next.
6477
6478 You probably still have broken lines in your sent.mbox. This fix only
6479 works for new messages, so you'll have to edit sent.mbox by hand. Look
6480 for "From " lines that have a localized timestamp in them, and change
6481 them to something that Time.parse can parse. It's probably possible to
6482 write a script to do this if you have a large number of htem.
6483 --
6484 William <wmorgan-sup at masanjin.net>
6485
6486 From wmorgan-sup@masanjin.net Mon Jun 15 15:18:28 2009
6487 From: wmorgan-sup@masanjin.net (William Morgan)
6488 Date: Mon, 15 Jun 2009 12:18:28 -0700
6489 Subject: [sup-talk] [BUG] Can't handle spaces in paths
6490 In-Reply-To: <80055d7c0906151147h826d5beg7e5c56092149cd54@mail.gmail.com>
6491 References: <80055d7c0906151147h826d5beg7e5c56092149cd54@mail.gmail.com>
6492 Message-ID: <1245093476-sup-4708@entry>
6493
6494 Reformatted excerpts from Andrei Thorp's message of 2009-06-15:
6495 > I just downloaded a whole lot of mail from my gmail account via
6496 > offlineimap, and tried to add a source with a space. In short, sup
6497 > doesn't like this. It tries to do a split somewhere and it doesn't
6498 > work out for it so well :)
6499
6500 Try putting a %20 instead of a space. A sad consequence of using URIs to
6501 specify sources.
6502 --
6503 William <wmorgan-sup at masanjin.net>
6504
6505 From garoth@gmail.com Mon Jun 15 15:44:13 2009
6506 From: garoth@gmail.com (Andrei Thorp)
6507 Date: Mon, 15 Jun 2009 15:44:13 -0400
6508 Subject: [sup-talk] Yet Another Offlineimap Thread (YAOT)
6509 Message-ID: <80055d7c0906151244y1d66a4b1g8df4e3aa1d544c4f@mail.gmail.com>
6510
6511 Hello!
6512
6513 So I decided today to finally jump in and try to use sup for my main
6514 gmail account and not just my work stuff. I've set up offlineimap and
6515 downloaded the mail that I care for. Questions:
6516
6517 - Does imap support a way to say which mails have been read and not?
6518 I think it probably does. If this is the case, can sup-sync-back
6519 somehow do this? It'd be nice if my gmail understood when a mail has
6520 been read, so when I sync back up with offlineimap, it's all savvy.
6521 - I vaguely saw some tricks here for how to reply with different
6522 e-mail addresses and stuff. I'd like to execute a whole different
6523 command when replying in some situations, so that my mail gets sent
6524 through gmail's smtp server instead of my work's one, for example. How
6525 would I achieve this?
6526 - I don't see a daemon mode for offlineimap. I guess the expected
6527 usage is to make it quiet and put it in a cron/regular script? Am I
6528 correct?
6529
6530 Thanks!
6531
6532 -AT
6533
6534 From guillaume.quintard@gmail.com Mon Jun 15 17:30:13 2009
6535 From: guillaume.quintard@gmail.com (Guillaume Quintard)
6536 Date: Mon, 15 Jun 2009 23:30:13 +0200
6537 Subject: [sup-talk] Crash after sending a message
6538 In-Reply-To: <1245093278-sup-4366@entry>
6539 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6540 <1245084718-sup-1647@entry> <1245092885-sup-1794@altis>
6541 <1245093278-sup-4366@entry>
6542 Message-ID: <1245101169-sup-9937@altis>
6543
6544 Excerpts from William Morgan's message of Mon Jun 15 21:17:20 +0200 2009:
6545 > You probably still have broken lines in your sent.mbox. This fix only
6546 > works for new messages, so you'll have to edit sent.mbox by hand. Look
6547 > for "From " lines that have a localized timestamp in them, and change
6548 > them to something that Time.parse can parse. It's probably possible to
6549 > write a script to do this if you have a large number of htem.
6550
6551 I think I said "save them in the mbox" to sup-config, and I still get
6552 that behaviour, so what? Do I dig in the 3.2Go .mbox (please, not that one),
6553 do I change to "save in sup://sent"? BTW, I renamed my sent.mbox, just
6554 in case.
6555
6556 If I really have to go into the huge mbox, what should I look for
6557 exactly, I didn't quite get what the parser failed on.
6558
6559 Regards
6560
6561 --
6562 Guillaume
6563
6564 From garoth@gmail.com Mon Jun 15 21:14:14 2009
6565 From: garoth@gmail.com (Andrei Thorp)
6566 Date: Mon, 15 Jun 2009 18:14:14 -0700
6567 Subject: [sup-talk] [BUG] Sup Overload
6568 In-Reply-To: <a412e2a70906151410w307c2f1fnbaf51ea43cc8121f@mail.gmail.com>
6569 References: <80055d7c0906151145r493c07c2h7a68d776f49ce91a@mail.gmail.com>
6570 <a412e2a70906151410w307c2f1fnbaf51ea43cc8121f@mail.gmail.com>
6571 Message-ID: <80055d7c0906151814u2ab0fdf4n76144e27517870c8@mail.gmail.com>
6572
6573 Forwarding to mailing list.
6574
6575 ---------- Forwarded message ----------
6576 From: Mark Alexander <marka at pobox.com>
6577 Date: Mon, Jun 15, 2009 at 2:10 PM
6578 Subject: Re: [sup-talk] [BUG] Sup Overload
6579 To: Andrei Thorp <garoth at gmail.com>
6580
6581 This may not be related, but at one point I found that feeding
6582 input characters to sup too quickly caused it to crash. ?I was using
6583 X cut-and-paste as a kind of poor-man's macro facility when I ran
6584 into this. ?If I recall correctly, the string I was cut-and-pasting into
6585 sup was this:
6586
6587 ? T=N=a$
6588
6589 which was supposed to tag all messages, mark them as read, and archive
6590 them. ?I think it was crashing when it got to the "$", but it might
6591 have been the "a" that did it. ?I haven't tried this in a while.
6592
6593 From wmorgan-sup@masanjin.net Mon Jun 15 22:18:05 2009
6594 From: wmorgan-sup@masanjin.net (William Morgan)
6595 Date: Mon, 15 Jun 2009 19:18:05 -0700
6596 Subject: [sup-talk] Crash after sending a message
6597 In-Reply-To: <1245101169-sup-9937@altis>
6598 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6599 <1245084718-sup-1647@entry> <1245092885-sup-1794@altis>
6600 <1245093278-sup-4366@entry> <1245101169-sup-9937@altis>
6601 Message-ID: <1245118534-sup-3523@entry>
6602
6603 Reformatted excerpts from Guillaume Quintard's message of 2009-06-15:
6604 > I think I said "save them in the mbox" to sup-config, and I still get
6605 > that behaviour, so what? Do I dig in the 3.2Go .mbox (please, not that
6606 > one), do I change to "save in sup://sent"? BTW, I renamed my
6607 > sent.mbox, just in case.
6608
6609 If you're seeing that error, you should edit the "From " lines in your
6610 sent.mbox file (which is presumably not the 3.2g one).
6611
6612 You'll see something like:
6613 From guillaume.quintard at gmail.com <date>
6614
6615 And a couple recent messages (i.e. at the bottom of the file) will have
6616 a <date> that's been localized to your locale. That's what has to
6617 change.
6618 --
6619 William <wmorgan-sup at masanjin.net>
6620
6621 From guillaume.quintard@gmail.com Tue Jun 16 04:06:48 2009
6622 From: guillaume.quintard@gmail.com (Guillaume Quintard)
6623 Date: Tue, 16 Jun 2009 10:06:48 +0200
6624 Subject: [sup-talk] Crash after sending a message
6625 In-Reply-To: <1245118534-sup-3523@entry>
6626 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6627 <1245084718-sup-1647@entry> <1245092885-sup-1794@altis>
6628 <1245093278-sup-4366@entry> <1245101169-sup-9937@altis>
6629 <1245118534-sup-3523@entry>
6630 Message-ID: <1245139562-sup-3587@altis>
6631
6632 Excerpts from William Morgan's message of Tue Jun 16 04:18:05 +0200 2009:
6633 > If you're seeing that error, you should edit the "From " lines in your
6634 > sent.mbox file (which is presumably not the 3.2g one).
6635 >
6636 > You'll see something like:
6637 > From guillaume.quintard at gmail.com <date>
6638 >
6639 > And a couple recent messages (i.e. at the bottom of the file) will have
6640 > a <date> that's been localized to your locale. That's what has to
6641 > change.
6642
6643 So, I grep'ed "save them in the mbox" from the big mbox, and from
6644 sent.mbox, logically, I should have found 2 occurences, one in my mail,
6645 one in yours, but found only one :-(.
6646
6647 I re-ran sup-config, told it to save in "sent", and that seems better.
6648 But I still don't know where the few messages sent during that time are.
6649 Plus, I sent a mail to one of my alternate addresses, and it popped up
6650 in the mailbox, without the "Sent" label, is that expected?
6651
6652 --
6653 Guillaume
6654
6655 From bwalton@artsci.utoronto.ca Tue Jun 16 07:20:41 2009
6656 From: bwalton@artsci.utoronto.ca (Ben Walton)
6657 Date: Tue, 16 Jun 2009 07:20:41 -0400
6658 Subject: [sup-talk] Crash after sending a message
6659 In-Reply-To: <1245139562-sup-3587@altis>
6660 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6661 <1245084718-sup-1647@entry> <1245092885-sup-1794@altis>
6662 <1245093278-sup-4366@entry> <1245101169-sup-9937@altis>
6663 <1245118534-sup-3523@entry> <1245139562-sup-3587@altis>
6664 Message-ID: <1245150910-sup-3911@ntdws12.chass.utoronto.ca>
6665
6666 Excerpts from Guillaume Quintard's message of Tue Jun 16 04:06:48 -0400 2009:
6667
6668 Hi Guillaume,
6669
6670 > I re-ran sup-config, told it to save in "sent", and that seems better.
6671 > But I still don't know where the few messages sent during that time are.
6672 > Plus, I sent a mail to one of my alternate addresses, and it popped up
6673 > in the mailbox, without the "Sent" label, is that expected?
6674
6675 The patch that allows for using any (most) sources as the outbox
6676 changed the way the sent label gets applied. When the message is
6677 polled, the label 'sent' is applied iff the source of the message
6678 matches the source uri in config.yaml. The default sent source
6679 (outbox) is sup://sent, which translates to $SUB_BASE/sent.mbox
6680 (normally ~/.sup/sent).
6681
6682 The other small behaviour change that this introduced was that
6683 depending on poll intervals, sent messages may not be immediately
6684 added to the index, but instead are picked up on the next run...I see
6685 this with my Maildir outbox. The source used as the outbox is logged
6686 at startup, although if you've restarted sup, that log is lost to you
6687 now...
6688
6689 HTH
6690 -Ben
6691 --
6692 Ben Walton
6693 Systems Programmer - CHASS
6694 University of Toronto
6695 C:416.407.5610 | W:416.978.4302
6696
6697 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
6698 Contact me to arrange for a CAcert assurance meeting.
6699 -------------- next part --------------
6700 A non-text attachment was scrubbed...
6701 Name: signature.asc
6702 Type: application/pgp-signature
6703 Size: 189 bytes
6704 Desc: not available
6705 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090616/b648e879/attachment.bin>
6706
6707 From guillaume.quintard@gmail.com Tue Jun 16 07:52:35 2009
6708 From: guillaume.quintard@gmail.com (Guillaume Quintard)
6709 Date: Tue, 16 Jun 2009 13:52:35 +0200
6710 Subject: [sup-talk] Crash after sending a message
6711 In-Reply-To: <1245150910-sup-3911@ntdws12.chass.utoronto.ca>
6712 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6713 <1245084718-sup-1647@entry> <1245092885-sup-1794@altis>
6714 <1245093278-sup-4366@entry> <1245101169-sup-9937@altis>
6715 <1245118534-sup-3523@entry> <1245139562-sup-3587@altis>
6716 <1245150910-sup-3911@ntdws12.chass.utoronto.ca>
6717 Message-ID: <1245152881-sup-3661@altis>
6718
6719 Excerpts from Ben Walton's message of Tue Jun 16 13:20:41 +0200 2009:
6720 > The patch that allows for using any (most) sources as the outbox
6721 > changed the way the sent label gets applied. When the message is
6722 > polled, the label 'sent' is applied iff the source of the message
6723 > matches the source uri in config.yaml. The default sent source
6724 > (outbox) is sup://sent, which translates to $SUB_BASE/sent.mbox
6725 > (normally ~/.sup/sent).
6726
6727 Well, it seems it's not the case, sent messages pop up in the mailbox
6728 without the sent label, last message got this:
6729 "From guillaume.quintard at gmail.com Tue Jun 16 13:47:26 +0200 2009"
6730 as a first line, and it's my main address, yet no label.
6731
6732 Am I misunderstanding something?
6733
6734 --
6735 Guillaume
6736
6737 From marcus-sup@bar-coded.net Tue Jun 16 08:42:08 2009
6738 From: marcus-sup@bar-coded.net (Marcus Williams)
6739 Date: Tue, 16 Jun 2009 13:42:08 +0100
6740 Subject: [sup-talk] [PATCH] Alternative View
6741 Message-ID: <1245156068-sup-7360@tomsk>
6742
6743 Adds a keypress to toggle to an alternative view in thread index mode.
6744 By default this removes the date, authors and number of threads from the
6745 view leaving more room for labels/snippets
6746
6747 This view is extendable via the alternative-view-widget hook. An example
6748 hook is included in the contrib/hooks directory that implements the
6749 standard sup view as an example. If you use this example your
6750 alternative view will not look any different to the standard sup view.
6751 It is meant to give you a base point for your edits.
6752 ---
6753 contrib/hooks/alternate-view-widget.rb | 39 ++++++++++++++++++++++
6754 lib/sup/modes/thread-index-mode.rb | 56 ++++++++++++++++++-------------
6755 2 files changed, 71 insertions(+), 24 deletions(-)
6756 create mode 100644 contrib/hooks/alternate-view-widget.rb
6757
6758 diff --git a/contrib/hooks/alternate-view-widget.rb b/contrib/hooks/alternate-view-widget.rb
6759 new file mode 100644
6760 index 0000000..cf936fd
6761 --- /dev/null
6762 +++ b/contrib/hooks/alternate-view-widget.rb
6763 @@ -0,0 +1,39 @@
6764 +# This hook recreates the standard sup view as the alternate view
6765 +# Note that this will mean there is no difference when toggling
6766 +# between the standard and alternate views in sup. This is meant to
6767 +# serve as a starting point for your own view
6768 +
6769 +date_width = Time::TO_NICE_S_MAX_LEN
6770 +date = thread.date.to_nice_s
6771 +starred = thread.has_label? :starred
6772 +
6773 +dp = thread.direct_participants.any? { |p| AccountManager.is_account? p }
6774 +p = dp || thread.participants.any? { |p| AccountManager.is_account? p }
6775 +
6776 +snippet = thread.snippet + (thread.snippet.empty? ? "" : "...")
6777 +
6778 +subj_color =
6779 + if thread.has_label?(:draft)
6780 + :index_draft_color
6781 + elsif thread.has_label?(:unread)
6782 + :index_new_color
6783 + elsif starred
6784 + :index_starred_color
6785 + else
6786 + :index_old_color
6787 + end
6788 +
6789 +[
6790 + [:tagged_color, tagged ? ">" : " "],
6791 + [:none, sprintf("%#{date_width}s", date)],
6792 + (starred ? [:starred_color, "*"] : [:none, " "]),
6793 +] + from +
6794 +[
6795 + [subj_color, size_widget_text],
6796 + [:to_me_color, thread.labels.member?(:attachment) ? "@" : " "],
6797 + [:to_me_color, dp ? ">" : (p ? '+' : " ")],
6798 +] + (thread.labels - hidden_labels).map { |label| [:label_color, "#{label} "] } +
6799 +[
6800 + [subj_color, thread.subj + (thread.subj.empty? ? "" : " ")],
6801 + [:snippet_color, snippet],
6802 +]
6803 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
6804 index 5fa4f4c..9124dbd 100644
6805 --- a/lib/sup/modes/thread-index-mode.rb
6806 +++ b/lib/sup/modes/thread-index-mode.rb
6807 @@ -8,6 +8,15 @@ class ThreadIndexMode < LineCursorMode
6808 MIN_FROM_WIDTH = 15
6809 LOAD_MORE_THREAD_NUM = 20
6810
6811 + HookManager.register "alternate-view-widget", <<EOS
6812 +Generates the per-thread view for each thread.
6813 +Variables:
6814 + thread: The message thread to be formatted.
6815 + hidden_labels: the hidden label list
6816 + tagged: true if this thread is tagged
6817 + from: the sup default from/author list
6818 + size_widget_text: the size widget text (from hook or default sup size)
6819 +EOS
6820 HookManager.register "index-mode-size-widget", <<EOS
6821 Generates the per-thread size widget for each thread.
6822 Variables:
6823 @@ -45,7 +54,7 @@ EOS
6824 k.add :apply_to_tagged, "Apply next command to all tagged threads", '+', '='
6825 k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
6826 k.add :undo, "Undo the previous action", 'u'
6827 - k.add :toggle_minimalist, "Toggle minimalist view", '~'
6828 + k.add :toggle_alternative_view, "Toggle alternative view", '~'
6829 end
6830
6831 def initialize hidden_labels=[], load_thread_opts={}
6832 @@ -63,7 +72,7 @@ EOS
6833 @hidden_labels = hidden_labels + LabelManager::HIDDEN_RESERVED_LABELS
6834 @date_width = DATE_WIDTH
6835
6836 - @minimal = false
6837 + @alternative = false
6838
6839 @interrupt_search = false
6840
6841 @@ -264,8 +273,8 @@ EOS
6842 end
6843 end
6844
6845 - def toggle_minimalist
6846 - @minimal = !@minimal
6847 + def toggle_alternative_view
6848 + @alternative= !@alternative
6849 regen_text
6850 end
6851
6852 @@ -841,26 +850,8 @@ protected
6853
6854 size_widget_text = sprintf "%#{ @size_widget_width}s", size_widget
6855
6856 -
6857 - if @minimal
6858 - if size_widget!=""
6859 - size_widget_text = "+"
6860 - else
6861 - size_widget_text = " "
6862 - end
6863 - line = []
6864 - else
6865 - line = [
6866 - [:tagged_color, @tags.tagged?(t) ? ">" : " "],
6867 - [:none, sprintf("%#{@date_width}s", date)],
6868 - (starred ? [:starred_color, "*"] : [:none, " "]),
6869 - ] + from
6870 - end
6871 -
6872 -
6873 - line +
6874 - [
6875 - [subj_color, size_widget_text],
6876 + alternateView = [
6877 + [subj_color, @alternative?(size_widget!=""?"+":" "):size_widget_text],
6878 [:to_me_color, t.labels.member?(:attachment) ? "@" : " "],
6879 [:to_me_color, dp ? ">" : (p ? '+' : " ")],
6880 ] +
6881 @@ -869,6 +860,23 @@ protected
6882 [subj_color, t.subj + (t.subj.empty? ? "" : " ")],
6883 [:snippet_color, snippet],
6884 ]
6885 +
6886 + defaultView = [
6887 + [:tagged_color, @tags.tagged?(t) ? ">" : " "],
6888 + [:none, sprintf("%#{@date_width}s", date)],
6889 + (starred ? [:starred_color, "*"] : [:none, " "]),
6890 + ] + from + alternateView
6891 +
6892 + alternateView = [
6893 + [:tagged_color, @tags.tagged?(t) ? ">" : " "],
6894 + ] + alternateView
6895 +
6896 +
6897 + if @alternative
6898 + HookManager.run("alternate-view-widget", :thread => t, :hidden_labels => @hidden_labels, :tagged => @tags.tagged?(t)?true:false, :from => from, :size_widget_text => size_widget_text) || alternateView
6899 + else
6900 + defaultView
6901 + end
6902 end
6903
6904 def dirty?; @mutex.synchronize { (@hidden_threads.keys + @threads).any? { |t| t.dirty? } } end
6905 --
6906 1.5.4.1
6907
6908 From marcus-sup@bar-coded.net Tue Jun 16 08:45:06 2009
6909 From: marcus-sup@bar-coded.net (Marcus Williams)
6910 Date: Tue, 16 Jun 2009 13:45:06 +0100
6911 Subject: [sup-talk] [PATCH] Minimalist view
6912 In-Reply-To: <1245073371-sup-3704@entry>
6913 References: <1244839497-sup-547@tomsk>
6914 <1244943297-sup-5509@ntdws12.chass.utoronto.ca>
6915 <1245073371-sup-3704@entry>
6916 Message-ID: <1245156233-sup-6049@tomsk>
6917
6918 On 15.6.2009, William Morgan wrote:
6919 > Yeah, I would generally like to have this type of thing done through
6920 > hooks, but if a lot of people like this mode then I could integrate it
6921 > directly.
6922
6923 New patch sent as separate message - renamed to alternative view and
6924 extendable via the hook mechanism.
6925
6926 Marcus
6927
6928 From bwalton@artsci.utoronto.ca Tue Jun 16 12:34:40 2009
6929 From: bwalton@artsci.utoronto.ca (Ben Walton)
6930 Date: Tue, 16 Jun 2009 12:34:40 -0400
6931 Subject: [sup-talk] Crash after sending a message
6932 In-Reply-To: <1245152881-sup-3661@altis>
6933 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
6934 <1245084718-sup-1647@entry> <1245092885-sup-1794@altis>
6935 <1245093278-sup-4366@entry> <1245101169-sup-9937@altis>
6936 <1245118534-sup-3523@entry> <1245139562-sup-3587@altis>
6937 <1245150910-sup-3911@ntdws12.chass.utoronto.ca>
6938 <1245152881-sup-3661@altis>
6939 Message-ID: <1245170025-sup-1339@ntdws12.chass.utoronto.ca>
6940
6941 Excerpts from Guillaume Quintard's message of Tue Jun 16 07:52:35 -0400 2009:
6942 > Well, it seems it's not the case, sent messages pop up in the mailbox
6943 > without the sent label, last message got this:
6944 > "From guillaume.quintard at gmail.com Tue Jun 16 13:47:26 +0200 2009"
6945 > as a first line, and it's my main address, yet no label.
6946
6947 The sent label is filtered from the inbox view. Try searching for
6948 sent mail with the search term: label:sent
6949
6950 > Am I misunderstanding something?
6951
6952 Maybe, but I may be misunderstanding too...
6953
6954 -Ben
6955
6956 --
6957 Ben Walton
6958 Systems Programmer - CHASS
6959 University of Toronto
6960 C:416.407.5610 | W:416.978.4302
6961
6962 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
6963 Contact me to arrange for a CAcert assurance meeting.
6964 -------------- next part --------------
6965 A non-text attachment was scrubbed...
6966 Name: signature.asc
6967 Type: application/pgp-signature
6968 Size: 189 bytes
6969 Desc: not available
6970 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090616/61ef63d0/attachment.bin>
6971
6972 From rlane@club.cc.cmu.edu Tue Jun 16 20:24:58 2009
6973 From: rlane@club.cc.cmu.edu (Rich Lane)
6974 Date: Tue, 16 Jun 2009 17:24:58 -0700
6975 Subject: [sup-talk] [PATCH] index: cleanup interface
6976 Message-ID: <1245198299-18742-1-git-send-email-rlane@club.cc.cmu.edu>
6977
6978 Added the public methods 'each_docid', 'each_message', and 'optimize' to the
6979 index. Removed the 'index' and 'ferret' accessors and modified their callers to
6980 use the new methods. Bonus fixes: sup-dump no longer skips the first message
6981 and sup_sync --start_at can now delete unseen messages.
6982 ---
6983 bin/sup-dump | 6 ++----
6984 bin/sup-sync | 21 +++++++--------------
6985 bin/sup-tweak-labels | 2 +-
6986 lib/sup/index.rb | 27 ++++++++++++++++++++-------
6987 4 files changed, 30 insertions(+), 26 deletions(-)
6988
6989 diff --git a/bin/sup-dump b/bin/sup-dump
6990 index 29f6d6e..9b0892e 100755
6991 --- a/bin/sup-dump
6992 +++ b/bin/sup-dump
6993 @@ -24,8 +24,6 @@ end
6994 index = Redwood::Index.new
6995 index.load
6996
6997 -(1 ... index.index.reader.max_doc).each do |i|
6998 - next if index.index.deleted? i
6999 - d = index.index[i]
7000 - puts [d[:message_id], "(" + d[:label] + ")"] * " "
7001 +index.each_message do |m|
7002 + puts "#{m.id} (#{m.labels * ' '})"
7003 end
7004 diff --git a/bin/sup-sync b/bin/sup-sync
7005 index 9c342d2..a6e3478 100755
7006 --- a/bin/sup-sync
7007 +++ b/bin/sup-sync
7008 @@ -208,24 +208,17 @@ begin
7009
7010 ## delete any messages in the index that claim they're from one of
7011 ## these sources, but that we didn't see.
7012 - ##
7013 - ## kinda crappy code here, because we delve directly into the Ferret
7014 - ## API.
7015 - ##
7016 - ## TODO: move this to Index, i suppose.
7017 - if (target == :all || target == :changed) && !opts[:start_at]
7018 + if (target == :all || target == :changed)
7019 $stderr.puts "Deleting missing messages from the index..."
7020 num_del, num_scanned = 0, 0
7021 sources.each do |source|
7022 raise "no source id for #{source}" unless source.id
7023 - q = "+source_id:#{source.id}"
7024 - q += " +source_info: >= #{opts[:start_at]}" if opts[:start_at]
7025 - index.index.search_each(q, :limit => :all) do |docid, score|
7026 + index.each_message :source_id => source.id do |m|
7027 num_scanned += 1
7028 - mid = index.index[docid][:message_id]
7029 - unless seen[mid]
7030 - puts "Deleting #{mid}" if opts[:verbose]
7031 - index.index.delete docid unless opts[:dry_run]
7032 + unless seen[m.id]
7033 + next unless m.source_info >= opts[:start_at] if opts[:start_at]
7034 + puts "Deleting #{m.id}" if opts[:verbose]
7035 + index.drop_entry m.id unless opts[:dry_run]
7036 num_del += 1
7037 end
7038 end
7039 @@ -237,7 +230,7 @@ begin
7040
7041 if opts[:optimize]
7042 $stderr.puts "Optimizing index..."
7043 - optt = time { index.index.optimize unless opts[:dry_run] }
7044 + optt = time { index.optimize unless opts[:dry_run] }
7045 $stderr.puts "Optimized index of size #{index.size} in #{optt}s."
7046 end
7047 rescue Redwood::FatalSourceError => e
7048 diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
7049 index 538db8b..f526a95 100755
7050 --- a/bin/sup-tweak-labels
7051 +++ b/bin/sup-tweak-labels
7052 @@ -118,7 +118,7 @@ begin
7053
7054 unless num_changed == 0
7055 $stderr.puts "Optimizing index..."
7056 - index.ferret.optimize unless opts[:dry_run]
7057 + index.optimize unless opts[:dry_run]
7058 end
7059
7060 rescue Exception => e
7061 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
7062 index ca01ee7..037b941 100644
7063 --- a/lib/sup/index.rb
7064 +++ b/lib/sup/index.rb
7065 @@ -24,11 +24,6 @@ class Index
7066
7067 include Singleton
7068
7069 - ## these two accessors should ONLY be used by single-threaded programs.
7070 - ## otherwise you will have a naughty ferret on your hands.
7071 - attr_reader :index
7072 - alias ferret index
7073 -
7074 def initialize dir=BASE_DIR
7075 @index_mutex = Monitor.new
7076
7077 @@ -151,7 +146,7 @@ EOS
7078 if File.exists? dir
7079 Redwood::log "loading index..."
7080 @index_mutex.synchronize do
7081 - @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer)
7082 + @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer, :id_field => 'message_id')
7083 Redwood::log "loaded index of #{@index.size} messages"
7084 end
7085 else
7086 @@ -171,7 +166,7 @@ EOS
7087 field_infos.add_field :refs
7088 field_infos.add_field :snippet, :index => :no, :term_vector => :no
7089 field_infos.create_index dir
7090 - @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer)
7091 + @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer, :id_field => 'message_id')
7092 end
7093 end
7094 end
7095 @@ -496,6 +491,22 @@ EOS
7096 results.hits.map { |hit| hit.doc }
7097 end
7098
7099 + def each_docid opts={}
7100 + query = build_query opts
7101 + results = @index_mutex.synchronize { @index.search query, :limit => (opts[:limit] || :all) }
7102 + results.hits.map { |hit| yield hit.doc }
7103 + end
7104 +
7105 + def each_message opts={}
7106 + each_docid opts do |docid|
7107 + yield build_message(docid)
7108 + end
7109 + end
7110 +
7111 + def optimize
7112 + @index_mutex.synchronize { @index.optimize }
7113 + end
7114 +
7115 protected
7116
7117 class ParseError < StandardError; end
7118 @@ -621,6 +632,8 @@ protected
7119 query.add_query Ferret::Search::TermQuery.new("label", "spam"), :must_not unless opts[:load_spam] || labels.include?(:spam)
7120 query.add_query Ferret::Search::TermQuery.new("label", "deleted"), :must_not unless opts[:load_deleted] || labels.include?(:deleted)
7121 query.add_query Ferret::Search::TermQuery.new("label", "killed"), :must_not if opts[:skip_killed]
7122 +
7123 + query.add_query Ferret::Search::TermQuery.new("source_id", opts[:source_id]), :must if opts[:source_id]
7124 query
7125 end
7126
7127 --
7128 1.6.0.4
7129
7130
7131 From rlane@club.cc.cmu.edu Tue Jun 16 20:24:59 2009
7132 From: rlane@club.cc.cmu.edu (Rich Lane)
7133 Date: Tue, 16 Jun 2009 17:24:59 -0700
7134 Subject: [sup-talk] [PATCH] index: consistent naming
7135 In-Reply-To: <1245198299-18742-1-git-send-email-rlane@club.cc.cmu.edu>
7136 References: <1245198299-18742-1-git-send-email-rlane@club.cc.cmu.edu>
7137 Message-ID: <1245198299-18742-2-git-send-email-rlane@club.cc.cmu.edu>
7138
7139 Replaced use of run_query with each_docid
7140 Rename instances of ferret query objects to 'ferret_query'
7141 Rename 'build_query' to 'build_ferret_query'
7142 Rename hashes passed to index methods to 'query'
7143 Rename 'parse_user_query_string' to 'parse_query'
7144 Change 'parse_query' to return a query hash
7145 Rename 'drop_entry' to 'delete' and modify callers to pass msgid
7146 ---
7147 bin/sup-sync | 2 +-
7148 bin/sup-tweak-labels | 4 +-
7149 lib/sup/draft.rb | 2 +-
7150 lib/sup/index.rb | 108 +++++++++++++++------------------
7151 lib/sup/modes/search-results-mode.rb | 20 +++----
7152 5 files changed, 63 insertions(+), 73 deletions(-)
7153
7154 diff --git a/bin/sup-sync b/bin/sup-sync
7155 index a6e3478..a759cbe 100755
7156 --- a/bin/sup-sync
7157 +++ b/bin/sup-sync
7158 @@ -218,7 +218,7 @@ begin
7159 unless seen[m.id]
7160 next unless m.source_info >= opts[:start_at] if opts[:start_at]
7161 puts "Deleting #{m.id}" if opts[:verbose]
7162 - index.drop_entry m.id unless opts[:dry_run]
7163 + index.delete m.id unless opts[:dry_run]
7164 num_del += 1
7165 end
7166 end
7167 diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
7168 index f526a95..6f603e2 100755
7169 --- a/bin/sup-tweak-labels
7170 +++ b/bin/sup-tweak-labels
7171 @@ -2,6 +2,7 @@
7172
7173 require 'rubygems'
7174 require 'trollop'
7175 +require 'enumerator'
7176 require "sup"
7177
7178 class Float
7179 @@ -81,7 +82,8 @@ begin
7180 end
7181 query += ' ' + opts[:query] if opts[:query]
7182
7183 - docs = Redwood::Index.run_query query
7184 + parsed_query = index.parse_query query
7185 + docs = Enumerable::Enumerator.new(index, :each_docid, parsed_query).map
7186 num_total = docs.size
7187
7188 $stderr.puts "Found #{num_total} documents across #{source_ids.length} sources. Scanning..."
7189 diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb
7190 index 32266b5..9127739 100644
7191 --- a/lib/sup/draft.rb
7192 +++ b/lib/sup/draft.rb
7193 @@ -37,7 +37,7 @@ class DraftManager
7194 return
7195 end
7196 raise ArgumentError, "not a draft: source id #{entry[:source_id].inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect} / docno #{docid}" unless entry[:source_id].to_i == DraftManager.source_id
7197 - Index.drop_entry docid
7198 + Index.delete m.id
7199 File.delete @source.fn_for_offset(entry[:source_info])
7200 UpdateManager.relay self, :single_message_deleted, m
7201 end
7202 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
7203 index 037b941..d15e7bb 100644
7204 --- a/lib/sup/index.rb
7205 +++ b/lib/sup/index.rb
7206 @@ -279,28 +279,28 @@ EOS
7207 ## you should probably not call this on a block that doesn't break
7208 ## rather quickly because the results can be very large.
7209 EACH_BY_DATE_NUM = 100
7210 - def each_id_by_date opts={}
7211 + def each_id_by_date query={}
7212 return if empty? # otherwise ferret barfs ###TODO: remove this once my ferret patch is accepted
7213 - query = build_query opts
7214 + ferret_query = build_ferret_query query
7215 offset = 0
7216 while true
7217 - limit = (opts[:limit])? [EACH_BY_DATE_NUM, opts[:limit] - offset].min : EACH_BY_DATE_NUM
7218 - results = @index_mutex.synchronize { @index.search query, :sort => "date DESC", :limit => limit, :offset => offset }
7219 - Redwood::log "got #{results.total_hits} results for query (offset #{offset}) #{query.inspect}"
7220 + limit = (query[:limit])? [EACH_BY_DATE_NUM, query[:limit] - offset].min : EACH_BY_DATE_NUM
7221 + results = @index_mutex.synchronize { @index.search ferret_query, :sort => "date DESC", :limit => limit, :offset => offset }
7222 + Redwood::log "got #{results.total_hits} results for query (offset #{offset}) #{ferret_query.inspect}"
7223 results.hits.each do |hit|
7224 yield @index_mutex.synchronize { @index[hit.doc][:message_id] }, lambda { build_message hit.doc }
7225 end
7226 - break if opts[:limit] and offset >= opts[:limit] - limit
7227 + break if query[:limit] and offset >= query[:limit] - limit
7228 break if offset >= results.total_hits - limit
7229 offset += limit
7230 end
7231 end
7232
7233 - def num_results_for opts={}
7234 + def num_results_for query={}
7235 return 0 if empty? # otherwise ferret barfs ###TODO: remove this once my ferret patch is accepted
7236
7237 - q = build_query opts
7238 - @index_mutex.synchronize { @index.search(q, :limit => 1).total_hits }
7239 + ferret_query = build_ferret_query query
7240 + @index_mutex.synchronize { @index.search(ferret_query, :limit => 1).total_hits }
7241 end
7242
7243 ## yield all messages in the thread containing 'm' by repeatedly
7244 @@ -313,7 +313,7 @@ EOS
7245 ## is found.
7246 SAME_SUBJECT_DATE_LIMIT = 7
7247 MAX_CLAUSES = 1000
7248 - def each_message_in_thread_for m, opts={}
7249 + def each_message_in_thread_for m, query={}
7250 #Redwood::log "Building thread for #{m.id}: #{m.subj}"
7251 messages = {}
7252 searched = {}
7253 @@ -332,7 +332,7 @@ EOS
7254 q.add_query sq, :must
7255 q.add_query Ferret::Search::RangeQuery.new(:date, :>= => date_min.to_indexable_s, :<= => date_max.to_indexable_s), :must
7256
7257 - q = build_query :qobj => q
7258 + q = build_ferret_query :qobj => q
7259
7260 p1 = @index_mutex.synchronize { @index.search(q).hits.map { |hit| @index[hit.doc][:message_id] } }
7261 Redwood::log "found #{p1.size} results for subject query #{q}"
7262 @@ -343,7 +343,7 @@ EOS
7263 pending = (pending + p1 + p2).uniq
7264 end
7265
7266 - until pending.empty? || (opts[:limit] && messages.size >= opts[:limit])
7267 + until pending.empty? || (query[:limit] && messages.size >= query[:limit])
7268 q = Ferret::Search::BooleanQuery.new true
7269 # this disappeared in newer ferrets... wtf.
7270 # q.max_clause_count = 2048
7271 @@ -356,14 +356,14 @@ EOS
7272 end
7273 pending = pending[lim .. -1]
7274
7275 - q = build_query :qobj => q
7276 + q = build_ferret_query :qobj => q
7277
7278 num_queries += 1
7279 killed = false
7280 @index_mutex.synchronize do
7281 @index.search_each(q, :limit => :all) do |docid, score|
7282 - break if opts[:limit] && messages.size >= opts[:limit]
7283 - if @index[docid][:label].split(/\s+/).include?("killed") && opts[:skip_killed]
7284 + break if query[:limit] && messages.size >= query[:limit]
7285 + if @index[docid][:label].split(/\s+/).include?("killed") && query[:skip_killed]
7286 killed = true
7287 break
7288 end
7289 @@ -419,7 +419,7 @@ EOS
7290 def wrap_subj subj; "__START_SUBJECT__ #{subj} __END_SUBJECT__"; end
7291 def unwrap_subj subj; subj =~ /__START_SUBJECT__ (.*?) __END_SUBJECT__/ && $1; end
7292
7293 - def drop_entry docno; @index_mutex.synchronize { @index.delete docno } end
7294 + def delete id; @index_mutex.synchronize { @index.delete id } end
7295
7296 def load_entry_for_id mid
7297 @index_mutex.synchronize do
7298 @@ -478,27 +478,14 @@ EOS
7299 @index_mutex.synchronize { @index.search(q, :limit => 1).total_hits > 0 }
7300 end
7301
7302 - ## takes a user query string and returns the list of docids for messages
7303 - ## that match the query.
7304 - ##
7305 - ## messages can then be loaded from the index with #build_message.
7306 - ##
7307 - ## raises a ParseError if the parsing failed.
7308 - def run_query query
7309 - qobj, opts = Redwood::Index.parse_user_query_string query
7310 - query = Redwood::Index.build_query opts.merge(:qobj => qobj)
7311 - results = @index.search query, :limit => (opts[:limit] || :all)
7312 - results.hits.map { |hit| hit.doc }
7313 - end
7314 -
7315 - def each_docid opts={}
7316 - query = build_query opts
7317 - results = @index_mutex.synchronize { @index.search query, :limit => (opts[:limit] || :all) }
7318 + def each_docid query={}
7319 + ferret_query = build_ferret_query query
7320 + results = @index_mutex.synchronize { @index.search ferret_query, :limit => (query[:limit] || :all) }
7321 results.hits.map { |hit| yield hit.doc }
7322 end
7323
7324 - def each_message opts={}
7325 - each_docid opts do |docid|
7326 + def each_message query={}
7327 + each_docid query do |docid|
7328 yield build_message(docid)
7329 end
7330 end
7331 @@ -507,16 +494,15 @@ EOS
7332 @index_mutex.synchronize { @index.optimize }
7333 end
7334
7335 -protected
7336 -
7337 class ParseError < StandardError; end
7338
7339 - ## parse a query string from the user. returns a query object and a set of
7340 - ## extra flags; both of these are meant to be passed to #build_query.
7341 + ## parse a query string from the user. returns a query object
7342 + ## that can be passed to any index method with a 'query'
7343 + ## argument, as well as build_ferret_query.
7344 ##
7345 ## raises a ParseError if something went wrong.
7346 - def parse_user_query_string s
7347 - extraopts = {}
7348 + def parse_query s
7349 + query = {}
7350
7351 subs = s.gsub(/\b(to|from):(\S+)\b/) do
7352 field, name = $1, $2
7353 @@ -542,8 +528,8 @@ protected
7354 ## final stage of query processing. if the user wants to search spam
7355 ## messages, not adding that is the right thing; if he doesn't want to
7356 ## search spam messages, then not adding it won't have any effect.
7357 - extraopts[:load_spam] = true if subs =~ /\blabel:spam\b/
7358 - extraopts[:load_deleted] = true if subs =~ /\blabel:deleted\b/
7359 + query[:load_spam] = true if subs =~ /\blabel:spam\b/
7360 + query[:load_deleted] = true if subs =~ /\blabel:deleted\b/
7361
7362 ## gmail style "is" operator
7363 subs = subs.gsub(/\b(is|has):(\S+)\b/) do
7364 @@ -552,10 +538,10 @@ protected
7365 when "read"
7366 "-label:unread"
7367 when "spam"
7368 - extraopts[:load_spam] = true
7369 + query[:load_spam] = true
7370 "label:spam"
7371 when "deleted"
7372 - extraopts[:load_deleted] = true
7373 + query[:load_deleted] = true
7374 "label:deleted"
7375 else
7376 "label:#{$2}"
7377 @@ -601,7 +587,7 @@ protected
7378 subs = subs.gsub(/\blimit:(\S+)\b/) do
7379 lim = $1
7380 if lim =~ /^\d+$/
7381 - extraopts[:limit] = lim.to_i
7382 + query[:limit] = lim.to_i
7383 ''
7384 else
7385 raise ParseError, "non-numeric limit #{lim.inspect}"
7386 @@ -609,32 +595,36 @@ protected
7387 end
7388
7389 begin
7390 - [@qparser.parse(subs), extraopts]
7391 + query[:qobj] = @qparser.parse(subs)
7392 + query[:text] = s
7393 + query
7394 rescue Ferret::QueryParser::QueryParseException => e
7395 raise ParseError, e.message
7396 end
7397 end
7398
7399 - def build_query opts
7400 - query = Ferret::Search::BooleanQuery.new
7401 - query.add_query opts[:qobj], :must if opts[:qobj]
7402 - labels = ([opts[:label]] + (opts[:labels] || [])).compact
7403 - labels.each { |t| query.add_query Ferret::Search::TermQuery.new("label", t.to_s), :must }
7404 - if opts[:participants]
7405 +private
7406 +
7407 + def build_ferret_query query
7408 + q = Ferret::Search::BooleanQuery.new
7409 + q.add_query query[:qobj], :must if query[:qobj]
7410 + labels = ([query[:label]] + (query[:labels] || [])).compact
7411 + labels.each { |t| q.add_query Ferret::Search::TermQuery.new("label", t.to_s), :must }
7412 + if query[:participants]
7413 q2 = Ferret::Search::BooleanQuery.new
7414 - opts[:participants].each do |p|
7415 + query[:participants].each do |p|
7416 q2.add_query Ferret::Search::TermQuery.new("from", p.email), :should
7417 q2.add_query Ferret::Search::TermQuery.new("to", p.email), :should
7418 end
7419 - query.add_query q2, :must
7420 + q.add_query q2, :must
7421 end
7422
7423 - query.add_query Ferret::Search::TermQuery.new("label", "spam"), :must_not unless opts[:load_spam] || labels.include?(:spam)
7424 - query.add_query Ferret::Search::TermQuery.new("label", "deleted"), :must_not unless opts[:load_deleted] || labels.include?(:deleted)
7425 - query.add_query Ferret::Search::TermQuery.new("label", "killed"), :must_not if opts[:skip_killed]
7426 + q.add_query Ferret::Search::TermQuery.new("label", "spam"), :must_not unless query[:load_spam] || labels.include?(:spam)
7427 + q.add_query Ferret::Search::TermQuery.new("label", "deleted"), :must_not unless query[:load_deleted] || labels.include?(:deleted)
7428 + q.add_query Ferret::Search::TermQuery.new("label", "killed"), :must_not if query[:skip_killed]
7429
7430 - query.add_query Ferret::Search::TermQuery.new("source_id", opts[:source_id]), :must if opts[:source_id]
7431 - query
7432 + q.add_query Ferret::Search::TermQuery.new("source_id", query[:source_id]), :must if query[:source_id]
7433 + q
7434 end
7435
7436 def save_sources fn=Redwood::SOURCE_FN
7437 diff --git a/lib/sup/modes/search-results-mode.rb b/lib/sup/modes/search-results-mode.rb
7438 index 227ee9b..121e817 100644
7439 --- a/lib/sup/modes/search-results-mode.rb
7440 +++ b/lib/sup/modes/search-results-mode.rb
7441 @@ -1,11 +1,9 @@
7442 module Redwood
7443
7444 class SearchResultsMode < ThreadIndexMode
7445 - def initialize qobj, qopts = nil
7446 - @qobj = qobj
7447 - @qopts = qopts
7448 -
7449 - super [], { :qobj => @qobj }.merge(@qopts)
7450 + def initialize query
7451 + @query = query
7452 + super [], query
7453 end
7454
7455 register_keymap do |k|
7456 @@ -13,9 +11,9 @@ class SearchResultsMode < ThreadIndexMode
7457 end
7458
7459 def refine_search
7460 - query = BufferManager.ask :search, "refine query: ", (@qobj.to_s + " ")
7461 - return unless query && query !~ /^\s*$/
7462 - SearchResultsMode.spawn_from_query query
7463 + text = BufferManager.ask :search, "refine query: ", (@query[:text] + " ")
7464 + return unless text && text !~ /^\s*$/
7465 + SearchResultsMode.spawn_from_query text
7466 end
7467
7468 ## a proper is_relevant? method requires some way of asking ferret
7469 @@ -26,10 +24,10 @@ class SearchResultsMode < ThreadIndexMode
7470
7471 def self.spawn_from_query text
7472 begin
7473 - qobj, extraopts = Index.parse_user_query_string(text)
7474 - return unless qobj
7475 + query = Index.parse_query(text)
7476 + return unless query
7477 short_text = text.length < 20 ? text : text[0 ... 20] + "..."
7478 - mode = SearchResultsMode.new qobj, extraopts
7479 + mode = SearchResultsMode.new query
7480 BufferManager.spawn "search: \"#{short_text}\"", mode
7481 mode.load_threads :num => mode.buffer.content_height
7482 rescue Index::ParseError => e
7483 --
7484 1.6.0.4
7485
7486
7487 From garoth@gmail.com Wed Jun 17 11:13:07 2009
7488 From: garoth@gmail.com (Andrei Thorp)
7489 Date: Wed, 17 Jun 2009 11:13:07 -0400
7490 Subject: [sup-talk] Yet Another Offlineimap Thread (YAOT)
7491 In-Reply-To: <80055d7c0906151244y1d66a4b1g8df4e3aa1d544c4f@mail.gmail.com>
7492 References: <80055d7c0906151244y1d66a4b1g8df4e3aa1d544c4f@mail.gmail.com>
7493 Message-ID: <80055d7c0906170813t55bd3f7dk1286e68eea9e2ad4@mail.gmail.com>
7494
7495 Anyway, so.
7496
7497 I set up a loop to run offlineimap on 5 minute intervals. Now, every
7498 so often, sup complains that it's fallen out of sync (I have no other
7499 clients doing anything there, just sup and offlineimap). I can't
7500 imagine why this is happening. Hints?
7501
7502 -AT
7503
7504 From ingmar@exherbo.org Wed Jun 17 11:29:36 2009
7505 From: ingmar@exherbo.org (Ingmar Vanhassel)
7506 Date: Wed, 17 Jun 2009 17:29:36 +0200
7507 Subject: [sup-talk] Yet Another Offlineimap Thread (YAOT)
7508 In-Reply-To: <80055d7c0906170813t55bd3f7dk1286e68eea9e2ad4@mail.gmail.com>
7509 References: <80055d7c0906151244y1d66a4b1g8df4e3aa1d544c4f@mail.gmail.com>
7510 <80055d7c0906170813t55bd3f7dk1286e68eea9e2ad4@mail.gmail.com>
7511 Message-ID: <1245252332-sup-8862@cannonball>
7512
7513 Excerpts from Andrei Thorp's message of Wed Jun 17 17:13:07 +0200 2009:
7514 > Anyway, so.
7515 >
7516 > I set up a loop to run offlineimap on 5 minute intervals. Now, every
7517 > so often, sup complains that it's fallen out of sync (I have no other
7518 > clients doing anything there, just sup and offlineimap). I can't
7519 > imagine why this is happening. Hints?
7520 >
7521 > -AT
7522
7523 Something is changing the state of your IMAP server, offlineimap is
7524 mirroring that, and sup notices.
7525
7526 Are you running any other client (even using gmail.com) on your gmail
7527 IMAP?
7528
7529 --
7530 Exherbo KDE, X.org maintainer
7531
7532 From garoth@gmail.com Wed Jun 17 11:54:44 2009
7533 From: garoth@gmail.com (Andrei Thorp)
7534 Date: Wed, 17 Jun 2009 11:54:44 -0400
7535 Subject: [sup-talk] Fwd: Yet Another Offlineimap Thread (YAOT)
7536 In-Reply-To: <80055d7c0906170854r6ac45e83vea42a3b4866d7c2d@mail.gmail.com>
7537 References: <80055d7c0906151244y1d66a4b1g8df4e3aa1d544c4f@mail.gmail.com>
7538 <80055d7c0906170813t55bd3f7dk1286e68eea9e2ad4@mail.gmail.com>
7539 <1245252332-sup-8862@cannonball>
7540 <80055d7c0906170854r6ac45e83vea42a3b4866d7c2d@mail.gmail.com>
7541 Message-ID: <80055d7c0906170854p214520ck73e8d498f6a0ba1c@mail.gmail.com>
7542
7543 On Wed, Jun 17, 2009 at 11:29 AM, Ingmar Vanhassel <ingmar at exherbo.org> wrote:
7544 >
7545 > Excerpts from Andrei Thorp's message of Wed Jun 17 17:13:07 +0200 2009:
7546 > > Anyway, so.
7547 > >
7548 > > I set up a loop to run offlineimap on 5 minute intervals. Now, every
7549 > > so often, sup complains that it's fallen out of sync (I have no other
7550 > > clients doing anything there, just sup and offlineimap). I can't
7551 > > imagine why this is happening. Hints?
7552 > >
7553 > > -AT
7554 >
7555 > Something is changing the state of your IMAP server, offlineimap is
7556 > mirroring that, and sup notices.
7557 >
7558 > Are you running any other client (even using gmail.com) on your gmail
7559 > IMAP?
7560
7561 Ahh, yes, I understand. Well, if you read my original post in this
7562 thread, I've actually not been able to figure out how to get sup to
7563 send via different servers based on different situations (I'd like it
7564 to use different send commands for work / gmail).
7565
7566 And yes, I've been using gmail, silly me.
7567
7568 > ?- Does imap support a way to say which mails have been read and not?
7569 > I think it probably does. If this is the case, can sup-sync-back
7570 > somehow do this? It'd be nice if my gmail understood when a mail has
7571 > been read, so when I sync back up with offlineimap, it's all savvy.
7572 > ?- I vaguely saw some tricks here for how to reply with different
7573 > e-mail addresses and stuff. I'd like to execute a whole different
7574 > command when replying in some situations, so that my mail gets sent
7575 > through gmail's smtp server instead of my work's one, for example. How
7576 > would I achieve this?
7577 > ?- I don't see a daemon mode for offlineimap. I guess the expected
7578 > usage is to make it quiet and put it in a cron/regular script? Am I
7579 > correct?
7580
7581 Cheers,
7582
7583 -AT
7584
7585 From wmorgan-sup@masanjin.net Wed Jun 17 12:04:34 2009
7586 From: wmorgan-sup@masanjin.net (William Morgan)
7587 Date: Wed, 17 Jun 2009 09:04:34 -0700
7588 Subject: [sup-talk] display_length issue with special-characters on
7589 non-UTF8 terminal
7590 In-Reply-To: <1244891132-sup-2424@valgus>
7591 References: <1244536704-sup-7027@valgus> <1244834230-sup-1200@entry>
7592 <1244891132-sup-2424@valgus>
7593 Message-ID: <1245254636-sup-2210@entry>
7594
7595 Reformatted excerpts from Tarko Tikan's message of 2009-06-13:
7596 > william wrote:
7597 > > Does this patch fix the issue? If so, I will release an 0.8.1.
7598 >
7599 > Yes it does. patch :) But I still don't have better idea how to fix
7600 > it so it'll have to stay like this.
7601
7602 I have released an 0.8.1 which has this patch in it.
7603 --
7604 William <wmorgan-sup at masanjin.net>
7605
7606 From wmorgan-sup@masanjin.net Wed Jun 17 12:14:56 2009
7607 From: wmorgan-sup@masanjin.net (William Morgan)
7608 Date: Wed, 17 Jun 2009 09:14:56 -0700
7609 Subject: [sup-talk] sup and ncursesw
7610 In-Reply-To: <1245074133-sup-9338@entry>
7611 References: <91de50e10906101050p2d23a74cy1bbfe2e80e69cca2@mail.gmail.com>
7612 <1244836517-sup-5520@entry>
7613 <91de50e10906130717x3a6d6097g5249ed6bb17fbfcf@mail.gmail.com>
7614 <1245074133-sup-9338@entry>
7615 Message-ID: <1245255253-sup-5713@entry>
7616
7617 Reformatted excerpts from William Morgan's message of 2009-06-15:
7618 > (And that's typically the point where you see the difference between
7619 > ncurses.so with and without the patch.)
7620
7621 BTW, it looks like the patch will not be necessary if we manage to move
7622 to 1.9.1:
7623
7624 http://redmine.ruby-lang.org/issues/show/975
7625 --
7626 William <wmorgan-sup at masanjin.net>
7627
7628 From garoth@gmail.com Wed Jun 17 12:20:30 2009
7629 From: garoth@gmail.com (Andrei Thorp)
7630 Date: Wed, 17 Jun 2009 12:20:30 -0400
7631 Subject: [sup-talk] Yet Another Offlineimap Thread (YAOT)
7632 In-Reply-To: <1245254490-sup-9198@cannonball>
7633 References: <80055d7c0906151244y1d66a4b1g8df4e3aa1d544c4f@mail.gmail.com>
7634 <80055d7c0906170813t55bd3f7dk1286e68eea9e2ad4@mail.gmail.com>
7635 <1245252332-sup-8862@cannonball>
7636 <80055d7c0906170854r6ac45e83vea42a3b4866d7c2d@mail.gmail.com>
7637 <1245254490-sup-9198@cannonball>
7638 Message-ID: <80055d7c0906170920p328f6a79ye7e1f40adb2a3e0e@mail.gmail.com>
7639
7640 Forward.
7641
7642 Excerpts from Andrei Thorp's message of Wed Jun 17 17:54:16 +0200 2009:
7643 > On Wed, Jun 17, 2009 at 11:29 AM, Ingmar Vanhassel <ingmar at exherbo.org> wrote:
7644 > >
7645 > > Excerpts from Andrei Thorp's message of Wed Jun 17 17:13:07 +0200 2009:
7646 > > > Anyway, so.
7647 > > >
7648 > > > I set up a loop to run offlineimap on 5 minute intervals. Now, every
7649 > > > so often, sup complains that it's fallen out of sync (I have no other
7650 > > > clients doing anything there, just sup and offlineimap). I can't
7651 > > > imagine why this is happening. Hints?
7652 > > >
7653 > > > -AT
7654 > >
7655 > > Something is changing the state of your IMAP server, offlineimap is
7656 > > mirroring that, and sup notices.
7657 > >
7658 > > Are you running any other client (even using gmail.com) on your gmail
7659 > > IMAP?
7660 >
7661 > Ahh, yes, I understand. Well, if you read my original post in this
7662 > thread, I've actually not been able to figure out how to get sup to
7663 > send via different servers based on different situations (I'd like it
7664 > to use different send commands for work / gmail).
7665
7666 Yeah, I was try to be lazy ;-)
7667
7668 For using multiple accounts, see
7669 http://sup.rubyforge.org/wiki/wiki.pl?MultipleAccountsAndReply
7670
7671 I use 'msmtp --account=foo -t' myself, since msmtp was incredibly easy
7672 to configure.
7673 - Configure some defaults for all accounts (logging, tls, see `man msmtp`)
7674 - Write a different account section in your msmtprc, then in sup's
7675 ?config.yaml, configure those accounts, where the sendmail command to
7676 ?run has an --acount=foo parameter, corresponding to an account in your
7677 ?msmtprc
7678
7679 Some people use a reply-from hook for dynamically setting from From:
7680 header, you may want to search the archives if that's something you'd
7681 like to use.
7682
7683 --
7684 Exherbo KDE, X.org maintainer
7685
7686 From garoth@gmail.com Wed Jun 17 12:22:47 2009
7687 From: garoth@gmail.com (Andrei Thorp)
7688 Date: Wed, 17 Jun 2009 12:22:47 -0400
7689 Subject: [sup-talk] Yet Another Offlineimap Thread (YAOT)
7690 In-Reply-To: <1245254490-sup-9198@cannonball>
7691 References: <80055d7c0906151244y1d66a4b1g8df4e3aa1d544c4f@mail.gmail.com>
7692 <80055d7c0906170813t55bd3f7dk1286e68eea9e2ad4@mail.gmail.com>
7693 <1245252332-sup-8862@cannonball>
7694 <80055d7c0906170854r6ac45e83vea42a3b4866d7c2d@mail.gmail.com>
7695 <1245254490-sup-9198@cannonball>
7696 Message-ID: <80055d7c0906170922o732fc260o3a7bdd5a825ac9c8@mail.gmail.com>
7697
7698 On Wed, Jun 17, 2009 at 12:10 PM, Ingmar Vanhassel <ingmar at exherbo.org> wrote:
7699 > For using multiple accounts, see
7700 > http://sup.rubyforge.org/wiki/wiki.pl?MultipleAccountsAndReply
7701
7702 Perfect! So now just the one issue of sup-sync-back. I guess one
7703 "solution" would be for me to mark things as deleted instead of
7704 archived/read, and I guess sync-back understands this. I don't love
7705 this though. Any other suggestions?
7706
7707 -AT
7708
7709 From nicolas.pouillard@gmail.com Wed Jun 17 14:34:08 2009
7710 From: nicolas.pouillard@gmail.com (Nicolas Pouillard)
7711 Date: Wed, 17 Jun 2009 20:34:08 +0200
7712 Subject: [sup-talk] display_length issue with special-characters on
7713 non-UTF8 terminal
7714 In-Reply-To: <1245254636-sup-2210@entry>
7715 References: <1244536704-sup-7027@valgus> <1244834230-sup-1200@entry>
7716 <1244891132-sup-2424@valgus> <1245254636-sup-2210@entry>
7717 Message-ID: <1245263427-sup-997@ausone.local>
7718
7719 Excerpts from William Morgan's message of Wed Jun 17 18:04:34 +0200 2009:
7720 > Reformatted excerpts from Tarko Tikan's message of 2009-06-13:
7721 > > william wrote:
7722 > > > Does this patch fix the issue? If so, I will release an 0.8.1.
7723 > >
7724 > > Yes it does. patch :) But I still don't have better idea how to fix
7725 > > it so it'll have to stay like this.
7726 >
7727 > I have released an 0.8.1 which has this patch in it.
7728
7729 I still have issues with display_length. I use UTF-8, urxvt
7730 and some characters disappear when a line contains special characters.
7731
7732 For instance in thread-view-mode if a line contains a special character
7733 then the last character is dropped.
7734
7735 I've "fixed" the issue by reverting a display_length call to a size call
7736 as in the attached patch.
7737
7738 diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
7739 index 8eedf96..795b4c9 100644
7740 --- a/lib/sup/buffer.rb
7741 +++ b/lib/sup/buffer.rb
7742 @@ -114,7 +114,7 @@ class Buffer
7743 stringl += 1 while stringl < s.length && s[0 ... stringl].display_length < maxl
7744 @w.mvaddstr y, x, s[0 ... stringl]
7745 unless opts[:no_fill]
7746 - l = s.display_length
7747 + l = s.size
7748 unless l >= maxl
7749 @w.mvaddstr(y, x + l, " " * (maxl - l))
7750 end
7751
7752 --
7753 Nicolas Pouillard
7754 http://nicolaspouillard.fr
7755
7756 From jim@gonzul.net Wed Jun 17 17:39:10 2009
7757 From: jim@gonzul.net (Jim Cheetham)
7758 Date: Thu, 18 Jun 2009 09:39:10 +1200
7759 Subject: [sup-talk] Character encoding when displaying quoted-printable
7760 messages
7761 Message-ID: <f4cc59760906171439q1b8983adw2008843b1ec02990@mail.gmail.com>
7762
7763 Hi, I've been looking at sup for only a day, as I'm trying to find a
7764 decent email client. I migrated from mutt to gmail, but now it's time
7765 to move away from gmail because their client is not smart enough.
7766
7767 Sup has passed my number 1 feature test; I can easily read messages
7768 while keeping multiple unsent messages available. Mutt does that, but
7769 it's not easy to see what messages you are currently working on.
7770
7771 However, I'm coming across some character decoding issues with
7772 quoted-printable that are making some messages hard to read. Any
7773 advice on how to improve things would be welcome ... In the example
7774 below, a NBSP entity is showing up as the characters "M-BM-"
7775
7776 I'm on Ubuntu 9.04, with the current master from git. Sup is running
7777 in GNOME Terminal 2.26.0, with UTF-8 encoding, although unsurprisingly
7778 switching to ISO-8859-1 makes no difference. $TERM=xterm (or 'screen'.
7779 vt100 and vt220 cause sup to halt at startup). This is the text that
7780 gets displayed for a sample message sent from Yahoo! mail ...
7781
7782 Visible in sup thread-view-mode:
7783 videos for specific hints regarding the gestures.M-BM- Do you have a decent
7784 recording device?M-BM- Have you seen what's available?M-BM- Do you have
7785 editing software?
7786
7787 Message source:
7788 X-Mailer: YahooMailClassic/5.4.12 YahooMailWebService/0.7.289.15
7789 MIME-Version: 1.0
7790 Content-Type: multipart/alternative; boundary="0-1465842634-1245251490=:14771"
7791 ...
7792 --0-1465842634-1245251490=:14771
7793 Content-Type: text/plain; charset=iso-8859-1
7794 Content-Transfer-Encoding: quoted-printable
7795 ...
7796 more videos for specific hints regarding the gestures.=A0 Do you have a dec=
7797 ent video recording device?=A0 Have you seen what's available?=A0 Do you ha=
7798 ve any video editing software?
7799
7800 Displayed in Gmail client:
7801 I was thinking about cleaning up the videos on YouTube, and perhaps
7802 adding more videos for specific hints regarding the gestures. Do you
7803 have a decent video recording device? Have you seen what's available?
7804 Do you have any video editing software?
7805
7806 HTML source when viewing the MIME attached message locally:
7807 I was thinking about cleaning up the videos on YouTube, and perhaps
7808 adding more videos for specific hints regarding the gestures. Do
7809 you have a decent video recording device? Have you seen what's
7810 available? Do you have any video editing software?<br><br>[1]
7811
7812 From usul@aruba.it Thu Jun 18 05:00:47 2009
7813 From: usul@aruba.it (Fabio Riga)
7814 Date: Thu, 18 Jun 2009 11:00:47 +0200
7815 Subject: [sup-talk] Crash after sending a message
7816 In-Reply-To: <1245084718-sup-1647@entry>
7817 References: <1244717279-sup-5999@viajero> <1244719933-sup-4261@viajero>
7818 <1245084718-sup-1647@entry>
7819 Message-ID: <1245315146-sup-2575@viajero>
7820
7821 Excerpts from William Morgan's message of lun giu 15 18:53:47 +0200 2009:
7822 > Sorry about that. The problem is that Sup was writing an invalid
7823 > sent.mbox file in certain locales, including yours, and then dying when
7824 > it couldn't parse its own file. If you update to the latest git, this
7825 > should be fixed for new messages, and you shouldn't need the LANG=C
7826 > hack.
7827 >
7828 > Please let me know if you have any more problems.
7829
7830 It seems ok with sup-git. I'd rather prefer to use a "stable" branch
7831 instead of bleeding-edge, I don't feel like a developer...
7832
7833 Thank you,
7834 Fabio
7835 --
7836 Fabio Riga
7837
7838 348 4458014 - fabio at comunicattiva.it
7839
7840 ComunicAttiva S.a.s. di Silvana D'Agata & C.
7841 via Campestre,189 - Sesto San Giovanni (MI) - Italia
7842 tel. 02 97373202 - fax 02 97373474
7843
7844 From bachjh@googlemail.com Thu Jun 18 05:26:03 2009
7845 From: bachjh@googlemail.com (=?UTF-8?B?SsO2cmctSGVuZHJpayBCYWNo?=)
7846 Date: Thu, 18 Jun 2009 11:26:03 +0200
7847 Subject: [sup-talk] sup and ncursesw
7848 In-Reply-To: <1245255253-sup-5713@entry>
7849 References: <91de50e10906101050p2d23a74cy1bbfe2e80e69cca2@mail.gmail.com>
7850 <1244836517-sup-5520@entry>
7851 <91de50e10906130717x3a6d6097g5249ed6bb17fbfcf@mail.gmail.com>
7852 <1245074133-sup-9338@entry> <1245255253-sup-5713@entry>
7853 Message-ID: <91de50e10906180226sf31cf94m43b18c316e9f898@mail.gmail.com>
7854
7855 2009/6/17 William Morgan <wmorgan-sup at masanjin.net>:
7856 > Reformatted excerpts from William Morgan's message of 2009-06-15:
7857 >> (And that's typically the point where you see the difference between
7858 >> ncurses.so with and without the patch.)
7859 >
7860 > BTW, it looks like the patch will not be necessary if we manage to move
7861 > to 1.9.1:
7862
7863 The patch actually works for me now, and probably had been working all
7864 the time. Whatever was screwed, after I manually redrew the screen
7865 _twice_ after the strange chars appeared, it was all fine.
7866 thanks for the help,
7867 - JH
7868
7869 From mariano.mara@gmail.com Thu Jun 18 13:31:45 2009
7870 From: mariano.mara@gmail.com (Mariano Mara)
7871 Date: Thu, 18 Jun 2009 14:31:45 -0300
7872 Subject: [sup-talk] invalid source error
7873 Message-ID: <20090618173145.GA4186@kafka>
7874
7875 Hi everyone. I have been using sup for quite some time now (great
7876 software by the way) and although I'm not using it as my main mail
7877 client I find it really useful to read several mailing lists I'm
7878 subscribed.
7879 I downloaded a few mailman archives and after a little formatting I was
7880 able to import them in sup as mboxes. One of them, however had a lot of
7881 errors when trying sup-sync and after a few hours of troubleshooting I
7882 gave up and remove it (not knowing a better way, I just deleted it from
7883 my sources.yaml).
7884 But now, when I try to start sup I'm hitting
7885
7886 --- RuntimeError from thread: load threads for thread-index-mode
7887 invalid source 19
7888
7889 Of course source 19 does not exist any more in sources.yaml and I don't
7890 know what else I can do to fix it.
7891 If you guys can give an advice I will really appreciate it.
7892
7893 This is my current sup version:
7894 $ sup --version
7895 [Thu Jun 18 14:30:08 -0300 2009] using character set encoding "UTF-8"
7896 sup v0.8.1
7897
7898 and this is the content of exception-log.txt
7899
7900 --- RuntimeError from thread: load threads for thread-index-mode
7901 invalid source 19
7902 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/index.rb:403:in
7903 `build_message'
7904 /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
7905 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/index.rb:399:in
7906 `build_message'
7907 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/index.rb:297:in
7908 `each_id_by_date'
7909 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/thread.rb:330:in `call'
7910 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/thread.rb:330:in
7911 `load_n_threads'
7912 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/index.rb:297:in
7913 `each_id_by_date'
7914 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/index.rb:296:in `each'
7915 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/index.rb:296:in
7916 `each_id_by_date'
7917 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/thread.rb:326:in
7918 `load_n_threads'
7919 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/modes/thread-index-mode.rb:620:in
7920 `__unprotected_load_n_threads'
7921 (eval):12:in `load_n_threads'
7922 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/modes/thread-index-mode.rb:604:in
7923 `load_n_threads_background'
7924 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup.rb:71:in
7925 `reporting_thread'
7926 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup.rb:69:in `initialize'
7927 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup.rb:69:in `new'
7928 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup.rb:69:in
7929 `reporting_thread'
7930 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/modes/thread-index-mode.rb:603:in
7931 `load_n_threads_background'
7932 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/modes/thread-index-mode.rb:673:in
7933 `__unprotected_load_threads'
7934 (eval):12:in `load_threads'
7935 /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/bin/sup:206
7936 /usr/bin/sup:19:in `load'
7937 /usr/bin/sup:19
7938
7939 Mariano
7940
7941 From guillaume.quintard@gmail.com Fri Jun 19 07:27:50 2009
7942 From: guillaume.quintard@gmail.com (Guillaume Quintard)
7943 Date: Fri, 19 Jun 2009 13:27:50 +0200
7944 Subject: [sup-talk] Carriage return
7945 Message-ID: <1245410627-sup-2801@altis>
7946
7947 Sup seems to work smoothly now (no noticeable problem with the sent label, hoorray!!) (not complaining since I'm using the next branch). Now I'd like to fix one little annoying thing: in case of error, messages will use the newline, but not the carriage return, meaning mutiple lines messages will appear like this:
7948 yadda yadda
7949 yadda yadda yadda yadda
7950 yadda yadda
7951
7952 Is there a way to fix that?
7953
7954 --
7955 Guillaume
7956
7957 From mailinglist@flasht.de Fri Jun 19 08:40:07 2009
7958 From: mailinglist@flasht.de (Christopher Bertels)
7959 Date: Fri, 19 Jun 2009 14:40:07 +0200
7960 Subject: [sup-talk] Delete single message in thread-view?
7961 Message-ID: <1245415127-sup-2107@thinkpad-ubuntu>
7962
7963 Hi!
7964 Is it possible to delete a single message from a thread?
7965 I haven't found a way to do this, but maybe I'm just blind.
7966
7967 Cheers,
7968 Christopher.
7969 --
7970 ================================
7971 Christopher Bertels
7972 http://www.adztec-independent.de
7973
7974 From garoth@gmail.com Fri Jun 19 09:51:12 2009
7975 From: garoth@gmail.com (Andrei Thorp)
7976 Date: Fri, 19 Jun 2009 09:51:12 -0400
7977 Subject: [sup-talk] Carriage return
7978 In-Reply-To: <1245410627-sup-2801@altis>
7979 References: <1245410627-sup-2801@altis>
7980 Message-ID: <1245419195-sup-7199@Longbow>
7981
7982 I'm not sure that this is carriage return related (Linux doesn't tend to
7983 use these, right?). However, I'm certainly getting similar corruption.
7984
7985 This happens with errors, as well as just randomly sometimes after sup
7986 closes/does something. My entire terminal actaully goes out of whack
7987 and starts behaving like this.
7988
7989 I acutally just blamed it on my terminal being buggy somehow
7990 (XFCE Terminal). I still think that's probably it. I'm not sure why sup
7991 causes it though.
7992
7993 Anyway, reset fixes it when that happens. But yeah.... but yeah.
7994
7995 Cheers :)
7996 --
7997 Andrei Thorp, Developer: Xandros Corp. (http://www.xandros.com)
7998
7999 Resisting temptation is easier when you think you'll probably get
8000 another chance later on.
8001
8002 From joe@talkhouse.com Fri Jun 19 12:23:23 2009
8003 From: joe@talkhouse.com (=?utf-8?q?Joe_W=C3=B6lfel?=)
8004 Date: Fri, 19 Jun 2009 12:23:23 -0400
8005 Subject: [sup-talk] [PATCH] Hack that fixes "undefined method multipart?"
8006 exception.
8007 Message-ID: <1245428166-sup-5693@joe-wolfels-power-mac-g5.local>
8008
8009 On sup-sync -c I kept getting an exception on line 372 of message.rb in the
8010 message_to_chunks function. The cause was that 'm' was supposed to be a
8011 message that needed to be converted to chunks. Instead, it was
8012 aRedwood::Chunk::CryptoNotice, which didn't have a mulitipart? method. So it
8013 crashed on "if m.multipart?". My assumption is that a
8014 Redwood::Chunk::CryptoNotice is already a chunk and doesn't need to be
8015 converted. So my solution is just to return it. That fixes the bug. But
8016 probably there is a more sensible fix. Possibly m should never have been a
8017 chunk in the first place.
8018 ---
8019 lib/sup/message.rb | 5 +++++
8020 1 files changed, 5 insertions(+), 0 deletions(-)
8021
8022 diff --git a/lib/sup/message.rb b/lib/sup/message.rb
8023 index ded577a..caf0cdb 100644
8024 --- a/lib/sup/message.rb
8025 +++ b/lib/sup/message.rb
8026 @@ -369,6 +369,11 @@ private
8027
8028 ## takes a RMail::Message, breaks it into Chunk:: classes.
8029 def message_to_chunks m, encrypted=false, sibling_types=[]
8030 + ## TODO: Replace the following four lines with something more sensible.
8031 + unless m.respond_to? :multipart?
8032 + puts "I bet this is a Redwood::Chunk::CryptoNotice: \n#{m.class}"
8033 + return m
8034 + end
8035 if m.multipart?
8036 chunks =
8037 case m.header.content_type
8038 --
8039 1.6.2.1
8040
8041 From rlane@club.cc.cmu.edu Sat Jun 20 16:49:59 2009
8042 From: rlane@club.cc.cmu.edu (Rich Lane)
8043 Date: Sat, 20 Jun 2009 13:49:59 -0700
8044 Subject: [sup-talk] [PATCH 0/18] Xapian-based index
8045 Message-ID: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8046
8047 This patch series refactors the Index class to remove Ferret-isms and support
8048 multiple index implementations. The included XapianIndex is a bit faster at
8049 indexing messages and significantly faster when searching because it
8050 precomputes thread membership. It also works on Ruby 1.9.1.
8051
8052 You can enable the new index with the environment variable SUP_INDEX=xapian.
8053
8054 It's missing a couple of features, notably threading by subject. I'm sure there
8055 are many more bugs left, so I'd appreciate any testing or review you all can
8056 provide.
8057
8058 These patches depend on the two I posted June 16: 'cleanup interface' and 'consistent naming'.
8059
8060 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:00 2009
8061 From: rlane@club.cc.cmu.edu (Rich Lane)
8062 Date: Sat, 20 Jun 2009 13:50:00 -0700
8063 Subject: [sup-talk] [PATCH 01/18] remove load_entry_for_id call in
8064 sup-recover-sources
8065 In-Reply-To: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8066 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8067 Message-ID: <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8068
8069 ---
8070 bin/sup-recover-sources | 12 +++++-------
8071 lib/sup/index.rb | 6 ++++++
8072 2 files changed, 11 insertions(+), 7 deletions(-)
8073
8074 diff --git a/bin/sup-recover-sources b/bin/sup-recover-sources
8075 index d3b1424..6e3810c 100755
8076 --- a/bin/sup-recover-sources
8077 +++ b/bin/sup-recover-sources
8078 @@ -69,15 +69,14 @@ ARGV.each do |fn|
8079 Redwood::MBox::Loader.new(fn, nil, !$opts[:unusual], $opts[:archive])
8080 end
8081
8082 - source_ids = {}
8083 + source_ids = Hash.new 0
8084 count = 0
8085 source.each do |offset, labels|
8086 m = Redwood::Message.new :source => source, :source_info => offset
8087 - docid, entry = index.load_entry_for_id m.id
8088 - next unless entry
8089 - #puts "# #{source} #{offset} #{entry[:source_id]}"
8090 -
8091 - source_ids[entry[:source_id]] = (source_ids[entry[:source_id]] || 0) + 1
8092 + m.load_from_source!
8093 + source_id = index.source_for_id m.id
8094 + next unless source_id
8095 + source_ids[source_id] += 1
8096 count += 1
8097 break if count == $opts[:scan_num]
8098 end
8099 @@ -86,7 +85,6 @@ ARGV.each do |fn|
8100 id = source_ids.keys.first.to_i
8101 puts "assigned #{source} to #{source_ids.keys.first}"
8102 source.id = id
8103 - source.seek_to! source.total
8104 index.add_source source
8105 else
8106 puts ">> unable to determine #{source}: #{source_ids.inspect}"
8107 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
8108 index d15e7bb..b5d0e5d 100644
8109 --- a/lib/sup/index.rb
8110 +++ b/lib/sup/index.rb
8111 @@ -494,6 +494,12 @@ EOS
8112 @index_mutex.synchronize { @index.optimize }
8113 end
8114
8115 + def source_for_id id
8116 + entry = @index[id]
8117 + return unless entry
8118 + entry[:source_id].to_i
8119 + end
8120 +
8121 class ParseError < StandardError; end
8122
8123 ## parse a query string from the user. returns a query object
8124 --
8125 1.6.0.4
8126
8127
8128 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:01 2009
8129 From: rlane@club.cc.cmu.edu (Rich Lane)
8130 Date: Sat, 20 Jun 2009 13:50:01 -0700
8131 Subject: [sup-talk] [PATCH 02/18] remove load_entry_for_id call in
8132 DraftManager.discard
8133 In-Reply-To: <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8134 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8135 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8136 Message-ID: <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
8137
8138 ---
8139 lib/sup/draft.rb | 9 ++-------
8140 1 files changed, 2 insertions(+), 7 deletions(-)
8141
8142 diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb
8143 index 9127739..1233945 100644
8144 --- a/lib/sup/draft.rb
8145 +++ b/lib/sup/draft.rb
8146 @@ -31,14 +31,9 @@ class DraftManager
8147 end
8148
8149 def discard m
8150 - docid, entry = Index.load_entry_for_id m.id
8151 - unless entry
8152 - Redwood::log "can't find entry for draft: #{m.id.inspect}. You probably already discarded it."
8153 - return
8154 - end
8155 - raise ArgumentError, "not a draft: source id #{entry[:source_id].inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect} / docno #{docid}" unless entry[:source_id].to_i == DraftManager.source_id
8156 + raise ArgumentError, "not a draft: source id #{m.source.id.inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect}" unless m.source.id.to_i == DraftManager.source_id
8157 Index.delete m.id
8158 - File.delete @source.fn_for_offset(entry[:source_info])
8159 + File.delete @source.fn_for_offset(m.source_info)
8160 UpdateManager.relay self, :single_message_deleted, m
8161 end
8162 end
8163 --
8164 1.6.0.4
8165
8166
8167 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:02 2009
8168 From: rlane@club.cc.cmu.edu (Rich Lane)
8169 Date: Sat, 20 Jun 2009 13:50:02 -0700
8170 Subject: [sup-talk] [PATCH 03/18] remove ferret entry from poll/sync
8171 interface
8172 In-Reply-To: <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
8173 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8174 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8175 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
8176 Message-ID: <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
8177
8178 This leads to an extra index lookup in the sup-sync update path, but I think
8179 it's worth it for the sake of API simplicity.
8180 ---
8181 bin/sup-sync | 8 ++++----
8182 bin/sup-sync-back | 6 +++---
8183 lib/sup/index.rb | 18 ++++--------------
8184 lib/sup/message.rb | 6 ++++++
8185 lib/sup/poll.rb | 33 ++++++++++++++-------------------
8186 lib/sup/sent.rb | 2 +-
8187 6 files changed, 32 insertions(+), 41 deletions(-)
8188
8189 diff --git a/bin/sup-sync b/bin/sup-sync
8190 index a759cbe..18a3cab 100755
8191 --- a/bin/sup-sync
8192 +++ b/bin/sup-sync
8193 @@ -137,7 +137,7 @@ begin
8194 num_added = num_updated = num_scanned = num_restored = 0
8195 last_info_time = start_time = Time.now
8196
8197 - Redwood::PollManager.add_messages_from source, :force_overwrite => true do |m, offset, entry|
8198 + Redwood::PollManager.add_messages_from source, :force_overwrite => true do |m_old, m, offset|
8199 num_scanned += 1
8200 seen[m.id] = true
8201
8202 @@ -153,10 +153,10 @@ begin
8203 ## skip if we're operating only on changed messages, the message
8204 ## is in the index, and it's unchanged from what the source is
8205 ## reporting.
8206 - next if target == :changed && entry && entry[:source_id].to_i == source.id && entry[:source_info].to_i == offset
8207 + next if target == :changed && m_old && m_old.source.id == source.id && m_old.source_info == offset
8208
8209 ## get the state currently in the index
8210 - index_state = entry[:label].symbolistize if entry
8211 + index_state = m_old.labels.dup if m_old
8212
8213 ## skip if we're operating on restored messages, and this one
8214 ## ain't.
8215 @@ -196,7 +196,7 @@ begin
8216 puts "Adding message #{source}##{offset} from #{m.from} with state {#{m.labels * ', '}}" if opts[:verbose]
8217 num_added += 1
8218 else
8219 - puts "Updating message #{source}##{offset}, source #{entry[:source_id]} => #{source.id}, offset #{entry[:source_info]} => #{offset}, state {#{index_state * ', '}} => {#{m.labels * ', '}}" if opts[:verbose]
8220 + puts "Updating message #{source}##{offset}, source #{m_old.source.id} => #{source.id}, offset #{m_old.source_info} => #{offset}, state {#{index_state * ', '}} => {#{m.labels * ', '}}" if opts[:verbose]
8221 num_updated += 1
8222 end
8223
8224 diff --git a/bin/sup-sync-back b/bin/sup-sync-back
8225 index 4f1387e..1c746d2 100755
8226 --- a/bin/sup-sync-back
8227 +++ b/bin/sup-sync-back
8228 @@ -105,11 +105,11 @@ EOS
8229 num_dropped = num_moved = num_scanned = 0
8230
8231 out_fp = Tempfile.new "sup-sync-back-#{source.id}"
8232 - Redwood::PollManager.add_messages_from source do |m, offset, entry|
8233 + Redwood::PollManager.add_messages_from source do |m_old, m, offset|
8234 num_scanned += 1
8235
8236 - if entry
8237 - labels = entry[:label].symbolistize.to_boolean_h
8238 + if m_old
8239 + labels = m_old.labels
8240
8241 if labels.member? :deleted
8242 if opts[:drop_deleted]
8243 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
8244 index b5d0e5d..89795da 100644
8245 --- a/lib/sup/index.rb
8246 +++ b/lib/sup/index.rb
8247 @@ -174,16 +174,10 @@ EOS
8248 ## Syncs the message to the index, replacing any previous version. adding
8249 ## either way. Index state will be determined by the message's #labels
8250 ## accessor.
8251 - ##
8252 - ## if need_load is false, docid and entry are assumed to be set to the
8253 - ## result of load_entry_for_id (which can be nil).
8254 - def sync_message m, need_load=true, docid=nil, entry=nil, opts={}
8255 - docid, entry = load_entry_for_id m.id if need_load
8256 + def sync_message m, opts={}
8257 + entry = @index[m.id]
8258
8259 raise "no source info for message #{m.id}" unless m.source && m.source_info
8260 - @index_mutex.synchronize do
8261 - raise "trying to delete non-corresponding entry #{docid} with index message-id #{@index[docid][:message_id].inspect} and parameter message id #{m.id.inspect}" if docid && @index[docid][:message_id] != m.id
8262 - end
8263
8264 source_id = if m.source.is_a? Integer
8265 m.source
8266 @@ -256,13 +250,9 @@ EOS
8267 }
8268
8269 @index_mutex.synchronize do
8270 - @index.delete docid if docid
8271 + @index.delete m.id
8272 @index.add_document d
8273 end
8274 -
8275 - ## this hasn't been triggered in a long time.
8276 - ## docid, entry = load_entry_for_id m.id
8277 - ## raise "just added message #{m.id.inspect} but couldn't find it in a search" unless docid
8278 end
8279
8280 def save_index fn=File.join(@dir, "ferret")
8281 @@ -391,7 +381,7 @@ EOS
8282 ## builds a message object from a ferret result
8283 def build_message docid
8284 @index_mutex.synchronize do
8285 - doc = @index[docid]
8286 + doc = @index[docid] or return
8287
8288 source = @source_mutex.synchronize { @sources[doc[:source_id].to_i] }
8289 raise "invalid source #{doc[:source_id]}" unless source
8290 diff --git a/lib/sup/message.rb b/lib/sup/message.rb
8291 index 8525fdf..b667cb3 100644
8292 --- a/lib/sup/message.rb
8293 +++ b/lib/sup/message.rb
8294 @@ -288,6 +288,12 @@ EOS
8295 "Subject: #{@subj}"]
8296 end
8297
8298 + def self.build_from_source source, source_info
8299 + m = Message.new :source => source, :source_info => source_info
8300 + m.load_from_source!
8301 + m
8302 + end
8303 +
8304 private
8305
8306 ## here's where we handle decoding mime attachments. unfortunately
8307 diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
8308 index 74f7d1c..bbad5f2 100644
8309 --- a/lib/sup/poll.rb
8310 +++ b/lib/sup/poll.rb
8311 @@ -95,11 +95,11 @@ EOS
8312
8313 num = 0
8314 numi = 0
8315 - add_messages_from source do |m, offset, entry|
8316 + add_messages_from source do |m_old, m, offset|
8317 ## always preserve the labels on disk.
8318 - m.labels = ((m.labels - [:unread, :inbox]) + entry[:label].symbolistize).uniq if entry
8319 + m.labels = ((m.labels - [:unread, :inbox]) + m_old.labels).uniq if m_old
8320 yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
8321 - unless entry
8322 + unless m_old
8323 num += 1
8324 from_and_subj << [m.from && m.from.longname, m.subj]
8325 if m.has_label?(:inbox) && ([:spam, :deleted, :killed] & m.labels).empty?
8326 @@ -138,29 +138,24 @@ EOS
8327 begin
8328 return if source.done? || source.has_errors?
8329
8330 - source.each do |offset, labels|
8331 + source.each do |offset, default_labels|
8332 if source.has_errors?
8333 Redwood::log "error loading messages from #{source}: #{source.error.message}"
8334 return
8335 end
8336
8337 - labels << :sent if source.uri.eql?(SentManager.source_uri)
8338 - labels.each { |l| LabelManager << l }
8339 - labels = labels + (source.archived? ? [] : [:inbox])
8340 + m_new = Message.build_from_source source, offset
8341 + m_old = Index.build_message m_new.id
8342
8343 - m = Message.new :source => source, :source_info => offset, :labels => labels
8344 - m.load_from_source!
8345 + m_new.labels = default_labels + (source.archived? ? [] : [:inbox])
8346 + m_new.labels << :sent if source.uri.eql?(SentManager.source_uri)
8347 + m_new.labels.delete :unread if m_new.source_marked_read?
8348 + m_new.labels.each { |l| LabelManager << l }
8349
8350 - if m.source_marked_read?
8351 - m.remove_label :unread
8352 - labels.delete :unread
8353 - end
8354 -
8355 - docid, entry = Index.load_entry_for_id m.id
8356 - HookManager.run "before-add-message", :message => m
8357 - m = yield(m, offset, entry) or next if block_given?
8358 - times = Index.sync_message m, false, docid, entry, opts
8359 - UpdateManager.relay self, :added, m unless entry
8360 + HookManager.run "before-add-message", :message => m_new
8361 + m_ret = yield(m_old, m_new, offset) or next if block_given?
8362 + Index.sync_message m_ret, opts
8363 + UpdateManager.relay self, :added, m_ret unless m_old
8364 end
8365 rescue SourceError => e
8366 Redwood::log "problem getting messages from #{source}: #{e.message}"
8367 diff --git a/lib/sup/sent.rb b/lib/sup/sent.rb
8368 index e6ae856..b750d71 100644
8369 --- a/lib/sup/sent.rb
8370 +++ b/lib/sup/sent.rb
8371 @@ -30,7 +30,7 @@ class SentManager
8372 def write_sent_message date, from_email, &block
8373 @source.store_message date, from_email, &block
8374
8375 - PollManager.add_messages_from(@source) do |m, o, e|
8376 + PollManager.add_messages_from(@source) do |m_old, m, offset|
8377 m.remove_label :unread
8378 m
8379 end
8380 --
8381 1.6.0.4
8382
8383
8384 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:03 2009
8385 From: rlane@club.cc.cmu.edu (Rich Lane)
8386 Date: Sat, 20 Jun 2009 13:50:03 -0700
8387 Subject: [sup-talk] [PATCH 04/18] index: remove unused method
8388 load_entry_for_id
8389 In-Reply-To: <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
8390 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8391 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8392 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
8393 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
8394 Message-ID: <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
8395
8396 ---
8397 lib/sup/index.rb | 11 -----------
8398 1 files changed, 0 insertions(+), 11 deletions(-)
8399
8400 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
8401 index 89795da..64afbdd 100644
8402 --- a/lib/sup/index.rb
8403 +++ b/lib/sup/index.rb
8404 @@ -411,17 +411,6 @@ EOS
8405
8406 def delete id; @index_mutex.synchronize { @index.delete id } end
8407
8408 - def load_entry_for_id mid
8409 - @index_mutex.synchronize do
8410 - results = @index.search Ferret::Search::TermQuery.new(:message_id, mid)
8411 - return if results.total_hits == 0
8412 - docid = results.hits[0].doc
8413 - entry = @index[docid]
8414 - entry_dup = entry.fields.inject({}) { |h, f| h[f] = entry[f]; h }
8415 - [docid, entry_dup]
8416 - end
8417 - end
8418 -
8419 def load_contacts emails, h={}
8420 q = Ferret::Search::BooleanQuery.new true
8421 emails.each do |e|
8422 --
8423 1.6.0.4
8424
8425
8426 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:04 2009
8427 From: rlane@club.cc.cmu.edu (Rich Lane)
8428 Date: Sat, 20 Jun 2009 13:50:04 -0700
8429 Subject: [sup-talk] [PATCH 05/18] switch DraftManager to use
8430 Message.build_from_source
8431 In-Reply-To: <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
8432 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8433 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8434 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
8435 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
8436 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
8437 Message-ID: <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
8438
8439 ---
8440 lib/sup/draft.rb | 3 ++-
8441 1 files changed, 2 insertions(+), 1 deletions(-)
8442
8443 diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb
8444 index 1233945..dd4574d 100644
8445 --- a/lib/sup/draft.rb
8446 +++ b/lib/sup/draft.rb
8447 @@ -21,7 +21,8 @@ class DraftManager
8448
8449 my_message = nil
8450 @source.each do |thisoffset, theselabels|
8451 - m = Message.new :source => @source, :source_info => thisoffset, :labels => theselabels
8452 + m = Message.build_from_source @source, thisoffset
8453 + m.labels = theselabels
8454 Index.sync_message m
8455 UpdateManager.relay self, :added, m
8456 my_message = m if thisoffset == offset
8457 --
8458 1.6.0.4
8459
8460
8461 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:06 2009
8462 From: rlane@club.cc.cmu.edu (Rich Lane)
8463 Date: Sat, 20 Jun 2009 13:50:06 -0700
8464 Subject: [sup-talk] [PATCH 07/18] move source-related methods to
8465 SourceManager
8466 In-Reply-To: <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
8467 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8468 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8469 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
8470 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
8471 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
8472 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
8473 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
8474 Message-ID: <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
8475
8476 ---
8477 bin/sup | 10 ++++----
8478 bin/sup-add | 10 ++++----
8479 bin/sup-config | 14 +++++-----
8480 bin/sup-recover-sources | 7 +++--
8481 bin/sup-sync | 6 ++--
8482 bin/sup-sync-back | 4 +-
8483 bin/sup-tweak-labels | 4 +-
8484 lib/sup.rb | 5 ++-
8485 lib/sup/index.rb | 52 ++----------------------------------------
8486 lib/sup/poll.rb | 2 +-
8487 lib/sup/source.rb | 57 +++++++++++++++++++++++++++++++++++++++++++++++
8488 11 files changed, 92 insertions(+), 79 deletions(-)
8489
8490 diff --git a/bin/sup b/bin/sup
8491 index 302ad7c..1febefd 100755
8492 --- a/bin/sup
8493 +++ b/bin/sup
8494 @@ -160,17 +160,17 @@ begin
8495 Redwood::start
8496 Index.load
8497
8498 - if(s = Index.source_for DraftManager.source_name)
8499 + if(s = Redwood::SourceManager.source_for DraftManager.source_name)
8500 DraftManager.source = s
8501 else
8502 Redwood::log "no draft source, auto-adding..."
8503 - Index.add_source DraftManager.new_source
8504 + Redwood::SourceManager.add_source DraftManager.new_source
8505 end
8506
8507 - if(s = Index.source_for SentManager.source_uri)
8508 + if(s = Redwood::SourceManager.source_for SentManager.source_uri)
8509 SentManager.source = s
8510 else
8511 - Index.add_source SentManager.default_source
8512 + Redwood::SourceManager.add_source SentManager.default_source
8513 end
8514
8515 HookManager.run "startup"
8516 @@ -190,7 +190,7 @@ begin
8517
8518 bm.draw_screen
8519
8520 - Index.usual_sources.each do |s|
8521 + Redwood::SourceManager.usual_sources.each do |s|
8522 next unless s.respond_to? :connect
8523 reporting_thread("call #connect on #{s}") do
8524 begin
8525 diff --git a/bin/sup-add b/bin/sup-add
8526 index 50bbb29..c491ca7 100755
8527 --- a/bin/sup-add
8528 +++ b/bin/sup-add
8529 @@ -82,12 +82,12 @@ index = Redwood::Index.new
8530 index.lock_or_die
8531
8532 begin
8533 - index.load_sources
8534 + Redwood::SourceManager.load_sources
8535
8536 ARGV.each do |uri|
8537 labels = $opts[:labels] ? $opts[:labels].split(/\s*,\s*/).uniq : []
8538
8539 - if !$opts[:force_new] && index.source_for(uri)
8540 + if !$opts[:force_new] && Redwood::SourceManager.source_for(uri)
8541 say "Already know about #{uri}; skipping."
8542 next
8543 end
8544 @@ -99,10 +99,10 @@ begin
8545 when "mbox+ssh"
8546 say "For SSH connections, if you will use public key authentication, you may leave the username and password blank."
8547 say ""
8548 - username, password = get_login_info uri, index.sources
8549 + username, password = get_login_info uri, Redwood::SourceManager.sources
8550 Redwood::MBox::SSHLoader.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels
8551 when "imap", "imaps"
8552 - username, password = get_login_info uri, index.sources
8553 + username, password = get_login_info uri, Redwood::SourceManager.sources
8554 Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels
8555 when "maildir"
8556 Redwood::Maildir.new uri, nil, !$opts[:unusual], $opts[:archive], nil, labels
8557 @@ -114,7 +114,7 @@ begin
8558 Trollop::die "Unknown source type #{parsed_uri.scheme.inspect}"
8559 end
8560 say "Adding #{source}..."
8561 - index.add_source source
8562 + Redwood::SourceManager.add_source source
8563 end
8564 ensure
8565 index.save
8566 diff --git a/bin/sup-config b/bin/sup-config
8567 index 398197f..9fcbee6 100755
8568 --- a/bin/sup-config
8569 +++ b/bin/sup-config
8570 @@ -152,7 +152,7 @@ end
8571 $terminal.wrap_at = :auto
8572 Redwood::start
8573 index = Redwood::Index.new
8574 -index.load_sources
8575 +Redwood::SourceManager.load_sources
8576
8577 say <<EOS
8578 Howdy neighbor! This here's sup-config, ready to help you jack in to
8579 @@ -191,12 +191,12 @@ $config[:editor] = editor
8580 done = false
8581 until done
8582 say "\nNow, we'll tell Sup where to find all your email."
8583 - index.load_sources
8584 + Redwood::SourceManager.load_sources
8585 say "Current sources:"
8586 - if index.sources.empty?
8587 + if Redwood::SourceManager.sources.empty?
8588 say " No sources!"
8589 else
8590 - index.sources.each { |s| puts "* #{s}" }
8591 + Redwood::SourceManager.sources.each { |s| puts "* #{s}" }
8592 end
8593
8594 say "\n"
8595 @@ -210,8 +210,8 @@ end
8596 say "\nSup needs to know where to store your sent messages."
8597 say "Only sources capable of storing mail will be listed.\n\n"
8598
8599 -index.load_sources
8600 -if index.sources.empty?
8601 +Redwood::SourceManager.load_sources
8602 +if Redwood::SourceManager.sources.empty?
8603 say "\nUsing the default sup://sent, since you haven't configured other sources yet."
8604 $config[:sent_source] = 'sup://sent'
8605 else
8606 @@ -222,7 +222,7 @@ else
8607 choose do |menu|
8608 menu.prompt = "Store my sent mail in? "
8609
8610 - valid_sents = index.sources.each do |s|
8611 + valid_sents = Redwood::SourceManager.sources.each do |s|
8612 have_sup_sent = true if s.to_s.eql?('sup://sent')
8613
8614 menu.choice(s.to_s) { $config[:sent_source] = s.to_s } if s.respond_to? :store_message
8615 diff --git a/bin/sup-recover-sources b/bin/sup-recover-sources
8616 index 6e3810c..db75b11 100755
8617 --- a/bin/sup-recover-sources
8618 +++ b/bin/sup-recover-sources
8619 @@ -48,13 +48,14 @@ EOS
8620 end.parse(ARGV)
8621
8622 require "sup"
8623 +Redwood::start
8624 puts "loading index..."
8625 index = Redwood::Index.new
8626 index.load
8627 puts "loaded index of #{index.size} messages"
8628
8629 ARGV.each do |fn|
8630 - next if index.source_for fn
8631 + next if Redwood::SourceManager.source_for fn
8632
8633 ## TODO: merge this code with the same snippet in import
8634 source =
8635 @@ -74,7 +75,7 @@ ARGV.each do |fn|
8636 source.each do |offset, labels|
8637 m = Redwood::Message.new :source => source, :source_info => offset
8638 m.load_from_source!
8639 - source_id = index.source_for_id m.id
8640 + source_id = Redwood::SourceManager.source_for_id m.id
8641 next unless source_id
8642 source_ids[source_id] += 1
8643 count += 1
8644 @@ -85,7 +86,7 @@ ARGV.each do |fn|
8645 id = source_ids.keys.first.to_i
8646 puts "assigned #{source} to #{source_ids.keys.first}"
8647 source.id = id
8648 - index.add_source source
8649 + Redwood::SourceManager.add_source source
8650 else
8651 puts ">> unable to determine #{source}: #{source_ids.inspect}"
8652 end
8653 diff --git a/bin/sup-sync b/bin/sup-sync
8654 index 18a3cab..270524a 100755
8655 --- a/bin/sup-sync
8656 +++ b/bin/sup-sync
8657 @@ -116,11 +116,11 @@ begin
8658 index.load
8659
8660 sources = ARGV.map do |uri|
8661 - index.source_for uri or Trollop::die "Unknown source: #{uri}. Did you add it with sup-add first?"
8662 + Redwood::SourceManager.source_for uri or Trollop::die "Unknown source: #{uri}. Did you add it with sup-add first?"
8663 end
8664
8665 - sources = index.usual_sources if sources.empty?
8666 - sources = index.sources if opts[:all_sources]
8667 + sources = Redwood::SourceManager.usual_sources if sources.empty?
8668 + sources = Redwood::SourceManager.sources if opts[:all_sources]
8669
8670 unless target == :new
8671 if opts[:start_at]
8672 diff --git a/bin/sup-sync-back b/bin/sup-sync-back
8673 index 05b9e8c..679e03a 100755
8674 --- a/bin/sup-sync-back
8675 +++ b/bin/sup-sync-back
8676 @@ -80,13 +80,13 @@ begin
8677 index.load
8678
8679 sources = ARGV.map do |uri|
8680 - s = index.source_for(uri) or die "unknown source: #{uri}. Did you add it with sup-add first?"
8681 + s = Redwood::SourceManager.source_for(uri) or die "unknown source: #{uri}. Did you add it with sup-add first?"
8682 s.is_a?(Redwood::MBox::Loader) or die "#{uri} is not an mbox source."
8683 s
8684 end
8685
8686 if sources.empty?
8687 - sources = index.usual_sources.select { |s| s.is_a? Redwood::MBox::Loader }
8688 + sources = Redwood::SourceManager.usual_sources.select { |s| s.is_a? Redwood::MBox::Loader }
8689 end
8690
8691 unless sources.all? { |s| s.file_path.nil? } || File.executable?(dotlockfile) || opts[:dont_use_dotlockfile]
8692 diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
8693 index 6f603e2..95a3b03 100755
8694 --- a/bin/sup-tweak-labels
8695 +++ b/bin/sup-tweak-labels
8696 @@ -66,10 +66,10 @@ begin
8697
8698 source_ids =
8699 if opts[:all_sources]
8700 - index.sources
8701 + Redwood::SourceManager.sources
8702 else
8703 ARGV.map do |uri|
8704 - index.source_for uri or Trollop::die "Unknown source: #{uri}. Did you add it with sup-add first?"
8705 + Redwood::SourceManager.source_for uri or Trollop::die "Unknown source: #{uri}. Did you add it with sup-add first?"
8706 end
8707 end.map { |s| s.id }
8708 Trollop::die "nothing to do: no sources" if source_ids.empty?
8709 diff --git a/lib/sup.rb b/lib/sup.rb
8710 index 8373820..5689c2b 100644
8711 --- a/lib/sup.rb
8712 +++ b/lib/sup.rb
8713 @@ -115,6 +115,7 @@ module Redwood
8714 Redwood::SuicideManager.new Redwood::SUICIDE_FN
8715 Redwood::CryptoManager.new
8716 Redwood::UndoManager.new
8717 + Redwood::SourceManager.new
8718 end
8719
8720 def finish
8721 @@ -130,7 +131,7 @@ module Redwood
8722 def report_broken_sources opts={}
8723 return unless BufferManager.instantiated?
8724
8725 - broken_sources = Index.sources.select { |s| s.error.is_a? FatalSourceError }
8726 + broken_sources = SourceManager.sources.select { |s| s.error.is_a? FatalSourceError }
8727 unless broken_sources.empty?
8728 BufferManager.spawn_unless_exists("Broken source notification for #{broken_sources.join(',')}", opts) do
8729 TextMode.new(<<EOM)
8730 @@ -147,7 +148,7 @@ EOM
8731 end
8732 end
8733
8734 - desynced_sources = Index.sources.select { |s| s.error.is_a? OutOfSyncSourceError }
8735 + desynced_sources = SourceManager.sources.select { |s| s.error.is_a? OutOfSyncSourceError }
8736 unless desynced_sources.empty?
8737 BufferManager.spawn_unless_exists("Out-of-sync source notification for #{broken_sources.join(',')}", opts) do
8738 TextMode.new(<<EOM)
8739 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
8740 index b9f4b36..7d6258d 100644
8741 --- a/lib/sup/index.rb
8742 +++ b/lib/sup/index.rb
8743 @@ -26,11 +26,7 @@ class Index
8744
8745 def initialize dir=BASE_DIR
8746 @index_mutex = Monitor.new
8747 -
8748 @dir = dir
8749 - @sources = {}
8750 - @sources_dirty = false
8751 - @source_mutex = Monitor.new
8752
8753 wsa = Ferret::Analysis::WhiteSpaceAnalyzer.new false
8754 sa = Ferret::Analysis::StandardAnalyzer.new [], true
8755 @@ -112,36 +108,17 @@ EOS
8756 end
8757
8758 def load
8759 - load_sources
8760 + SourceManager.load_sources
8761 load_index
8762 end
8763
8764 def save
8765 Redwood::log "saving index and sources..."
8766 FileUtils.mkdir_p @dir unless File.exists? @dir
8767 - save_sources
8768 + SourceManager.save_sources
8769 save_index
8770 end
8771
8772 - def add_source source
8773 - @source_mutex.synchronize do
8774 - raise "duplicate source!" if @sources.include? source
8775 - @sources_dirty = true
8776 - max = @sources.max_of { |id, s| s.is_a?(DraftLoader) || s.is_a?(SentLoader) ? 0 : id }
8777 - source.id ||= (max || 0) + 1
8778 - ##source.id += 1 while @sources.member? source.id
8779 - @sources[source.id] = source
8780 - end
8781 - end
8782 -
8783 - def sources
8784 - ## favour the inbox by listing non-archived sources first
8785 - @source_mutex.synchronize { @sources.values }.sort_by { |s| s.id }.partition { |s| !s.archived? }.flatten
8786 - end
8787 -
8788 - def source_for uri; sources.find { |s| s.is_source_for? uri }; end
8789 - def usual_sources; sources.find_all { |s| s.usual? }; end
8790 -
8791 def load_index dir=File.join(@dir, "ferret")
8792 if File.exists? dir
8793 Redwood::log "loading index..."
8794 @@ -383,7 +360,7 @@ EOS
8795 @index_mutex.synchronize do
8796 doc = @index[docid] or return
8797
8798 - source = @source_mutex.synchronize { @sources[doc[:source_id].to_i] }
8799 + source = SourceManager[doc[:source_id].to_i]
8800 raise "invalid source #{doc[:source_id]}" unless source
8801
8802 #puts "building message #{doc[:message_id]} (#{source}##{doc[:source_info]})"
8803 @@ -442,14 +419,6 @@ EOS
8804 contacts.keys.compact
8805 end
8806
8807 - def load_sources fn=Redwood::SOURCE_FN
8808 - source_array = (Redwood::load_yaml_obj(fn) || []).map { |o| Recoverable.new o }
8809 - @source_mutex.synchronize do
8810 - @sources = Hash[*(source_array).map { |s| [s.id, s] }.flatten]
8811 - @sources_dirty = false
8812 - end
8813 - end
8814 -
8815 def each_docid query={}
8816 ferret_query = build_ferret_query query
8817 results = @index_mutex.synchronize { @index.search ferret_query, :limit => (query[:limit] || :all) }
8818 @@ -604,21 +573,6 @@ private
8819 q.add_query Ferret::Search::TermQuery.new("source_id", query[:source_id]), :must if query[:source_id]
8820 q
8821 end
8822 -
8823 - def save_sources fn=Redwood::SOURCE_FN
8824 - @source_mutex.synchronize do
8825 - if @sources_dirty || @sources.any? { |id, s| s.dirty? }
8826 - bakfn = fn + ".bak"
8827 - if File.exists? fn
8828 - File.chmod 0600, fn
8829 - FileUtils.mv fn, bakfn, :force => true unless File.exists?(bakfn) && File.size(fn) == 0
8830 - end
8831 - Redwood::save_yaml_obj sources.sort_by { |s| s.id.to_i }, fn, true
8832 - File.chmod 0600, fn
8833 - end
8834 - @sources_dirty = false
8835 - end
8836 - end
8837 end
8838
8839 end
8840 diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
8841 index bbad5f2..c83290c 100644
8842 --- a/lib/sup/poll.rb
8843 +++ b/lib/sup/poll.rb
8844 @@ -83,7 +83,7 @@ EOS
8845 from_and_subj_inbox = []
8846
8847 @mutex.synchronize do
8848 - Index.usual_sources.each do |source|
8849 + SourceManager.usual_sources.each do |source|
8850 # yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})"
8851 begin
8852 yield "Loading from #{source}... " unless source.done? || (source.respond_to?(:has_errors?) && source.has_errors?)
8853 diff --git a/lib/sup/source.rb b/lib/sup/source.rb
8854 index fb98dbc..1bb7797 100644
8855 --- a/lib/sup/source.rb
8856 +++ b/lib/sup/source.rb
8857 @@ -155,4 +155,61 @@ protected
8858 end
8859 end
8860
8861 +class SourceManager
8862 + include Singleton
8863 +
8864 + def initialize
8865 + @sources = {}
8866 + @sources_dirty = false
8867 + @source_mutex = Monitor.new
8868 + self.class.i_am_the_instance self
8869 + end
8870 +
8871 + def [](id)
8872 + @source_mutex.synchronize { @sources[id] }
8873 + end
8874 +
8875 + def add_source source
8876 + @source_mutex.synchronize do
8877 + raise "duplicate source!" if @sources.include? source
8878 + @sources_dirty = true
8879 + max = @sources.max_of { |id, s| s.is_a?(DraftLoader) || s.is_a?(SentLoader) ? 0 : id }
8880 + source.id ||= (max || 0) + 1
8881 + ##source.id += 1 while @sources.member? source.id
8882 + @sources[source.id] = source
8883 + end
8884 + end
8885 +
8886 + def sources
8887 + ## favour the inbox by listing non-archived sources first
8888 + @source_mutex.synchronize { @sources.values }.sort_by { |s| s.id }.partition { |s| !s.archived? }.flatten
8889 + end
8890 +
8891 + def source_for uri; sources.find { |s| s.is_source_for? uri }; end
8892 + def usual_sources; sources.find_all { |s| s.usual? }; end
8893 +
8894 + def load_sources fn=Redwood::SOURCE_FN
8895 + source_array = (Redwood::load_yaml_obj(fn) || []).map { |o| Recoverable.new o }
8896 + @source_mutex.synchronize do
8897 + @sources = Hash[*(source_array).map { |s| [s.id, s] }.flatten]
8898 + @sources_dirty = false
8899 + end
8900 + end
8901 +
8902 + def save_sources fn=Redwood::SOURCE_FN
8903 + @source_mutex.synchronize do
8904 + if @sources_dirty || @sources.any? { |id, s| s.dirty? }
8905 + bakfn = fn + ".bak"
8906 + if File.exists? fn
8907 + File.chmod 0600, fn
8908 + FileUtils.mv fn, bakfn, :force => true unless File.exists?(bakfn) && File.size(fn) == 0
8909 + end
8910 + Redwood::save_yaml_obj sources.sort_by { |s| s.id.to_i }, fn, true
8911 + File.chmod 0600, fn
8912 + end
8913 + @sources_dirty = false
8914 + end
8915 + end
8916 +end
8917 +
8918 end
8919 --
8920 1.6.0.4
8921
8922
8923 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:05 2009
8924 From: rlane@club.cc.cmu.edu (Rich Lane)
8925 Date: Sat, 20 Jun 2009 13:50:05 -0700
8926 Subject: [sup-talk] [PATCH 06/18] index: move
8927 has_any_from_source_with_label? to sup-sync-back
8928 In-Reply-To: <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
8929 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
8930 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
8931 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
8932 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
8933 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
8934 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
8935 Message-ID: <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
8936
8937 ---
8938 bin/sup-sync-back | 7 ++++++-
8939 lib/sup/index.rb | 7 -------
8940 2 files changed, 6 insertions(+), 8 deletions(-)
8941
8942 diff --git a/bin/sup-sync-back b/bin/sup-sync-back
8943 index 1c746d2..05b9e8c 100755
8944 --- a/bin/sup-sync-back
8945 +++ b/bin/sup-sync-back
8946 @@ -4,6 +4,7 @@ require 'rubygems'
8947 require 'uri'
8948 require 'tempfile'
8949 require 'trollop'
8950 +require 'enumerator'
8951 require "sup"
8952
8953 ## save a message 'm' to an open file pointer 'fp'
8954 @@ -14,6 +15,10 @@ def die msg
8955 $stderr.puts "Error: #{msg}"
8956 exit(-1)
8957 end
8958 +def has_any_from_source_with_label? index, source, label
8959 + query = { :source_id => source.id, :label => label, :limit => 1 }
8960 + not Enumerable::Enumerator.new(index, :each_docid, query).map.empty?
8961 +end
8962
8963 opts = Trollop::options do
8964 version "sup-sync-back (sup #{Redwood::VERSION})"
8965 @@ -96,7 +101,7 @@ EOS
8966 sources.each do |source|
8967 $stderr.puts "Scanning #{source}..."
8968
8969 - unless ((opts[:drop_deleted] || opts[:move_deleted]) && index.has_any_from_source_with_label?(source, :deleted)) || ((opts[:drop_spam] || opts[:move_spam]) && index.has_any_from_source_with_label?(source, :spam))
8970 + unless ((opts[:drop_deleted] || opts[:move_deleted]) && has_any_from_source_with_label?(index, source, :deleted)) || ((opts[:drop_spam] || opts[:move_spam]) && has_any_from_source_with_label?(index, source, :spam))
8971 $stderr.puts "Nothing to do from this source; skipping"
8972 next
8973 end
8974 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
8975 index 64afbdd..b9f4b36 100644
8976 --- a/lib/sup/index.rb
8977 +++ b/lib/sup/index.rb
8978 @@ -450,13 +450,6 @@ EOS
8979 end
8980 end
8981
8982 - def has_any_from_source_with_label? source, label
8983 - q = Ferret::Search::BooleanQuery.new
8984 - q.add_query Ferret::Search::TermQuery.new("source_id", source.id.to_s), :must
8985 - q.add_query Ferret::Search::TermQuery.new("label", label.to_s), :must
8986 - @index_mutex.synchronize { @index.search(q, :limit => 1).total_hits > 0 }
8987 - end
8988 -
8989 def each_docid query={}
8990 ferret_query = build_ferret_query query
8991 results = @index_mutex.synchronize { @index.search ferret_query, :limit => (query[:limit] || :all) }
8992 --
8993 1.6.0.4
8994
8995
8996 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:07 2009
8997 From: rlane@club.cc.cmu.edu (Rich Lane)
8998 Date: Sat, 20 Jun 2009 13:50:07 -0700
8999 Subject: [sup-talk] [PATCH 08/18] index: remove unused method fresh_thread_id
9000 In-Reply-To: <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
9001 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
9002 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
9003 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
9004 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
9005 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
9006 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
9007 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
9008 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
9009 Message-ID: <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
9010
9011 ---
9012 lib/sup/index.rb | 1 -
9013 1 files changed, 0 insertions(+), 1 deletions(-)
9014
9015 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
9016 index 7d6258d..e3f9e69 100644
9017 --- a/lib/sup/index.rb
9018 +++ b/lib/sup/index.rb
9019 @@ -382,7 +382,6 @@ EOS
9020 end
9021 end
9022
9023 - def fresh_thread_id; @next_thread_id += 1; end
9024 def wrap_subj subj; "__START_SUBJECT__ #{subj} __END_SUBJECT__"; end
9025 def unwrap_subj subj; subj =~ /__START_SUBJECT__ (.*?) __END_SUBJECT__/ && $1; end
9026
9027 --
9028 1.6.0.4
9029
9030
9031 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:09 2009
9032 From: rlane@club.cc.cmu.edu (Rich Lane)
9033 Date: Sat, 20 Jun 2009 13:50:09 -0700
9034 Subject: [sup-talk] [PATCH 10/18] index: make wrap_subj methods private
9035 In-Reply-To: <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
9036 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
9037 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
9038 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
9039 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
9040 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
9041 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
9042 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
9043 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
9044 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
9045 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
9046 Message-ID: <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
9047
9048 ---
9049 lib/sup/index.rb | 6 +++---
9050 1 files changed, 3 insertions(+), 3 deletions(-)
9051
9052 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
9053 index 080a4ec..5ddd6ee 100644
9054 --- a/lib/sup/index.rb
9055 +++ b/lib/sup/index.rb
9056 @@ -382,9 +382,6 @@ EOS
9057 end
9058 end
9059
9060 - def wrap_subj subj; "__START_SUBJECT__ #{subj} __END_SUBJECT__"; end
9061 - def unwrap_subj subj; subj =~ /__START_SUBJECT__ (.*?) __END_SUBJECT__/ && $1; end
9062 -
9063 def delete id; @index_mutex.synchronize { @index.delete id } end
9064
9065 def load_contacts emails, h={}
9066 @@ -572,6 +569,9 @@ private
9067 q.add_query Ferret::Search::TermQuery.new("source_id", query[:source_id]), :must if query[:source_id]
9068 q
9069 end
9070 +
9071 + def wrap_subj subj; "__START_SUBJECT__ #{subj} __END_SUBJECT__"; end
9072 + def unwrap_subj subj; subj =~ /__START_SUBJECT__ (.*?) __END_SUBJECT__/ && $1; end
9073 end
9074
9075 end
9076 --
9077 1.6.0.4
9078
9079
9080 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:10 2009
9081 From: rlane@club.cc.cmu.edu (Rich Lane)
9082 Date: Sat, 20 Jun 2009 13:50:10 -0700
9083 Subject: [sup-talk] [PATCH 11/18] index: move Ferret-specific code to
9084 ferret_index.rb
9085 In-Reply-To: <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
9086 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
9087 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
9088 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
9089 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
9090 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
9091 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
9092 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
9093 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
9094 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
9095 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
9096 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
9097 Message-ID: <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
9098
9099 ---
9100 lib/sup/ferret_index.rb | 463 +++++++++++++++++++++++++++++++++++++++++++++++
9101 lib/sup/index.rb | 453 +++++-----------------------------------------
9102 2 files changed, 509 insertions(+), 407 deletions(-)
9103 create mode 100644 lib/sup/ferret_index.rb
9104
9105 diff --git a/lib/sup/ferret_index.rb b/lib/sup/ferret_index.rb
9106 new file mode 100644
9107 index 0000000..53c19e0
9108 --- /dev/null
9109 +++ b/lib/sup/ferret_index.rb
9110 @@ -0,0 +1,463 @@
9111 +require 'ferret'
9112 +
9113 +module Redwood
9114 +
9115 +class FerretIndex < BaseIndex
9116 +
9117 + def initialize dir=BASE_DIR
9118 + super
9119 +
9120 + @index_mutex = Monitor.new
9121 + wsa = Ferret::Analysis::WhiteSpaceAnalyzer.new false
9122 + sa = Ferret::Analysis::StandardAnalyzer.new [], true
9123 + @analyzer = Ferret::Analysis::PerFieldAnalyzer.new wsa
9124 + @analyzer[:body] = sa
9125 + @analyzer[:subject] = sa
9126 + @qparser ||= Ferret::QueryParser.new :default_field => :body, :analyzer => @analyzer, :or_default => false
9127 + end
9128 +
9129 + def load_index dir=File.join(@dir, "ferret")
9130 + if File.exists? dir
9131 + Redwood::log "loading index..."
9132 + @index_mutex.synchronize do
9133 + @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer, :id_field => 'message_id')
9134 + Redwood::log "loaded index of #{@index.size} messages"
9135 + end
9136 + else
9137 + Redwood::log "creating index..."
9138 + @index_mutex.synchronize do
9139 + field_infos = Ferret::Index::FieldInfos.new :store => :yes
9140 + field_infos.add_field :message_id, :index => :untokenized
9141 + field_infos.add_field :source_id
9142 + field_infos.add_field :source_info
9143 + field_infos.add_field :date, :index => :untokenized
9144 + field_infos.add_field :body
9145 + field_infos.add_field :label
9146 + field_infos.add_field :attachments
9147 + field_infos.add_field :subject
9148 + field_infos.add_field :from
9149 + field_infos.add_field :to
9150 + field_infos.add_field :refs
9151 + field_infos.add_field :snippet, :index => :no, :term_vector => :no
9152 + field_infos.create_index dir
9153 + @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer, :id_field => 'message_id')
9154 + end
9155 + end
9156 + end
9157 +
9158 + def sync_message m, opts={}
9159 + entry = @index[m.id]
9160 +
9161 + raise "no source info for message #{m.id}" unless m.source && m.source_info
9162 +
9163 + source_id = if m.source.is_a? Integer
9164 + m.source
9165 + else
9166 + m.source.id or raise "unregistered source #{m.source} (id #{m.source.id.inspect})"
9167 + end
9168 +
9169 + snippet = if m.snippet_contains_encrypted_content? && $config[:discard_snippets_from_encrypted_messages]
9170 + ""
9171 + else
9172 + m.snippet
9173 + end
9174 +
9175 + ## write the new document to the index. if the entry already exists in the
9176 + ## index, reuse it (which avoids having to reload the entry from the source,
9177 + ## which can be quite expensive for e.g. large threads of IMAP actions.)
9178 + ##
9179 + ## exception: if the index entry belongs to an earlier version of the
9180 + ## message, use everything from the new message instead, but union the
9181 + ## flags. this allows messages sent to mailing lists to have their header
9182 + ## updated and to have flags set properly.
9183 + ##
9184 + ## minor hack: messages in sources with lower ids have priority over
9185 + ## messages in sources with higher ids. so messages in the inbox will
9186 + ## override everyone, and messages in the sent box will be overridden
9187 + ## by everyone else.
9188 + ##
9189 + ## written in this manner to support previous versions of the index which
9190 + ## did not keep around the entry body. upgrading is thus seamless.
9191 + entry ||= {}
9192 + labels = m.labels.uniq # override because this is the new state, unless...
9193 +
9194 + ## if we are a later version of a message, ignore what's in the index,
9195 + ## but merge in the labels.
9196 + if entry[:source_id] && entry[:source_info] && entry[:label] &&
9197 + ((entry[:source_id].to_i > source_id) || (entry[:source_info].to_i < m.source_info))
9198 + labels = (entry[:label].symbolistize + m.labels).uniq
9199 + #Redwood::log "found updated version of message #{m.id}: #{m.subj}"
9200 + #Redwood::log "previous version was at #{entry[:source_id].inspect}:#{entry[:source_info].inspect}, this version at #{source_id.inspect}:#{m.source_info.inspect}"
9201 + #Redwood::log "merged labels are #{labels.inspect} (index #{entry[:label].inspect}, message #{m.labels.inspect})"
9202 + entry = {}
9203 + end
9204 +
9205 + ## if force_overwite is true, ignore what's in the index. this is used
9206 + ## primarily by sup-sync to force index updates.
9207 + entry = {} if opts[:force_overwrite]
9208 +
9209 + d = {
9210 + :message_id => m.id,
9211 + :source_id => source_id,
9212 + :source_info => m.source_info,
9213 + :date => (entry[:date] || m.date.to_indexable_s),
9214 + :body => (entry[:body] || m.indexable_content),
9215 + :snippet => snippet, # always override
9216 + :label => labels.uniq.join(" "),
9217 + :attachments => (entry[:attachments] || m.attachments.uniq.join(" ")),
9218 +
9219 + ## always override :from and :to.
9220 + ## older versions of Sup would often store the wrong thing in the index
9221 + ## (because they were canonicalizing email addresses, resulting in the
9222 + ## wrong name associated with each.) the correct address is read from
9223 + ## the original header when these messages are opened in thread-view-mode,
9224 + ## so this allows people to forcibly update the address in the index by
9225 + ## marking those threads for saving.
9226 + :from => (m.from ? m.from.indexable_content : ""),
9227 + :to => (m.to + m.cc + m.bcc).map { |x| x.indexable_content }.join(" "),
9228 +
9229 + :subject => (entry[:subject] || wrap_subj(Message.normalize_subj(m.subj))),
9230 + :refs => (entry[:refs] || (m.refs + m.replytos).uniq.join(" ")),
9231 + }
9232 +
9233 + @index_mutex.synchronize do
9234 + @index.delete m.id
9235 + @index.add_document d
9236 + end
9237 + end
9238 +
9239 + def save_index fn=File.join(@dir, "ferret")
9240 + # don't have to do anything, apparently
9241 + end
9242 +
9243 + def contains_id? id
9244 + @index_mutex.synchronize { @index.search(Ferret::Search::TermQuery.new(:message_id, id)).total_hits > 0 }
9245 + end
9246 +
9247 + def size
9248 + @index_mutex.synchronize { @index.size }
9249 + end
9250 +
9251 + EACH_BY_DATE_NUM = 100
9252 + def each_id_by_date query={}
9253 + return if empty? # otherwise ferret barfs ###TODO: remove this once my ferret patch is accepted
9254 + ferret_query = build_ferret_query query
9255 + offset = 0
9256 + while true
9257 + limit = (query[:limit])? [EACH_BY_DATE_NUM, query[:limit] - offset].min : EACH_BY_DATE_NUM
9258 + results = @index_mutex.synchronize { @index.search ferret_query, :sort => "date DESC", :limit => limit, :offset => offset }
9259 + Redwood::log "got #{results.total_hits} results for query (offset #{offset}) #{ferret_query.inspect}"
9260 + results.hits.each do |hit|
9261 + yield @index_mutex.synchronize { @index[hit.doc][:message_id] }, lambda { build_message hit.doc }
9262 + end
9263 + break if query[:limit] and offset >= query[:limit] - limit
9264 + break if offset >= results.total_hits - limit
9265 + offset += limit
9266 + end
9267 + end
9268 +
9269 + def num_results_for query={}
9270 + return 0 if empty? # otherwise ferret barfs ###TODO: remove this once my ferret patch is accepted
9271 + ferret_query = build_ferret_query query
9272 + @index_mutex.synchronize { @index.search(ferret_query, :limit => 1).total_hits }
9273 + end
9274 +
9275 + SAME_SUBJECT_DATE_LIMIT = 7
9276 + MAX_CLAUSES = 1000
9277 + def each_message_in_thread_for m, opts={}
9278 + #Redwood::log "Building thread for #{m.id}: #{m.subj}"
9279 + messages = {}
9280 + searched = {}
9281 + num_queries = 0
9282 +
9283 + pending = [m.id]
9284 + if $config[:thread_by_subject] # do subject queries
9285 + date_min = m.date - (SAME_SUBJECT_DATE_LIMIT * 12 * 3600)
9286 + date_max = m.date + (SAME_SUBJECT_DATE_LIMIT * 12 * 3600)
9287 +
9288 + q = Ferret::Search::BooleanQuery.new true
9289 + sq = Ferret::Search::PhraseQuery.new(:subject)
9290 + wrap_subj(Message.normalize_subj(m.subj)).split.each do |t|
9291 + sq.add_term t
9292 + end
9293 + q.add_query sq, :must
9294 + q.add_query Ferret::Search::RangeQuery.new(:date, :>= => date_min.to_indexable_s, :<= => date_max.to_indexable_s), :must
9295 +
9296 + q = build_ferret_query :qobj => q
9297 +
9298 + p1 = @index_mutex.synchronize { @index.search(q).hits.map { |hit| @index[hit.doc][:message_id] } }
9299 + Redwood::log "found #{p1.size} results for subject query #{q}"
9300 +
9301 + p2 = @index_mutex.synchronize { @index.search(q.to_s, :limit => :all).hits.map { |hit| @index[hit.doc][:message_id] } }
9302 + Redwood::log "found #{p2.size} results in string form"
9303 +
9304 + pending = (pending + p1 + p2).uniq
9305 + end
9306 +
9307 + until pending.empty? || (opts[:limit] && messages.size >= opts[:limit])
9308 + q = Ferret::Search::BooleanQuery.new true
9309 + # this disappeared in newer ferrets... wtf.
9310 + # q.max_clause_count = 2048
9311 +
9312 + lim = [MAX_CLAUSES / 2, pending.length].min
9313 + pending[0 ... lim].each do |id|
9314 + searched[id] = true
9315 + q.add_query Ferret::Search::TermQuery.new(:message_id, id), :should
9316 + q.add_query Ferret::Search::TermQuery.new(:refs, id), :should
9317 + end
9318 + pending = pending[lim .. -1]
9319 +
9320 + q = build_ferret_query :qobj => q
9321 +
9322 + num_queries += 1
9323 + killed = false
9324 + @index_mutex.synchronize do
9325 + @index.search_each(q, :limit => :all) do |docid, score|
9326 + break if opts[:limit] && messages.size >= opts[:limit]
9327 + if @index[docid][:label].split(/\s+/).include?("killed") && opts[:skip_killed]
9328 + killed = true
9329 + break
9330 + end
9331 + mid = @index[docid][:message_id]
9332 + unless messages.member?(mid)
9333 + #Redwood::log "got #{mid} as a child of #{id}"
9334 + messages[mid] ||= lambda { build_message docid }
9335 + refs = @index[docid][:refs].split
9336 + pending += refs.select { |id| !searched[id] }
9337 + end
9338 + end
9339 + end
9340 + end
9341 +
9342 + if killed
9343 + Redwood::log "thread for #{m.id} is killed, ignoring"
9344 + false
9345 + else
9346 + Redwood::log "ran #{num_queries} queries to build thread of #{messages.size} messages for #{m.id}: #{m.subj}" if num_queries > 0
9347 + messages.each { |mid, builder| yield mid, builder }
9348 + true
9349 + end
9350 + end
9351 +
9352 + ## builds a message object from a ferret result
9353 + def build_message docid
9354 + @index_mutex.synchronize do
9355 + doc = @index[docid] or return
9356 +
9357 + source = SourceManager[doc[:source_id].to_i]
9358 + raise "invalid source #{doc[:source_id]}" unless source
9359 +
9360 + #puts "building message #{doc[:message_id]} (#{source}##{doc[:source_info]})"
9361 +
9362 + fake_header = {
9363 + "date" => Time.at(doc[:date].to_i),
9364 + "subject" => unwrap_subj(doc[:subject]),
9365 + "from" => doc[:from],
9366 + "to" => doc[:to].split.join(", "), # reformat
9367 + "message-id" => doc[:message_id],
9368 + "references" => doc[:refs].split.map { |x| "<#{x}>" }.join(" "),
9369 + }
9370 +
9371 + m = Message.new :source => source, :source_info => doc[:source_info].to_i,
9372 + :labels => doc[:label].symbolistize,
9373 + :snippet => doc[:snippet]
9374 + m.parse_header fake_header
9375 + m
9376 + end
9377 + end
9378 +
9379 + def delete id
9380 + @index_mutex.synchronize { @index.delete id }
9381 + end
9382 +
9383 + def load_contacts emails, h={}
9384 + q = Ferret::Search::BooleanQuery.new true
9385 + emails.each do |e|
9386 + qq = Ferret::Search::BooleanQuery.new true
9387 + qq.add_query Ferret::Search::TermQuery.new(:from, e), :should
9388 + qq.add_query Ferret::Search::TermQuery.new(:to, e), :should
9389 + q.add_query qq
9390 + end
9391 + q.add_query Ferret::Search::TermQuery.new(:label, "spam"), :must_not
9392 +
9393 + Redwood::log "contact search: #{q}"
9394 + contacts = {}
9395 + num = h[:num] || 20
9396 + @index_mutex.synchronize do
9397 + @index.search_each q, :sort => "date DESC", :limit => :all do |docid, score|
9398 + break if contacts.size >= num
9399 + #Redwood::log "got message #{docid} to: #{@index[docid][:to].inspect} and from: #{@index[docid][:from].inspect}"
9400 + f = @index[docid][:from]
9401 + t = @index[docid][:to]
9402 +
9403 + if AccountManager.is_account_email? f
9404 + t.split(" ").each { |e| contacts[Person.from_address(e)] = true }
9405 + else
9406 + contacts[Person.from_address(f)] = true
9407 + end
9408 + end
9409 + end
9410 +
9411 + contacts.keys.compact
9412 + end
9413 +
9414 + def each_docid query={}
9415 + ferret_query = build_ferret_query query
9416 + results = @index_mutex.synchronize { @index.search ferret_query, :limit => (query[:limit] || :all) }
9417 + results.hits.map { |hit| yield hit.doc }
9418 + end
9419 +
9420 + def each_message query={}
9421 + each_docid query do |docid|
9422 + yield build_message(docid)
9423 + end
9424 + end
9425 +
9426 + def optimize
9427 + @index_mutex.synchronize { @index.optimize }
9428 + end
9429 +
9430 + def source_for_id id
9431 + entry = @index[id]
9432 + return unless entry
9433 + entry[:source_id].to_i
9434 + end
9435 +
9436 + class ParseError < StandardError; end
9437 +
9438 + ## parse a query string from the user. returns a query object
9439 + ## that can be passed to any index method with a 'query'
9440 + ## argument, as well as build_ferret_query.
9441 + ##
9442 + ## raises a ParseError if something went wrong.
9443 + def parse_query s
9444 + query = {}
9445 +
9446 + subs = s.gsub(/\b(to|from):(\S+)\b/) do
9447 + field, name = $1, $2
9448 + if(p = ContactManager.contact_for(name))
9449 + [field, p.email]
9450 + elsif name == "me"
9451 + [field, "(" + AccountManager.user_emails.join("||") + ")"]
9452 + else
9453 + [field, name]
9454 + end.join(":")
9455 + end
9456 +
9457 + ## if we see a label:deleted or a label:spam term anywhere in the query
9458 + ## string, we set the extra load_spam or load_deleted options to true.
9459 + ## bizarre? well, because the query allows arbitrary parenthesized boolean
9460 + ## expressions, without fully parsing the query, we can't tell whether
9461 + ## the user is explicitly directing us to search spam messages or not.
9462 + ## e.g. if the string is -(-(-(-(-label:spam)))), does the user want to
9463 + ## search spam messages or not?
9464 + ##
9465 + ## so, we rely on the fact that turning these extra options ON turns OFF
9466 + ## the adding of "-label:deleted" or "-label:spam" terms at the very
9467 + ## final stage of query processing. if the user wants to search spam
9468 + ## messages, not adding that is the right thing; if he doesn't want to
9469 + ## search spam messages, then not adding it won't have any effect.
9470 + query[:load_spam] = true if subs =~ /\blabel:spam\b/
9471 + query[:load_deleted] = true if subs =~ /\blabel:deleted\b/
9472 +
9473 + ## gmail style "is" operator
9474 + subs = subs.gsub(/\b(is|has):(\S+)\b/) do
9475 + field, label = $1, $2
9476 + case label
9477 + when "read"
9478 + "-label:unread"
9479 + when "spam"
9480 + query[:load_spam] = true
9481 + "label:spam"
9482 + when "deleted"
9483 + query[:load_deleted] = true
9484 + "label:deleted"
9485 + else
9486 + "label:#{$2}"
9487 + end
9488 + end
9489 +
9490 + ## gmail style attachments "filename" and "filetype" searches
9491 + subs = subs.gsub(/\b(filename|filetype):(\((.+?)\)\B|(\S+)\b)/) do
9492 + field, name = $1, ($3 || $4)
9493 + case field
9494 + when "filename"
9495 + Redwood::log "filename - translated #{field}:#{name} to attachments:(#{name.downcase})"
9496 + "attachments:(#{name.downcase})"
9497 + when "filetype"
9498 + Redwood::log "filetype - translated #{field}:#{name} to attachments:(*.#{name.downcase})"
9499 + "attachments:(*.#{name.downcase})"
9500 + end
9501 + end
9502 +
9503 + if $have_chronic
9504 + subs = subs.gsub(/\b(before|on|in|during|after):(\((.+?)\)\B|(\S+)\b)/) do
9505 + field, datestr = $1, ($3 || $4)
9506 + realdate = Chronic.parse datestr, :guess => false, :context => :past
9507 + if realdate
9508 + case field
9509 + when "after"
9510 + Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate.end}"
9511 + "date:(>= #{sprintf "%012d", realdate.end.to_i})"
9512 + when "before"
9513 + Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate.begin}"
9514 + "date:(<= #{sprintf "%012d", realdate.begin.to_i})"
9515 + else
9516 + Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate}"
9517 + "date:(<= #{sprintf "%012d", realdate.end.to_i}) date:(>= #{sprintf "%012d", realdate.begin.to_i})"
9518 + end
9519 + else
9520 + raise ParseError, "can't understand date #{datestr.inspect}"
9521 + end
9522 + end
9523 + end
9524 +
9525 + ## limit:42 restrict the search to 42 results
9526 + subs = subs.gsub(/\blimit:(\S+)\b/) do
9527 + lim = $1
9528 + if lim =~ /^\d+$/
9529 + query[:limit] = lim.to_i
9530 + ''
9531 + else
9532 + raise ParseError, "non-numeric limit #{lim.inspect}"
9533 + end
9534 + end
9535 +
9536 + begin
9537 + query[:qobj] = @qparser.parse(subs)
9538 + query[:text] = s
9539 + query
9540 + rescue Ferret::QueryParser::QueryParseException => e
9541 + raise ParseError, e.message
9542 + end
9543 + end
9544 +
9545 +private
9546 +
9547 + def build_ferret_query query
9548 + q = Ferret::Search::BooleanQuery.new
9549 + q.add_query query[:qobj], :must if query[:qobj]
9550 + labels = ([query[:label]] + (query[:labels] || [])).compact
9551 + labels.each { |t| q.add_query Ferret::Search::TermQuery.new("label", t.to_s), :must }
9552 + if query[:participants]
9553 + q2 = Ferret::Search::BooleanQuery.new
9554 + query[:participants].each do |p|
9555 + q2.add_query Ferret::Search::TermQuery.new("from", p.email), :should
9556 + q2.add_query Ferret::Search::TermQuery.new("to", p.email), :should
9557 + end
9558 + q.add_query q2, :must
9559 + end
9560 +
9561 + q.add_query Ferret::Search::TermQuery.new("label", "spam"), :must_not unless query[:load_spam] || labels.include?(:spam)
9562 + q.add_query Ferret::Search::TermQuery.new("label", "deleted"), :must_not unless query[:load_deleted] || labels.include?(:deleted)
9563 + q.add_query Ferret::Search::TermQuery.new("label", "killed"), :must_not if query[:skip_killed]
9564 +
9565 + q.add_query Ferret::Search::TermQuery.new("source_id", query[:source_id]), :must if query[:source_id]
9566 + q
9567 + end
9568 +
9569 + def wrap_subj subj; "__START_SUBJECT__ #{subj} __END_SUBJECT__"; end
9570 + def unwrap_subj subj; subj =~ /__START_SUBJECT__ (.*?) __END_SUBJECT__/ && $1; end
9571 +end
9572 +
9573 +end
9574 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
9575 index 5ddd6ee..be0e870 100644
9576 --- a/lib/sup/index.rb
9577 +++ b/lib/sup/index.rb
9578 @@ -1,7 +1,6 @@
9579 -## the index structure for redwood. interacts with ferret.
9580 +## Index interface, subclassed by Ferret indexer.
9581
9582 require 'fileutils'
9583 -require 'ferret'
9584
9585 begin
9586 require 'chronic'
9587 @@ -13,7 +12,7 @@ end
9588
9589 module Redwood
9590
9591 -class Index
9592 +class BaseIndex
9593 class LockError < StandardError
9594 def initialize h
9595 @h = h
9596 @@ -25,17 +24,8 @@ class Index
9597 include Singleton
9598
9599 def initialize dir=BASE_DIR
9600 - @index_mutex = Monitor.new
9601 @dir = dir
9602 -
9603 - wsa = Ferret::Analysis::WhiteSpaceAnalyzer.new false
9604 - sa = Ferret::Analysis::StandardAnalyzer.new [], true
9605 - @analyzer = Ferret::Analysis::PerFieldAnalyzer.new wsa
9606 - @analyzer[:body] = sa
9607 - @analyzer[:subject] = sa
9608 - @qparser ||= Ferret::QueryParser.new :default_field => :body, :analyzer => @analyzer, :or_default => false
9609 @lock = Lockfile.new lockfile, :retries => 0, :max_age => nil
9610 -
9611 self.class.i_am_the_instance self
9612 end
9613
9614 @@ -119,155 +109,44 @@ EOS
9615 save_index
9616 end
9617
9618 - def load_index dir=File.join(@dir, "ferret")
9619 - if File.exists? dir
9620 - Redwood::log "loading index..."
9621 - @index_mutex.synchronize do
9622 - @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer, :id_field => 'message_id')
9623 - Redwood::log "loaded index of #{@index.size} messages"
9624 - end
9625 - else
9626 - Redwood::log "creating index..."
9627 - @index_mutex.synchronize do
9628 - field_infos = Ferret::Index::FieldInfos.new :store => :yes
9629 - field_infos.add_field :message_id, :index => :untokenized
9630 - field_infos.add_field :source_id
9631 - field_infos.add_field :source_info
9632 - field_infos.add_field :date, :index => :untokenized
9633 - field_infos.add_field :body
9634 - field_infos.add_field :label
9635 - field_infos.add_field :attachments
9636 - field_infos.add_field :subject
9637 - field_infos.add_field :from
9638 - field_infos.add_field :to
9639 - field_infos.add_field :refs
9640 - field_infos.add_field :snippet, :index => :no, :term_vector => :no
9641 - field_infos.create_index dir
9642 - @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer, :id_field => 'message_id')
9643 - end
9644 - end
9645 + def load_index
9646 + unimplemented
9647 end
9648
9649 ## Syncs the message to the index, replacing any previous version. adding
9650 ## either way. Index state will be determined by the message's #labels
9651 ## accessor.
9652 def sync_message m, opts={}
9653 - entry = @index[m.id]
9654 -
9655 - raise "no source info for message #{m.id}" unless m.source && m.source_info
9656 -
9657 - source_id = if m.source.is_a? Integer
9658 - m.source
9659 - else
9660 - m.source.id or raise "unregistered source #{m.source} (id #{m.source.id.inspect})"
9661 - end
9662 -
9663 - snippet = if m.snippet_contains_encrypted_content? && $config[:discard_snippets_from_encrypted_messages]
9664 - ""
9665 - else
9666 - m.snippet
9667 - end
9668 -
9669 - ## write the new document to the index. if the entry already exists in the
9670 - ## index, reuse it (which avoids having to reload the entry from the source,
9671 - ## which can be quite expensive for e.g. large threads of IMAP actions.)
9672 - ##
9673 - ## exception: if the index entry belongs to an earlier version of the
9674 - ## message, use everything from the new message instead, but union the
9675 - ## flags. this allows messages sent to mailing lists to have their header
9676 - ## updated and to have flags set properly.
9677 - ##
9678 - ## minor hack: messages in sources with lower ids have priority over
9679 - ## messages in sources with higher ids. so messages in the inbox will
9680 - ## override everyone, and messages in the sent box will be overridden
9681 - ## by everyone else.
9682 - ##
9683 - ## written in this manner to support previous versions of the index which
9684 - ## did not keep around the entry body. upgrading is thus seamless.
9685 - entry ||= {}
9686 - labels = m.labels.uniq # override because this is the new state, unless...
9687 -
9688 - ## if we are a later version of a message, ignore what's in the index,
9689 - ## but merge in the labels.
9690 - if entry[:source_id] && entry[:source_info] && entry[:label] &&
9691 - ((entry[:source_id].to_i > source_id) || (entry[:source_info].to_i < m.source_info))
9692 - labels = (entry[:label].symbolistize + m.labels).uniq
9693 - #Redwood::log "found updated version of message #{m.id}: #{m.subj}"
9694 - #Redwood::log "previous version was at #{entry[:source_id].inspect}:#{entry[:source_info].inspect}, this version at #{source_id.inspect}:#{m.source_info.inspect}"
9695 - #Redwood::log "merged labels are #{labels.inspect} (index #{entry[:label].inspect}, message #{m.labels.inspect})"
9696 - entry = {}
9697 - end
9698 -
9699 - ## if force_overwite is true, ignore what's in the index. this is used
9700 - ## primarily by sup-sync to force index updates.
9701 - entry = {} if opts[:force_overwrite]
9702 -
9703 - d = {
9704 - :message_id => m.id,
9705 - :source_id => source_id,
9706 - :source_info => m.source_info,
9707 - :date => (entry[:date] || m.date.to_indexable_s),
9708 - :body => (entry[:body] || m.indexable_content),
9709 - :snippet => snippet, # always override
9710 - :label => labels.uniq.join(" "),
9711 - :attachments => (entry[:attachments] || m.attachments.uniq.join(" ")),
9712 -
9713 - ## always override :from and :to.
9714 - ## older versions of Sup would often store the wrong thing in the index
9715 - ## (because they were canonicalizing email addresses, resulting in the
9716 - ## wrong name associated with each.) the correct address is read from
9717 - ## the original header when these messages are opened in thread-view-mode,
9718 - ## so this allows people to forcibly update the address in the index by
9719 - ## marking those threads for saving.
9720 - :from => (m.from ? m.from.indexable_content : ""),
9721 - :to => (m.to + m.cc + m.bcc).map { |x| x.indexable_content }.join(" "),
9722 -
9723 - :subject => (entry[:subject] || wrap_subj(Message.normalize_subj(m.subj))),
9724 - :refs => (entry[:refs] || (m.refs + m.replytos).uniq.join(" ")),
9725 - }
9726 -
9727 - @index_mutex.synchronize do
9728 - @index.delete m.id
9729 - @index.add_document d
9730 - end
9731 + unimplemented
9732 end
9733
9734 - def save_index fn=File.join(@dir, "ferret")
9735 - # don't have to do anything, apparently
9736 + def save_index fn
9737 + unimplemented
9738 end
9739
9740 def contains_id? id
9741 - @index_mutex.synchronize { @index.search(Ferret::Search::TermQuery.new(:message_id, id)).total_hits > 0 }
9742 + unimplemented
9743 end
9744 +
9745 def contains? m; contains_id? m.id end
9746 - def size; @index_mutex.synchronize { @index.size } end
9747 +
9748 + def size
9749 + unimplemented
9750 + end
9751 +
9752 def empty?; size == 0 end
9753
9754 - ## you should probably not call this on a block that doesn't break
9755 + ## Yields a message-id and message-building lambda for each
9756 + ## message that matches the given query, in descending date order.
9757 + ## You should probably not call this on a block that doesn't break
9758 ## rather quickly because the results can be very large.
9759 - EACH_BY_DATE_NUM = 100
9760 def each_id_by_date query={}
9761 - return if empty? # otherwise ferret barfs ###TODO: remove this once my ferret patch is accepted
9762 - ferret_query = build_ferret_query query
9763 - offset = 0
9764 - while true
9765 - limit = (query[:limit])? [EACH_BY_DATE_NUM, query[:limit] - offset].min : EACH_BY_DATE_NUM
9766 - results = @index_mutex.synchronize { @index.search ferret_query, :sort => "date DESC", :limit => limit, :offset => offset }
9767 - Redwood::log "got #{results.total_hits} results for query (offset #{offset}) #{ferret_query.inspect}"
9768 - results.hits.each do |hit|
9769 - yield @index_mutex.synchronize { @index[hit.doc][:message_id] }, lambda { build_message hit.doc }
9770 - end
9771 - break if query[:limit] and offset >= query[:limit] - limit
9772 - break if offset >= results.total_hits - limit
9773 - offset += limit
9774 - end
9775 + unimplemented
9776 end
9777
9778 + ## Return the number of matches for query in the index
9779 def num_results_for query={}
9780 - return 0 if empty? # otherwise ferret barfs ###TODO: remove this once my ferret patch is accepted
9781 -
9782 - ferret_query = build_ferret_query query
9783 - @index_mutex.synchronize { @index.search(ferret_query, :limit => 1).total_hits }
9784 + unimplemented
9785 end
9786
9787 ## yield all messages in the thread containing 'm' by repeatedly
9788 @@ -278,300 +157,60 @@ EOS
9789 ## only two options, :limit and :skip_killed. if :skip_killed is
9790 ## true, stops loading any thread if a message with a :killed flag
9791 ## is found.
9792 - SAME_SUBJECT_DATE_LIMIT = 7
9793 - MAX_CLAUSES = 1000
9794 def each_message_in_thread_for m, opts={}
9795 - #Redwood::log "Building thread for #{m.id}: #{m.subj}"
9796 - messages = {}
9797 - searched = {}
9798 - num_queries = 0
9799 -
9800 - pending = [m.id]
9801 - if $config[:thread_by_subject] # do subject queries
9802 - date_min = m.date - (SAME_SUBJECT_DATE_LIMIT * 12 * 3600)
9803 - date_max = m.date + (SAME_SUBJECT_DATE_LIMIT * 12 * 3600)
9804 -
9805 - q = Ferret::Search::BooleanQuery.new true
9806 - sq = Ferret::Search::PhraseQuery.new(:subject)
9807 - wrap_subj(Message.normalize_subj(m.subj)).split.each do |t|
9808 - sq.add_term t
9809 - end
9810 - q.add_query sq, :must
9811 - q.add_query Ferret::Search::RangeQuery.new(:date, :>= => date_min.to_indexable_s, :<= => date_max.to_indexable_s), :must
9812 -
9813 - q = build_ferret_query :qobj => q
9814 -
9815 - p1 = @index_mutex.synchronize { @index.search(q).hits.map { |hit| @index[hit.doc][:message_id] } }
9816 - Redwood::log "found #{p1.size} results for subject query #{q}"
9817 -
9818 - p2 = @index_mutex.synchronize { @index.search(q.to_s, :limit => :all).hits.map { |hit| @index[hit.doc][:message_id] } }
9819 - Redwood::log "found #{p2.size} results in string form"
9820 -
9821 - pending = (pending + p1 + p2).uniq
9822 - end
9823 -
9824 - until pending.empty? || (opts[:limit] && messages.size >= opts[:limit])
9825 - q = Ferret::Search::BooleanQuery.new true
9826 - # this disappeared in newer ferrets... wtf.
9827 - # q.max_clause_count = 2048
9828 -
9829 - lim = [MAX_CLAUSES / 2, pending.length].min
9830 - pending[0 ... lim].each do |id|
9831 - searched[id] = true
9832 - q.add_query Ferret::Search::TermQuery.new(:message_id, id), :should
9833 - q.add_query Ferret::Search::TermQuery.new(:refs, id), :should
9834 - end
9835 - pending = pending[lim .. -1]
9836 -
9837 - q = build_ferret_query :qobj => q
9838 -
9839 - num_queries += 1
9840 - killed = false
9841 - @index_mutex.synchronize do
9842 - @index.search_each(q, :limit => :all) do |docid, score|
9843 - break if opts[:limit] && messages.size >= opts[:limit]
9844 - if @index[docid][:label].split(/\s+/).include?("killed") && opts[:skip_killed]
9845 - killed = true
9846 - break
9847 - end
9848 - mid = @index[docid][:message_id]
9849 - unless messages.member?(mid)
9850 - #Redwood::log "got #{mid} as a child of #{id}"
9851 - messages[mid] ||= lambda { build_message docid }
9852 - refs = @index[docid][:refs].split
9853 - pending += refs.select { |id| !searched[id] }
9854 - end
9855 - end
9856 - end
9857 - end
9858 -
9859 - if killed
9860 - Redwood::log "thread for #{m.id} is killed, ignoring"
9861 - false
9862 - else
9863 - Redwood::log "ran #{num_queries} queries to build thread of #{messages.size} messages for #{m.id}: #{m.subj}" if num_queries > 0
9864 - messages.each { |mid, builder| yield mid, builder }
9865 - true
9866 - end
9867 + unimplemented
9868 end
9869
9870 - ## builds a message object from a ferret result
9871 - def build_message docid
9872 - @index_mutex.synchronize do
9873 - doc = @index[docid] or return
9874 -
9875 - source = SourceManager[doc[:source_id].to_i]
9876 - raise "invalid source #{doc[:source_id]}" unless source
9877 -
9878 - #puts "building message #{doc[:message_id]} (#{source}##{doc[:source_info]})"
9879 -
9880 - fake_header = {
9881 - "date" => Time.at(doc[:date].to_i),
9882 - "subject" => unwrap_subj(doc[:subject]),
9883 - "from" => doc[:from],
9884 - "to" => doc[:to].split.join(", "), # reformat
9885 - "message-id" => doc[:message_id],
9886 - "references" => doc[:refs].split.map { |x| "<#{x}>" }.join(" "),
9887 - }
9888 -
9889 - m = Message.new :source => source, :source_info => doc[:source_info].to_i,
9890 - :labels => doc[:label].symbolistize,
9891 - :snippet => doc[:snippet]
9892 - m.parse_header fake_header
9893 - m
9894 - end
9895 + ## Load message with the given message-id from the index
9896 + def build_message id
9897 + unimplemented
9898 end
9899
9900 - def delete id; @index_mutex.synchronize { @index.delete id } end
9901 -
9902 - def load_contacts emails, h={}
9903 - q = Ferret::Search::BooleanQuery.new true
9904 - emails.each do |e|
9905 - qq = Ferret::Search::BooleanQuery.new true
9906 - qq.add_query Ferret::Search::TermQuery.new(:from, e), :should
9907 - qq.add_query Ferret::Search::TermQuery.new(:to, e), :should
9908 - q.add_query qq
9909 - end
9910 - q.add_query Ferret::Search::TermQuery.new(:label, "spam"), :must_not
9911 -
9912 - Redwood::log "contact search: #{q}"
9913 - contacts = {}
9914 - num = h[:num] || 20
9915 - @index_mutex.synchronize do
9916 - @index.search_each q, :sort => "date DESC", :limit => :all do |docid, score|
9917 - break if contacts.size >= num
9918 - #Redwood::log "got message #{docid} to: #{@index[docid][:to].inspect} and from: #{@index[docid][:from].inspect}"
9919 - f = @index[docid][:from]
9920 - t = @index[docid][:to]
9921 -
9922 - if AccountManager.is_account_email? f
9923 - t.split(" ").each { |e| contacts[Person.from_address(e)] = true }
9924 - else
9925 - contacts[Person.from_address(f)] = true
9926 - end
9927 - end
9928 - end
9929 + ## Delete message with the given message-id from the index
9930 + def delete id
9931 + unimplemented
9932 + end
9933
9934 - contacts.keys.compact
9935 + ## Given an array of email addresses, return an array of Person objects that
9936 + ## have sent mail to or received mail from any of the given addresses.
9937 + def load_contacts email_addresses, h={}
9938 + unimplemented
9939 end
9940
9941 + ## Yield each docid matching query
9942 def each_docid query={}
9943 - ferret_query = build_ferret_query query
9944 - results = @index_mutex.synchronize { @index.search ferret_query, :limit => (query[:limit] || :all) }
9945 - results.hits.map { |hit| yield hit.doc }
9946 + unimplemented
9947 end
9948
9949 + ## Yield each messages matching query
9950 def each_message query={}
9951 - each_docid query do |docid|
9952 - yield build_message(docid)
9953 - end
9954 + unimplemented
9955 end
9956
9957 + ## Implementation-specific optimization step
9958 def optimize
9959 - @index_mutex.synchronize { @index.optimize }
9960 + unimplemented
9961 end
9962
9963 + ## Return the id source of the source the message with the given message-id
9964 + ## was synced from
9965 def source_for_id id
9966 - entry = @index[id]
9967 - return unless entry
9968 - entry[:source_id].to_i
9969 + unimplemented
9970 end
9971
9972 class ParseError < StandardError; end
9973
9974 ## parse a query string from the user. returns a query object
9975 ## that can be passed to any index method with a 'query'
9976 - ## argument, as well as build_ferret_query.
9977 + ## argument.
9978 ##
9979 ## raises a ParseError if something went wrong.
9980 def parse_query s
9981 - query = {}
9982 -
9983 - subs = s.gsub(/\b(to|from):(\S+)\b/) do
9984 - field, name = $1, $2
9985 - if(p = ContactManager.contact_for(name))
9986 - [field, p.email]
9987 - elsif name == "me"
9988 - [field, "(" + AccountManager.user_emails.join("||") + ")"]
9989 - else
9990 - [field, name]
9991 - end.join(":")
9992 - end
9993 -
9994 - ## if we see a label:deleted or a label:spam term anywhere in the query
9995 - ## string, we set the extra load_spam or load_deleted options to true.
9996 - ## bizarre? well, because the query allows arbitrary parenthesized boolean
9997 - ## expressions, without fully parsing the query, we can't tell whether
9998 - ## the user is explicitly directing us to search spam messages or not.
9999 - ## e.g. if the string is -(-(-(-(-label:spam)))), does the user want to
10000 - ## search spam messages or not?
10001 - ##
10002 - ## so, we rely on the fact that turning these extra options ON turns OFF
10003 - ## the adding of "-label:deleted" or "-label:spam" terms at the very
10004 - ## final stage of query processing. if the user wants to search spam
10005 - ## messages, not adding that is the right thing; if he doesn't want to
10006 - ## search spam messages, then not adding it won't have any effect.
10007 - query[:load_spam] = true if subs =~ /\blabel:spam\b/
10008 - query[:load_deleted] = true if subs =~ /\blabel:deleted\b/
10009 -
10010 - ## gmail style "is" operator
10011 - subs = subs.gsub(/\b(is|has):(\S+)\b/) do
10012 - field, label = $1, $2
10013 - case label
10014 - when "read"
10015 - "-label:unread"
10016 - when "spam"
10017 - query[:load_spam] = true
10018 - "label:spam"
10019 - when "deleted"
10020 - query[:load_deleted] = true
10021 - "label:deleted"
10022 - else
10023 - "label:#{$2}"
10024 - end
10025 - end
10026 -
10027 - ## gmail style attachments "filename" and "filetype" searches
10028 - subs = subs.gsub(/\b(filename|filetype):(\((.+?)\)\B|(\S+)\b)/) do
10029 - field, name = $1, ($3 || $4)
10030 - case field
10031 - when "filename"
10032 - Redwood::log "filename - translated #{field}:#{name} to attachments:(#{name.downcase})"
10033 - "attachments:(#{name.downcase})"
10034 - when "filetype"
10035 - Redwood::log "filetype - translated #{field}:#{name} to attachments:(*.#{name.downcase})"
10036 - "attachments:(*.#{name.downcase})"
10037 - end
10038 - end
10039 -
10040 - if $have_chronic
10041 - subs = subs.gsub(/\b(before|on|in|during|after):(\((.+?)\)\B|(\S+)\b)/) do
10042 - field, datestr = $1, ($3 || $4)
10043 - realdate = Chronic.parse datestr, :guess => false, :context => :past
10044 - if realdate
10045 - case field
10046 - when "after"
10047 - Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate.end}"
10048 - "date:(>= #{sprintf "%012d", realdate.end.to_i})"
10049 - when "before"
10050 - Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate.begin}"
10051 - "date:(<= #{sprintf "%012d", realdate.begin.to_i})"
10052 - else
10053 - Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate}"
10054 - "date:(<= #{sprintf "%012d", realdate.end.to_i}) date:(>= #{sprintf "%012d", realdate.begin.to_i})"
10055 - end
10056 - else
10057 - raise ParseError, "can't understand date #{datestr.inspect}"
10058 - end
10059 - end
10060 - end
10061 -
10062 - ## limit:42 restrict the search to 42 results
10063 - subs = subs.gsub(/\blimit:(\S+)\b/) do
10064 - lim = $1
10065 - if lim =~ /^\d+$/
10066 - query[:limit] = lim.to_i
10067 - ''
10068 - else
10069 - raise ParseError, "non-numeric limit #{lim.inspect}"
10070 - end
10071 - end
10072 -
10073 - begin
10074 - query[:qobj] = @qparser.parse(subs)
10075 - query[:text] = s
10076 - query
10077 - rescue Ferret::QueryParser::QueryParseException => e
10078 - raise ParseError, e.message
10079 - end
10080 - end
10081 -
10082 -private
10083 -
10084 - def build_ferret_query query
10085 - q = Ferret::Search::BooleanQuery.new
10086 - q.add_query query[:qobj], :must if query[:qobj]
10087 - labels = ([query[:label]] + (query[:labels] || [])).compact
10088 - labels.each { |t| q.add_query Ferret::Search::TermQuery.new("label", t.to_s), :must }
10089 - if query[:participants]
10090 - q2 = Ferret::Search::BooleanQuery.new
10091 - query[:participants].each do |p|
10092 - q2.add_query Ferret::Search::TermQuery.new("from", p.email), :should
10093 - q2.add_query Ferret::Search::TermQuery.new("to", p.email), :should
10094 - end
10095 - q.add_query q2, :must
10096 - end
10097 -
10098 - q.add_query Ferret::Search::TermQuery.new("label", "spam"), :must_not unless query[:load_spam] || labels.include?(:spam)
10099 - q.add_query Ferret::Search::TermQuery.new("label", "deleted"), :must_not unless query[:load_deleted] || labels.include?(:deleted)
10100 - q.add_query Ferret::Search::TermQuery.new("label", "killed"), :must_not if query[:skip_killed]
10101 -
10102 - q.add_query Ferret::Search::TermQuery.new("source_id", query[:source_id]), :must if query[:source_id]
10103 - q
10104 + unimplemented
10105 end
10106 -
10107 - def wrap_subj subj; "__START_SUBJECT__ #{subj} __END_SUBJECT__"; end
10108 - def unwrap_subj subj; subj =~ /__START_SUBJECT__ (.*?) __END_SUBJECT__/ && $1; end
10109 end
10110
10111 end
10112 +
10113 +require 'lib/sup/ferret_index'
10114 +Redwood::Index = Redwood::FerretIndex
10115 --
10116 1.6.0.4
10117
10118
10119 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:11 2009
10120 From: rlane@club.cc.cmu.edu (Rich Lane)
10121 Date: Sat, 20 Jun 2009 13:50:11 -0700
10122 Subject: [sup-talk] [PATCH 12/18] remove last external uses of ferret docid
10123 In-Reply-To: <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
10124 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
10125 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
10126 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
10127 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
10128 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
10129 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
10130 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
10131 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
10132 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
10133 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
10134 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
10135 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
10136 Message-ID: <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
10137
10138 ---
10139 bin/sup-sync-back | 2 +-
10140 bin/sup-tweak-labels | 6 +++---
10141 lib/sup/ferret_index.rb | 10 ++--------
10142 lib/sup/index.rb | 12 +++++++-----
10143 4 files changed, 13 insertions(+), 17 deletions(-)
10144
10145 diff --git a/bin/sup-sync-back b/bin/sup-sync-back
10146 index 679e03a..8aa2039 100755
10147 --- a/bin/sup-sync-back
10148 +++ b/bin/sup-sync-back
10149 @@ -17,7 +17,7 @@ def die msg
10150 end
10151 def has_any_from_source_with_label? index, source, label
10152 query = { :source_id => source.id, :label => label, :limit => 1 }
10153 - not Enumerable::Enumerator.new(index, :each_docid, query).map.empty?
10154 + not Enumerable::Enumerator.new(index, :each_id, query).map.empty?
10155 end
10156
10157 opts = Trollop::options do
10158 diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
10159 index 95a3b03..a8115ea 100755
10160 --- a/bin/sup-tweak-labels
10161 +++ b/bin/sup-tweak-labels
10162 @@ -83,14 +83,14 @@ begin
10163 query += ' ' + opts[:query] if opts[:query]
10164
10165 parsed_query = index.parse_query query
10166 - docs = Enumerable::Enumerator.new(index, :each_docid, parsed_query).map
10167 - num_total = docs.size
10168 + ids = Enumerable::Enumerator.new(index, :each_id, parsed_query).map
10169 + num_total = ids.size
10170
10171 $stderr.puts "Found #{num_total} documents across #{source_ids.length} sources. Scanning..."
10172
10173 num_changed = num_scanned = 0
10174 last_info_time = start_time = Time.now
10175 - docs.each do |id|
10176 + ids.each do |id|
10177 num_scanned += 1
10178
10179 m = index.build_message id
10180 diff --git a/lib/sup/ferret_index.rb b/lib/sup/ferret_index.rb
10181 index 53c19e0..a2c30ab 100644
10182 --- a/lib/sup/ferret_index.rb
10183 +++ b/lib/sup/ferret_index.rb
10184 @@ -301,16 +301,10 @@ class FerretIndex < BaseIndex
10185 contacts.keys.compact
10186 end
10187
10188 - def each_docid query={}
10189 + def each_id query={}
10190 ferret_query = build_ferret_query query
10191 results = @index_mutex.synchronize { @index.search ferret_query, :limit => (query[:limit] || :all) }
10192 - results.hits.map { |hit| yield hit.doc }
10193 - end
10194 -
10195 - def each_message query={}
10196 - each_docid query do |docid|
10197 - yield build_message(docid)
10198 - end
10199 + results.hits.map { |hit| yield @index[hit.doc][:message_id] }
10200 end
10201
10202 def optimize
10203 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
10204 index be0e870..45382f1 100644
10205 --- a/lib/sup/index.rb
10206 +++ b/lib/sup/index.rb
10207 @@ -177,14 +177,16 @@ EOS
10208 unimplemented
10209 end
10210
10211 - ## Yield each docid matching query
10212 - def each_docid query={}
10213 + ## Yield each message-id matching query
10214 + def each_id query={}
10215 unimplemented
10216 end
10217
10218 - ## Yield each messages matching query
10219 - def each_message query={}
10220 - unimplemented
10221 + ## Yield each message matching query
10222 + def each_message query={}, &b
10223 + each_id query do |id|
10224 + yield build_message(id)
10225 + end
10226 end
10227
10228 ## Implementation-specific optimization step
10229 --
10230 1.6.0.4
10231
10232
10233 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:08 2009
10234 From: rlane@club.cc.cmu.edu (Rich Lane)
10235 Date: Sat, 20 Jun 2009 13:50:08 -0700
10236 Subject: [sup-talk] [PATCH 09/18] index: revert overeager opts->query rename
10237 in each_message_in_thread_for
10238 In-Reply-To: <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
10239 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
10240 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
10241 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
10242 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
10243 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
10244 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
10245 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
10246 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
10247 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
10248 Message-ID: <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
10249
10250 ---
10251 lib/sup/index.rb | 8 ++++----
10252 1 files changed, 4 insertions(+), 4 deletions(-)
10253
10254 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
10255 index e3f9e69..080a4ec 100644
10256 --- a/lib/sup/index.rb
10257 +++ b/lib/sup/index.rb
10258 @@ -280,7 +280,7 @@ EOS
10259 ## is found.
10260 SAME_SUBJECT_DATE_LIMIT = 7
10261 MAX_CLAUSES = 1000
10262 - def each_message_in_thread_for m, query={}
10263 + def each_message_in_thread_for m, opts={}
10264 #Redwood::log "Building thread for #{m.id}: #{m.subj}"
10265 messages = {}
10266 searched = {}
10267 @@ -310,7 +310,7 @@ EOS
10268 pending = (pending + p1 + p2).uniq
10269 end
10270
10271 - until pending.empty? || (query[:limit] && messages.size >= query[:limit])
10272 + until pending.empty? || (opts[:limit] && messages.size >= opts[:limit])
10273 q = Ferret::Search::BooleanQuery.new true
10274 # this disappeared in newer ferrets... wtf.
10275 # q.max_clause_count = 2048
10276 @@ -329,8 +329,8 @@ EOS
10277 killed = false
10278 @index_mutex.synchronize do
10279 @index.search_each(q, :limit => :all) do |docid, score|
10280 - break if query[:limit] && messages.size >= query[:limit]
10281 - if @index[docid][:label].split(/\s+/).include?("killed") && query[:skip_killed]
10282 + break if opts[:limit] && messages.size >= opts[:limit]
10283 + if @index[docid][:label].split(/\s+/).include?("killed") && opts[:skip_killed]
10284 killed = true
10285 break
10286 end
10287 --
10288 1.6.0.4
10289
10290
10291 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:13 2009
10292 From: rlane@club.cc.cmu.edu (Rich Lane)
10293 Date: Sat, 20 Jun 2009 13:50:13 -0700
10294 Subject: [sup-talk] [PATCH 14/18] index: choose index implementation with
10295 config entry or environment variable
10296 In-Reply-To: <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
10297 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
10298 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
10299 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
10300 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
10301 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
10302 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
10303 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
10304 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
10305 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
10306 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
10307 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
10308 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
10309 <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
10310 <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
10311 Message-ID: <1245531017-9907-15-git-send-email-rlane@club.cc.cmu.edu>
10312
10313 ---
10314 lib/sup.rb | 2 ++
10315 lib/sup/index.rb | 10 ++++++++--
10316 2 files changed, 10 insertions(+), 2 deletions(-)
10317
10318 diff --git a/lib/sup.rb b/lib/sup.rb
10319 index 5689c2b..54de73f 100644
10320 --- a/lib/sup.rb
10321 +++ b/lib/sup.rb
10322 @@ -54,6 +54,8 @@ module Redwood
10323 YAML_DOMAIN = "masanjin.net"
10324 YAML_DATE = "2006-10-01"
10325
10326 + DEFAULT_INDEX = 'ferret'
10327 +
10328 ## record exceptions thrown in threads nicely
10329 @exceptions = []
10330 @exception_mutex = Mutex.new
10331 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
10332 index 45382f1..df428f7 100644
10333 --- a/lib/sup/index.rb
10334 +++ b/lib/sup/index.rb
10335 @@ -212,7 +212,13 @@ EOS
10336 end
10337 end
10338
10339 +index_name = ENV['SUP_INDEX'] || $config[:index] || DEFAULT_INDEX
10340 +begin
10341 + require "sup/#{index_name}_index"
10342 +rescue LoadError
10343 + fail "invalid index name #{index_name.inspect}"
10344 end
10345 +Index = Redwood.const_get "#{index_name.capitalize}Index"
10346 +Redwood::log "using index #{Index.name}"
10347
10348 -require 'lib/sup/ferret_index'
10349 -Redwood::Index = Redwood::FerretIndex
10350 +end
10351 --
10352 1.6.0.4
10353
10354
10355 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:12 2009
10356 From: rlane@club.cc.cmu.edu (Rich Lane)
10357 Date: Sat, 20 Jun 2009 13:50:12 -0700
10358 Subject: [sup-talk] [PATCH 13/18] add Message.indexable_{body, chunks,
10359 subject}
10360 In-Reply-To: <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
10361 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
10362 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
10363 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
10364 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
10365 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
10366 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
10367 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
10368 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
10369 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
10370 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
10371 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
10372 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
10373 <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
10374 Message-ID: <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
10375
10376 ---
10377 lib/sup/message.rb | 16 ++++++++++++++--
10378 1 files changed, 14 insertions(+), 2 deletions(-)
10379
10380 diff --git a/lib/sup/message.rb b/lib/sup/message.rb
10381 index b667cb3..2999986 100644
10382 --- a/lib/sup/message.rb
10383 +++ b/lib/sup/message.rb
10384 @@ -270,11 +270,23 @@ EOS
10385 to.map { |p| p.indexable_content },
10386 cc.map { |p| p.indexable_content },
10387 bcc.map { |p| p.indexable_content },
10388 - chunks.select { |c| c.is_a? Chunk::Text }.map { |c| c.lines },
10389 - Message.normalize_subj(subj),
10390 + indexable_chunks.map { |c| c.lines },
10391 + indexable_subject,
10392 ].flatten.compact.join " "
10393 end
10394
10395 + def indexable_body
10396 + indexable_chunks.map { |c| c.lines }.flatten.compact.join " "
10397 + end
10398 +
10399 + def indexable_chunks
10400 + chunks.select { |c| c.is_a? Chunk::Text }
10401 + end
10402 +
10403 + def indexable_subject
10404 + Message.normalize_subj(subj)
10405 + end
10406 +
10407 def quotable_body_lines
10408 chunks.find_all { |c| c.quotable? }.map { |c| c.lines }.flatten
10409 end
10410 --
10411 1.6.0.4
10412
10413
10414 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:14 2009
10415 From: rlane@club.cc.cmu.edu (Rich Lane)
10416 Date: Sat, 20 Jun 2009 13:50:14 -0700
10417 Subject: [sup-talk] [PATCH 15/18] index: add xapian implementation
10418 In-Reply-To: <1245531017-9907-15-git-send-email-rlane@club.cc.cmu.edu>
10419 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
10420 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
10421 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
10422 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
10423 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
10424 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
10425 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
10426 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
10427 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
10428 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
10429 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
10430 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
10431 <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
10432 <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
10433 <1245531017-9907-15-git-send-email-rlane@club.cc.cmu.edu>
10434 Message-ID: <1245531017-9907-16-git-send-email-rlane@club.cc.cmu.edu>
10435
10436 ---
10437 lib/sup/poll.rb | 2 +-
10438 lib/sup/xapian_index.rb | 483 +++++++++++++++++++++++++++++++++++++++++++++++
10439 2 files changed, 484 insertions(+), 1 deletions(-)
10440 create mode 100644 lib/sup/xapian_index.rb
10441
10442 diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
10443 index c83290c..8a9d218 100644
10444 --- a/lib/sup/poll.rb
10445 +++ b/lib/sup/poll.rb
10446 @@ -147,7 +147,7 @@ EOS
10447 m_new = Message.build_from_source source, offset
10448 m_old = Index.build_message m_new.id
10449
10450 - m_new.labels = default_labels + (source.archived? ? [] : [:inbox])
10451 + m_new.labels += default_labels + (source.archived? ? [] : [:inbox])
10452 m_new.labels << :sent if source.uri.eql?(SentManager.source_uri)
10453 m_new.labels.delete :unread if m_new.source_marked_read?
10454 m_new.labels.each { |l| LabelManager << l }
10455 diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
10456 new file mode 100644
10457 index 0000000..7faa64d
10458 --- /dev/null
10459 +++ b/lib/sup/xapian_index.rb
10460 @@ -0,0 +1,483 @@
10461 +require 'xapian'
10462 +require 'gdbm'
10463 +require 'set'
10464 +
10465 +module Redwood
10466 +
10467 +# This index implementation uses Xapian for searching and GDBM for storage. It
10468 +# tends to be slightly faster than Ferret for indexing and significantly faster
10469 +# for searching due to precomputing thread membership.
10470 +class XapianIndex < BaseIndex
10471 + STEM_LANGUAGE = "english"
10472 +
10473 + def initialize dir=BASE_DIR
10474 + super
10475 +
10476 + @index_mutex = Monitor.new
10477 +
10478 + @entries = MarshalledGDBM.new File.join(dir, "entries.db")
10479 + @docids = MarshalledGDBM.new File.join(dir, "docids.db")
10480 + @thread_members = MarshalledGDBM.new File.join(dir, "thread_members.db")
10481 + @thread_ids = MarshalledGDBM.new File.join(dir, "thread_ids.db")
10482 + @assigned_docids = GDBM.new File.join(dir, "assigned_docids.db")
10483 +
10484 + @xapian = Xapian::WritableDatabase.new(File.join(dir, "xapian"), Xapian::DB_CREATE_OR_OPEN)
10485 + @term_generator = Xapian::TermGenerator.new()
10486 + @term_generator.stemmer = Xapian::Stem.new(STEM_LANGUAGE)
10487 + @enquire = Xapian::Enquire.new @xapian
10488 + @enquire.weighting_scheme = Xapian::BoolWeight.new
10489 + @enquire.docid_order = Xapian::Enquire::ASCENDING
10490 + end
10491 +
10492 + def load_index
10493 + end
10494 +
10495 + def save_index
10496 + end
10497 +
10498 + def optimize
10499 + end
10500 +
10501 + def size
10502 + synchronize { @xapian.doccount }
10503 + end
10504 +
10505 + def contains_id? id
10506 + synchronize { @entries.member? id }
10507 + end
10508 +
10509 + def source_for_id id
10510 + synchronize { @entries[id][:source_id] }
10511 + end
10512 +
10513 + def delete id
10514 + synchronize { @xapian.delete_document @docids[id] }
10515 + end
10516 +
10517 + def build_message id
10518 + entry = synchronize { @entries[id] }
10519 + return unless entry
10520 +
10521 + source = SourceManager[entry[:source_id]]
10522 + raise "invalid source #{entry[:source_id]}" unless source
10523 +
10524 + mk_addrs = lambda { |l| l.map { |e,n| "#{n} <#{e}>" } * ', ' }
10525 + mk_refs = lambda { |l| l.map { |r| "<#{r}>" } * ' ' }
10526 + fake_header = {
10527 + 'message-id' => entry[:message_id],
10528 + 'date' => Time.at(entry[:date]),
10529 + 'subject' => entry[:subject],
10530 + 'from' => mk_addrs[[entry[:from]]],
10531 + 'to' => mk_addrs[[entry[:to]]],
10532 + 'cc' => mk_addrs[[entry[:cc]]],
10533 + 'bcc' => mk_addrs[[entry[:bcc]]],
10534 + 'reply-tos' => mk_refs[entry[:replytos]],
10535 + 'references' => mk_refs[entry[:refs]],
10536 + }
10537 +
10538 + m = Message.new :source => source, :source_info => entry[:source_info],
10539 + :labels => entry[:labels],
10540 + :snippet => entry[:snippet]
10541 + m.parse_header fake_header
10542 + m
10543 + end
10544 +
10545 + def sync_message m, opts={}
10546 + entry = synchronize { @entries[m.id] }
10547 + snippet = m.snippet
10548 + entry ||= {}
10549 + labels = m.labels
10550 + entry = {} if opts[:force_overwrite]
10551 +
10552 + d = {
10553 + :message_id => m.id,
10554 + :source_id => m.source.id,
10555 + :source_info => m.source_info,
10556 + :date => (entry[:date] || m.date),
10557 + :snippet => snippet,
10558 + :labels => labels.uniq,
10559 + :from => (entry[:from] || [m.from.email, m.from.name]),
10560 + :to => (entry[:to] || m.to.map { |p| [p.email, p.name] }),
10561 + :cc => (entry[:cc] || m.cc.map { |p| [p.email, p.name] }),
10562 + :bcc => (entry[:bcc] || m.bcc.map { |p| [p.email, p.name] }),
10563 + :subject => m.subj,
10564 + :refs => (entry[:refs] || m.refs),
10565 + :replytos => (entry[:replytos] || m.replytos),
10566 + }
10567 +
10568 + m.labels.each { |l| LabelManager << l }
10569 +
10570 + synchronize do
10571 + index_message m, opts
10572 + union_threads([m.id] + m.refs + m.replytos)
10573 + @entries[m.id] = d
10574 + end
10575 + true
10576 + end
10577 +
10578 + def num_results_for query={}
10579 + xapian_query = build_xapian_query query
10580 + matchset = run_query xapian_query, 0, 0, 100
10581 + matchset.matches_estimated
10582 + end
10583 +
10584 + EACH_ID_PAGE = 100
10585 + def each_id query={}
10586 + offset = 0
10587 + page = EACH_ID_PAGE
10588 +
10589 + xapian_query = build_xapian_query query
10590 + while true
10591 + ids = run_query_ids xapian_query, offset, (offset+page)
10592 + ids.each { |id| yield id }
10593 + break if ids.size < page
10594 + offset += page
10595 + end
10596 + end
10597 +
10598 + def each_id_by_date query={}
10599 + each_id(query) { |id| yield id, lambda { build_message id } }
10600 + end
10601 +
10602 + def each_message_in_thread_for m, opts={}
10603 + # TODO thread by subject
10604 + # TODO handle killed threads
10605 + ids = synchronize { @thread_members[@thread_ids[m.id]] } || []
10606 + ids.select { |id| contains_id? id }.each { |id| yield id, lambda { build_message id } }
10607 + true
10608 + end
10609 +
10610 + def load_contacts emails, opts={}
10611 + contacts = Set.new
10612 + num = opts[:num] || 20
10613 + each_id_by_date :participants => emails do |id,b|
10614 + break if contacts.size >= num
10615 + m = b.call
10616 + ([m.from]+m.to+m.cc+m.bcc).compact.each { |p| contacts << [p.name, p.email] }
10617 + end
10618 + contacts.to_a.compact.map { |n,e| Person.new n, e }[0...num]
10619 + end
10620 +
10621 + # TODO share code with the Ferret index
10622 + def parse_query s
10623 + query = {}
10624 +
10625 + subs = s.gsub(/\b(to|from):(\S+)\b/) do
10626 + field, name = $1, $2
10627 + if(p = ContactManager.contact_for(name))
10628 + [field, p.email]
10629 + elsif name == "me"
10630 + [field, "(" + AccountManager.user_emails.join("||") + ")"]
10631 + else
10632 + [field, name]
10633 + end.join(":")
10634 + end
10635 +
10636 + ## if we see a label:deleted or a label:spam term anywhere in the query
10637 + ## string, we set the extra load_spam or load_deleted options to true.
10638 + ## bizarre? well, because the query allows arbitrary parenthesized boolean
10639 + ## expressions, without fully parsing the query, we can't tell whether
10640 + ## the user is explicitly directing us to search spam messages or not.
10641 + ## e.g. if the string is -(-(-(-(-label:spam)))), does the user want to
10642 + ## search spam messages or not?
10643 + ##
10644 + ## so, we rely on the fact that turning these extra options ON turns OFF
10645 + ## the adding of "-label:deleted" or "-label:spam" terms at the very
10646 + ## final stage of query processing. if the user wants to search spam
10647 + ## messages, not adding that is the right thing; if he doesn't want to
10648 + ## search spam messages, then not adding it won't have any effect.
10649 + query[:load_spam] = true if subs =~ /\blabel:spam\b/
10650 + query[:load_deleted] = true if subs =~ /\blabel:deleted\b/
10651 +
10652 + ## gmail style "is" operator
10653 + subs = subs.gsub(/\b(is|has):(\S+)\b/) do
10654 + field, label = $1, $2
10655 + case label
10656 + when "read"
10657 + "-label:unread"
10658 + when "spam"
10659 + query[:load_spam] = true
10660 + "label:spam"
10661 + when "deleted"
10662 + query[:load_deleted] = true
10663 + "label:deleted"
10664 + else
10665 + "label:#{$2}"
10666 + end
10667 + end
10668 +
10669 + ## gmail style attachments "filename" and "filetype" searches
10670 + subs = subs.gsub(/\b(filename|filetype):(\((.+?)\)\B|(\S+)\b)/) do
10671 + field, name = $1, ($3 || $4)
10672 + case field
10673 + when "filename"
10674 + Redwood::log "filename - translated #{field}:#{name} to attachment:\"#{name.downcase}\""
10675 + "attachment:\"#{name.downcase}\""
10676 + when "filetype"
10677 + Redwood::log "filetype - translated #{field}:#{name} to attachment_extension:#{name.downcase}"
10678 + "attachment_extension:#{name.downcase}"
10679 + end
10680 + end
10681 +
10682 + if $have_chronic
10683 + lastdate = 2<<32 - 1
10684 + firstdate = 0
10685 + subs = subs.gsub(/\b(before|on|in|during|after):(\((.+?)\)\B|(\S+)\b)/) do
10686 + field, datestr = $1, ($3 || $4)
10687 + realdate = Chronic.parse datestr, :guess => false, :context => :past
10688 + if realdate
10689 + case field
10690 + when "after"
10691 + Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate.end}"
10692 + "date:#{realdate.end.to_i}..#{lastdate}"
10693 + when "before"
10694 + Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate.begin}"
10695 + "date:#{firstdate}..#{realdate.end.to_i}"
10696 + else
10697 + Redwood::log "chronic: translated #{field}:#{datestr} to #{realdate}"
10698 + "date:#{realdate.begin.to_i}..#{realdate.end.to_i}"
10699 + end
10700 + else
10701 + raise ParseError, "can't understand date #{datestr.inspect}"
10702 + end
10703 + end
10704 + end
10705 +
10706 + ## limit:42 restrict the search to 42 results
10707 + subs = subs.gsub(/\blimit:(\S+)\b/) do
10708 + lim = $1
10709 + if lim =~ /^\d+$/
10710 + query[:limit] = lim.to_i
10711 + ''
10712 + else
10713 + raise ParseError, "non-numeric limit #{lim.inspect}"
10714 + end
10715 + end
10716 +
10717 + qp = Xapian::QueryParser.new
10718 + qp.database = @xapian
10719 + qp.stemmer = Xapian::Stem.new(STEM_LANGUAGE)
10720 + qp.stemming_strategy = Xapian::QueryParser::STEM_SOME
10721 + qp.default_op = Xapian::Query::OP_AND
10722 + qp.add_valuerangeprocessor(Xapian::NumberValueRangeProcessor.new(DATE_VALUENO, 'date:', true))
10723 + NORMAL_PREFIX.each { |k,v| qp.add_prefix k, v }
10724 + BOOLEAN_PREFIX.each { |k,v| qp.add_boolean_prefix k, v }
10725 + xapian_query = qp.parse_query(subs, Xapian::QueryParser::FLAG_PHRASE|Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_LOVEHATE|Xapian::QueryParser::FLAG_WILDCARD, PREFIX['body'])
10726 +
10727 + raise ParseError if xapian_query.nil? or xapian_query.empty?
10728 + query[:qobj] = xapian_query
10729 + query[:text] = s
10730 + query
10731 + end
10732 +
10733 + private
10734 +
10735 + # Stemmed
10736 + NORMAL_PREFIX = {
10737 + 'subject' => 'S',
10738 + 'body' => 'B',
10739 + 'from_name' => 'FN',
10740 + 'to_name' => 'TN',
10741 + 'name' => 'N',
10742 + 'attachment' => 'A',
10743 + }
10744 +
10745 + # Unstemmed
10746 + BOOLEAN_PREFIX = {
10747 + 'type' => 'K',
10748 + 'from_email' => 'FE',
10749 + 'to_email' => 'TE',
10750 + 'email' => 'E',
10751 + 'date' => 'D',
10752 + 'label' => 'L',
10753 + 'source_id' => 'I',
10754 + 'attachment_extension' => 'O',
10755 + }
10756 +
10757 + PREFIX = NORMAL_PREFIX.merge BOOLEAN_PREFIX
10758 +
10759 + DATE_VALUENO = 0
10760 +
10761 + # Xapian can very efficiently sort in ascending docid order. Sup always wants
10762 + # to sort by descending date, so this method maps between them. In order to
10763 + # handle multiple messages per second, we use a logistic curve centered
10764 + # around MIDDLE_DATE so that the slope (docid/s) is greatest in this time
10765 + # period. A docid collision is not an error - the code will pick the next
10766 + # smallest unused one.
10767 + DOCID_SCALE = 2.0**32
10768 + TIME_SCALE = 2.0**27
10769 + MIDDLE_DATE = Time.gm(2011)
10770 + def assign_docid m
10771 + t = (m.date.to_i - MIDDLE_DATE.to_i).to_f
10772 + docid = (DOCID_SCALE - DOCID_SCALE/(Math::E**(-(t/TIME_SCALE)) + 1)).to_i
10773 + begin
10774 + while @assigned_docids.member? [docid].pack("N")
10775 + docid -= 1
10776 + end
10777 + rescue
10778 + end
10779 + @assigned_docids[[docid].pack("N")] = ''
10780 + docid
10781 + end
10782 +
10783 + def synchronize &b
10784 + @index_mutex.synchronize &b
10785 + end
10786 +
10787 + def run_query xapian_query, offset, limit, checkatleast=0
10788 + synchronize do
10789 + @enquire.query = xapian_query
10790 + @enquire.mset(offset, limit-offset, checkatleast)
10791 + end
10792 + end
10793 +
10794 + def run_query_ids xapian_query, offset, limit
10795 + matchset = run_query xapian_query, offset, limit
10796 + matchset.matches.map { |r| r.document.data }
10797 + end
10798 +
10799 + Q = Xapian::Query
10800 + def build_xapian_query opts
10801 + labels = ([opts[:label]] + (opts[:labels] || [])).compact
10802 + neglabels = [:spam, :deleted, :killed].reject { |l| (labels.include? l) || opts.member?("load_#{l}".intern) }
10803 + pos_terms, neg_terms = [], []
10804 +
10805 + pos_terms << mkterm(:type, 'mail')
10806 + pos_terms.concat(labels.map { |l| mkterm(:label,l) })
10807 + pos_terms << opts[:qobj] if opts[:qobj]
10808 + pos_terms << mkterm(:source_id, opts[:source_id]) if opts[:source_id]
10809 +
10810 + if opts[:participants]
10811 + participant_terms = opts[:participants].map { |p| mkterm(:email,:any, (Redwood::Person === p) ? p.email : p) }
10812 + pos_terms << Q.new(Q::OP_OR, participant_terms)
10813 + end
10814 +
10815 + neg_terms.concat(neglabels.map { |l| mkterm(:label,l) })
10816 +
10817 + pos_query = Q.new(Q::OP_AND, pos_terms)
10818 + neg_query = Q.new(Q::OP_OR, neg_terms)
10819 +
10820 + if neg_query.empty?
10821 + pos_query
10822 + else
10823 + Q.new(Q::OP_AND_NOT, [pos_query, neg_query])
10824 + end
10825 + end
10826 +
10827 + def index_message m, opts
10828 + terms = []
10829 + text = []
10830 +
10831 + subject_text = m.indexable_subject
10832 + body_text = m.indexable_body
10833 +
10834 + # Person names are indexed with several prefixes
10835 + person_termer = lambda do |d|
10836 + lambda do |p|
10837 + ["#{d}_name", "name", "body"].each do |x|
10838 + text << [p.name, PREFIX[x]]
10839 + end if p.name
10840 + [d, :any].each { |x| terms << mkterm(:email, x, p.email) }
10841 + end
10842 + end
10843 +
10844 + person_termer[:from][m.from] if m.from
10845 + (m.to+m.cc+m.bcc).each(&(person_termer[:to]))
10846 +
10847 + terms << mkterm(:date,m.date) if m.date
10848 + m.labels.each { |t| terms << mkterm(:label,t) }
10849 + terms << mkterm(:type, 'mail')
10850 + terms << mkterm(:source_id, m.source.id)
10851 + m.attachments.each do |a|
10852 + a =~ /\.(\w+)$/ or next
10853 + t = mkterm(:attachment_extension, $1)
10854 + terms << t
10855 + end
10856 +
10857 + # Full text search content
10858 + text << [subject_text, PREFIX['subject']]
10859 + text << [subject_text, PREFIX['body']]
10860 + text << [body_text, PREFIX['body']]
10861 + m.attachments.each { |a| text << [a, PREFIX['attachment']] }
10862 +
10863 + # Date value for range queries
10864 + date_value = Xapian.sortable_serialise(m.date.to_i)
10865 +
10866 + doc = Xapian::Document.new
10867 + docid = @docids[m.id] || assign_docid(m)
10868 +
10869 + @term_generator.document = doc
10870 + text.each { |text,prefix| @term_generator.index_text text, 1, prefix }
10871 + terms.each { |term| doc.add_term term }
10872 + doc.add_value DATE_VALUENO, date_value
10873 + doc.data = m.id
10874 +
10875 + @xapian.replace_document docid, doc
10876 + @docids[m.id] = docid
10877 + end
10878 +
10879 + # Construct a Xapian term
10880 + def mkterm type, *args
10881 + case type
10882 + when :label
10883 + PREFIX['label'] + args[0].to_s.downcase
10884 + when :type
10885 + PREFIX['type'] + args[0].to_s.downcase
10886 + when :date
10887 + PREFIX['date'] + args[0].getutc.strftime("%Y%m%d%H%M%S")
10888 + when :email
10889 + case args[0]
10890 + when :from then PREFIX['from_email']
10891 + when :to then PREFIX['to_email']
10892 + when :any then PREFIX['email']
10893 + else raise "Invalid email term type #{args[0]}"
10894 + end + args[1].to_s.downcase
10895 + when :source_id
10896 + PREFIX['source_id'] + args[0].to_s.downcase
10897 + when :attachment_extension
10898 + PREFIX['attachment_extension'] + args[0].to_s.downcase
10899 + else
10900 + raise "Invalid term type #{type}"
10901 + end
10902 + end
10903 +
10904 + # Join all the given message-ids into a single thread
10905 + def union_threads ids
10906 + seen_threads = Set.new
10907 + related = Set.new
10908 +
10909 + # Get all the ids that will be in the new thread
10910 + ids.each do |id|
10911 + related << id
10912 + thread_id = @thread_ids[id]
10913 + if thread_id && !seen_threads.member?(thread_id)
10914 + thread_members = @thread_members[thread_id]
10915 + related.merge thread_members
10916 + seen_threads << thread_id
10917 + end
10918 + end
10919 +
10920 + # Pick a leader and move all the others to its thread
10921 + a = related.to_a
10922 + best, *rest = a.sort_by { |x| x.hash }
10923 + @thread_members[best] = a
10924 + @thread_ids[best] = best
10925 + rest.each do |x|
10926 + @thread_members.delete x
10927 + @thread_ids[x] = best
10928 + end
10929 + end
10930 +end
10931 +
10932 +end
10933 +
10934 +class MarshalledGDBM < GDBM
10935 + def []= k, v
10936 + super k, Marshal.dump(v)
10937 + end
10938 +
10939 + def [] k
10940 + v = super k
10941 + v ? Marshal.load(v) : nil
10942 + end
10943 +end
10944 --
10945 1.6.0.4
10946
10947
10948 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:16 2009
10949 From: rlane@club.cc.cmu.edu (Rich Lane)
10950 Date: Sat, 20 Jun 2009 13:50:16 -0700
10951 Subject: [sup-talk] [PATCH 17/18] add limit argument to
10952 author_names_and_newness_for_thread
10953 In-Reply-To: <1245531017-9907-17-git-send-email-rlane@club.cc.cmu.edu>
10954 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
10955 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
10956 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
10957 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
10958 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
10959 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
10960 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
10961 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
10962 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
10963 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
10964 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
10965 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
10966 <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
10967 <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
10968 <1245531017-9907-15-git-send-email-rlane@club.cc.cmu.edu>
10969 <1245531017-9907-16-git-send-email-rlane@club.cc.cmu.edu>
10970 <1245531017-9907-17-git-send-email-rlane@club.cc.cmu.edu>
10971 Message-ID: <1245531017-9907-18-git-send-email-rlane@club.cc.cmu.edu>
10972
10973 ---
10974 lib/sup/modes/thread-index-mode.rb | 15 ++++++++++-----
10975 1 files changed, 10 insertions(+), 5 deletions(-)
10976
10977 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
10978 index 0bd8110..b671119 100644
10979 --- a/lib/sup/modes/thread-index-mode.rb
10980 +++ b/lib/sup/modes/thread-index-mode.rb
10981 @@ -1,3 +1,5 @@
10982 +require 'set'
10983 +
10984 module Redwood
10985
10986 ## subclasses should implement:
10987 @@ -757,10 +759,12 @@ protected
10988
10989 def authors; map { |m, *o| m.from if m }.compact.uniq; end
10990
10991 - def author_names_and_newness_for_thread t
10992 + def author_names_and_newness_for_thread t, limit=nil
10993 new = {}
10994 - authors = t.map do |m, *o|
10995 + authors = Set.new
10996 + t.each do |m, *o|
10997 next unless m
10998 + break if limit and authors.size >= limit
10999
11000 name =
11001 if AccountManager.is_account?(m.from)
11002 @@ -772,12 +776,13 @@ protected
11003 end
11004
11005 new[name] ||= m.has_label?(:unread)
11006 - name
11007 + authors << name
11008 end
11009
11010 - authors.compact.uniq.map { |a| [a, new[a]] }
11011 + authors.to_a.map { |a| [a, new[a]] }
11012 end
11013
11014 + AUTHOR_LIMIT = 5
11015 def text_for_thread_at line
11016 t, size_widget = @mutex.synchronize { [@threads[line], @size_widgets[line]] }
11017
11018 @@ -787,7 +792,7 @@ protected
11019
11020 ## format the from column
11021 cur_width = 0
11022 - ann = author_names_and_newness_for_thread t
11023 + ann = author_names_and_newness_for_thread t, AUTHOR_LIMIT
11024 from = []
11025 ann.each_with_index do |(name, newness), i|
11026 break if cur_width >= from_width
11027 --
11028 1.6.0.4
11029
11030
11031 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:15 2009
11032 From: rlane@club.cc.cmu.edu (Rich Lane)
11033 Date: Sat, 20 Jun 2009 13:50:15 -0700
11034 Subject: [sup-talk] [PATCH 16/18] fix String#ord monkeypatch
11035 In-Reply-To: <1245531017-9907-16-git-send-email-rlane@club.cc.cmu.edu>
11036 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11037 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
11038 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
11039 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
11040 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
11041 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
11042 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
11043 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
11044 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
11045 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
11046 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
11047 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
11048 <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
11049 <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
11050 <1245531017-9907-15-git-send-email-rlane@club.cc.cmu.edu>
11051 <1245531017-9907-16-git-send-email-rlane@club.cc.cmu.edu>
11052 Message-ID: <1245531017-9907-17-git-send-email-rlane@club.cc.cmu.edu>
11053
11054 ---
11055 lib/sup/util.rb | 2 +-
11056 1 files changed, 1 insertions(+), 1 deletions(-)
11057
11058 diff --git a/lib/sup/util.rb b/lib/sup/util.rb
11059 index 8f60cc4..0609908 100644
11060 --- a/lib/sup/util.rb
11061 +++ b/lib/sup/util.rb
11062 @@ -282,7 +282,7 @@ class String
11063 gsub(/\t/, " ").gsub(/\r/, "")
11064 end
11065
11066 - if not defined? ord
11067 + unless method_defined? :ord
11068 def ord
11069 self[0]
11070 end
11071 --
11072 1.6.0.4
11073
11074
11075 From rlane@club.cc.cmu.edu Sat Jun 20 16:50:17 2009
11076 From: rlane@club.cc.cmu.edu (Rich Lane)
11077 Date: Sat, 20 Jun 2009 13:50:17 -0700
11078 Subject: [sup-talk] [PATCH 18/18] dont using SavingHash#[] for membership
11079 test
11080 In-Reply-To: <1245531017-9907-18-git-send-email-rlane@club.cc.cmu.edu>
11081 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11082 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
11083 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
11084 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
11085 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
11086 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
11087 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
11088 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
11089 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
11090 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
11091 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
11092 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
11093 <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
11094 <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
11095 <1245531017-9907-15-git-send-email-rlane@club.cc.cmu.edu>
11096 <1245531017-9907-16-git-send-email-rlane@club.cc.cmu.edu>
11097 <1245531017-9907-17-git-send-email-rlane@club.cc.cmu.edu>
11098 <1245531017-9907-18-git-send-email-rlane@club.cc.cmu.edu>
11099 Message-ID: <1245531017-9907-19-git-send-email-rlane@club.cc.cmu.edu>
11100
11101 ---
11102 lib/sup/thread.rb | 8 +++++---
11103 1 files changed, 5 insertions(+), 3 deletions(-)
11104
11105 diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb
11106 index 99f21dc..d395c35 100644
11107 --- a/lib/sup/thread.rb
11108 +++ b/lib/sup/thread.rb
11109 @@ -310,13 +310,15 @@ class ThreadSet
11110 private :prune_thread_of
11111
11112 def remove_id mid
11113 - return unless(c = @messages[mid])
11114 + return unless @messages.member?(mid)
11115 + c = @messages[mid]
11116 remove_container c
11117 prune_thread_of c
11118 end
11119
11120 def remove_thread_containing_id mid
11121 - c = @messages[mid] or return
11122 + return unless @messages.member?(mid)
11123 + c = @messages[mid]
11124 t = c.root.thread
11125 @threads.delete_if { |key, thread| t == thread }
11126 end
11127 @@ -355,7 +357,7 @@ class ThreadSet
11128 return if threads.size < 2
11129
11130 containers = threads.map do |t|
11131 - c = @messages[t.first.id]
11132 + c = @messages.member?(c) ? @messages[t.first.id] : nil
11133 raise "not in threadset: #{t.first.id}" unless c && c.message
11134 c
11135 end
11136 --
11137 1.6.0.4
11138
11139
11140 From garoth@gmail.com Mon Jun 22 10:46:10 2009
11141 From: garoth@gmail.com (Andrei Thorp)
11142 Date: Mon, 22 Jun 2009 10:46:10 -0400
11143 Subject: [sup-talk] [PATCH 18/18] dont using SavingHash#[] for
11144 membership test
11145 In-Reply-To: <1245531017-9907-19-git-send-email-rlane@club.cc.cmu.edu>
11146 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11147 <1245531017-9907-2-git-send-email-rlane@club.cc.cmu.edu>
11148 <1245531017-9907-3-git-send-email-rlane@club.cc.cmu.edu>
11149 <1245531017-9907-4-git-send-email-rlane@club.cc.cmu.edu>
11150 <1245531017-9907-5-git-send-email-rlane@club.cc.cmu.edu>
11151 <1245531017-9907-6-git-send-email-rlane@club.cc.cmu.edu>
11152 <1245531017-9907-7-git-send-email-rlane@club.cc.cmu.edu>
11153 <1245531017-9907-8-git-send-email-rlane@club.cc.cmu.edu>
11154 <1245531017-9907-9-git-send-email-rlane@club.cc.cmu.edu>
11155 <1245531017-9907-10-git-send-email-rlane@club.cc.cmu.edu>
11156 <1245531017-9907-11-git-send-email-rlane@club.cc.cmu.edu>
11157 <1245531017-9907-12-git-send-email-rlane@club.cc.cmu.edu>
11158 <1245531017-9907-13-git-send-email-rlane@club.cc.cmu.edu>
11159 <1245531017-9907-14-git-send-email-rlane@club.cc.cmu.edu>
11160 <1245531017-9907-15-git-send-email-rlane@club.cc.cmu.edu>
11161 <1245531017-9907-16-git-send-email-rlane@club.cc.cmu.edu>
11162 <1245531017-9907-17-git-send-email-rlane@club.cc.cmu.edu>
11163 <1245531017-9907-18-git-send-email-rlane@club.cc.cmu.edu>
11164 <1245531017-9907-19-git-send-email-rlane@club.cc.cmu.edu>
11165 Message-ID: <1245681928-sup-3077@Longbow>
11166
11167 Wow, that's one heck of a set of patches... good work dude :)
11168
11169 -AT
11170 --
11171 Andrei Thorp, Developer: Xandros Corp. (http://www.xandros.com)
11172
11173 Make it idiot-proof, and someone will breed a better idiot.
11174 -- Oliver Elphick
11175
11176 From wmorgan-sup@masanjin.net Wed Jun 24 12:30:39 2009
11177 From: wmorgan-sup@masanjin.net (William Morgan)
11178 Date: Wed, 24 Jun 2009 09:30:39 -0700
11179 Subject: [sup-talk] [PATCH 0/18] Xapian-based index
11180 In-Reply-To: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11181 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11182 Message-ID: <1245854803-sup-4481@entry>
11183
11184 Hi Rich,
11185
11186 Reformatted excerpts from Rich Lane's message of 2009-06-20:
11187 > This patch series refactors the Index class to remove Ferret-isms and
11188 > support multiple index implementations. The included XapianIndex is a
11189 > bit faster at indexing messages and significantly faster when
11190 > searching because it precomputes thread membership. It also works on
11191 > Ruby 1.9.1.
11192
11193 This is great. Really, really great. You've refactored a crufty
11194 interface that's been growing untamed over the past three years, you've
11195 gotten us away from the unmaintained scariness that is Ferret, you've
11196 fixed the largest source of interface slowness (thread recomputation),
11197 and you've enabled us to move to the beautiful, speedy, encoding-aware
11198 world of Ruby 1.9. Thank you for satisfying all of my Sup-related
11199 desires in one fell swoop. From my lofty throne, I commend thee.
11200
11201 Once the bugs are ironed out, I would like to make this the default
11202 index format and eventually deprecate Ferret.
11203
11204 In the mean time, I've placed your patches on a branch called xapian. If
11205 anyone wants to play with this, here's what you do:
11206
11207 1. install the ruby xapian library and the ruby gdbm library, if you
11208 don't have them. These are packaged by your distro, and are not gems.
11209 2. git fetch
11210 3. git checkout -b xapian origin/xapian
11211 4. cp ~/.sup/sources.yaml /tmp # just in case
11212 5. sup-dump > dumpfile
11213 6. SUP_INDEX=xapian sup-sync --all --all-sources --restore dumpfile
11214 7. SUP_INDEX=xapian bin/sup -o
11215 8. Oooh, fast.
11216
11217 This should not disturb your Ferret index, so you can switch back and
11218 forth between the two. (Message state, of course, is not shared.)
11219 However, adding new messages to one index will prevent it from being
11220 automatically added to the other, so I recommend running in Xapian mode
11221 with -o and not pressing 'P'.
11222
11223 > It's missing a couple of features, notably threading by subject.
11224
11225 FWIW, I've been thinking about deprecating that particular feature for
11226 quite some time.
11227
11228 > I'm sure there are many more bugs left, so I'd appreciate any testing
11229 > or review you all can provide.
11230
11231 sup-sync crashes for me fairly systematically with this error:
11232
11233 ./lib/sup/xapian_index.rb:404:in `sortable_serialise': Expected argument 0 of type double, but got Fixnum 51767811298 (TypeError)
11234 in SWIG method 'Xapian::sortable_serialise'
11235 from ./lib/sup/xapian_index.rb:404:in `index_message'
11236 from ./lib/sup/xapian_index.rb:111:in `sync_message'
11237 from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
11238 from ./lib/sup/xapian_index.rb:324:in `synchronize'
11239 from ./lib/sup/xapian_index.rb:110:in `sync_message'
11240 from ./lib/sup/util.rb:519:in `send'
11241 from ./lib/sup/util.rb:519:in `method_missing'
11242 from ./lib/sup/poll.rb:157:in `add_messages_from'
11243 from ./lib/sup/source.rb:100:in `each'
11244 from ./lib/sup/util.rb:558:in `send'
11245 from ./lib/sup/util.rb:558:in `__pass'
11246 from ./lib/sup/util.rb:545:in `method_missing'
11247 from ./lib/sup/poll.rb:141:in `add_messages_from'
11248 from ./lib/sup/util.rb:519:in `send'
11249 from ./lib/sup/util.rb:519:in `method_missing'
11250 from bin/sup-sync:140
11251 from bin/sup-sync:135:in `each'
11252 from bin/sup-sync:135
11253
11254 I haven't spent any time tracking it down. Other than that, so far so
11255 good.
11256 --
11257 William <wmorgan-sup at masanjin.net>
11258
11259 From wmorgan-sup@masanjin.net Wed Jun 24 13:33:46 2009
11260 From: wmorgan-sup@masanjin.net (William Morgan)
11261 Date: Wed, 24 Jun 2009 10:33:46 -0700
11262 Subject: [sup-talk] [PATCH 0/18] Xapian-based index
11263 In-Reply-To: <1245854803-sup-4481@entry>
11264 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11265 <1245854803-sup-4481@entry>
11266 Message-ID: <1245864733-sup-1216@entry>
11267
11268 Reformatted excerpts from William Morgan's message of 2009-06-24:
11269 > sup-sync crashes for me fairly systematically with this error:
11270 >
11271 > ./lib/sup/xapian_index.rb:404:in `sortable_serialise': Expected argument 0 of
11272 > type double, but got Fixnum 51767811298 (TypeError)
11273
11274 This turns out to be due to dates being far in the future (e.g. on spam
11275 messages). I'm using the attached patch, which is pretty much a hack, to
11276 force them to be between 1969 and 2038. Better solutions welcome. (I
11277 haven't committed this.)
11278 --
11279 William <wmorgan-sup at masanjin.net>
11280 -------------- next part --------------
11281 A non-text attachment was scrubbed...
11282 Name: 0001-bugfix-dates-need-to-be-truncated-for-xapian-to-ind.patch
11283 Type: application/octet-stream
11284 Size: 2484 bytes
11285 Desc: not available
11286 URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090624/fae22ca3/attachment.obj>
11287
11288 From olly@survex.com Thu Jun 25 22:00:57 2009
11289 From: olly@survex.com (Olly Betts)
11290 Date: Fri, 26 Jun 2009 02:00:57 +0000 (UTC)
11291 Subject: [sup-talk] [PATCH 0/18] Xapian-based index
11292 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11293 <1245854803-sup-4481@entry> <1245864733-sup-1216@entry>
11294 Message-ID: <loom.20090625T222159-861@post.gmane.org>
11295
11296 William Morgan <wmorgan-sup at masanjin.net> writes:
11297 > Reformatted excerpts from William Morgan's message of 2009-06-24:
11298 > > sup-sync crashes for me fairly systematically with this error:
11299 > >
11300 > > ./lib/sup/xapian_index.rb:404:in `sortable_serialise': Expected argument 0 of
11301 > > type double, but got Fixnum 51767811298 (TypeError)
11302 >
11303 > This turns out to be due to dates being far in the future (e.g. on spam
11304 > messages). I'm using the attached patch, which is pretty much a hack, to
11305 > force them to be between 1969 and 2038. Better solutions welcome. (I
11306 > haven't committed this.)
11307
11308 The error you get here is actually a bug in SWIG (http://www.swig.org/). Xapian
11309 uses SWIG to generate the wrappers for Ruby.
11310
11311 The code SWIG currently uses to convert a parameter when a C/C++ function
11312 takes a double doesn't handle a "fixnum" which is larger than MAXINT. I've
11313 just applied a fix to SWIG SVN:
11314
11315 http://swig.svn.sourceforge.net/viewvc/swig?view=rev&revision=11320
11316
11317 I'll make sure this fix makes it into the next Xapian release (which will be
11318 1.0.14).
11319
11320 Cheers,
11321 Olly
11322
11323
11324 From wmorgan-sup@masanjin.net Fri Jun 26 09:49:40 2009
11325 From: wmorgan-sup@masanjin.net (William Morgan)
11326 Date: Fri, 26 Jun 2009 06:49:40 -0700
11327 Subject: [sup-talk] [PATCH 0/18] Xapian-based index
11328 In-Reply-To: <loom.20090625T222159-861@post.gmane.org>
11329 References: <1245531017-9907-1-git-send-email-rlane@club.cc.cmu.edu>
11330 <1245854803-sup-4481@entry> <1245864733-sup-1216@entry>
11331 <loom.20090625T222159-861@post.gmane.org>
11332 Message-ID: <1246022094-sup-3336@entry>
11333
11334 Reformatted excerpts from Olly Betts's message of 2009-06-25:
11335 > I'll make sure this fix makes it into the next Xapian release (which
11336 > will be 1.0.14).
11337
11338 Awesome, thanks!
11339
11340 Though even with SWIG fixed there will still be some tweaking necessary
11341 in Sup because the logistic function used for generating Xapian docids
11342 still has trouble with extreme dates.
11343
11344 BTW, more kudos to Rich for somehow finding a way to use a logistic
11345 function in an email client.
11346 --
11347 William <wmorgan-sup at masanjin.net>
11348
11349 From ezyang@MIT.EDU Fri Jun 26 13:10:01 2009
11350 From: ezyang@MIT.EDU (Edward Z. Yang)
11351 Date: Fri, 26 Jun 2009 13:10:01 -0400
11352 Subject: [sup-talk] [PATCH] before-search hook
11353 In-Reply-To: <1245087294-sup-6276@entry>
11354 References: <1244612627-sup-982@javelin> <1245087294-sup-6276@entry>
11355 Message-ID: <1246035946-sup-7069@javelin>
11356
11357 Done.
11358
11359
11360 >From 19f9da29020f1dfa97a4e6d0e4866cec840cfddc Mon Sep 17 00:00:00 2001
11361 From: Edward Z. Yang <edwardzyang at thewritingpot.com>
11362 Date: Wed, 10 Jun 2009 01:42:50 -0400
11363 Subject: [PATCH 1/2] Add custom-search hook, for shortcuts for custom search queries.
11364 Signed-off-by: Edward Z. Yang <ezyang at mit.edu>
11365
11366 ---
11367 lib/sup/hook.rb | 5 +++++
11368 lib/sup/index.rb | 14 +++++++++++++-
11369 2 files changed, 18 insertions(+), 1 deletions(-)
11370
11371 diff --git a/lib/sup/hook.rb b/lib/sup/hook.rb
11372 index 0a0a2f6..33a97b2 100644
11373 --- a/lib/sup/hook.rb
11374 +++ b/lib/sup/hook.rb
11375 @@ -19,6 +19,11 @@ class HookManager
11376
11377 attr_writer :__locals
11378
11379 + ## an annoying gotcha here is that if you try something
11380 + ## like var = var.foo(), var will magically get allocated
11381 + ## to Nil and method_missing will never get called. You
11382 + ## can work around this by calling self.var or simply
11383 + ## not assigning it to itself.
11384 def method_missing m, *a
11385 case @__locals[m]
11386 when Proc
11387 diff --git a/lib/sup/index.rb b/lib/sup/index.rb
11388 index ca01ee7..9c985d9 100644
11389 --- a/lib/sup/index.rb
11390 +++ b/lib/sup/index.rb
11391 @@ -24,6 +24,16 @@ class Index
11392
11393 include Singleton
11394
11395 + HookManager.register "custom-search", <<EOS
11396 +Executes before a string search is applied to the index,
11397 +returning a new search string.
11398 +Variables:
11399 + subs: The string being searched. Be careful about shadowing:
11400 + this variable is actually a method, so use a temporary variable
11401 + or explicitly call self.subs; the substitutions in index.rb
11402 + don't actually work.
11403 +EOS
11404 +
11405 ## these two accessors should ONLY be used by single-threaded programs.
11406 ## otherwise you will have a naughty ferret on your hands.
11407 attr_reader :index
11408 @@ -507,7 +517,9 @@ protected
11409 def parse_user_query_string s
11410 extraopts = {}
11411
11412 - subs = s.gsub(/\b(to|from):(\S+)\b/) do
11413 + subs = HookManager.run("custom-search", :subs => s) || s
11414 +
11415 + subs = subs.gsub(/\b(to|from):(\S+)\b/) do
11416 field, name = $1, $2
11417 if(p = ContactManager.contact_for(name))
11418 [field, p.email]
11419 --
11420 1.6.3.2
11421
11422 From me@nicholasbs.net Sun Jun 28 22:32:02 2009
11423 From: me@nicholasbs.net (Nicholas Bergson-Shilcock)
11424 Date: Sun, 28 Jun 2009 22:32:02 -0400
11425 Subject: [sup-talk] Transitioning to OfflineIMAP
11426 In-Reply-To: <1244852427-sup-5831@entry>
11427 References: <1244844014-sup-6606@twoface> <1244852427-sup-5831@entry>
11428 Message-ID: <1246242608-sup-3151@twoface>
11429
11430 Excerpts from William Morgan's message of Fri Jun 12 20:24:44 -0400 2009:
11431 > Reformatted excerpts from Nicholas Bergson-Shilcock's message of 2009-06-12:
11432 > > Before I go any further, I wanted to know if sup supported any sort of
11433 > > "graceful" account transitioning -- I'd ideally like to switch to my
11434 > > new maildir source without losing the index information I have for my
11435 > > IMAP source. The obvious way of switching over (removing my old source
11436 > > and adding the new one) would mean essentially starting over. Is this
11437 > > what I have to do or is there another way for me to switch?
11438 >
11439 > I wouldn't call it graceful, exactly, but you should be able to preserve
11440 > state by running sup-dump on the original source, drop the index (move
11441 > your ~/.sup/ferret directory somewhere else), edit your source.yaml
11442 > file, and use sup-sync --restored --restore <dumpfile> to scan over the
11443 > new source and restore the state for each message.
11444 >
11445 > It will take a while. Try it on a subset of messages first if possible
11446 > to make sure it's working. Post any questions and I'll try and help you.
11447
11448 I just finally got around to trying this and it worked perfectly on the
11449 first try. Thank you, thank you, thank you! My mail is now about an
11450 order of magnitude faster.
11451
11452 Keep up the awesome work,
11453 -Nick
11454