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
089533ba
...
089533babd10164d66c5b225ace23f4a04b22515
authored
2004-01-12 12:26:47 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Auto-detection of maildir format.
1 parent
000ea85a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
9 deletions
mailbox/maildir/folder.c
mailbox/maildir/folder.c
View file @
089533b
...
...
@@ -21,20 +21,83 @@
#ifdef ENABLE_MAILDIR
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <folder0.h>
#include <registrar0.h>
#include <maildir.h>
static
int
_maildir_folder_init
(
folder_t
folder
ARG_UNUSED
)
{
return
0
;
}
static
int
dir_exists
(
const
char
*
name
,
const
char
*
suf
)
{
struct
stat
st
;
char
*
s
=
maildir_mkfilename
(
name
,
suf
,
NULL
);
if
(
stat
(
s
,
&
st
)
<
0
)
return
0
;
free
(
s
);
return
S_ISDIR
(
st
.
st_mode
);
}
static
int
_maildir_is_scheme
(
record_t
record
,
const
char
*
url
)
{
if
(
!
url
||
!
record
->
scheme
)
return
0
;
if
(
strncmp
(
record
->
scheme
,
url
,
strlen
(
record
->
scheme
))
==
0
)
return
1
;
if
(
strncmp
(
MU_PATH_SCHEME
,
url
,
MU_PATH_SCHEME_LEN
)
==
0
)
{
/* Attemp auto-detection */
struct
stat
st
;
if
(
stat
(
url
,
&
st
)
<
0
)
return
1
;
/* mailbox_open will complain */
if
(
!
S_ISDIR
(
st
.
st_mode
))
return
0
;
return
dir_exists
(
url
,
TMPSUF
)
&&
dir_exists
(
url
,
CURSUF
)
&&
dir_exists
(
url
,
NEWSUF
);
}
return
0
;
}
/*
MAILDIR url
maildir:path
*/
int
_maildir_url_init
(
url_t
url
)
{
return
amd_url_init
(
url
,
MU_MAILDIR_SCHEME
);
}
static
struct
_record
_maildir_record
=
{
MU_MAILDIR_SCHEME
,
_
url_maildir
_init
,
/* Url init. */
_
maildir_url
_init
,
/* Url init. */
_mailbox_maildir_init
,
/* Mailbox init. */
NULL
,
/* Mailer init. */
_
folder_maildi
r_init
,
/* Folder init. */
_
maildir_folde
r_init
,
/* Folder init. */
NULL
,
/* back pointer. */
NULL
,
/* _is_scheme method. */
_maildir_is_scheme
,
/* _is_scheme method. */
NULL
,
/* _get_url method. */
NULL
,
/* _get_mailbox method. */
NULL
,
/* _get_mailer method. */
...
...
@@ -42,12 +105,6 @@ static struct _record _maildir_record =
};
record_t
maildir_record
=
&
_maildir_record
;
int
_folder_maildir_init
(
folder_t
folder
ARG_UNUSED
)
{
return
0
;
}
#else
#include <stdio.h>
#include <registrar0.h>
...
...
Please
register
or
sign in
to post a comment