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
a8e98469
...
a8e98469ab9c18ccd81b503611610f78f8eb4368
authored
2002-11-20 12:26:21 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixed indentation.
1 parent
de692ff6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
29 deletions
mailbox/mailer.c
mailbox/mailer.c
View file @
a8e9846
...
...
@@ -37,25 +37,23 @@
#include <mailer0.h>
static
char
*
mailer_url_default
;
static
char
*
mailer_url_default
;
/* FIXME: I'd like to check that the URL is valid, but that requires that the
mailers already be registered! */
int
mailer_set_url_default
(
const
char
*
url
)
mailer_set_url_default
(
const
char
*
url
)
{
char
*
n
=
NULL
;
char
*
n
=
NULL
;
if
(
!
url
)
if
(
!
url
)
return
EINVAL
;
if
((
n
=
strdup
(
url
))
==
NULL
)
if
((
n
=
strdup
(
url
))
==
NULL
)
return
ENOMEM
;
if
(
mailer_url_default
)
free
(
mailer_url_default
);
if
(
mailer_url_default
)
free
(
mailer_url_default
);
mailer_url_default
=
n
;
...
...
@@ -63,12 +61,12 @@ mailer_set_url_default(const char* url)
}
int
mailer_get_url_default
(
const
char
**
url
)
mailer_get_url_default
(
const
char
**
url
)
{
if
(
!
url
)
if
(
!
url
)
return
EINVAL
;
if
(
mailer_url_default
)
if
(
mailer_url_default
)
*
url
=
mailer_url_default
;
else
*
url
=
MAILER_URL_DEFAULT
;
...
...
@@ -153,7 +151,7 @@ mailer_create (mailer_t * pmailer, const char *name)
}
void
mailer_destroy
(
mailer_t
*
pmailer
)
mailer_destroy
(
mailer_t
*
pmailer
)
{
if
(
pmailer
&&
*
pmailer
)
{
...
...
@@ -216,45 +214,45 @@ mailer_close (mailer_t mailer)
int
mailer_check_from
(
address_t
from
)
mailer_check_from
(
address_t
from
)
{
size_t
n
=
0
;
if
(
!
from
)
if
(
!
from
)
return
EINVAL
;
if
(
address_get_count
(
from
,
&
n
)
||
n
!=
1
)
if
(
address_get_count
(
from
,
&
n
)
||
n
!=
1
)
return
MU_ERR_MAILER_BAD_FROM
;
if
(
address_get_email_count
(
from
,
&
n
)
||
n
==
0
)
if
(
address_get_email_count
(
from
,
&
n
)
||
n
==
0
)
return
MU_ERR_MAILER_BAD_FROM
;
return
0
;
}
int
mailer_check_to
(
address_t
to
)
mailer_check_to
(
address_t
to
)
{
size_t
count
=
0
;
size_t
emails
=
0
;
size_t
groups
=
0
;
if
(
!
to
)
if
(
!
to
)
return
EINVAL
;
if
(
address_get_count
(
to
,
&
count
))
if
(
address_get_count
(
to
,
&
count
))
return
MU_ERR_MAILER_BAD_TO
;
if
(
address_get_email_count
(
to
,
&
emails
))
if
(
address_get_email_count
(
to
,
&
emails
))
return
MU_ERR_MAILER_BAD_TO
;
if
(
emails
==
0
)
if
(
emails
==
0
)
return
MU_ERR_MAILER_NO_RCPT_TO
;
if
(
address_get_group_count
(
to
,
&
groups
))
if
(
address_get_group_count
(
to
,
&
groups
))
return
MU_ERR_MAILER_BAD_TO
;
if
(
count
-
emails
-
groups
!=
0
)
if
(
count
-
emails
-
groups
!=
0
)
/* then not everything is a group or an email address */
return
MU_ERR_MAILER_BAD_TO
;
...
...
@@ -298,7 +296,7 @@ mailer_set_stream (mailer_t mailer, stream_t stream)
}
int
mailer_get_stream
(
mailer_t
mailer
,
stream_t
*
pstream
)
mailer_get_stream
(
mailer_t
mailer
,
stream_t
*
pstream
)
{
if
(
mailer
==
NULL
||
pstream
==
NULL
)
return
EINVAL
;
...
...
@@ -308,7 +306,7 @@ mailer_get_stream (mailer_t mailer, stream_t *pstream)
}
int
mailer_get_observable
(
mailer_t
mailer
,
observable_t
*
pobservable
)
mailer_get_observable
(
mailer_t
mailer
,
observable_t
*
pobservable
)
{
/* FIXME: I should check for invalid types */
if
(
mailer
==
NULL
||
pobservable
==
NULL
)
...
...
@@ -325,7 +323,7 @@ mailer_get_observable (mailer_t mailer, observable_t *pobservable)
}
int
mailer_get_property
(
mailer_t
mailer
,
property_t
*
pproperty
)
mailer_get_property
(
mailer_t
mailer
,
property_t
*
pproperty
)
{
if
(
mailer
==
NULL
||
pproperty
==
NULL
)
return
EINVAL
;
...
...
@@ -350,7 +348,7 @@ mailer_set_debug (mailer_t mailer, mu_debug_t debug)
}
int
mailer_get_debug
(
mailer_t
mailer
,
mu_debug_t
*
pdebug
)
mailer_get_debug
(
mailer_t
mailer
,
mu_debug_t
*
pdebug
)
{
if
(
mailer
==
NULL
||
pdebug
==
NULL
)
return
EINVAL
;
...
...
@@ -365,7 +363,7 @@ mailer_get_debug (mailer_t mailer, mu_debug_t *pdebug)
}
int
mailer_get_url
(
mailer_t
mailer
,
url_t
*
purl
)
mailer_get_url
(
mailer_t
mailer
,
url_t
*
purl
)
{
if
(
!
mailer
||
!
purl
)
return
EINVAL
;
...
...
Please
register
or
sign in
to post a comment