diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-02-05 14:19:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-02-05 14:26:33 +0100 |
commit | f0f911b0063f737f81096078bcf0ba98f97b9c52 (patch) | |
tree | 977af38422c899c7b73dd6d04606737a605f810a /alot | |
parent | e331cc44b672d39e09b5c971c4f3a99d5a3c93cc (diff) |
Drop support for removing messages.
This functionality is too obscure and dangerous, it should be done
manually instead.
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/thread.py | 46 | ||||
-rw-r--r-- | alot/db/manager.py | 18 |
2 files changed, 0 insertions, 64 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 468ae149..6f83083a 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -747,52 +747,6 @@ class PipeCommand(Command): ui.notify(self.done_msg) -@registerCommand(MODE, 'remove', arguments=[ - (['--all'], {'action': 'store_true', 'help': 'remove whole thread'})]) -class RemoveCommand(Command): - - """remove message(s) from the index""" - repeatable = True - - def __init__(self, all=False, **kwargs): - """ - :param all: remove all messages from thread, not just selected one - :type all: bool - """ - Command.__init__(self, **kwargs) - self.all = all - - async def apply(self, ui): - threadbuffer = ui.current_buffer - # get messages and notification strings - if self.all: - thread = threadbuffer.get_selected_thread() - tid = thread.get_thread_id() - messages = thread.get_messages().keys() - confirm_msg = 'remove all messages in thread?' - ok_msg = 'removed all messages in thread: %s' % tid - else: - msg = threadbuffer.get_selected_message() - messages = [msg] - confirm_msg = 'remove selected message?' - ok_msg = 'removed message: %s' % msg.get_message_id() - - # ask for confirmation - if (await ui.choice(confirm_msg, select='yes', cancel='no')) == 'no': - return - - # notify callback - def callback(): - threadbuffer.rebuild() - ui.notify(ok_msg) - - # remove messages - for m in messages: - ui.dbman.remove_message(m, afterwards=callback) - - await ui.apply_command(FlushCommand()) - - @registerCommand(MODE, 'print', arguments=[ (['--all'], {'action': 'store_true', 'help': 'print all messages'}), (['--raw'], {'action': 'store_true', 'help': 'pass raw mail string'}), diff --git a/alot/db/manager.py b/alot/db/manager.py index 956ddcbc..8f457712 100644 --- a/alot/db/manager.py +++ b/alot/db/manager.py @@ -146,10 +146,6 @@ class DBManager: msg.thaw() logging.debug('thaw') - elif cmd == 'remove': - path = current_item[2] - db.remove_message(path) - elif cmd == 'setconfig': key = current_item[2] value = current_item[3] @@ -442,20 +438,6 @@ class DBManager: else: self.writequeue.append(('add', afterwards, path, tags)) - def remove_message(self, message, afterwards=None): - """ - Remove a message from the notmuch index - - :param message: message to remove - :type message: :class:`Message` - :param afterwards: callback to trigger after removing - :type afterwards: callable or None - """ - if self.ro: - raise DatabaseROError() - path = message.get_filename() - self.writequeue.append(('remove', afterwards, path)) - def save_named_query(self, alias, querystring, afterwards=None): """ add an alias for a query string. |