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
dbfad7e1
...
dbfad7e18ddeadced961dcd12137ad2b12d4c42e
authored
2001-05-11 05:34:10 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
More cleanup in the fetch imap code.
1 parent
bc49501d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
11 deletions
ChangeLog
imap4d/fetch.c
imap4d/imap4d.h
imap4d/util.c
ChangeLog
View file @
dbfad7e
2001-05-11 Alain Magloire
* imap4d/fetch.c: More cleanup in the bodystructure code,
arrange response indentation etc ...
* impa4d/utils.c (util_send_string): New helper function.
2001-05-10 Alain Magloire
* imap4d/fetch.c: Implemented INTERNALDATE.
...
...
imap4d/fetch.c
View file @
dbfad7e
This diff is collapsed.
Click to expand it.
imap4d/imap4d.h
View file @
dbfad7e
...
...
@@ -175,6 +175,7 @@ extern int imap4d_bye __P ((int));
/* Helper functions. */
extern
int
util_out
__P
((
int
,
const
char
*
,
...));
extern
int
util_send
__P
((
const
char
*
,
...));
extern
int
util_send_string
__P
((
const
char
*
));
extern
int
util_start
__P
((
char
*
));
extern
int
util_finish
__P
((
struct
imap4d_command
*
,
int
,
const
char
*
,
...));
extern
int
util_getstate
__P
((
void
));
...
...
imap4d/util.c
View file @
dbfad7e
...
...
@@ -18,7 +18,7 @@
#include "imap4d.h"
#include <ctype.h>
static
int
add2set
__P
((
size_t
**
,
int
*
,
unsigned
long
,
size_t
));
static
int
add2set
__P
((
size_t
**
,
int
*
,
unsigned
long
));
static
const
char
*
sc2string
__P
((
int
));
/* Get the next space/CR/NL separated word, some words are between double
...
...
@@ -184,9 +184,6 @@ util_msgset (char *s, size_t **set, int *n, int isuid)
status
=
mailbox_messages_count
(
mbox
,
&
max
);
if
(
status
!=
0
)
return
status
;
/* The number after the "*" in an untagged FETCH response is always a
message sequence number, not a unique identifier, even for a UID
command response. But do what they meant not what they say. */
/* If it is a uid sequence, override max with the UID. */
if
(
isuid
)
{
...
...
@@ -216,9 +213,23 @@ util_msgset (char *s, size_t **set, int *n, int isuid)
}
if
(
low
)
{
/* Reverse it. */
if
(
low
>
val
)
{
long
tmp
=
low
;
tmp
-=
2
;
if
(
tmp
<=
0
||
val
==
0
)
{
free
(
*
set
);
*
n
=
0
;
return
EINVAL
;
}
low
=
val
;
val
=
tmp
;
}
for
(;
low
&&
low
<=
val
;
low
++
)
{
status
=
add2set
(
set
,
n
,
low
,
max
);
status
=
add2set
(
set
,
n
,
low
);
if
(
status
!=
0
)
return
status
;
}
...
...
@@ -226,7 +237,7 @@ util_msgset (char *s, size_t **set, int *n, int isuid)
}
else
{
status
=
add2set
(
set
,
n
,
val
,
max
);
status
=
add2set
(
set
,
n
,
val
);
if
(
status
!=
0
)
return
status
;
}
...
...
@@ -284,9 +295,23 @@ util_msgset (char *s, size_t **set, int *n, int isuid)
if
(
low
)
{
/* Reverse it. */
if
(
low
>
val
)
{
long
tmp
=
low
;
tmp
-=
2
;
if
(
tmp
<=
0
||
val
==
0
)
{
free
(
set
);
*
n
=
0
;
return
EINVAL
;
}
low
=
val
;
val
=
tmp
;
}
for
(;
low
&&
low
<=
val
;
low
++
)
{
status
=
add2set
(
set
,
n
,
low
,
max
);
status
=
add2set
(
set
,
n
,
low
);
if
(
status
!=
0
)
return
status
;
}
...
...
@@ -306,6 +331,18 @@ util_send (const char *format, ...)
return
status
;
}
/* Send NIL if empty string, a literal if the string contains double quotes
or the string surrounded by double quotes. */
int
util_send_string
(
const
char
*
buffer
)
{
if
(
*
buffer
==
'\0'
)
return
util_send
(
"NIL"
);
if
(
strchr
(
buffer
,
'"'
))
return
util_send
(
"{%u}
\r\n
%s"
,
strlen
(
buffer
),
buffer
);
return
util_send
(
"
\"
%s
\"
"
,
buffer
);
}
/* Send an unsolicited response. */
int
util_out
(
int
rc
,
const
char
*
format
,
...)
...
...
@@ -417,7 +454,7 @@ imap4d_readline (FILE *fp)
}
}
while
(
number
>
0
);
/* syslog (LOG_INFO, "readline: %s", line); */
syslog
(
LOG_INFO
,
"readline: %s"
,
line
);
return
line
;
}
...
...
@@ -522,11 +559,11 @@ sc2string (int rc)
}
static
int
add2set
(
size_t
**
set
,
int
*
n
,
unsigned
long
val
,
size_t
max
)
add2set
(
size_t
**
set
,
int
*
n
,
unsigned
long
val
)
{
int
*
tmp
;
if
(
val
==
0
||
val
>
max
||
(
tmp
=
realloc
(
*
set
,
(
*
n
+
1
)
*
sizeof
(
**
set
)))
==
NULL
)
tmp
=
realloc
(
*
set
,
(
*
n
+
1
)
*
sizeof
(
**
set
));
if
(
tmp
==
NULL
)
{
if
(
*
set
)
free
(
*
set
);
...
...
Please
register
or
sign in
to post a comment