Rewrite IMAP flags handling/display code
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 15 Dec 2010 23:30:53 +0000 (16:30 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 16 Dec 2010 20:03:01 +0000 (13:03 -0700)
commit5fe00abb2cdde93a178812d19178d8d8d07bbaff
tree0d3c61a1dbd74c33c1f6f8fa17591eb416ba06e6
parent61c90ad7a4bb9828f189b8f3ff4870c597a1c907
Rewrite IMAP flags handling/display code

Rewrite to match recent search rewrite. Biggest benefit: removes a large
amount of logic from the preferences file (and, thus, wasted storage in
the session).

Move all flags to separate objects, and use these objects to interact
with the various flag quirks.

This commit does make a fairly significant UI change: you no longer mark
a message as 'Unseen', you unmark it as 'Seen'.  Not quite as intuitive
to me, but this is the way the IMAP specs define it and the way that
other MUAs (e.g. Thunderbird) show to user. But at the internal level it
allows us to get rid of the 'inverse' flagging.

Fix bug: Allow filtering of ALL IMAP flags in dimp, not just user settable
ones.

fullmessage-dimp.js -> message-dimp.js

For those upgrading that have custom flags you don't want to lose, this
script is what I used to convert.  YMMV.

<?php
require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('imp', array('authentication' => 'none'));

$registry->setAuth(***USERNAME***, array());

$msgflags = array_merge(
    json_decode($prefs->getValue('msgflags_user'), true),
    json_decode($prefs->getValue('msgflags'), true)
);
$out = array();

foreach ($msgflags as $key => $val) {
    if ($val['t'] == 'imapp') {
        $out[] = new IMP_Flag_User($val['l'], $key, $val['b']);
    }
}

$prefs->setValue('msgflags', serialize($out));
$prefs->remove('msgflags_user');
51 files changed:
imp/config/prefs.php.dist
imp/js/compose-dimp.js
imp/js/dimpbase.js
imp/js/dimpcore.js
imp/js/fullmessage-dimp.js [deleted file]
imp/js/message-dimp.js [new file with mode: 0644]
imp/lib/Ajax/Application.php
imp/lib/Api.php
imp/lib/Application.php
imp/lib/Flag/Base.php [new file with mode: 0644]
imp/lib/Flag/Imap.php [new file with mode: 0644]
imp/lib/Flag/Imap/Answered.php [new file with mode: 0644]
imp/lib/Flag/Imap/Deleted.php [new file with mode: 0644]
imp/lib/Flag/Imap/Draft.php [new file with mode: 0644]
imp/lib/Flag/Imap/Flagged.php [new file with mode: 0644]
imp/lib/Flag/Imap/Forwarded.php [new file with mode: 0644]
imp/lib/Flag/Imap/Seen.php [new file with mode: 0644]
imp/lib/Flag/System.php [new file with mode: 0644]
imp/lib/Flag/System/Attachment.php [new file with mode: 0644]
imp/lib/Flag/System/Encrypted.php [new file with mode: 0644]
imp/lib/Flag/System/HighPriority.php [new file with mode: 0644]
imp/lib/Flag/System/LowPriority.php [new file with mode: 0644]
imp/lib/Flag/System/Personal.php [new file with mode: 0644]
imp/lib/Flag/System/Signed.php [new file with mode: 0644]
imp/lib/Flag/System/Unseen.php [new file with mode: 0644]
imp/lib/Flag/User.php [new file with mode: 0644]
imp/lib/Flags.php [new file with mode: 0644]
imp/lib/Imap/Flags.php [deleted file]
imp/lib/Indices.php
imp/lib/Injector/Factory/Flags.php [new file with mode: 0644]
imp/lib/Message.php
imp/lib/Prefs/Ui.php
imp/lib/Search/Element/Flag.php
imp/lib/Ui/Mailbox.php
imp/lib/Views/ListMessages.php
imp/lib/Views/ShowMessage.php
imp/mailbox-mimp.php
imp/mailbox.php
imp/message-dimp.php
imp/message-mimp.php
imp/message.php
imp/package.xml
imp/search-basic.php
imp/search.php
imp/templates/dimp/index.inc
imp/templates/dimp/javascript_defs.php
imp/templates/mobile/javascript_defs.php
imp/templates/prefs/flags.html
imp/themes/default/dimp/screen.css
imp/themes/default/screen.css
imp/themes/silver/screen.css