summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-08-17 19:12:43 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-08-17 19:12:43 +0100
commitb86b1463217c29eaa3124af964ef4c9c20ed8243 (patch)
treeafb762db86d65f6ee3ad83c68ee5a6410bdbcf73 /alot
parentf0cd4134ce038a41e189b5ccc9e1c039f070aa4e (diff)
this sets sync_maildir according when tagging
DBManager reads the maildir.synchronize_flags option from notmuch's config and calls the api accordingly when tagging
Diffstat (limited to 'alot')
-rw-r--r--alot/db.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/alot/db.py b/alot/db.py
index 3af0c3eb..94338982 100644
--- a/alot/db.py
+++ b/alot/db.py
@@ -21,6 +21,7 @@ from datetime import datetime
from collections import deque
from message import Message
+from settings import notmuchconfig as config
DB_ENC = 'utf-8'
@@ -89,8 +90,7 @@ class DBManager:
sync_maildir_flags=sync)
msg.thaw()
- def tag(self, querystring, tags, remove_rest=False,
- sync_maildir_flags=False):
+ def tag(self, querystring, tags, remove_rest=False):
"""
add tags to all matching messages. Raises
:exc:`DatabaseROError` if in read only mode.
@@ -105,6 +105,7 @@ class DBManager:
"""
if self.ro:
raise DatabaseROError()
+ sync_maildir_flags = config.getboolean('maildir', 'synchronize_flags')
if remove_rest:
self.writequeue.append(('set', querystring, tags,
sync_maildir_flags))
@@ -112,7 +113,7 @@ class DBManager:
self.writequeue.append(('tag', querystring, tags,
sync_maildir_flags))
- def untag(self, querystring, tags, sync_maildir_flags=False):
+ def untag(self, querystring, tags):
"""
add tags to all matching messages. Raises
:exc:`DatabaseROError` if in read only mode.
@@ -125,6 +126,7 @@ class DBManager:
"""
if self.ro:
raise DatabaseROError()
+ sync_maildir_flags = config.getboolean('maildir', 'synchronize_flags')
self.writequeue.append(('untag', querystring, tags,
sync_maildir_flags))
@@ -204,7 +206,7 @@ class Thread:
l.sort()
return l
- def add_tags(self, tags, sync_maildir_flags=False):
+ def add_tags(self, tags):
"""adds tags to all messages in this thread
:param tags: tags to add
@@ -212,11 +214,10 @@ class Thread:
"""
newtags = set(tags).difference(self._tags)
if newtags:
- self._dbman.tag('thread:' + self._id, newtags,
- sync_maildir_flags=sync_maildir_flags)
+ self._dbman.tag('thread:' + self._id, newtags)
self._tags = self._tags.union(newtags)
- def remove_tags(self, tags, sync_maildir_flags=False):
+ def remove_tags(self, tags):
"""remove tags from all messages in this thread
:param tags: tags to remove
@@ -224,11 +225,10 @@ class Thread:
"""
rmtags = set(tags).intersection(self._tags)
if rmtags:
- self._dbman.untag('thread:' + self._id, tags,
- sync_maildir_flags=sync_maildir_flags)
+ self._dbman.untag('thread:' + self._id, tags)
self._tags = self._tags.difference(rmtags)
- def set_tags(self, tags, sync_maildir_flags=False):
+ def set_tags(self, tags):
"""set tags of all messages in this thread. This removes all tags and
attaches the given ones in one step.
@@ -236,8 +236,7 @@ class Thread:
:type tags: list of str
"""
if tags != self._tags:
- self._dbman.tag('thread:' + self._id, tags, remove_rest=True,
- sync_maildir_flags=sync_maildir_flags)
+ self._dbman.tag('thread:' + self._id, tags, remove_rest=True)
self._tags = set(tags)
def get_authors(self): # TODO: make this return a list of strings