<DKIM> [PATCH 3/3] __syncmessagesto_flags: store keywords

Nicolas Sebrecht nicolas.s-dev at laposte.net
Sat Nov 7 17:57:13 GMT 2015


On Sat, Nov 07, 2015 at 11:16:55AM -0300, Igor Almeida wrote:
> This uses the destination folder's keyword mapping to translate the
> message's keywords into some appropriate format.
> 
> Tested only with local Maildir.

Please, document this in offlineimap.conf.

Also, I wonder how Keywords for IMAP <-> IMAP is currently discarded.

> Signed-off-by: Igor Almeida <igor.contato at gmail.com>
> ---
>  offlineimap/folder/Base.py | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
> index 5031a40..b48afbe 100644
> --- a/offlineimap/folder/Base.py
> +++ b/offlineimap/folder/Base.py
> @@ -937,6 +937,32 @@ class BaseFolder(object):
>              else:
>                  statusflags = set()
>  
> +            #keywords: if there is a keyword map, use it to figure out what
> +            #other 'flags' we should add
> +            try:
> +                keywordmap = dstfolder.getrepository().getkeywordmap()
> +                knownkeywords = set(keywordmap.keys())
> +
> +                selfkeywords = self.getmessagekeywords(uid)
> +
> +                if not knownkeywords >= selfkeywords:
> +                    #some of the message's keywords are not in the mapping, so
> +                    #skip them
> +
> +                    skipped_keywords = list(selfkeywords - knownkeywords)
> +                    selfkeywords &= knownkeywords
> +
> +                    self.ui.warn("Unknown keywords skipped: %s\n"
> +                        "You may want to change your configuration to include "
> +                        "those\n" % (skipped_keywords))

I guess that dynamically allowing any Keyword would be the next topic.
:-)

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list