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
631effe4
...
631effe4bb766bb5174fb5bf5f64208f06ea88ec
authored
2004-06-21 03:22:17 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
new Macros and declarations.
1 parent
8bc0b928
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
12 deletions
include/mailutils/nntp.h
include/mailutils/sys/nntp.h
include/mailutils/nntp.h
View file @
631effe
...
...
@@ -45,19 +45,34 @@ extern int mu_nntp_set_debug (mu_nntp_t nntp, mu_debug_t debug);
extern
int
mu_nntp_stls
(
mu_nntp_t
nntp
);
extern
int
mu_nntp_article
(
mu_nntp_t
nntp
,
unsigned
long
num
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_mode_reader
(
mu_nntp_t
nntp
);
/* A list is return with the multi-line answer. It is the responsability of
the caller to call list_destroy() to dipose of the list. */
extern
int
mu_nntp_list_extensions
(
mu_nntp_t
nntp
,
list_t
*
plist
);
extern
int
mu_nntp_quit
(
mu_nntp_t
nntp
);
extern
int
mu_nntp_group
(
mu_nntp_t
nntp
,
const
char
*
group
,
unsigned
long
*
total
,
unsigned
long
*
first
,
unsigned
long
*
last
,
char
**
name
);
extern
int
mu_nntp_last
(
mu_nntp_t
nntp
,
unsigned
long
*
number
,
char
**
mid
);
extern
int
mu_nntp_next
(
mu_nntp_t
nntp
,
unsigned
long
*
number
,
char
**
mid
);
extern
int
mu_nntp_article
(
mu_nntp_t
nntp
,
unsigned
long
number
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_article_id
(
mu_nntp_t
nntp
,
const
char
*
id
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_head
(
mu_nntp_t
nntp
,
unsigned
long
num
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_head
(
mu_nntp_t
nntp
,
unsigned
long
number
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_head_id
(
mu_nntp_t
nntp
,
const
char
*
name
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_body
(
mu_nntp_t
nntp
,
unsigned
long
num
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_body_id
(
mu_nntp_t
nntp
,
const
char
*
name
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_body
(
mu_nntp_t
nntp
,
unsigned
long
number
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_body_id
(
mu_nntp_t
nntp
,
const
char
*
id
,
unsigned
long
*
pnum
,
char
**
mid
,
stream_t
*
stream
);
extern
int
mu_nntp_stat
(
mu_nntp_t
nntp
,
unsigned
long
num
,
char
**
id
);
extern
int
mu_nntp_stat_id
(
mu_nntp_t
nntp
,
const
char
*
name
,
char
**
id
);
extern
int
mu_nntp_stat
(
mu_nntp_t
nntp
,
unsigned
long
number
,
unsigned
long
*
pnum
,
char
**
m
id
);
extern
int
mu_nntp_stat_id
(
mu_nntp_t
nntp
,
const
char
*
id
,
unsigned
long
*
pnum
,
char
**
m
id
);
extern
int
mu_nntp_group
(
mu_nntp_t
nntp
,
const
char
*
group
,
long
*
total
,
long
*
first
,
long
*
last
,
char
**
name
);
extern
int
mu_nntp_date
(
mu_nntp_t
nntp
,
unsigned
int
*
year
,
unsigned
int
*
month
,
unsigned
int
*
day
,
unsigned
int
*
hour
,
unsigned
int
*
minute
,
unsigned
int
*
second
);
/* Reads the multi-line response of the server, nread will be 0 when the termination octets
...
...
include/mailutils/sys/nntp.h
View file @
631effe
...
...
@@ -30,15 +30,46 @@
extern
"C"
{
#endif
/* Response codes. */
#define MU_NNTP_RESP_CODE_SERVER_DATE 111
#define MU_NNTP_RESP_CODE_POSTING_ALLOWED 200
#define MU_NNTP_RESP_CODE_POSTING_PROHIBITED 201
#define MU_NNTP_RESP_CODE_LIST_FOLLOW 202
#define MU_NNTP_RESP_CODE_CLOSING 205
#define MU_NNTP_RESP_CODE_GROUP_SELECTED 211
#define MU_NNTP_RESP_CODE_ARTICLE_FOLLOW 220
#define MU_NNTP_RESP_CODE_HEAD_FOLLOW 221
#define MU_NNTP_RESP_CODE_BODY_FOLLOW 222
#define MU_NNTP_RESP_CODE_ARTICLE_FOUND 223
#define MU_NNTP_RESP_CODE_TEMP_UNAVAILABLE 400
#define MU_NNTP_RESP_CODE_NO_EXTENSION 402
#define MU_NNTP_RESP_CODE_NO_ARTICLE_WITH_MID 430
#define MU_NNTP_RESP_CODE_NO_GROUP_SELECTED 412
#define MU_NNTP_RESP_CODE_NUMBER_INVALID 420
#define MU_NNTP_RESP_CODE_NO_ARTICLE 422
#define MU_NNTP_RESP_CODE_NO_ARTICLE_IN_RANGE 423
#define MU_NNTP_RESP_CODE_PERM_UNAVAILABLE 502
enum
mu_nntp_state
{
MU_NNTP_NO_STATE
,
MU_NNTP_CONNECT
,
MU_NNTP_GREETINGS
,
MU_NNTP_MODE_READER
,
MU_NNTP_MODE_READER_ACK
,
MU_NNTP_LIST_EXTENSIONS
,
MU_NNTP_LIST_EXTENSIONS_ACK
,
MU_NNTP_LIST_EXTENSIONS_RX
,
MU_NNTP_QUIT
,
MU_NNTP_QUIT_ACK
,
MU_NNTP_GROUP
,
MU_NNTP_GROUP_ACK
,
MU_NNTP_LAST
,
MU_NNTP_LAST_ACK
,
MU_NNTP_NEXT
,
MU_NNTP_NEXT_ACK
,
MU_NNTP_ARTICLE
,
MU_NNTP_ARTICLE_ACK
,
MU_NNTP_ARTICLE_RX
,
MU_NNTP_HEAD
,
MU_NNTP_HEAD_ACK
,
MU_NNTP_HEAD_RX
,
MU_NNTP_BODY
,
MU_NNTP_BODY_ACK
,
MU_NNTP_BODY_RX
,
MU_NNTP_STAT
,
MU_NNTP_STAT_ACK
,
MU_NNTP_
STLS
,
MU_NNTP_STLS_ACK
,
MU_NNTP_STLS_CONNECT
,
MU_NNTP_
DATE
,
MU_NNTP_DATE_ACK
,
MU_NNTP_DONE
,
MU_NNTP_UNKNOWN
,
MU_NNTP_ERROR
};
...
...
@@ -79,8 +110,9 @@ struct _mu_nntp
extern
int
mu_nntp_debug_cmd
(
mu_nntp_t
);
extern
int
mu_nntp_debug_ack
(
mu_nntp_t
);
extern
int
mu_nntp_stream_create
(
mu_nntp_t
pop3
,
stream_t
*
pstream
);
extern
int
mu_nntp_stream_create
(
mu_nntp_t
nntp
,
stream_t
*
pstream
);
extern
int
mu_nntp_carrier_is_ready
(
stream_t
carrier
,
int
flag
,
int
timeout
);
extern
int
mu_nntp_parse_article
(
mu_nntp_t
nntp
,
int
code
,
unsigned
long
*
pnum
,
char
**
mid
);
/* Check for non recoverable error.
The error is consider not recoverable if not part of the signal set:
...
...
@@ -118,12 +150,23 @@ do \
} \
while (0)
/* Check if we got
"2xx". In NNTP protocol and ack of "2xx" means the command was successfull
.
/* Check if we got
the rigth. In NNTP protocol and ack of "2xx" means the command was completed
.
*/
#define MU_NNTP_CHECK_OK(nntp) \
#define MU_NNTP_CHECK_CODE(nntp, code) \
do \
{ \
if (mu_nntp_response_code (nntp) == code) \
{ \
nntp->state = MU_NNTP_NO_STATE; \
return EACCES; \
} \
} \
while (0)
#define MU_NNTP_CHECK_CODE2(nntp, code1, code2) \
do \
{ \
if (
nntp->ack.buf[0] != '2'
) \
if (
mu_nntp_response_code (nntp) == code1 || mu_nntp_response_code (nntp) == code2
) \
{ \
nntp->state = MU_NNTP_NO_STATE; \
return EACCES; \
...
...
Please
register
or
sign in
to post a comment