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
c02f8c0e
...
c02f8c0e054fc601496690f4fef65a85abd83216
authored
2000-10-24 05:29:21 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Updatint some of the programs, mail/pop3d. The documentation
still have a lot to go.
1 parent
3211c993
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
86 additions
and
124 deletions
doc/mailbox.texi
doc/message.texi
from/from.c
mail/mail.c
mail/mail.h
mail/top.c
mailbox/auth.c
mailbox/mbx_pop.c
pop3d/list.c
pop3d/pop3d.c
pop3d/pop3d.h
doc/mailbox.texi
View file @
c02f8c0
...
...
@@ -30,13 +30,10 @@ The validation is base on the scheme of the url @var{name} or @var{id}.
The
return
value
is
@code
{
0
}
on
success
and
a
code
number
on
error
conditions
:
@table
@code
@item
MU_ERROR_INVALID_NAME
@item
EINVAL
The
url
@var
{
name
}
supply
is
invalid
or
not
supported
.
@item
MU_ERROR_INVALID_ID
The
@var
{
id
}
is
not
pointing
to
a
valid
reference
.
@item
MU_ERROR_INVALID_ARG
@var
{
pmbox
}
is
NULL
.
@item
MU_ERROR_OUT_OF_MEMORY
@item
ENOMEM
Not
enough
memory
to
allocate
resources
.
@end
table
@end
deftypefun
...
...
@@ -52,7 +49,7 @@ The mailbox stream is put in @var{pstream}.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is invalid or @var{pstream} is NULL.
@end table
@end deftypefun
...
...
@@ -62,7 +59,7 @@ Set the @var{stream} connection to use for the mailbox.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} or @var{stream} are NULL.
@end table
@end deftypefun
...
...
@@ -74,14 +71,14 @@ See @code{stream_create} for @var{flag} description.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_
EAGAIN
@itemx
MU_ERROR_
EINPROGRESS
@item EAGAIN
@itemx EINPROGRESS
Operation in progress.
@item
MU_ERROR_
BUSY
@item
E
BUSY
Resource busy.
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null or flag is invalid.
@item
MU_ERROR_OUT_OF_MEMORY
@item
ENOMEM
Not enough memory.
@end table
@end deftypefun
...
...
@@ -91,7 +88,7 @@ The stream attach to @var{mbox} is close.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -106,9 +103,9 @@ initialize.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null or @var{msgno} is invalid.
@item
MU_ERROR_OUT_OF_MEMORY
@item
ENOMEM
Not enough memory.
@end table
@end deftypefun
...
...
@@ -118,7 +115,7 @@ The @var{message} is append to the mailbox @var{mbox}.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null or @var{message} is invalid.
@end table
@end deftypefun
...
...
@@ -128,7 +125,7 @@ Give the number of message is @var{mbox}.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -138,7 +135,7 @@ All the messages set deleted are removed.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -148,7 +145,7 @@ Return the @var{locker} object.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -158,7 +155,7 @@ Set the type of locking done by the @var{mbox}.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -168,7 +165,7 @@ Retriever the @var{*pauth} of the @var{mbox}.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -178,7 +175,7 @@ Set the type of authaurity for the mailbox.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -188,7 +185,7 @@ Check if the mailbox is uptodate.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -198,9 +195,9 @@ Scan the mailbox for new messages starting at message @var{msgno}.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@item
MU_ERROR_OUT_OF_MEMORY
@item
ENOMEM
Not enough memory.
@end table
@end deftypefun
...
...
@@ -210,7 +207,7 @@ Gives the @var{mbox} size.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
...
...
@@ -220,79 +217,31 @@ Gives the constructed @var{url}.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@end table
@end deftypefun
@deftypefun int mailbox_
register (mailbox_t mbox @var{mbox}, size_t @var{type}, int (*@var{action}) (size_t @var{type}, void *@var{arg}), void *@var{arg
})
@deftypefun int mailbox_
get_observable (mailbox_t mbox @var{mbox}, observable_t*@var{observable
})
Register a notification for a event @var{type}:
@table @code
@item MU_EVT_MBX_DESTROY
Mailbox destruction.
@item MU_EVT_MBX_CORRUPTED
When doing expunge an error condition occured.
@item MU_EVT_MBX_MSG_ADD
On every new message when scanning.
@item MU_EVT_MBX_PROGRESS
When scanning notification is send.
@end table
@var{action} will be call when the event occured.
Get the observable object.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@item
MU_ERROR_OUT_OF_MEMORY
@item
ENOMEM
Not enough memory.
@end table
@end deftypefun
@deftypefun int mailbox_deregister (mailbox_t @var{mbox}, void *@var{action})
Delete a register @var{action} for an event.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item MU_ERROR_INVALID_ARG
@var{mbox} is null.
@end table
@end deftypefun
@deftypefun int mailbox_set_debug_level (mailbox_t @var{mbox}, size_t @var{level})
Set a trace @var{level}:
@table @code
@item MU_MAILBOX_DEBUG_TRACE
Trace the functions.
@item MU_MAILBOX_DEBUG_PROT
Trace the protocol.
@end table
The return value is @code{0} on success and a code number on error conditions:
@table @code
@table @code
@item MU_ERROR_INVALID_ARG
@var{mbox} is null.
@end table
@end table
@end deftypefun
@deftypefun int mailbox_get_debug_level (mailbox_t @var{mbox}, size_t *@var{plevel})
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item MU_ERROR_INVALID_ARG
@var{mbox} is null.
@end table
@end deftypefun
@deftypefun int mailbox_set_debug_print (mailbox_t @var{mbox}, int (*@var{debug_print}) (void *@var{arg}, const char *@var{buffer}, size_t @var{buffler_length}), void *@var{arg})
Set the function @var{debug_print} being call for the trace.
@deftypefun int mailbox_get_debug (mailbox_t @var{mbox}, debug_t *@var{debug})
Get a debug object.
The return value is @code{0} on success and a code number on error conditions:
@table @code
@item
MU_ERROR_INVALID_ARG
@item
EINVAL
@var{mbox} is null.
@item ENOMEM
@end table
@end deftypefun
...
...
doc/message.texi
View file @
c02f8c0
...
...
@@ -90,14 +90,7 @@ Return non-zero value if message is multi-part.
@deftypefun
int
message_set_uidl
(
message_t
@var
{
msg
},
int
(
*
@var
{
_get_uidl
})(
message_t
,
char
*
,
size_t
,
size_t
*
),
void
*
@var
{
owner
})
@end
deftypefun
@deftypefun
int
message_register
(
message_t
@var
{
msg
},
size_t
@var
{
type
},
int
(
*
@var
{
action
})
(
size_t
,
void
*
),
void
*
@var
{
arg
})
@table
@code
@item
MU_EVT_MSG_DESTROY
Message
destruction
.
@end
table
@end
deftypefun
@deftypefun
int
message_deregister
(
message_t
@var
{
msg
},
void
*
@var
{
action
})
@deftypefun
int
message_get_observable
(
message_t
@var
{
msg
},
observable_t
*
@var
{
observable
})
@end
deftypefun
@deftypefun
int
message_create_attachment
(
const
char
*
@var
{
content_type
},
const
char
*
@var
{
encoding
},
const
char
*
@var
{
filename
},
message_t
*
@var
{
newmsg
})
...
...
from/from.c
View file @
c02f8c0
...
...
@@ -33,19 +33,8 @@
#include <string.h>
#include <unistd.h>
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
#include <mailutils/mailbox.h>
#ifndef _PATH_MAILDIR
# define _PATH_MAILDIR "/var/spool/mail"
#endif
#ifndef VERSION
# define VERSION "unknow"
#endif
#include <mailutils/registrar.h>
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -62,15 +51,31 @@ main(int argc, char **argv)
if
(
argc
>
1
)
mailbox_name
=
argv
[
1
];
/* Register the desire formats. */
{
list_t
bookie
;
registrar_get_list
(
&
bookie
);
list_append
(
bookie
,
mbox_record
);
list_append
(
bookie
,
path_record
);
list_append
(
bookie
,
pop_record
);
}
if
((
status
=
mailbox_create_default
(
&
mbox
,
mailbox_name
))
!=
0
||
(
status
=
mailbox_open
(
mbox
,
MU_
MAILBOX_RDONLY
))
!=
0
)
||
(
status
=
mailbox_open
(
mbox
,
MU_
STREAM_READ
))
!=
0
)
{
fprintf
(
stderr
,
"could not create/open: %s
\n
"
,
strerror
(
status
));
exit
(
1
);
}
/* Debuging Trace. */
{
//debug_t debug;
//mailbox_get_debug (mbox, &debug);
//debug_set_level (debug, MU_DEBUG_TRACE|MU_DEBUG_PROT);
}
mailbox_messages_count
(
mbox
,
&
count
);
for
(
i
=
1
;
i
<=
count
;
++
i
)
for
(
i
=
1
;
i
<=
count
;
++
i
)
{
message_t
msg
;
header_t
hdr
;
...
...
@@ -83,9 +88,8 @@ main(int argc, char **argv)
header_get_value
(
hdr
,
MU_HEADER_FROM
,
from
,
30
,
NULL
);
header_get_value
(
hdr
,
MU_HEADER_SUBJECT
,
subject
,
40
,
NULL
);
fprintf
(
stdout
,
"%s
\t
%s
\n
"
,
from
,
subject
);
fprintf
(
stdout
,
"%s
\t
%s
\n
"
,
from
,
subject
);
}
mailbox_close
(
mbox
);
mailbox_close
(
mbox
);
return
0
;
}
...
...
mail/mail.c
View file @
c02f8c0
...
...
@@ -122,6 +122,15 @@ main (int argc, char **argv)
cursor
=
1
;
realcursor
=
cursor
;
/* Register the desire formats. */
{
list_t
bookie
;
registrar_get_list
(
&
bookie
);
list_append
(
bookie
,
mbox_record
);
list_append
(
bookie
,
path_record
);
list_append
(
bookie
,
pop_record
);
}
signal
(
SIGPIPE
,
SIG_IGN
);
/* set up the default environment */
...
...
mail/mail.h
View file @
c02f8c0
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999
, 2000
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -41,6 +41,7 @@
#include <mailutils/message.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/registrar.h>
#include <argcv.h>
#include <getline.h>
...
...
mail/top.c
View file @
c02f8c0
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999
, 2000
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -56,5 +56,3 @@ mail_top (int argc, char **argv)
}
return
1
;
}
...
...
mailbox/auth.c
View file @
c02f8c0
...
...
@@ -104,7 +104,11 @@ ticket_pop (ticket_t ticket, const char *challenge, char **parg)
echo_off
(
&
stored_settings
);
fgets
(
arg
,
sizeof
(
arg
),
stdin
);
if
(
!
echo
)
{
echo_on
(
&
stored_settings
);
putchar
(
'\n'
);
fflush
(
stdout
);
}
arg
[
strlen
(
arg
)
-
1
]
=
'\0'
;
/* nuke the trailing line. */
*
parg
=
strdup
(
arg
);
}
...
...
mailbox/mbx_pop.c
View file @
c02f8c0
...
...
@@ -1177,10 +1177,6 @@ pop_top (stream_t is, char *buffer, size_t buflen,
mpd
=
mpm
->
mpd
;
/* We do not carry the offset backward(for pop), should be doc somewhere. */
if
((
size_t
)
offset
<
mpm
->
header_size
)
return
ESPIPE
;
/* Busy ? */
CHECK_BUSY
(
mpd
->
mbox
,
mpd
,
func
,
msg
);
...
...
@@ -1380,11 +1376,6 @@ pop_retr (pop_message_t mpm, char *buffer, size_t buflen, off_t offset,
return
0
;
}
/* We do not carry the offset backward(for pop), should be doc somewhere. */
/*if (offset < mpm->header_size)
return ESPIPE;
*/
/* pop_retr() is not call directly so we assume that the locks were set. */
switch
(
mpd
->
state
)
...
...
@@ -1453,7 +1444,7 @@ pop_retr (pop_message_t mpm, char *buffer, size_t buflen, off_t offset,
if
(
!
mpm
->
skip_header
)
{
ssize_t
pos
=
offset
-
mpm
->
header_size
;
if
(
pos
)
if
(
pos
>
0
)
{
nread
=
fill_buffer
(
mpd
,
NULL
,
pos
);
mpm
->
header_size
+=
nread
;
...
...
pop3d/list.c
View file @
c02f8c0
...
...
@@ -24,6 +24,7 @@ pop3_list (const char *arg)
{
size_t
mesgno
;
size_t
size
=
0
;
size_t
lines
=
0
;
message_t
msg
;
attribute_t
attr
;
...
...
@@ -47,7 +48,8 @@ pop3_list (const char *arg)
if
(
!
attribute_is_deleted
(
attr
))
{
message_size
(
msg
,
&
size
);
fprintf
(
ofile
,
"%d %d
\r\n
"
,
mesgno
,
size
);
message_lines
(
msg
,
&
lines
);
fprintf
(
ofile
,
"%d %d
\r\n
"
,
mesgno
,
size
+
lines
);
}
}
fprintf
(
ofile
,
".
\r\n
"
);
...
...
@@ -61,7 +63,8 @@ pop3_list (const char *arg)
if
(
attribute_is_deleted
(
attr
))
return
ERR_MESG_DELE
;
message_size
(
msg
,
&
size
);
fprintf
(
ofile
,
"+OK %d %d
\r\n
"
,
mesgno
,
size
);
message_lines
(
msg
,
&
lines
);
fprintf
(
ofile
,
"+OK %d %d
\r\n
"
,
mesgno
,
size
+
lines
);
}
return
OK
;
...
...
pop3d/pop3d.c
View file @
c02f8c0
...
...
@@ -92,6 +92,15 @@ main (int argc, char **argv)
exit
(
1
);
}
/* Register the desire formats. */
{
list_t
bookie
;
registrar_get_list
(
&
bookie
);
list_append
(
bookie
,
mbox_record
);
list_append
(
bookie
,
path_record
);
list_append
(
bookie
,
pop_record
);
}
/* Set the signal handlers */
signal
(
SIGINT
,
pop3_signal
);
signal
(
SIGQUIT
,
pop3_signal
);
...
...
pop3d/pop3d.h
View file @
c02f8c0
...
...
@@ -99,6 +99,7 @@
#include <mailutils/message.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/registrar.h>
/* For Berkley DB2 APOP password file */
#ifdef BDB2
...
...
Please
register
or
sign in
to post a comment