Kevin Riggle [Fri, 21 Aug 2009 01:57:42 +0000 (21:57 -0400)]
add an after-add-message hook
I want to do some unrelated processing on each message I receive, but I
don't want to block the message being added to the index. This patch
adds a hook which runs /after/ the message is added to the index.
William Morgan [Mon, 24 Aug 2009 22:32:39 +0000 (18:32 -0400)]
fix proc locals, which must use the old method trick
For hook locals that are specified as procs (usually for performance
reasons), use methods instead of local variables. Sadly you don't get
all the regular variable semantics, but it is the only option for
delayed evaluation AFAICT.
Benoît PIERRE [Wed, 19 Aug 2009 20:56:55 +0000 (22:56 +0200)]
fix garbaged text in textfield when using ncursesw
Apparently, field_buffer content is not initialized to blanks when using
the wide-character version of ncurses. Forcing a call to
set_field_buffer fix the problem.
William Morgan [Tue, 11 Aug 2009 19:34:50 +0000 (15:34 -0400)]
refactor index access into three methods and rewrite PollManager#each_message_from
Couple big changes in this commit, but they're all tied together.
Index.sync_message is refactored into three separate methods: add_message,
update_message and update_message_state. The intention is that add_message is
called for new messages only, update_message is called for changing the method
body on disk (e.g. when we see multiple copies of the same message, or by
DraftManager when the text of a draft is changes), and update_message_state is
called when the labels on a message change. So indexes that differentiate those
operations can exhibit more natural performance characteristics.
Also, PollManager.add_messages_from has been renamed to each_message_from and
changed significantly. It now *only* yields successive messages; it does not
load the index version of the message, and it does not auto-add the message to
the index. (In fact, it ignores the result of the block.) There's also a new
method called add_new_message that calls Index.add_message and then relays the
update to other GUI elements.
There was a lot of refactoring of sup-sync that was part of this. Probably
not strictly necessary but it was too hard to untangle the changes.
William Morgan [Fri, 7 Aug 2009 01:33:19 +0000 (21:33 -0400)]
refactor index locking interaction and replace suicidemanager
Since SIGTERM now works, we have a better way of killing a remote
process than SuicideManager. So replace that with a $die global.
Also refactor the interactive locking code into a separate module
so as not to pollute index.rb with such trivial concerns.
William Morgan [Thu, 6 Aug 2009 16:21:46 +0000 (12:21 -0400)]
rewrap getch in select, handle sigwinch manually
This is necessary to operate with many versions of the ruby ncurses library,
all of which block threads when getch is being called. But this means we can't
use getch to determine a sigwich, since we won't see it until an actual key is
pressed. so we handle sigwinch ourselves.
William Morgan [Wed, 5 Aug 2009 19:40:02 +0000 (15:40 -0400)]
improve ncurses key handling for sigwinch and sigint
see comments. adding a nodelay call before each getch means we don't need a
select() call, which means that we can get sigwinch and sigint signals from
ncurses.
William Morgan [Wed, 24 Jun 2009 17:30:43 +0000 (13:30 -0400)]
bugfix: dates need to be truncated for xapian to index
If dates are way out of range, the current indexing process both dies
and generates bad doc ids. This patch forces dates to be within a
reasonable range (current between 1969 and 2038.) Not necessarily the
best solution.
William Morgan [Wed, 24 Jun 2009 13:10:19 +0000 (09:10 -0400)]
explicitly load index version, for better error messages
Catching the LoadError was masking errors from not having dependent
library like xapian and gdbm. This change makes the error messages
reflect what's actually missing. Since we're adding index types at
roughly once every 3 years, an explicit list like this shouldn't be too
difficult to maintain.