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
ebcdaaf0
...
ebcdaaf0a4293c81229f6b8e5287d3a6a77b8f83
authored
2011-11-10 14:06:20 +0200
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
ssh://gray@git.sv.gnu.org/srv/git/mailutils
2 parents
56e4e27f
243dee23
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
79 deletions
examples/python/iconv.py
examples/python/mailcap.py
examples/python/url-parse.py
libmu_dbm/kyoto.c
python/libmu_py/filter.c
python/libmu_py/url.c
python/mailutils/error.py
python/mailutils/url.py
examples/python/iconv.py
View file @
ebcdaaf
...
...
@@ -23,22 +23,13 @@ if len (sys.argv) != 3:
sys
.
exit
(
0
)
sti
=
stream
.
StdioStream
(
stream
.
MU_STDIN_FD
)
sti
.
open
()
cvt
=
filter
.
FilterIconvStream
(
sti
,
sys
.
argv
[
1
],
sys
.
argv
[
2
])
cvt
.
open
()
out
=
stream
.
StdioStream
(
stream
.
MU_STDOUT_FD
,
0
)
out
.
open
()
total
=
0
while
True
:
buf
=
cvt
.
read
(
total
)
buf
=
cvt
.
read
()
out
.
write
(
buf
)
total
+=
cvt
.
read_count
if
not
cvt
.
read_count
:
break
out
.
flush
()
out
.
close
()
sti
.
close
()
...
...
examples/python/mailcap.py
View file @
ebcdaaf
...
...
@@ -17,8 +17,6 @@
from
mailutils
import
stream
,
mailcap
stm
=
stream
.
FileStream
(
"/etc/mailcap"
)
stm
.
open
()
mc
=
mailcap
.
Mailcap
(
stm
)
for
i
,
entry
in
enumerate
(
mc
):
...
...
examples/python/url-parse.py
View file @
ebcdaaf
...
...
@@ -21,7 +21,6 @@ from mailutils.error import *
def
parse
(
str
):
try
:
u
=
url
.
Url
(
str
)
u
.
parse
()
print
"URL:
%
s"
%
u
print
"
\t
scheme <
%
s>"
%
u
.
get_scheme
()
...
...
libmu_dbm/kyoto.c
View file @
ebcdaaf
...
...
@@ -19,6 +19,7 @@
# include <config.h>
#endif
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
...
...
@@ -38,6 +39,7 @@ struct kc_descr
{
KCDB
*
db
;
/* db */
KCCUR
*
cur
;
/* cursor */
int
fd
;
};
static
int
...
...
@@ -49,7 +51,17 @@ _kc_file_safety (mu_dbm_file_t db, int mode, uid_t owner)
int
_kc_get_fd
(
mu_dbm_file_t
db
,
int
*
pag
,
int
*
dir
)
{
return
ENOSYS
;
struct
kc_descr
*
kcd
=
db
->
db_descr
;
if
(
kcd
->
fd
==
-
1
)
{
kcd
->
fd
=
open
(
db
->
db_name
,
O_RDONLY
);
if
(
kcd
->
fd
==
-
1
)
return
errno
;
}
*
pag
=
kcd
->
fd
;
if
(
dir
)
*
dir
=
kcd
->
fd
;
return
0
;
}
static
int
...
...
@@ -93,6 +105,7 @@ _kc_open (mu_dbm_file_t db, int flags, int mode)
kcd
->
db
=
kdb
;
kcd
->
cur
=
NULL
;
db
->
db_descr
=
kcd
;
kcd
->
fd
=
-
1
;
return
0
;
}
...
...
@@ -102,6 +115,8 @@ _kc_close (mu_dbm_file_t db)
if
(
db
->
db_descr
)
{
struct
kc_descr
*
kcd
=
db
->
db_descr
;
if
(
kcd
->
fd
!=
-
1
)
close
(
kcd
->
fd
);
kcdbclose
(
kcd
->
db
);
kcdbdel
(
kcd
->
db
);
free
(
kcd
);
...
...
python/libmu_py/filter.c
View file @
ebcdaaf
...
...
@@ -66,8 +66,8 @@ api_filter_iconv_create (PyObject *self, PyObject *args)
argv
[
1
]
=
fromcode
;
argv
[
2
]
=
tocode
;
mu_filter_create_args
(
&
py_stm
->
stm
,
py_transport
->
stm
,
argv
[
0
],
3
,
argv
,
MU_FILTER_DECODE
,
flags
);
status
=
mu_filter_create_args
(
&
py_stm
->
stm
,
py_transport
->
stm
,
argv
[
0
],
3
,
argv
,
MU_FILTER_DECODE
,
flags
);
return
_ro
(
PyInt_FromLong
(
status
));
}
...
...
python/libmu_py/url.c
View file @
ebcdaaf
...
...
@@ -102,18 +102,6 @@ api_url_destroy (PyObject *self, PyObject *args)
return
_ro
(
Py_None
);
}
/* FIXME: Remove */
static
PyObject
*
api_url_parse
(
PyObject
*
self
,
PyObject
*
args
)
{
PyUrl
*
py_url
;
if
(
!
PyArg_ParseTuple
(
args
,
"O!"
,
&
PyUrlType
,
&
py_url
))
return
NULL
;
return
_ro
(
0
);
}
static
PyObject
*
api_url_get_port
(
PyObject
*
self
,
PyObject
*
args
)
{
...
...
@@ -255,9 +243,6 @@ static PyMethodDef methods[] = {
{
"destroy"
,
(
PyCFunction
)
api_url_destroy
,
METH_VARARGS
,
"Destroy the url and free its resources."
},
{
"parse"
,
(
PyCFunction
)
api_url_parse
,
METH_VARARGS
,
"Parse the url, after calling this the get functions can be called."
},
{
"to_string"
,
(
PyCFunction
)
api_url_to_string
,
METH_VARARGS
,
""
},
...
...
python/mailutils/error.py
View file @
ebcdaaf
...
...
@@ -48,11 +48,11 @@ MU_ERR_BASE = 0x1000
MU_ERR_FAILURE
=
(
MU_ERR_BASE
+
0
)
MU_ERR_CANCELED
=
(
MU_ERR_BASE
+
1
)
MU_ERR_
NO_HANDLER
=
(
MU_ERR_BASE
+
2
)
MU_ERR_
EMPTY_VFN
=
(
MU_ERR_BASE
+
3
)
MU_ERR_
OUT_NULL
=
(
MU_ERR_BASE
+
4
)
MU_ERR_
OUT_PTR_NULL
=
(
MU_ERR_BASE
+
5
)
MU_ERR_
MBX_NULL
=
(
MU_ERR_BASE
+
6
)
MU_ERR_
EMPTY_VFN
=
(
MU_ERR_BASE
+
2
)
MU_ERR_
OUT_PTR_NULL
=
(
MU_ERR_BASE
+
3
)
MU_ERR_
MBX_REMOVED
=
(
MU_ERR_BASE
+
4
)
MU_ERR_
NOT_OPEN
=
(
MU_ERR_BASE
+
5
)
MU_ERR_
OPEN
=
(
MU_ERR_BASE
+
6
)
MU_ERR_INVALID_EMAIL
=
(
MU_ERR_BASE
+
7
)
MU_ERR_EMPTY_ADDRESS
=
(
MU_ERR_BASE
+
8
)
MU_ERR_LOCKER_NULL
=
(
MU_ERR_BASE
+
9
)
...
...
@@ -65,38 +65,60 @@ MU_ERR_LOCK_EXT_ERR = (MU_ERR_BASE+15)
MU_ERR_LOCK_EXT_KILLED
=
(
MU_ERR_BASE
+
16
)
MU_ERR_NO_SUCH_USER
=
(
MU_ERR_BASE
+
17
)
MU_ERR_GETHOSTBYNAME
=
(
MU_ERR_BASE
+
18
)
MU_ERR_BAD_RESUMPTION
=
(
MU_ERR_BASE
+
19
)
MU_ERR_MAILER_BAD_FROM
=
(
MU_ERR_BASE
+
20
)
MU_ERR_MAILER_BAD_TO
=
(
MU_ERR_BASE
+
21
)
MU_ERR_MAILER_NO_RCPT_TO
=
(
MU_ERR_BASE
+
22
)
MU_ERR_MAILER_BAD_URL
=
(
MU_ERR_BASE
+
23
)
MU_ERR_SMTP_RCPT_FAILED
=
(
MU_ERR_BASE
+
24
)
MU_ERR_TCP_NO_HOST
=
(
MU_ERR_BASE
+
25
)
MU_ERR_TCP_NO_PORT
=
(
MU_ERR_BASE
+
26
)
MU_ERR_BAD_2047_INPUT
=
(
MU_ERR_BASE
+
27
)
MU_ERR_BAD_2047_ENCODING
=
(
MU_ERR_BASE
+
28
)
MU_ERR_NOUSERNAME
=
(
MU_ERR_BASE
+
29
)
MU_ERR_NOPASSWORD
=
(
MU_ERR_BASE
+
30
)
MU_ERR_UNSAFE_PERMS
=
(
MU_ERR_BASE
+
31
)
MU_ERR_BAD_AUTH_SCHEME
=
(
MU_ERR_BASE
+
32
)
MU_ERR_AUTH_FAILURE
=
(
MU_ERR_BASE
+
33
)
MU_ERR_PROCESS_NOEXEC
=
(
MU_ERR_BASE
+
34
)
MU_ERR_PROCESS_EXITED
=
(
MU_ERR_BASE
+
35
)
MU_ERR_PROCESS_SIGNALED
=
(
MU_ERR_BASE
+
36
)
MU_ERR_PROCESS_UNKNOWN_FAILURE
=
(
MU_ERR_BASE
+
37
)
MU_ERR_CONN_CLOSED
=
(
MU_ERR_BASE
+
38
)
MU_ERR_PARSE
=
(
MU_ERR_BASE
+
39
)
MU_ERR_NOENT
=
(
MU_ERR_BASE
+
40
)
MU_ERR_EXISTS
=
(
MU_ERR_BASE
+
41
)
MU_ERR_BUFSPACE
=
(
MU_ERR_BASE
+
42
)
MU_ERR_SQL
=
(
MU_ERR_BASE
+
43
)
MU_ERR_DB_ALREADY_CONNECTED
=
(
MU_ERR_BASE
+
44
)
MU_ERR_DB_NOT_CONNECTED
=
(
MU_ERR_BASE
+
45
)
MU_ERR_RESULT_NOT_RELEASED
=
(
MU_ERR_BASE
+
46
)
MU_ERR_NO_QUERY
=
(
MU_ERR_BASE
+
47
)
MU_ERR_BAD_COLUMN
=
(
MU_ERR_BASE
+
48
)
MU_ERR_NO_RESULT
=
(
MU_ERR_BASE
+
49
)
MU_ERR_NO_INTERFACE
=
(
MU_ERR_BASE
+
50
)
MU_ERR_BADOP
=
(
MU_ERR_BASE
+
51
)
MU_ERR_BAD_FILENAME
=
(
MU_ERR_BASE
+
52
)
MU_ERR_READ
=
(
MU_ERR_BASE
+
53
)
MU_ERR_MAILER_BAD_FROM
=
(
MU_ERR_BASE
+
19
)
MU_ERR_MAILER_BAD_TO
=
(
MU_ERR_BASE
+
20
)
MU_ERR_MAILER_NO_RCPT_TO
=
(
MU_ERR_BASE
+
21
)
MU_ERR_MAILER_BAD_URL
=
(
MU_ERR_BASE
+
22
)
MU_ERR_SMTP_RCPT_FAILED
=
(
MU_ERR_BASE
+
23
)
MU_ERR_TCP_NO_HOST
=
(
MU_ERR_BASE
+
24
)
MU_ERR_TCP_NO_PORT
=
(
MU_ERR_BASE
+
25
)
MU_ERR_BAD_2047_INPUT
=
(
MU_ERR_BASE
+
26
)
MU_ERR_BAD_2047_ENCODING
=
(
MU_ERR_BASE
+
27
)
MU_ERR_NOUSERNAME
=
(
MU_ERR_BASE
+
28
)
MU_ERR_NOPASSWORD
=
(
MU_ERR_BASE
+
29
)
MU_ERR_BADREPLY
=
(
MU_ERR_BASE
+
30
)
MU_ERR_SEQ
=
(
MU_ERR_BASE
+
31
)
MU_ERR_REPLY
=
(
MU_ERR_BASE
+
32
)
MU_ERR_BAD_AUTH_SCHEME
=
(
MU_ERR_BASE
+
33
)
MU_ERR_AUTH_FAILURE
=
(
MU_ERR_BASE
+
34
)
MU_ERR_PROCESS_NOEXEC
=
(
MU_ERR_BASE
+
35
)
MU_ERR_PROCESS_EXITED
=
(
MU_ERR_BASE
+
36
)
MU_ERR_PROCESS_SIGNALED
=
(
MU_ERR_BASE
+
37
)
MU_ERR_PROCESS_UNKNOWN_FAILURE
=
(
MU_ERR_BASE
+
38
)
MU_ERR_CONN_CLOSED
=
(
MU_ERR_BASE
+
39
)
MU_ERR_PARSE
=
(
MU_ERR_BASE
+
40
)
MU_ERR_NOENT
=
(
MU_ERR_BASE
+
41
)
MU_ERR_EXISTS
=
(
MU_ERR_BASE
+
42
)
MU_ERR_BUFSPACE
=
(
MU_ERR_BASE
+
43
)
MU_ERR_SQL
=
(
MU_ERR_BASE
+
44
)
MU_ERR_DB_ALREADY_CONNECTED
=
(
MU_ERR_BASE
+
45
)
MU_ERR_DB_NOT_CONNECTED
=
(
MU_ERR_BASE
+
46
)
MU_ERR_RESULT_NOT_RELEASED
=
(
MU_ERR_BASE
+
47
)
MU_ERR_NO_QUERY
=
(
MU_ERR_BASE
+
48
)
MU_ERR_BAD_COLUMN
=
(
MU_ERR_BASE
+
49
)
MU_ERR_NO_RESULT
=
(
MU_ERR_BASE
+
50
)
MU_ERR_NO_INTERFACE
=
(
MU_ERR_BASE
+
51
)
MU_ERR_BADOP
=
(
MU_ERR_BASE
+
52
)
MU_ERR_BAD_FILENAME
=
(
MU_ERR_BASE
+
53
)
MU_ERR_READ
=
(
MU_ERR_BASE
+
54
)
MU_ERR_NO_TRANSPORT
=
(
MU_ERR_BASE
+
55
)
MU_ERR_AUTH_NO_CRED
=
(
MU_ERR_BASE
+
56
)
MU_ERR_URL_MISS_PARTS
=
(
MU_ERR_BASE
+
57
)
MU_ERR_URL_EXTRA_PARTS
=
(
MU_ERR_BASE
+
58
)
MU_ERR_URL_INVALID_PARAMETER
=
(
MU_ERR_BASE
+
59
)
MU_ERR_INFO_UNAVAILABLE
=
(
MU_ERR_BASE
+
60
)
MU_ERR_NONAME
=
(
MU_ERR_BASE
+
61
)
MU_ERR_BADFLAGS
=
(
MU_ERR_BASE
+
62
)
MU_ERR_SOCKTYPE
=
(
MU_ERR_BASE
+
63
)
MU_ERR_FAMILY
=
(
MU_ERR_BASE
+
64
)
MU_ERR_SERVICE
=
(
MU_ERR_BASE
+
65
)
MU_ERR_PERM_OWNER_MISMATCH
=
(
MU_ERR_BASE
+
66
)
MU_ERR_PERM_GROUP_WRITABLE
=
(
MU_ERR_BASE
+
67
)
MU_ERR_PERM_WORLD_WRITABLE
=
(
MU_ERR_BASE
+
68
)
MU_ERR_PERM_GROUP_READABLE
=
(
MU_ERR_BASE
+
69
)
MU_ERR_PERM_WORLD_READABLE
=
(
MU_ERR_BASE
+
70
)
MU_ERR_PERM_LINKED_WRDIR
=
(
MU_ERR_BASE
+
71
)
MU_ERR_PERM_DIR_IWGRP
=
(
MU_ERR_BASE
+
72
)
MU_ERR_PERM_DIR_IWOTH
=
(
MU_ERR_BASE
+
73
)
MU_ERR_DISABLED
=
(
MU_ERR_BASE
+
74
)
MU_ERR_LAST
=
(
MU_ERR_BASE
+
75
)
...
...
python/mailutils/url.py
View file @
ebcdaaf
...
...
@@ -40,14 +40,6 @@ class Url:
def
__str__
(
self
):
return
url
.
to_string
(
self
.
url
)
def
parse
(
self
):
"""Parses the url, after calling this the get functions
can be called."""
if
self
.
__owner
:
status
=
url
.
parse
(
self
.
url
)
if
status
:
raise
UrlError
(
status
)
def
get_port
(
self
):
status
,
port
=
url
.
get_port
(
self
.
url
)
if
status
:
...
...
Please
register
or
sign in
to post a comment