Re: Adding a tag



On 2001-05-25 01:39 Evrard Nicolas wrote:
> I'm planning to add a 'delayed delete' to balsa that way it would be
> enough to tag a mail and after a certain amount of time, this message
> would be deleted ... But I suppose, I will have to add some header
> like : X-Deld : Y

When you invoke "message/delete" action, the message is deleted from the
BalsaIndex/GtkCList (see below for closer description). However, on the
backend side, it calls only
mutt_set_flag() (which only sets the deleted flag, but does not actually
remove the message). Later, a *broken* libbalsa_mailbox_commit_changes()
function is called which synchronizes backend information with frontend.

The function libbalsa_mailbox_commit_changes() is broken because it does
not do what it is supposed to do and the name is a bit misleading for
its current use (the present functionality should be called more like
libbalsa_mailbox_sync_with backend(); also, it it too complicated and
should be rewritten; a proper function for forcing backend to commit the
changes is needed).

Since the messages are not physically deleted, it would be sufficient
just not to call present libbalsa_mailbox_commit_changes() on every
message delete. 

The message deletion scheme is following (balsa_message_delete):
- a message is asked to mark itself as deleted
(libbalsa_message_delete()); it asks libmutt backend to perform this
action using mutt_set_flag().

- next, LibBalsaMailbox is asked to sync with backend:
libbalsa_mailbox_commit_changes() is called which emits
LibBalsaMailbox::"message-delete" signal for deleted messages.
BalsaIndex displaying given LibBalsaMailbox has a signal handler
instaled for this signal (handler is set in
balsa_index_load_mailbox_node() and is called
mailbox_messages_delete_cb()). This handler removes deleted messages
from the list.

Is it sufficiently clearly explained?

If you would like to make a patch for it, try to have message filtering
in the picture: while unfortunately named
libbalsa_mailbox_commit_changes() generates delete signals for messages
that have DELETED flag set, it could generate such messages for messages
that do not fulfill another condition, say, do not contain text "PATCH"
in the subject. Basically, it would be best to write a
libbalsa_mailbox_sync_lists() or similar, that would accept a callback
function as an argument, and would remove messages from the
LibBalsaMailbox list that calback fails for, and add messages from the
backend that were not present, and the filter callback returns true. 
This would be the optimal solution.

/Pawel
-- 
Pawel Salek (pawsa@theochem.kth.se) http://www.theochem.kth.se/~pawsa/
Theoretical Chemistry Division, KTH voice: +46 8 790-8202




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]