summaryrefslogtreecommitdiff
path: root/python/libmu_py
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2009-07-13 17:17:00 +0200
committerWojciech Polak <polak@gnu.org>2009-07-13 17:20:25 +0200
commitb390f3773720cf07d88a192740c0082504faa7f8 (patch)
treeee647ff0bf7feb2de13fa987d4f4fada91e4f631 /python/libmu_py
parent36a121b9d19e24815f415054926e5b2f074618df (diff)
downloadmailutils-b390f3773720cf07d88a192740c0082504faa7f8.tar.gz
mailutils-b390f3773720cf07d88a192740c0082504faa7f8.tar.bz2
Add more is/set/unset attribute methods (Python).
* python/libmu_py/attribute.c: Add userflag functions. * python/mailutils/attribute.py: Add more is/set/unset methods. * python/mailutils/mailbox.py (open): Bugfix.
Diffstat (limited to 'python/libmu_py')
-rw-r--r--python/libmu_py/attribute.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/python/libmu_py/attribute.c b/python/libmu_py/attribute.c
index b292d65bd..a930f77a1 100644
--- a/python/libmu_py/attribute.c
+++ b/python/libmu_py/attribute.c
@@ -181,6 +181,45 @@ api_attribute_unset_flags (PyObject *self, PyObject *args)
}
static PyObject *
+api_attribute_is_userflag (PyObject *self, PyObject *args)
+{
+ int state, flag;
+ PyAttribute *py_attr;
+
+ if (!PyArg_ParseTuple (args, "O!i", &PyAttributeType, &py_attr, &flag))
+ return NULL;
+
+ state = mu_attribute_is_userflag (py_attr->attr, flag);
+ return _ro (PyBool_FromLong (state));
+}
+
+static PyObject *
+api_attribute_set_userflag (PyObject *self, PyObject *args)
+{
+ int status, flag;
+ PyAttribute *py_attr;
+
+ if (!PyArg_ParseTuple (args, "O!i", &PyAttributeType, &py_attr, &flag))
+ return NULL;
+
+ status = mu_attribute_set_userflag (py_attr->attr, flag);
+ return _ro (PyInt_FromLong (status));
+}
+
+static PyObject *
+api_attribute_unset_userflag (PyObject *self, PyObject *args)
+{
+ int status, flag;
+ PyAttribute *py_attr;
+
+ if (!PyArg_ParseTuple (args, "O!i", &PyAttributeType, &py_attr, &flag))
+ return NULL;
+
+ status = mu_attribute_unset_userflag (py_attr->attr, flag);
+ return _ro (PyInt_FromLong (status));
+}
+
+static PyObject *
api_attribute_to_string (PyObject *self, PyObject *args)
{
char buf[MU_STATUS_BUF_SIZE];
@@ -221,6 +260,15 @@ static PyMethodDef methods[] = {
{ "unset_flags", (PyCFunction) api_attribute_unset_flags, METH_VARARGS,
"" },
+ { "is_userflag", (PyCFunction) api_attribute_is_userflag, METH_VARARGS,
+ "" },
+
+ { "set_userflag", (PyCFunction) api_attribute_set_userflag, METH_VARARGS,
+ "" },
+
+ { "unset_userflag", (PyCFunction) api_attribute_unset_userflag,
+ METH_VARARGS, "" },
+
{ "to_string", (PyCFunction) api_attribute_to_string, METH_VARARGS,
"" },

Return to:

Send suggestions and report system problems to the System administrator.