[claws-mail-cvs-commit] ChangeLog
Holger Berndt <[email protected]> Wed, 19 Aug 2009 17:15:57 +0000
| Newsgroups | gmane.mail.sylpheed.claws.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /srv/cvs/claws-mail/plugins/python
In directory ran:/tmp/cvs-serv26432
Modified Files:
Tag: gtk2
ChangeLog README configure.ac
Log Message:
2009-08-19 [holger] 0.1cvs9
* README
Add some examples
Index: README
===================================================================
RCS file: /srv/cvs/claws-mail/plugins/python/Attic/README,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- README 19 Aug 2009 16:49:25 -0000 1.1.2.4
+++ README 19 Aug 2009 17:15:54 -0000 1.1.2.5
@@ -4,10 +4,15 @@
console, or stored in scripts under ~/.claws-mail/python-scripts.
The scripts are then accessible via the menu of the main window.
-As an example, the following code is sending the same mail
-to a list of people, one at a time.
-
+A few examples follow. This can be seen as a generalisation of
+templates.
+
========================== 8< ===========================
+# Send the same mail to a list of people, one at a time.
+# As this is normal Python code, the message contents and
+# the addresses could also come from an external source
+# (such as a file, or a database).
+
addresses = ["[email protected]", "[email protected]", "[email protected]"]
for address in addresses:
@@ -35,9 +40,35 @@
# Finally, the action group of the main window can be used to send the messages out
clawsmail.get_mainwindow_action_group().get_action("Message/SendQueue").activate()
+
========================== 8< ===========================
-This can be seen as a generalisation of templates. It is
-normal Python code, the message contents and the addresses
-could also come from an external source (such as a file,
-or a database).
+# Batch processing: Apply an action to all messages recursively starting from
+# the currently selected folder.
+
+# Define the function to deal with individual folders
+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, the subtree below it, and call above function for all folders
+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)
Index: configure.ac
===================================================================
RCS file: /srv/cvs/claws-mail/plugins/python/Attic/configure.ac,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -d -r1.1.2.8 -r1.1.2.9
--- configure.ac 19 Aug 2009 17:11:28 -0000 1.1.2.8
+++ configure.ac 19 Aug 2009 17:15:55 -0000 1.1.2.9
@@ -10,7 +10,7 @@
MAJOR_VERSION=0
MINOR_VERSION=1
MICRO_VERSION=0
-EXTRA_VERSION=8
+EXTRA_VERSION=9
if test \( $EXTRA_VERSION -eq 0 \); then
if test \( $MICRO_VERSION -eq 0 \); then
Index: ChangeLog
===================================================================
RCS file: /srv/cvs/claws-mail/plugins/python/Attic/ChangeLog,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -d -r1.1.2.8 -r1.1.2.9
--- ChangeLog 19 Aug 2009 17:11:28 -0000 1.1.2.8
+++ ChangeLog 19 Aug 2009 17:15:54 -0000 1.1.2.9
@@ -1,3 +1,8 @@
+2009-08-19 [holger] 0.1cvs9
+
+ * README
+ Add some examples
+
2009-08-19 [holger] 0.1cvs8
* src/clawsmailmodule.c