Clean all ‘… warning: "_POSIX_C_SOURCE" redefined’
[claws.git] / src / plugins / python / composewindowtype.c
index 110296bd38cbcecbfb6d19199fad5aa42453544b..65ba8643d042747cbe8f1a1df3f18b1d80d398e9 100644 (file)
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
-#include "claws-features.h"
+#  include "claws-features.h"
 #endif
 
-#include <glib.h>
-#include <glib/gi18n.h>
-
 #include "composewindowtype.h"
+#include "accounttype.h"
 
 #include "clawsmailmodule.h"
 #include "foldertype.h"
@@ -33,6 +31,9 @@
 #include "account.h"
 #include "summaryview.h"
 
+#include <glib.h>
+#include <glib/gi18n.h>
+
 #include <structmember.h>
 
 #include <string.h>
@@ -42,6 +43,7 @@ typedef struct {
     PyObject *ui_manager;
     PyObject *text;
     PyObject *replyinfo;
+    PyObject *fwdinfo;
     Compose *compose;
 } clawsmail_ComposeWindowObject;
 
@@ -50,6 +52,7 @@ static void ComposeWindow_dealloc(clawsmail_ComposeWindowObject* self)
   Py_XDECREF(self->ui_manager);
   Py_XDECREF(self->text);
   Py_XDECREF(self->replyinfo);
+  Py_XDECREF(self->fwdinfo);
   self->ob_type->tp_free((PyObject*)self);
 }
 
@@ -81,6 +84,7 @@ static void composewindow_set_compose(clawsmail_ComposeWindowObject *self, Compo
   store_py_object(&(self->text), get_gobj_from_address(compose->text));
 
   store_py_object(&(self->replyinfo), clawsmail_messageinfo_new(compose->replyinfo));
+  store_py_object(&(self->fwdinfo), clawsmail_messageinfo_new(compose->fwdinfo));
 }
 
 static int ComposeWindow_init(clawsmail_ComposeWindowObject *self, PyObject *args, PyObject *kwds)
@@ -443,6 +447,15 @@ static PyObject* ComposeWindow_set_modified(clawsmail_ComposeWindowObject *self,
   return Py_None;
 }
 
+static PyObject* get_account(clawsmail_ComposeWindowObject *self, void *closure)
+{
+  if(self->compose->account) {
+    return clawsmail_account_new(self->compose->account);
+  }
+  Py_RETURN_NONE;
+}
+
+
 static PyMethodDef ComposeWindow_methods[] = {
     {"set_subject", (PyCFunction)ComposeWindow_set_subject, METH_VARARGS,
      "set_subject(text) - set subject to text\n"
@@ -539,6 +552,16 @@ static PyMemberDef ComposeWindow_members[] = {
     {"replyinfo", T_OBJECT_EX, offsetof(clawsmail_ComposeWindowObject, replyinfo), 0,
      "replyinfo - The MessageInfo object of the message that is being replied to, or None"},
 
+    {"forwardinfo", T_OBJECT_EX, offsetof(clawsmail_ComposeWindowObject, fwdinfo), 0,
+     "forwardinfo - The MessageInfo object of the message that is being forwarded, or None"},
+
+    {NULL}
+};
+
+static PyGetSetDef ComposeWindow_getset[] = {
+    {"account", (getter)get_account, (setter)NULL,
+      "account - the account corresponding to this compose window", NULL},
+
     {NULL}
 };
 
@@ -574,7 +597,7 @@ static PyTypeObject clawsmail_ComposeWindowType = {
     0,                         /* tp_iternext */
     ComposeWindow_methods,     /* tp_methods */
     ComposeWindow_members,     /* tp_members */
-    0,                         /* tp_getset */
+    ComposeWindow_getset,      /* tp_getset */
     0,                         /* tp_base */
     0,                         /* tp_dict */
     0,                         /* tp_descr_get */