1 # -*- coding: utf-8 -*-
3 # Define the function to deal with each folder
4 def deal_with_folder(folder):
5 # Get actions for selecting all messages, and marking the selection as read
6 action_group = clawsmail.get_mainwindow_action_group();
7 select_all_action = action_group.get_action("Edit/SelectAll")
8 mark_read_action = action_group.get_action("Message/Mark/MarkRead")
11 clawsmail.folderview_select_folder(folder)
13 # Search for messages with age greater than 28 days
14 clawsmail.quicksearch_search("ag 28", clawsmail.QUICK_SEARCH_EXTENDED)
16 # Mark all messages in the search result as read
17 select_all_action.activate()
18 mark_read_action.activate()
22 root = clawsmail.get_folderview_selected_folder()
24 # Get a tree of subfolders. The argument could also be a string of a mailbox name,
25 # or left out for a list of mailbox trees.
26 tree = clawsmail.get_folder_tree(root)
28 # Call above function for all folders.
29 tree.traverse(deal_with_folder)
31 # Clear the quicksearch widget again
32 clawsmail.quicksearch_clear()
34 # Change back to original folder
35 clawsmail.folderview_select_folder(root)