From: Holger Berndt Date: Wed, 12 Aug 2015 18:14:17 +0000 (+0200) Subject: Python plugin: Add Folder to MessageInfo objects X-Git-Tag: 3.13.0~76 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=b20b2b3508765ce95842aff8e13feb86ff2b599a Python plugin: Add Folder to MessageInfo objects --- diff --git a/src/plugins/python/messageinfotype.c b/src/plugins/python/messageinfotype.c index 3c7194a57..ea983204c 100644 --- a/src/plugins/python/messageinfotype.c +++ b/src/plugins/python/messageinfotype.c @@ -21,6 +21,7 @@ #endif #include "messageinfotype.h" +#include "foldertype.h" #include "common/tags.h" #include "common/defs.h" @@ -306,6 +307,16 @@ static int set_flag(clawsmail_MessageInfoObject *self, PyObject *value, void *cl return 0; } + +static PyObject* get_Folder(clawsmail_MessageInfoObject *self, void *closure) +{ + if(self->msginfo && self->msginfo->folder) { + return clawsmail_folder_new(self->msginfo->folder); + } + Py_RETURN_NONE; +} + + static PyMethodDef MessageInfo_methods[] = { {"is_new", is_new, METH_NOARGS, "is_new() - checks if the message is new\n" @@ -407,7 +418,10 @@ static PyGetSetDef MessageInfo_getset[] = { {"forwarded", (getter)get_flag, (setter)NULL, "forwarded - Forwarded-flag of the message", GINT_TO_POINTER(MSG_FORWARDED)}, - {NULL} + {"Folder", (getter)get_Folder, (setter)NULL, + "Folder - Folder in which the message is contained", NULL}, + + {NULL} };