Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
f6b40b8d
...
f6b40b8d77c08636e90ae23b86dd01f7e70f080e
authored
2009-07-11 19:13:07 +0300
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
ssh://gray@git.savannah.gnu.org/srv/git/mailutils
2 parents
4b073831
181e0c84
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
0 deletions
include/mailutils/cpp/mailbox.h
libmu_cpp/mailbox.cc
python/libmu_py/mailbox.c
python/mailutils/mailbox.py
include/mailutils/cpp/mailbox.h
View file @
f6b40b8
...
...
@@ -49,6 +49,7 @@ class MailboxBase
void
append_message
(
const
Message
&
msg
);
void
expunge
();
void
sync
();
List
&
get_uidls
();
void
lock
();
void
unlock
();
mu_off_t
get_size
();
...
...
libmu_cpp/mailbox.cc
View file @
f6b40b8
...
...
@@ -124,6 +124,18 @@ MailboxBase :: sync ()
throw
Exception
(
"MailboxBase::sync"
,
status
);
}
List
&
MailboxBase
::
get_uidls
()
{
mu_list_t
c_list
;
int
status
=
mu_mailbox_get_uidls
(
mbox
,
&
c_list
);
if
(
status
)
throw
Exception
(
"MailboxBase::get_uidls"
,
status
);
return
*
new
List
(
c_list
);
}
void
MailboxBase
::
lock
()
{
...
...
python/libmu_py/mailbox.c
View file @
f6b40b8
...
...
@@ -264,6 +264,38 @@ api_mailbox_sync (PyObject *self, PyObject *args)
return
_ro
(
PyInt_FromLong
(
status
));
}
static
int
uidls_extractor
(
void
*
data
,
PyObject
**
dst
)
{
struct
mu_uidl
*
uidl
=
(
struct
mu_uidl
*
)
data
;
*
dst
=
PyTuple_New
(
2
);
PyTuple_SetItem
(
*
dst
,
0
,
PyInt_FromLong
(
uidl
->
msgno
));
PyTuple_SetItem
(
*
dst
,
1
,
PyString_FromString
(
uidl
->
uidl
));
return
0
;
}
static
PyObject
*
api_mailbox_get_uidls
(
PyObject
*
self
,
PyObject
*
args
)
{
int
status
;
PyMailbox
*
py_mbox
;
PyObject
*
py_list
;
mu_list_t
c_list
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O!"
,
&
PyMailboxType
,
&
py_mbox
))
return
NULL
;
status
=
mu_mailbox_get_uidls
(
py_mbox
->
mbox
,
&
c_list
);
if
(
c_list
)
py_list
=
mu_py_mulist_to_pylist
(
c_list
,
uidls_extractor
);
else
py_list
=
PyTuple_New
(
0
);
return
status_object
(
status
,
py_list
);
}
static
PyObject
*
api_mailbox_lock
(
PyObject
*
self
,
PyObject
*
args
)
{
...
...
@@ -397,6 +429,9 @@ static PyMethodDef methods[] = {
{
"sync"
,
(
PyCFunction
)
api_mailbox_sync
,
METH_VARARGS
,
""
},
{
"get_uidls"
,
(
PyCFunction
)
api_mailbox_get_uidls
,
METH_VARARGS
,
""
},
{
"lock"
,
(
PyCFunction
)
api_mailbox_lock
,
METH_VARARGS
,
""
},
...
...
python/mailutils/mailbox.py
View file @
f6b40b8
...
...
@@ -103,6 +103,13 @@ class MailboxBase:
if
status
:
raise
MailboxError
(
status
)
def
get_uidls
(
self
):
"""Get UIDL list."""
status
,
uidls
=
mailbox
.
get_uidls
(
self
.
mbox
)
if
status
:
raise
MailboxError
(
status
)
return
uidls
def
lock
(
self
):
"""Lock the mailbox."""
status
=
mailbox
.
lock
(
self
.
mbox
)
...
...
Please
register
or
sign in
to post a comment