Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 8ad6e1560cbd90aa35f798d4080c8547 > files > 19

claws-mail-plugins-python-3.7.9-2.fc15.i686.rpm

# -*- coding: utf-8 -*-

# Define the function to deal with each folder
def deal_with_folder(folder):
    # Get actions for selecting all messages, and marking the selection as read
    action_group = clawsmail.get_mainwindow_action_group();
    select_all_action = action_group.get_action("Edit/SelectAll")
    mark_read_action = action_group.get_action("Message/Mark/MarkRead")
    
    # Select given folder
    clawsmail.folderview_select_folder(folder)
    
    # Search for messages with age greater than 28 days
    clawsmail.quicksearch_search("ag 28", clawsmail.QUICK_SEARCH_EXTENDED)
    
    # Mark all messages in the search result as read
    select_all_action.activate()
    mark_read_action.activate()


# Get selected folder
root = clawsmail.get_folderview_selected_folder()

# Get a tree of subfolders. The argument could also be a string of a mailbox name,
# or left out for a list of mailbox trees.
tree = clawsmail.get_folder_tree(root)

# Call above function for all folders.
tree.traverse(deal_with_folder)

# Clear the quicksearch widget again
clawsmail.quicksearch_clear()

# Change back to original folder
clawsmail.folderview_select_folder(root)