summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bootstrap.conf1
-rw-r--r--configure.ac1
-rw-r--r--doc/texinfo/nntp.texi100
-rw-r--r--doc/texinfo/programs/mailutils.texi2
-rw-r--r--examples/.gitignore1
-rw-r--r--examples/Makefile.am15
-rw-r--r--examples/nntpclient.c1078
-rw-r--r--include/mailutils/Makefile.am1
-rw-r--r--include/mailutils/nntp.h247
-rw-r--r--include/mailutils/registrar.h8
-rw-r--r--include/mailutils/sys/Makefile.am1
-rw-r--r--include/mailutils/sys/nntp.h221
-rw-r--r--libmailutils/base/nullrec.c4
-rw-r--r--libmailutils/base/version.c3
-rw-r--r--libmu_scm/mailutils/Makefile.am4
-rw-r--r--libproto/Makefile.am4
-rw-r--r--libproto/nntp/.gitignore9
-rw-r--r--libproto/nntp/Makefile.am59
-rw-r--r--libproto/nntp/folder.c201
-rw-r--r--libproto/nntp/mbox.c686
-rw-r--r--libproto/nntp/nntp0.h92
-rw-r--r--libproto/nntp/nntp_article.c141
-rw-r--r--libproto/nntp/nntp_body.c108
-rw-r--r--libproto/nntp/nntp_carrier.c55
-rw-r--r--libproto/nntp/nntp_connect.c87
-rw-r--r--libproto/nntp/nntp_create.c72
-rw-r--r--libproto/nntp/nntp_date.c100
-rw-r--r--libproto/nntp/nntp_debug.c38
-rw-r--r--libproto/nntp/nntp_destroy.c52
-rw-r--r--libproto/nntp/nntp_disconnect.c47
-rw-r--r--libproto/nntp/nntp_group.c109
-rw-r--r--libproto/nntp/nntp_head.c106
-rw-r--r--libproto/nntp/nntp_help.c74
-rw-r--r--libproto/nntp/nntp_ihave.c151
-rw-r--r--libproto/nntp/nntp_iterator.c185
-rw-r--r--libproto/nntp/nntp_last.c72
-rw-r--r--libproto/nntp/nntp_list_active.c113
-rw-r--r--libproto/nntp/nntp_list_distribpats.c118
-rw-r--r--libproto/nntp/nntp_list_distributions.c117
-rw-r--r--libproto/nntp/nntp_list_extensions.c80
-rw-r--r--libproto/nntp/nntp_list_newsgroups.c117
-rw-r--r--libproto/nntp/nntp_list_times.c122
-rw-r--r--libproto/nntp/nntp_mode_reader.c66
-rw-r--r--libproto/nntp/nntp_newgroups.c82
-rw-r--r--libproto/nntp/nntp_newnews.c92
-rw-r--r--libproto/nntp/nntp_next.c72
-rw-r--r--libproto/nntp/nntp_post.c152
-rw-r--r--libproto/nntp/nntp_quit.c61
-rw-r--r--libproto/nntp/nntp_readline.c193
-rw-r--r--libproto/nntp/nntp_response.c86
-rw-r--r--libproto/nntp/nntp_sendline.c122
-rw-r--r--libproto/nntp/nntp_stat.c100
-rw-r--r--libproto/nntp/nntp_stream.c145
-rw-r--r--libproto/nntp/nntp_timeout.c48
-rw-r--r--libproto/nntp/url.c50
-rw-r--r--mapi/MAPIAddress.c27
-rw-r--r--mapi/MAPIDeleteMail.c25
-rw-r--r--mapi/MAPIDetails.c25
-rw-r--r--mapi/MAPIFindNext.c27
-rw-r--r--mapi/MAPIFreeBuffer.c25
-rw-r--r--mapi/MAPILogoff.c26
-rw-r--r--mapi/MAPILogon.c26
-rw-r--r--mapi/MAPIReadMail.c26
-rw-r--r--mapi/MAPISaveMail.c25
-rw-r--r--mapi/MAPISendDocuments.c27
-rw-r--r--mapi/MAPISendMail.c26
-rw-r--r--mapi/Makefile.am41
-rw-r--r--mapi/mapi.h185
-rw-r--r--mu/libexec/ldflags.c10
69 files changed, 5 insertions, 6587 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index 2c2b3f5..348f71e 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -48,7 +48,6 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--flag=mu_debug_printf:3:c-format\\\
--flag=mu_sieve_error:2:c-format\\\
--flag=mu_sieve_log_action:3:c-format\\\
- --flag=mu_nntp_writeline:2:c-format\\\
--flag=mu_pop3_writeline:2:c-format\\\
--flag=mu_stream_printf:3:c-format\\\
--flag=mu_stream_sequential_printf:2:c-format\\\
diff --git a/configure.ac b/configure.ac
index 5480313..9ccafb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -985,7 +985,6 @@ MU_ENABLE_REMOTE_MAILBOX_FORMAT([imap])
# This is not a full-fledged testsuite yet, but it might be useful anyways
AC_CONFIG_FILES([libproto/imap/tests/Makefile])
MU_ENABLE_REMOTE_MAILBOX_FORMAT([pop])
-MU_ENABLE_LOCAL_MAILBOX_FORMAT([nntp],[],[],["$mu_build_experimental" = "yes"])
MU_ENABLE_LOCAL_MAILBOX_FORMAT([mh])
MU_ENABLE_LOCAL_MAILBOX_FORMAT([maildir])
MU_ENABLE_LOCAL_MAILBOX_FORMAT([dotmail])
diff --git a/doc/texinfo/nntp.texi b/doc/texinfo/nntp.texi
deleted file mode 100644
index 23a377d..0000000
--- a/doc/texinfo/nntp.texi
+++ b/dev/null
@@ -1,100 +0,0 @@
-@c This is part of the GNU Mailutils manual.
-@c Copyright (C) 1999-2020 Free Software Foundation, Inc.
-@c See file mailutils.texi for copying conditions.
-@comment *******************************************************************
-
-@smallexample
-@code{/* Prefix @emph{mu_nntp_} is reserved */}
-@code{#include <mailutils/nntp.h>}
-
-@end smallexample
-
-Network News Transfer Protocol. Not implemented.
-
-@subsection Commands
-
-@subsubsection Initialization
-@cindex NNTP Initialization
-@deftypefun int mu_nntp_create (mu_nntp_t *)
-@end deftypefun
-
-@deftypefun int mu_nntp_destroy (mu_nntp_t *)
-@end deftypefun
-
-@deftypefun int mu_nntp_open (nnpt_t)
-@end deftypefun
-
-@subsubsection Article
-@cindex NNTP Article
-@deftypefun int mu_nntp_article (nnpt_t)
-@end deftypefun
-
-@subsubsection Body
-@cindex NNTP Body
-@deftypefun int mu_nntp_body (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Group
-@cindex NNTP Group
-@deftypefun int mu_nntp_group (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Head
-@cindex NNTP Head
-@deftypefun int mu_nntp_head (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Help
-@cindex NNTP Help
-@deftypefun int mu_nntp_help (mu_nntp_t)
-@end deftypefun
-
-@subsubsection IHave
-@cindex NNTP IHave
-@deftypefun int mu_nntp_ihave (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Last
-@cindex NNTP Last
-@deftypefun int mu_nntp_last (mu_nntp_t)
-@end deftypefun
-
-@subsubsection List
-@cindex NNTP List
-@deftypefun int mu_nntp_list (mu_nntp_t)
-@end deftypefun
-
-@subsubsection NewGroups
-@cindex NNTP NewGroups
-@deftypefun int mu_nntp_newgroups (mu_nntp_t)
-@end deftypefun
-
-@subsubsection NewNews
-@cindex NNTP NewNews
-@deftypefun int mu_nntp_newnews (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Next
-@cindex NNTP Next
-@deftypefun int mu_nntp_next (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Post
-@cindex NNTP Post
-@deftypefun int mu_nntp_post (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Quit
-@cindex NNTP Quit
-@deftypefun int mu_nntp_quit (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Slave
-@cindex NNTP Slave
-@deftypefun int mu_nntp_slave (mu_nntp_t)
-@end deftypefun
-
-@subsubsection Stat
-@cindex NNTP Stat
-@deftypefun int mu_nntp_stat (mu_nntp_t)
-@end deftypefun
diff --git a/doc/texinfo/programs/mailutils.texi b/doc/texinfo/programs/mailutils.texi
index a515f1e..d4769b8 100644
--- a/doc/texinfo/programs/mailutils.texi
+++ b/doc/texinfo/programs/mailutils.texi
@@ -187,8 +187,6 @@ Link in the Maildir format support.
Link in the IMAP protocol support.
@item pop
Link in the POP protocol support.
-@item nntp
-Link in the NNTP protocol support.
@item mailer
Enable support for mailers.
@item sieve
diff --git a/examples/.gitignore b/examples/.gitignore
index faf9e43..c5a7849 100644
--- a/examples/.gitignore
+++ b/examples/.gitignore
@@ -25,7 +25,6 @@ mucat
muemail
murun
musocio
-nntpclient
sa
sfrom
url-parse
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 9ad214e..8e46b56 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -14,10 +14,6 @@
## You should have received a copy of the GNU General Public License
## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-if MU_COND_SUPPORT_NNTP
- NNTPCLIENT = nntpclient
-endif
-
if MU_COND_SUPPORT_CXX
CPP_DIR = cpp
endif
@@ -46,12 +42,9 @@ noinst_PROGRAMS = \
muemail\
murun\
musocio\
- $(NNTPCLIENT)\
sa\
sfrom
-EXTRA_PROGRAMS = nntpclient
-
## NOTE: Numaddr must be an installable target, otherwise libtool
## will not create a shared library and `make check' will fail in
## sieve. Pity.
@@ -97,14 +90,6 @@ mboxsize_LDADD =\
$(MU_AUTHLIBS)\
$(MU_LIB_MAILUTILS)
-nntpclient_LDADD = \
- $(MU_APP_LIBRARIES) \
- $(MU_LIB_NNTP)\
- $(MU_LIB_AUTH)\
- $(MU_AUTHLIBS)\
- $(MU_LIB_MAILUTILS)\
- @READLINE_LIBS@
-
lsf_LDADD = \
$(MU_LIB_MAILBOX)\
$(MU_LIB_AUTH)\
diff --git a/examples/nntpclient.c b/examples/nntpclient.c
deleted file mode 100644
index ef3a9b7..0000000
--- a/examples/nntpclient.c
+++ b/dev/null
@@ -1,1078 +0,0 @@
-/* nntpclient.c -- An application which demonstrates how to use the
- GNU Mailutils nntp functions. This application interactively allows users
- to contact a nntp server.
-
- Copyright (C) 2003-2020 Free Software Foundation, Inc.
-
- GNU Mailutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- GNU Mailutils is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <strings.h>
-#include <stdlib.h>
-#include <termios.h>
-#include <signal.h>
-#include <time.h>
-
-#ifdef WITH_READLINE
-# include <readline/readline.h>
-# include <readline/history.h>
-#endif
-
-#include <mailutils/nntp.h>
-#include <mailutils/iterator.h>
-#include <mailutils/error.h>
-#include <mailutils/errno.h>
-#include <mailutils/util.h>
-#include <mailutils/cctype.h>
-#include <mailutils/cstr.h>
-
-/* A structure which contains information on the commands this program
- can understand. */
-
-typedef struct
-{
- const char *name; /* User printable name of the function. */
- int (*func) (char *); /* Function to call to do the job. */
- const char *doc; /* Documentation for this function. */
-}
-COMMAND;
-
-/* The names of functions that actually do the manipulation. */
-int com_article (char *);
-int com_body (char *);
-int com_connect (char *);
-int com_date (char *);
-int com_disconnect (char *);
-int com_exit (char *);
-int com_group (char *);
-int com_head (char *);
-int com_help (char *);
-int com_ihave (char *);
-int com_info (char *);
-int com_last (char *);
-int com_list (char *);
-int com_list_active (char *);
-int com_list_active_times (char *);
-int com_list_distributions (char *);
-int com_list_distrib_pats (char *);
-int com_list_extensions (char *);
-int com_list_newsgroups (char *);
-int com_mode (char *);
-int com_mode_reader (char *);
-int com_newgroups (char *);
-int com_newnews (char *);
-int com_next (char *);
-int com_post (char *);
-int com_quit (char *);
-int com_stat (char *);
-int com_verbose (char *);
-
-void initialize_readline (void);
-COMMAND *find_command (char *);
-char *dupstr (const char *);
-int execute_line (char *);
-int valid_argument (const char *, char *);
-
-void sig_int (int);
-
-COMMAND commands[] = {
- {"article", com_article, "Retrieve an article: ARTICLE [message_id|number]"},
- {"body", com_body, "Retrieve the body of an article: BODY [message_id|number]"},
- {"connect", com_connect, "Open connection: connect hostname [port]"},
- {"date", com_date, "Server date: DATE"},
- {"disconnect", com_disconnect, "Close connection: disconnect"},
- {"exit", com_exit, "exit program"},
- {"group", com_group, "Select a group: GROUP group"},
- {"head", com_head, "Retrieve the head of an article: HEAD [message_id|number]"},
- {"help", com_help, "Ask the server for info: HELP"},
- {"ihave", com_ihave, "Transfer an article to the server : IHAVE <<enter the article, finish with a '.' or ctrl-D>>"},
- {"last", com_last, "Set current to the previous article: LAST"},
- {"list", com_list, "List : LIST [ACTIVE|ACTIVE.TIMES|DISTRIB.PATS|DISTRIBUTIONS|EXTENSIONS|NEWSGROUPS]"},
- {"mode", com_mode, "Set mode reader: MODE READER"},
- {"newgroups", com_newgroups, "Ask for new groups : NEWGROUPS [yyyymmdd hhmmss [GMT]]"},
- {"newnews", com_newnews, "Ask for new news : NEWNEWS wildmat [yyyymmdd hhmmss]"},
- {"next", com_next, "Set current to the next article: NEXT"},
- {"post", com_post, "Post an article to the server : POST <<enter the article, finish with a '.' or ctrl-D>>"},
- {"quit", com_quit, "Terminate the session: QUIT"},
- {"stat", com_stat, "Check the status of an article : STAT [message_id|number]"},
- {"verbose", com_verbose, "Enable Protocol tracing: verbose {on|off}"},
- {"?", com_info, "Dysplay this help"},
- {NULL, NULL, NULL}
-};
-
-/* The name of this program, as taken from argv[0]. */
-char *progname;
-
-/* Global handle for nntp. */
-mu_nntp_t nntp;
-
-/* Flag if verbosity is needed. */
-int verbose;
-
-/* When non-zero, this global means the user is done using this program. */
-int done;
-
-char *
-dupstr (const char *s)
-{
- char *r;
-
- r = malloc (strlen (s) + 1);
- if (!r)
- {
- fprintf (stderr, "Memory exhausted\n");
- exit (1);
- }
- strcpy (r, s);
- return r;
-}
-
-
-#ifdef WITH_READLINE
-/* Interface to Readline Completion */
-
-char *command_generator (const char *, int);
-char **nntp_completion (char *, int, int);
-
-/* Tell the GNU Readline library how to complete. We want to try to complete
- on command names if this is the first word in the line, or on filenames
- if not. */
-void
-initialize_readline ()
-{
- /* Allow conditional parsing of the ~/.inputrc file. */
- rl_readline_name = (char *) "nntp";
-
- /* Tell the completer that we want a crack first. */
- rl_attempted_completion_function = (CPPFunction *) nntp_completion;
-}
-
-/* Attempt to complete on the contents of TEXT. START and END bound the
- region of rl_line_buffer that contains the word to complete. TEXT is
- the word to complete. We can use the entire contents of rl_line_buffer
- in case we want to do some simple parsing. Return the array of matches,
- or NULL if there aren't any. */
-char **
-nntp_completion (char *text, int start, int end)
-{
- char **matches;
-
- (void) end;
- matches = (char **) NULL;
-
- /* If this word is at the start of the line, then it is a command
- to complete. Otherwise it is the name of a file in the current
- directory. */
- if (start == 0)
- matches = rl_completion_matches (text, command_generator);
-
- return (matches);
-}
-
-/* Generator function for command completion. STATE lets us know whether
- to start from scratch; without any state (i.e. STATE == 0), then we
- start at the top of the list. */
-char *
-command_generator (const char *text, int state)
-{
- static int list_index, len;
- const char *name;
-
- /* If this is a new word to complete, initialize now. This includes
- saving the length of TEXT for efficiency, and initializing the index
- variable to 0. */
- if (!state)
- {
- list_index = 0;
- len = strlen (text);
- }
-
- /* Return the next name which partially matches from the command list. */
- while ((name = commands[list_index].name))
- {
- list_index++;
-
- if (strncmp (name, text, len) == 0)
- return (dupstr (name));
- }
-
- /* If no names matched, then return NULL. */
- return ((char *) NULL);
-}
-
-#else
-void
-initialize_readline ()
-{
-}
-
-char *
-readline (char *prompt)
-{
- char buf[255];
-
- if (prompt)
- {
- printf ("%s", prompt);
- fflush (stdout);
- }
-
- if (!fgets (buf, sizeof (buf), stdin))
- return NULL;
- return strdup (buf);
-}
-
-void
-add_history (const char *s MU_ARG_UNUSED)
-{
-}
-#endif
-
-
-int
-main (int argc MU_ARG_UNUSED, char **argv)
-{
- char *line, *s;
-
- progname = strrchr (argv[0], '/');
- if (progname)
- progname++;
- else
- progname = argv[0];
-
- initialize_readline (); /* Bind our completer. */
-
- /* Loop reading and executing lines until the user quits. */
- while (!done)
- {
-
- line = readline ((char *) "nntp> ");
-
- if (!line)
- break;
-
- /* Remove leading and trailing whitespace from the line.
- Then, if there is anything left, add it to the history list
- and execute it. */
- s = mu_str_stripws (line);
-
- if (*s)
- {
- int status;
- add_history (s);
- status = execute_line (s);
- if (status != 0)
- fprintf (stderr, "Error: %s\n", mu_strerror (status));
- }
-
- free (line);
- }
- exit (0);
-}
-
-/* Parse and execute a command line. */
-int
-execute_line (char *line)
-{
- COMMAND *command;
- char *word, *arg;
-
- /* Isolate the command word. */
- word = mu_str_skip_class (line, MU_CTYPE_SPACE);
- arg = mu_str_skip_class_comp (word, MU_CTYPE_SPACE);
- if (*arg)
- {
- *arg++ = 0;
- arg = mu_str_skip_class (arg, MU_CTYPE_SPACE);
- }
-
- command = find_command (word);
-
- if (!command)
- {
- mu_error ("%s: No such command.", word);
- return 0;
- }
-
- /* Call the function. */
- return ((*(command->func)) (arg));
-}
-
-/* Look up NAME as the name of a command, and return a pointer to that
- command. Return a NULL pointer if NAME isn't a command name. */
-COMMAND *
-find_command (char *name)
-{
- register int i;
-
- for (i = 0; commands[i].name; i++)
- if (strcmp (name, commands[i].name) == 0)
- return (&commands[i]);
-
- return ((COMMAND *) NULL);
-}
-
-int
-com_verbose (char *arg)
-{
- int status = 0;
- if (!valid_argument ("verbose", arg))
- return EINVAL;
-
- verbose = (strcmp (arg, "on") == 0);
- if (nntp != NULL)
- {
- if (verbose)
- {
- mu_debug_set_category_level (MU_DEBCAT_REMOTE,
- MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
- status = mu_nntp_set_debug (nntp, debug);
- }
- else
- {
- status = mu_nntp_set_debug (nntp, NULL);
- }
- }
- return status;
-}
-
-int com_mode (char *arg)
-{
- if (!valid_argument("mode", arg))
- return EINVAL;
- if (mu_c_strncasecmp (arg, "READER", 6) == 0)
- return com_mode_reader (arg);
- return EINVAL;
-}
-
-int
-com_mode_reader (char *arg MU_ARG_UNUSED)
-{
- return mu_nntp_mode_reader (nntp);
-}
-
-int
-com_head (char *arg)
-{
- mu_stream_t stream = NULL;
- int status;
-
- /* No space allowed. */
- if (arg != NULL && strchr (arg, ' ') != NULL)
- return EINVAL;
-
- if ((arg == NULL || *arg == '\0') || (arg != NULL && *arg == '<'))
- status = mu_nntp_head_id (nntp, arg, NULL, NULL, &stream);
- else
- {
- unsigned long number = strtoul (arg, NULL, 10);
- status = mu_nntp_head (nntp, number, NULL, NULL, &stream);
- }
-
- if (status == 0 && stream != NULL)
- {
- size_t n = 0;
- char buf[128];
- /* FIXME: mu_stream_seek (stream, 0, MU_SEEK_SET); ? */
- while ((mu_stream_readline (stream, buf, sizeof buf, &n) == 0) && n)
- printf ("%s", buf);
- mu_stream_destroy (&stream);
- }
- return status;
-}
-
-int
-com_body (char *arg)
-{
- mu_stream_t stream = NULL;
- int status;
-
- /* No space allowed. */
- if (arg != NULL && strchr (arg, ' ') != NULL)
- return EINVAL;
-
- if ((arg == NULL || *arg == '\0') || (arg != NULL && *arg == '<'))
- status = mu_nntp_body_id (nntp, arg, NULL, NULL, &stream);
- else
- {
- unsigned long number = strtoul (arg, NULL, 10);
- status = mu_nntp_body (nntp, number, NULL, NULL, &stream);
- }
-
- if (status == 0 && stream != NULL)
- {
- char buf[128];
- while (mu_stream_readline (stream, buf, sizeof buf, 0) == 0)
- printf ("%s", buf);
- mu_stream_destroy (&stream);
- }
- return status;
-}
-
-int
-com_article (char *arg)
-{
- mu_stream_t stream = NULL;
- int status;
-
- /* No space allowed. */
- if (arg != NULL && strchr (arg, ' ') != NULL)
- return EINVAL;
-
- if ((arg == NULL || *arg == '\0') || (arg != NULL && *arg == '<'))
- status = mu_nntp_article_id (nntp, arg, NULL, NULL, &stream);
- else
- {
- unsigned long number = strtoul (arg, NULL, 10);
- status = mu_nntp_article (nntp, number, NULL, NULL, &stream);
- }
-
- if (status == 0 && stream != NULL)
- {
- size_t n = 0;
- char buf[128];
- while ((mu_stream_readline (stream, buf, sizeof buf, 0, &n) == 0) && n)
- printf ("%s", buf);
- mu_stream_destroy (&stream, NULL);
- }
- return status;
-}
-
-int
-com_group (char *arg)
-{
- int status;
- unsigned long total, low, high;
- char *name = NULL;
- if (!valid_argument ("group", arg))
- return EINVAL;
- status = mu_nntp_group (nntp, arg, &total, &low, &high, &name);
- if (status == 0)
- {
- printf ("%s: low[%ld] high[%ld] total[%ld]\n", (name == NULL) ? "" : name, low, high, total);
- free (name);
- }
- return status;
-}
-
-int com_list (char *arg)
-{
- int status = EINVAL;
- char *keyword = NULL;
-
- if (arg != NULL)
- {
- char *p = strchr (arg, ' ');
- if (p)
- {
- *p++ = '\0';
- keyword = arg;
- arg = p;
- }
- else
- {
- keyword = arg;
- }
- }
- else
- keyword = arg;
-
- if (keyword == NULL || *keyword == '\0')
- {
- status = com_list_active (arg);
- }
- else if (mu_c_strncasecmp (keyword, "ACTIVE.TIMES", 12) == 0)
- {
- status = com_list_active_times (arg);
- }
- else if (mu_c_strncasecmp (keyword, "ACTIVE", 6) == 0)
- {
- status = com_list_active (arg);
- }
- else if (mu_c_strncasecmp (keyword, "EXTENSIONS", 10) == 0)
- {
- status = com_list_extensions (arg);
- }
- else if (mu_c_strncasecmp (keyword, "DISTRIBUTIONS", 13) == 0)
- {
- status = com_list_distributions (arg);
- }
- else if (mu_c_strncasecmp (keyword, "DISTRIB.PATS", 12) == 0)
- {
- status = com_list_distrib_pats (arg);
- }
- else if (mu_c_strncasecmp (keyword, "NEWSGROUPS", 10) == 0)
- {
- status = com_list_newsgroups (arg);
- }
- return status;
-}
-
-int
-com_list_extensions (char *arg MU_ARG_UNUSED)
-{
- mu_iterator_t iterator = NULL;
- int status = mu_nntp_list_extensions (nntp, &iterator);
-
- if (status == 0)
- {
- printf ("List Extension:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *extension = NULL;
- mu_iterator_current (iterator, (void **) &extension);
- printf (" %s\n", extension);
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_list_active (char *arg)
-{
- mu_iterator_t iterator = NULL;
- int status = mu_nntp_list_active (nntp, arg, &iterator);
-
- if (status == 0)
- {
- printf ("List Active:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *buffer = NULL;
- char *group = NULL;
- unsigned long high;
- unsigned long low;
- char stat;
- mu_iterator_current (iterator, (void **) &buffer);
- mu_nntp_parse_list_active (buffer, &group, &high, &low, &stat);
- if (group)
- {
- printf (" group(%s)", group);
- free (group);
- }
- printf (" high(%ld) low(%ld) status(%c)\n", high, low, stat);
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_list_active_times (char *arg)
-{
- mu_iterator_t iterator = NULL;
- int status = mu_nntp_list_active_times (nntp, arg, &iterator);
-
- if (status == 0)
- {
- printf ("List Active.Times:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *buffer = NULL;
- char *group = NULL;
- char *creator = NULL;
- unsigned long time = 0;
- mu_iterator_current (iterator, (void **) &buffer);
- mu_nntp_parse_list_active_times (buffer, &group, &time, &creator);
- if (group)
- {
- printf (" group(%s)", group);
- free (group);
- }
- if (time)
- {
- char *p = ctime((time_t *)&time);
- char *buf = strdup (p);
- p = strchr (buf, '\n');
- if (p)
- {
- buf[p - buf] = '\0';
- }
- printf (" times(%s)", buf);
- free (buf);
- }
- if (creator)
- {
- printf (" creator(%s)", creator);
- free (creator);
- }
- printf ("\n");
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_list_distributions (char *arg MU_ARG_UNUSED)
-{
- mu_iterator_t iterator = NULL;
- int status = mu_nntp_list_distributions (nntp, arg, &iterator);
-
- if (status == 0)
- {
- printf ("List Distributions:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *buffer = NULL;
- char *key = NULL;
- char *value = NULL;
- mu_iterator_current (iterator, (void **) &buffer);
- mu_nntp_parse_list_distributions (buffer, &key, &value);
- if (key)
- {
- printf (" %s", key);
- free (key);
- }
- if (value)
- {
- printf (": %s", value);
- free (value);
- }
- printf ("\n");
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_list_distrib_pats (char *arg MU_ARG_UNUSED)
-{
- mu_iterator_t iterator = NULL;
- int status = mu_nntp_list_distrib_pats (nntp, &iterator);
-
- if (status == 0)
- {
- printf ("List Distrib Pats:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *buffer = NULL;
- unsigned long weight = 0;
- char *wildmat = NULL;
- char *distrib = NULL;
- mu_iterator_current (iterator, (void **) &buffer);
- mu_nntp_parse_list_distrib_pats (buffer, &weight, &wildmat, &distrib);
- printf (" weight(%ld)", weight);
- if (wildmat)
- {
- printf (":%s", wildmat);
- free (wildmat);
- }
- if (distrib)
- {
- printf (":%s", distrib);
- free (distrib);
- }
- printf ("\n");
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_list_newsgroups (char *arg)
-{
- mu_iterator_t iterator = NULL;
- int status = mu_nntp_list_newsgroups (nntp, arg, &iterator);
-
- if (status == 0)
- {
- printf ("Newsgroups:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *buffer = NULL;
- char *group = NULL;
- char *desc = NULL;
- mu_iterator_current (iterator, (void **) &buffer);
- mu_nntp_parse_list_newsgroups (buffer, &group, &desc);
- if (group)
- {
- printf (" %s", group);
- free (group);
- }
- if (desc)
- {
- printf (":%s", desc);
- free (desc);
- }
- printf ("\n");
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_last (char *arg MU_ARG_UNUSED)
-{
- char *mid = NULL;
- unsigned long number = 0;
- int status;
- status = mu_nntp_last (nntp, &number, &mid);
- if (status == 0)
- {
- fprintf (stdout, "%ld %s\n", number, (mid == NULL) ? "" : mid);
- free (mid);
- }
- return status;
-}
-
-int
-com_next (char *arg MU_ARG_UNUSED)
-{
- char *mid = NULL;
- unsigned long number = 0;
- int status;
- status = mu_nntp_next (nntp, &number, &mid);
- if (status == 0)
- {
- fprintf (stdout, "%ld %s\n", number, (mid == NULL) ? "" : mid);
- free (mid);
- }
- return status;
-}
-
-int
-com_newgroups (char *arg)
-{
- mu_iterator_t iterator = NULL;
- int status;
- int year, month, day, hour, min, sec, is_gmt;
- year = month = day = hour = min = sec = is_gmt = 0;
-
- if (arg != NULL && *arg != '\0')
- {
- char gmt[4];
- memset (gmt, 0, 4);
- sscanf (arg, "%4d%2d%2d %2d%2d%2d %3s", &year, &month, &day, &hour, &min, &sec, gmt);
- is_gmt = mu_c_strncasecmp ("GMT", gmt, 3) == 0;
- }
-
- /* If nothing defined take the current time. */
- if (year == 0)
- {
- time_t now = time (NULL);
- struct tm *stime = localtime (&now);
- sec = stime->tm_sec; /* seconds */
- min = stime->tm_min; /* minutes */
- hour = stime->tm_hour; /* hours */
- day = stime->tm_mday; /* day of the month */
- month = stime->tm_mon; /* month */
- year = stime->tm_year + 1900; /* year */
- }
-
- status = mu_nntp_newgroups (nntp, year, month, day, hour, min, sec, is_gmt, &iterator);
- if (status == 0)
- {
- printf ("New Groups:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *buffer = NULL;
- char *group = NULL;
- unsigned long high = 0;
- unsigned long low = 0;
- char stat = 0;
- mu_iterator_current (iterator, (void **) &buffer);
- mu_nntp_parse_newgroups (buffer, &group, &high, &low, &stat);
- if (group)
- {
- printf (" group(%s)", group);
- free (group);
- }
- printf (" hig(%lu) low(%lu) status(%c)\n", high, low, stat);
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_newnews (char *arg)
-{
- mu_iterator_t iterator = NULL;
- char *wildmat;
- char gmt[4];
- int year, month, day, hour, min, sec, is_gmt;
- int status;
-
- if (!valid_argument ("newnews", arg))
- return EINVAL;
-
- year = month = day = hour = min = sec = is_gmt = 0;
- memset (gmt, 0, 4);
-
- wildmat = calloc (1, 512);
- sscanf (arg, "%511s %4d%2d%2d %2d%2d%2d %3s", wildmat, &year, &month, &day, &hour, &min, &sec, gmt);
- is_gmt = mu_c_strncasecmp ("GMT", gmt, 3) == 0;
-
- if (year == 0)
- {
- time_t now = time (NULL);
- struct tm *stime = localtime (&now);
- sec = stime->tm_sec; /* seconds */
- min = stime->tm_min; /* minutes */
- hour = stime->tm_hour; /* hours */
- day = stime->tm_mday; /* day of the month */
- month = stime->tm_mon; /* month */
- year = stime->tm_year + 1900; /* year */
- }
-
- status = mu_nntp_newnews (nntp, wildmat, year, month, day, hour, min, sec, is_gmt, &iterator);
- if (status == 0)
- {
- printf ("New News:\n");
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *mid = NULL;
- mu_iterator_current (iterator, (void **) &mid);
- printf (" %s\n", mid);
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-int
-com_stat (char *arg)
-{
- char *mid = NULL;
- unsigned long number = 0;
- int status = 0;
-
- /* No space allowed. */
- if (arg != NULL && strchr (arg, ' ') != NULL)
- return EINVAL;
-
- if ((arg == NULL || *arg == '\0') || (arg != NULL && *arg == '<'))
- status = mu_nntp_stat_id (nntp, arg, &number, &mid);
- else
- {
- unsigned long number = strtoul (arg, NULL, 10);
- status = mu_nntp_stat (nntp, number, &number, &mid);
- }
- if (status == 0)
- {
- fprintf (stdout, "status: %ld %s\n", number, (mid == NULL) ? "" : mid);
- free (mid);
- }
- return status;
-}
-
-int
-com_date (char *arg MU_ARG_UNUSED)
-{
- unsigned int year, month, day, hour, min, sec;
- int status;
- year = month = day = hour = min = sec = 0;
- status = mu_nntp_date (nntp, &year, &month, &day, &hour, &min, &sec);
- if (status == 0)
- {
- fprintf (stdout, "date: year(%d) month(%d) day(%d) hour(%d) min(%d) sec(%d)\n", year, month, day, hour, min, sec);
- }
- return status;
-}
-
-int
-com_post (char *arg)
-{
- fprintf (stderr, "Not implemented\n");
- return 0;
-}
-
-int
-com_ihave (char *arg)
-{
- fprintf (stderr, "Not implemented\n");
- return 0;
-}
-
-int
-com_help (char *arg MU_ARG_UNUSED)
-{
- mu_stream_t stream = NULL;
- int status;
-
- status = mu_nntp_help (nntp, &stream);
- if (status == 0 && stream != NULL)
- {
- size_t n = 0;
- char buf[128];
- while ((mu_stream_readline (stream, buf, sizeof buf, 0, &n) == 0) && n)
- printf ("%s", buf);
- mu_stream_destroy (&stream, NULL);
- }
- return status;
-}
-
-/* Print out help for ARG, or for all of the commands if ARG is
- not present. */
-int
-com_info (char *arg)
-{
- int i;
- int printed = 0;
-
- for (i = 0; commands[i].name; i++)
- {
- if (!*arg || (strcmp (arg, commands[i].name) == 0))
- {
- printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
- printed++;
- }
- }
-
- if (!printed)
- {
- printf ("No commands match `%s'. Possibilities are:\n", arg);
-
- for (i = 0; commands[i].name; i++)
- {
- /* Print in six columns. */
- if (printed == 6)
- {
- printed = 0;
- printf ("\n");
- }
-
- printf ("%s\t", commands[i].name);
- printed++;
- }
-
- if (printed)
- printf ("\n");
- }
- return 0;
-}
-
-int
-com_connect (char *arg)
-{
- char host[256];
- int port = 119;
- int status;
-
- *host = '\0';
-
- /* Try with the environment. */
- if (arg == NULL || *arg == '\0')
- arg = getenv ("NNTPSERVER");
- if (!valid_argument ("connect", arg))
- return EINVAL;
- sscanf (arg, "%256s %d", host, &port);
- if (!valid_argument ("connect", host))
- return EINVAL;
- if (nntp)
- com_disconnect (NULL);
- status = mu_nntp_create (&nntp);
- if (status == 0)
- {
- mu_stream_t tcp;
-
- if (verbose)
- com_verbose ("on");
- status =
- mu_tcp_stream_create (&tcp, host, port, MU_STREAM_READ);
- if (status == 0)
- {
- mu_nntp_set_carrier (nntp, tcp);
- status = mu_nntp_connect (nntp);
- }
- else
- {
- mu_nntp_destroy (&nntp);
- nntp = NULL;
- }
- }
-
- if (status != 0)
- fprintf (stderr, "Failed to create nntp: %s\n", mu_strerror (status));
- return status;
-}
-
-int
-com_disconnect (char *arg MU_ARG_UNUSED)
-{
- (void) arg;
- if (nntp)
- {
- mu_nntp_disconnect (nntp);
- mu_nntp_destroy (&nntp);
- nntp = NULL;
- }
- return 0;
-}
-
-int
-com_quit (char *arg MU_ARG_UNUSED)
-{
- int status = 0;
- if (nntp)
- {
- if (mu_nntp_quit (nntp) == 0)
- {
- status = com_disconnect (arg);
- }
- else
- {
- fprintf (stdout, "Try 'exit' to leave %s\n", progname);
- }
- }
- else
- fprintf (stdout, "Try 'exit' to leave %s\n", progname);
- return status;
-}
-
-int
-com_exit (char *arg MU_ARG_UNUSED)
-{
- if (nntp)
- {
- mu_nntp_disconnect (nntp);
- mu_nntp_destroy (&nntp);
- }
- done = 1;
- return 0;
-}
-
-/* Return non-zero if ARG is a valid argument for CALLER, else print
- an error message and return zero. */
-int
-valid_argument (const char *caller, char *arg)
-{
- if (arg == NULL || *arg == '\0')
- {
- fprintf (stderr, "%s: Argument required.\n", caller);
- return 0;
- }
-
- return 1;
-}
diff --git a/include/mailutils/Makefile.am b/include/mailutils/Makefile.am
index 12c22e4..bbef7a1 100644
--- a/include/mailutils/Makefile.am
+++ b/include/mailutils/Makefile.am
@@ -82,7 +82,6 @@ pkginclude_HEADERS = \
mu_auth.h\
util.h\
nls.h\
- nntp.h\
observer.h\
opool.h\
opt.h\
diff --git a/include/mailutils/nntp.h b/include/mailutils/nntp.h
deleted file mode 100644
index 9decbc8..0000000
--- a/include/mailutils/nntp.h
+++ b/dev/null
@@ -1,247 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _MAILUTILS_NNTP_H
-#define _MAILUTILS_NNTP_H
-
-#include <mailutils/debug.h>
-#include <mailutils/stream.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct _mu_nntp;
-typedef struct _mu_nntp* mu_nntp_t;
-
-#define MU_NNTP_DEFAULT_PORT 119
-#define MU_NNTP_URL_SCHEME "nntp"
-
-extern int mu_nntp_create (mu_nntp_t *nntp);
-extern void mu_nntp_destroy (mu_nntp_t *nntp);
-
-extern int mu_nntp_set_carrier (mu_nntp_t nntp, mu_stream_t carrier);
-extern int mu_nntp_get_carrier (mu_nntp_t nntp, mu_stream_t *pcarrier);
-
-extern int mu_nntp_connect (mu_nntp_t nntp);
-extern int mu_nntp_disconnect (mu_nntp_t nntp);
-
-extern int mu_nntp_set_timeout (mu_nntp_t nntp, int timeout);
-extern int mu_nntp_get_timeout (mu_nntp_t nntp, int *timeout);
-
-extern int mu_nntp_stls (mu_nntp_t nntp);
-
-
-extern int mu_nntp_mode_reader (mu_nntp_t nntp);
-
-/* An iterator is return with the multi-line answer. It is the responsibility
- of the caller to call mu_iterator_destroy() to dispose of the iterator. */
-extern int mu_nntp_list_extensions (mu_nntp_t nntp, mu_iterator_t *iterator);
-
-extern int mu_nntp_quit (mu_nntp_t nntp);
-
-/* The argument name is allocated with malloc(3). The caller is responsible
- to call free(3) */
-extern int mu_nntp_group (mu_nntp_t nntp,
- const char *group,
- unsigned long *total,
- unsigned long *first,
- unsigned long *last, char **name);
-
-/* The argument mid is allocated with malloc(3). The caller is responsible
- to call free(3) */
-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);
-
-/* The argument mid is allocated with malloc(3). The caller is responsible
- to call free(3). The caller must call stream_destoy() when done, no
- other commands are permitted until the stream is destroyed. */
-extern int mu_nntp_article (mu_nntp_t nntp, unsigned long number,
- unsigned long *pnum, char **mid,
- mu_stream_t *stream);
-extern int mu_nntp_article_id (mu_nntp_t nntp, const char *id,
- unsigned long *pnum, char **mid,
- mu_stream_t *stream);
-extern int mu_nntp_head (mu_nntp_t nntp, unsigned long number,
- unsigned long *pnum, char **mid,
- mu_stream_t *stream);
-extern int mu_nntp_head_id (mu_nntp_t nntp, const char *name,
- unsigned long *pnum, char **mid,
- mu_stream_t *stream);
-extern int mu_nntp_body (mu_nntp_t nntp, unsigned long number,
- unsigned long *pnum, char **mid,
- mu_stream_t *stream);
-extern int mu_nntp_body_id (mu_nntp_t nntp, const char *id,
- unsigned long *pnum, char **mid,
- mu_stream_t *stream);
-
-/* The argument mid is allocated with malloc(3). The caller is responsible
- to call free(3) */
-extern int mu_nntp_stat (mu_nntp_t nntp, unsigned long number,
- unsigned long *pnum, char **mid);
-extern int mu_nntp_stat_id (mu_nntp_t nntp, const char *id,
- unsigned long *pnum, char **mid);
-
-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);
-
-/* The caller must call stream_destoy() when done, no other commands are
- permitted until the stream is destroyed. */
-extern int mu_nntp_help (mu_nntp_t nntp, mu_stream_t *stream);
-
-
-/* An iterator is return with the multi-line answer. It is the responsibility
- of the caller to call mu_iterator_destroy() to dispose of the iterator. */
-extern int mu_nntp_newgroups (mu_nntp_t nntp, unsigned int year,
- unsigned int month, unsigned int day,
- unsigned int hour, unsigned int minute,
- unsigned int second, int is_gmt,
- mu_iterator_t *iterator);
-
-/* A iterator is return with the multi-line answer. It is the responsibility
- of the caller to call mu_iterator_destroy() to dispose of the iterator. */
-extern int mu_nntp_newnews (mu_nntp_t nntp, const char *wildmat,
- unsigned int year, unsigned int month,
- unsigned int day, unsigned int hour,
- unsigned int minute, unsigned int second,
- int is_gmt, mu_iterator_t *iterator);
-
-extern int mu_nntp_post (mu_nntp_t nntp, mu_stream_t stream);
-extern int mu_nntp_ihave (mu_nntp_t nntp, const char *mid,
- mu_stream_t stream);
-
-
-/* A iterator is return with the multi-line answer. It is the responsibility
- of the caller to call mu_iterator_destroy() to dispose of the iterator. */
-extern int mu_nntp_list_active (mu_nntp_t nntp, const char *wildmat,
- mu_iterator_t *iterator);
-extern int mu_nntp_list_active_times (mu_nntp_t nntp,
- const char *wildmat,
- mu_iterator_t *iterator);
-extern int mu_nntp_list_distributions (mu_nntp_t nntp,
- const char *wildmat,
- mu_iterator_t *iterator);
-extern int mu_nntp_list_distrib_pats (mu_nntp_t nntp, mu_iterator_t *iterator);
-extern int mu_nntp_list_newsgroups (mu_nntp_t nntp,
- const char *wildmat,
- mu_iterator_t *iterator);
-
-
-/* Parse the list active response.
- "group high low status"
- group: is the name of the group
- high: high wather mark
- low: low water mark
- status: current status
- 'y': posting is permitted
- 'm': posting is not permitted
- 'm': postings will be moderated
-
- The argument group is allocated with malloc(3). The caller is responsible
- to call free(3).
-*/
-
-extern int mu_nntp_parse_list_active (const char *buffer, char **group,
- unsigned long *high, unsigned long *low,
- char *status);
-extern int mu_nntp_parse_newgroups (const char *buffer, char **group,
- unsigned long *high, unsigned long *low,
- char *status);
-
-/* Parse the list active.times response.
- "group time creator"
- group: is the name of the group
- time: measure in seconds since Jan 1 1970
- creator: entity taht created the newsgroup
-
- The argument group/creator is allocated with malloc(3). The caller is
- responsible to call free(3).
-*/
-
-extern int mu_nntp_parse_list_active_times (const char *buffer, char **group,
- unsigned long *time,
- char **creator);
-/* Parse the list distributions response.
- "key value"
- key: field key.
- value: short explaination of key
-
- The argument key/value is allocated with malloc(3). The caller is responsible
- to call free(3).
-*/
-extern int mu_nntp_parse_list_distributions (const char *buffer,
- char **key, char **value);
-
-/* Parse the list distributions response.
- "weight:wildmat:distrib"
- weight:
- wildmat:
- distrib:
-
- The argument wildmat/distrib is allocated with malloc(3). The caller is
- responsible to call free(3).
-*/
-extern int mu_nntp_parse_list_distrib_pats (const char *buffer,
- unsigned long *weight,
- char **wildmat, char **distrib);
-
-/* Parse the list distributions response.
- "group description"
-
- The argument group/description is allocated with malloc(3). The caller is
- responsible to call free(3).
-*/
-extern int mu_nntp_parse_list_newsgroups (const char *buffer, char **group,
- char **description);
-
-/* Reads the multi-line response of the server, nread will be 0 when the
- termination octets are detected. Clients should not use this function
- unless they are sending a direct command. */
-extern int mu_nntp_readline (mu_nntp_t nntp, char *buffer,
- size_t buflen, size_t *nread);
-
-/* Returns the last command acknowledge. If the server supports RESP-CODE,
- the message could be retrieved, but it is up the caller to do the parsing.
-*/
-extern int mu_nntp_response (mu_nntp_t nntp, char *buffer,
- size_t buflen, size_t *nread);
-
-/* pop3_writeline copies the line in the internal buffer, a mu_pop3_send() is
- needed to do the actual transmission. */
-extern int mu_nntp_writeline (mu_nntp_t nntp, const char *format, ...)
- MU_PRINTFLIKE(2,3);
-
-/* mu_pop3_sendline() is equivalent to:
- mu_pop3_writeline (pop3, line);
- mu_pop3_send (pop3);
- */
-extern int mu_nntp_sendline (mu_nntp_t nntp, const char *line);
-
-/* Transmit via the carrier the internal buffer data. */
-extern int mu_nntp_send (mu_nntp_t nntp);
-
-extern int mu_nntp_response_code (mu_nntp_t nntp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MAILUTILS_POP3_H */
diff --git a/include/mailutils/registrar.h b/include/mailutils/registrar.h
index ef3fa1a..5feac38 100644
--- a/include/mailutils/registrar.h
+++ b/include/mailutils/registrar.h
@@ -111,8 +111,6 @@ extern mu_record_t mu_imaps_record;
/* Remote Mailbox POP3, pop:// */
extern mu_record_t mu_pop_record;
extern mu_record_t mu_pops_record;
-/* Remote newsgroup NNTP, nntp:// */
-extern mu_record_t mu_nntp_record;
/* Local Mailbox Unix Mailbox, "mbox:" */
extern mu_record_t mu_mbox_record;
@@ -126,7 +124,6 @@ extern mu_record_t mu_maildir_record;
#define MU_MBOX_PRIO 300
#define MU_MAILDIR_PRIO 400
#define MU_MH_PRIO 500
-#define MU_NNTP_PRIO 600
#define MU_PATH_PRIO 1000
#define MU_SMTP_PRIO 10000
@@ -168,7 +165,6 @@ extern mu_record_t mu_dotmail_record;
mu_registrar_record (mu_pops_record);\
mu_registrar_record (mu_imap_record);\
mu_registrar_record (mu_imaps_record);\
- mu_registrar_record (mu_nntp_record);\
} while (0)
#define mu_register_all_mailer_formats() do {\
@@ -178,9 +174,7 @@ extern mu_record_t mu_dotmail_record;
mu_registrar_record (mu_prog_record);\
} while (0)
-#define mu_register_extra_formats() do {\
- mu_registrar_record (mu_nntp_record);\
-} while (0)
+#define mu_register_extra_formats()
#define mu_register_all_formats() do {\
mu_register_all_mbox_formats ();\
diff --git a/include/mailutils/sys/Makefile.am b/include/mailutils/sys/Makefile.am
index a77a978..31225ef 100644
--- a/include/mailutils/sys/Makefile.am
+++ b/include/mailutils/sys/Makefile.am
@@ -46,7 +46,6 @@ sysinclude_HEADERS = \
mime.h\
monitor.h\
msgset.h\
- nntp.h\
nullstream.h\
observer.h\
pop3.h\
diff --git a/include/mailutils/sys/nntp.h b/include/mailutils/sys/nntp.h
deleted file mode 100644
index 05b6b89..0000000
--- a/include/mailutils/sys/nntp.h
+++ b/dev/null
@@ -1,221 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _MAILUTILS_SYS_NNTP_H
-#define _MAILUTILS_SYS_NNTP_H
-
-#include <sys/types.h>
-#include <mailutils/nntp.h>
-#include <mailutils/errno.h>
-
-#ifdef DMALLOC
-# include <dmalloc.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Response codes. */
-
-#define MU_NNTP_RESP_CODE_HELP_FOLLOW 100
-#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_EXTENSIONS_FOLLOW 202
-
-#define MU_NNTP_RESP_CODE_CLOSING 205
-#define MU_NNTP_RESP_CODE_GROUP_SELECTED 211
-
-#define MU_NNTP_RESP_CODE_LIST_FOLLOW 215
-
-#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_NEWNEWS_FOLLOW 230
-#define MU_NNTP_RESP_CODE_NEWGROUPS_FOLLOW 231
-#define MU_NNTP_RESP_CODE_TRANSFER_OK 235
-
-#define MU_NNTP_RESP_CODE_ARTICLE_RECEIVED 240
-
-#define MU_NNTP_RESP_CODE_TRANSFER_ARTICLE 335
-#define MU_NNTP_RESP_CODE_SEND_ARTICLE 340
-
-#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_ARTICLE_NOT_WANTED 435
-#define MU_NNTP_RESP_CODE_TRANSFER_NOT_POSSIBLE 436
-#define MU_NNTP_RESP_CODE_TRANSFER_REJECTED 437
-#define MU_NNTP_RESP_CODE_POSTING_NOT_PERMITTED 440
-#define MU_NNTP_RESP_CODE_POSTING_FAILED 441
-#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_LIST_ACTIVE, MU_NNTP_LIST_ACTIVE_ACK, MU_NNTP_LIST_ACTIVE_RX,
- MU_NNTP_LIST_ACTIVE_TIMES, MU_NNTP_LIST_ACTIVE_TIMES_ACK, MU_NNTP_LIST_ACTIVE_TIMES_RX,
- MU_NNTP_LIST_DISTRIBUTIONS, MU_NNTP_LIST_DISTRIBUTIONS_ACK, MU_NNTP_LIST_DISTRIBUTIONS_RX,
- MU_NNTP_LIST_DISTRIB_PATS, MU_NNTP_LIST_DISTRIB_PATS_ACK, MU_NNTP_LIST_DISTRIB_PATS_RX,
- MU_NNTP_LIST_NEWSGROUPS, MU_NNTP_LIST_NEWSGROUPS_ACK, MU_NNTP_LIST_NEWSGROUPS_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_DATE, MU_NNTP_DATE_ACK,
- MU_NNTP_HELP, MU_NNTP_HELP_ACK, MU_NNTP_HELP_RX,
- MU_NNTP_NEWGROUPS, MU_NNTP_NEWGROUPS_ACK, MU_NNTP_NEWGROUPS_RX,
- MU_NNTP_NEWNEWS, MU_NNTP_NEWNEWS_ACK, MU_NNTP_NEWNEWS_RX,
- MU_NNTP_POST, MU_NNTP_POST_ACK, MU_NNTP_POST_0, MU_NNTP_POST_1, MU_NNTP_POST_2, MU_NNTP_POST_3,
- MU_NNTP_IHAVE, MU_NNTP_IHAVE_ACK, MU_NNTP_IHAVE_0, MU_NNTP_IHAVE_1, MU_NNTP_IHAVE_2, MU_NNTP_IHAVE_3,
- MU_NNTP_DONE, MU_NNTP_UNKNOWN, MU_NNTP_ERROR
- };
-
-/* Structure holding the data necessary to do proper buffering. */
-struct mu_nntp_work_buf
- {
- char *buf;
- char *ptr;
- char *nl;
- size_t len;
- };
-
-/* Structure holding the data for post. */
-struct mu_nntp_post_buf
- {
- char *buf;
- int sent_crlf;
- size_t nread;
- long offset;
- size_t len;
- };
-
-/* Structure to hold things general to nntp connection, like its state, etc ... */
-struct _mu_nntp
- {
- /* Working I/O buffer.
- io.buf: Working io buffer
- io.ptr: Points to the end of the buffer, the non consumed chars
- io.nl: Points to the '\n' char in the string
- io.len: Len of io_buf. */
- struct mu_nntp_work_buf io;
-
- /* Holds the first line response of the last command, i.e the ACK:
- ack.buf: Buffer for the ack
- ack.ptr: Working pointer, indicate the start of the non consumed chars
- ack.len: Size 512 according to RFC2449. */
- struct mu_nntp_work_buf ack;
- int acknowledge;
-
- /* Holds the buffer/offset etc ... for the article to post. */
- struct mu_nntp_post_buf post;
-
- unsigned timeout; /* Default is 10 minutes. */
-
- enum mu_nntp_state state; /* Indicate the state of the running command. */
-
- mu_stream_t carrier; /* TCP Connection. */
- };
-
-extern int mu_nntp_debug_cmd (mu_nntp_t);
-extern int mu_nntp_debug_ack (mu_nntp_t);
-extern int mu_nntp_iterator_create (mu_nntp_t, mu_iterator_t *iterator);
-extern int mu_nntp_stream_create (mu_nntp_t nntp, mu_stream_t *pstream);
-extern int mu_nntp_carrier_is_ready (mu_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:
- EAGAIN, EINPROGRESS, EINTR.
- For unrecoverable error we reset, by moving the working ptr
- to the begining of the buffer and setting the state to error.
- */
-#define MU_NNTP_CHECK_EAGAIN(nntp, status) \
-do \
- { \
- if (status != 0) \
- { \
- if (status != EAGAIN && status != EINPROGRESS && status != EINTR) \
- { \
- nntp->io.ptr = nntp->io.buf; \
- nntp->state = MU_NNTP_ERROR; \
- } \
- return status; \
- } \
- } \
-while (0)
-
-/* If error return.
- Check status an reset(see MU_NNTP_CHECK_EAGAIN) the buffer.
- */
-#define MU_NNTP_CHECK_ERROR(nntp, status) \
-do \
- { \
- if (status != 0) \
- { \
- nntp->io.ptr = nntp->io.buf; \
- nntp->state = MU_NNTP_ERROR; \
- return status; \
- } \
- } \
-while (0)
-
-/* Check if we got the rigth. In NNTP protocol and ack of "2xx" means the command was completed.
- */
-#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 (mu_nntp_response_code (nntp) != code1 && mu_nntp_response_code (nntp) != code2) \
- { \
- nntp->state = MU_NNTP_NO_STATE; \
- return EACCES; \
- } \
- } \
-while (0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MAILUTILS_SYS_NNTP_H */
diff --git a/libmailutils/base/nullrec.c b/libmailutils/base/nullrec.c
index 82f81f2..393f995 100644
--- a/libmailutils/base/nullrec.c
+++ b/libmailutils/base/nullrec.c
@@ -34,10 +34,6 @@ mu_record_t mu_pop_record = NULL;
mu_record_t mu_pops_record = NULL;
#endif
-#ifndef ENABLE_NNTP
-mu_record_t mu_nntp_record = NULL;
-#endif
-
#ifndef ENABLE_MH
mu_record_t mu_mh_record = NULL;
#endif
diff --git a/libmailutils/base/version.c b/libmailutils/base/version.c
index 6e8ab3b..b2b59f9 100644
--- a/libmailutils/base/version.c
+++ b/libmailutils/base/version.c
@@ -121,9 +121,6 @@ static struct mu_conf_option mu_conf_option[] = {
#ifdef ENABLE_SENDMAIL
{ "ENABLE_SENDMAIL", N_("Sendmail command line interface support")},
#endif
-#ifdef ENABLE_NNTP
- { "ENABLE_NNTP", N_("NNTP protocol support") },
-#endif
#ifdef ENABLE_RADIUS
{ "ENABLE_RADIUS", N_("RADIUS protocol support") },
#endif
diff --git a/libmu_scm/mailutils/Makefile.am b/libmu_scm/mailutils/Makefile.am
index e47da43..1851993 100644
--- a/libmu_scm/mailutils/Makefile.am
+++ b/libmu_scm/mailutils/Makefile.am
@@ -36,10 +36,6 @@ if MU_COND_SUPPORT_IMAP
MU_FEATURES += -DMU_SUPPORT_IMAP
endif
-if MU_COND_SUPPORT_NNTP
- MU_FEATURES += -DMU_SUPPORT_NNTP
-endif
-
if MU_COND_SUPPORT_MH
MU_FEATURES += -DMU_SUPPORT_MH
endif
diff --git a/libproto/Makefile.am b/libproto/Makefile.am
index 3c23326..6e3376b 100644
--- a/libproto/Makefile.am
+++ b/libproto/Makefile.am
@@ -24,10 +24,6 @@ if MU_COND_SUPPORT_IMAP
SUBDIRS += imap
endif
-if MU_COND_SUPPORT_NNTP
- SUBDIRS += nntp
-endif
-
if MU_COND_SUPPORT_MH
SUBDIRS += mh
endif
diff --git a/libproto/nntp/.gitignore b/libproto/nntp/.gitignore
deleted file mode 100644
index a343739..0000000
--- a/libproto/nntp/.gitignore
+++ b/dev/null
@@ -1,9 +0,0 @@
-*.la
-*.lo
-.deps
-.libs
-Makefile
-Makefile.in
-T
-_*
-.gdbinit
diff --git a/libproto/nntp/Makefile.am b/libproto/nntp/Makefile.am
deleted file mode 100644
index d1bd514..0000000
--- a/libproto/nntp/Makefile.am
+++ b/dev/null
@@ -1,59 +0,0 @@
-## This file is part of GNU Mailutils.
-## Copyright (C) 2004-2020 Free Software Foundation, Inc.
-##
-## GNU Mailutils is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License as
-## published by the Free Software Foundation; either version 3, or (at
-## your option) any later version.
-##
-## GNU Mailutils is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-
-AM_CPPFLAGS = $(MU_LIB_COMMON_INCLUDES)
-
-lib_LTLIBRARIES = libmu_nntp.la
-libmu_nntp_la_LDFLAGS=-version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@
-libmu_nntp_la_LIBADD = $(MU_LIB_MAILUTILS)
-libmu_nntp_la_SOURCES = \
- nntp_article.c \
- nntp_body.c \
- nntp_carrier.c \
- nntp_connect.c \
- nntp_create.c \
- nntp_date.c \
- nntp_debug.c \
- nntp_destroy.c \
- nntp_disconnect.c \
- nntp_group.c \
- nntp_head.c \
- nntp_help.c \
- nntp_ihave.c \
- nntp_iterator.c \
- nntp_last.c \
- nntp_list_active.c \
- nntp_list_distribpats.c \
- nntp_list_distributions.c \
- nntp_list_extensions.c \
- nntp_list_newsgroups.c \
- nntp_list_times.c \
- nntp_mode_reader.c \
- nntp_newgroups.c \
- nntp_newnews.c \
- nntp_next.c \
- nntp_post.c \
- nntp_quit.c \
- nntp_readline.c \
- nntp_response.c \
- nntp_sendline.c \
- nntp_stat.c \
- nntp_stream.c \
- nntp_timeout.c \
- nntp0.h \
- url.c \
- folder.c \
- mbox.c
diff --git a/libproto/nntp/folder.c b/libproto/nntp/folder.c
deleted file mode 100644
index e1b47bc..0000000
--- a/libproto/nntp/folder.c
+++ b/dev/null
@@ -1,201 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef ENABLE_NNTP
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-
-#include <mailutils/nntp.h>
-#include <mailutils/errno.h>
-#include <mailutils/mailbox.h>
-#include <mailutils/registrar.h>
-#include <mailutils/url.h>
-
-#include <mailutils/sys/folder.h>
-#include "mailutils/sys/nntp.h"
-
-/* We export url parsing and the initialisation of
- the mailbox, via the register entry/record. */
-
-static struct _mu_record _nntp_record =
-{
- MU_NNTP_PRIO,
- MU_NNTP_URL_SCHEME,
- MU_RECORD_DEFAULT,
- MU_URL_SCHEME | MU_URL_CRED | MU_URL_INET | MU_URL_PATH,
- MU_URL_HOST,
- _nntp_url_init, /* Url init. */
- _nntp_mailbox_init, /* Mailbox init. */
- NULL, /* Mailer init. */
- _nntp_folder_init, /* Folder init. */
- NULL, /* No need for an back pointer. */
- NULL, /* _is_scheme method. */
- NULL, /* _get_url method. */
- NULL, /* _get_mailbox method. */
- NULL, /* _get_mailer method. */
- NULL /* _get_folder method. */
-};
-mu_record_t mu_nntp_record = &_nntp_record;
-
-static int nntp_folder_open (mu_folder_t, int);
-static int nntp_folder_close (mu_folder_t);
-static void nntp_folder_destroy (mu_folder_t folder);
-static int nntp_folder_list (mu_folder_t folder, const char *ref,
- void *name, int flags,
- size_t max,
- mu_list_t flist,
- mu_folder_enumerate_fp efp, void *edp);
-
-int
-_nntp_folder_init (mu_folder_t folder)
-{
- f_nntp_t f_nntp;
-
- f_nntp = folder->data = calloc (1, sizeof (*f_nntp));
- if (f_nntp == NULL)
- return ENOMEM;
-
- f_nntp->folder = folder;
-
- folder->_destroy = nntp_folder_destroy;
-
- folder->_open = nntp_folder_open;
- folder->_close = nntp_folder_close;
-
- folder->_list = nntp_folder_list;
- /* Not supported.
- folder->_lsub = folder_nntp_lsub;
- folder->_subscribe = folder_nntp_subscribe;
- folder->_unsubscribe = folder_nntp_unsubscribe;
- folder->_delete = folder_nntp_delete;
- folder->_rename = folder_nntp_rename;
- */
-
- return 0;
-}
-
-static int
-nntp_folder_open (mu_folder_t folder, int flags)
-{
- f_nntp_t f_nntp = folder->data;
- mu_stream_t carrier = NULL;
- const char *host;
- unsigned port = MU_NNTP_DEFAULT_PORT; /* default nntp port. */
- int status = 0;
-
- /* If we are already open for business, noop. */
- mu_monitor_wrlock (folder->monitor);
- if (f_nntp->isopen)
- {
- mu_monitor_unlock (folder->monitor);
- return 0;
- }
- mu_monitor_unlock (folder->monitor);
-
- /* Fetch the server name and the port in the mu_url_t. */
- status = mu_url_sget_host (folder->url, &host);
- if (status != 0)
- return status;
- mu_url_get_port (folder->url, &port);
-
- folder->flags = flags;
-
- /* Create the networking stack. */
- status = mu_tcp_stream_create (&carrier, host, port, folder->flags);
- if (status != 0)
- return status;
- /* Ask for the stream internal buffering mechanism scheme. */
- mu_stream_setbufsiz (carrier, BUFSIZ);
- mu_debug (MU_DEBCAT_FOLDER, MU_DEBUG_PROT, ("folder_nntp_open (%s:%ld)",
- host, port));
-
- status = mu_nntp_create (&f_nntp->nntp);
- if (status == 0)
- {
- status = mu_nntp_set_carrier (f_nntp->nntp, carrier);
- if (status == 0)
- {
- status = mu_nntp_connect (f_nntp->nntp);
- if (status == 0)
- {
- mu_monitor_wrlock (folder->monitor);
- f_nntp->isopen++;
- mu_monitor_unlock (folder->monitor);
- }
- }
- }
-
- return status;
-}
-
-static int
-nntp_folder_close (mu_folder_t folder)
-{
- f_nntp_t f_nntp = folder->data;
- int status = 0;
-
- mu_monitor_wrlock (folder->monitor);
- f_nntp->isopen--;
- if (f_nntp->isopen)
- {
- mu_monitor_unlock (folder->monitor);
- return 0;
- }
- mu_monitor_unlock (folder->monitor);
- status = mu_nntp_quit (f_nntp->nntp);
- f_nntp->selected = NULL;
- return status;
-
-}
-
-/* Destroy the folder resources. */
-static void
-nntp_folder_destroy (mu_folder_t folder)
-{
- if (folder->data)
- {
- f_nntp_t f_nntp = folder->data;
- if (f_nntp->nntp)
- mu_nntp_destroy (&f_nntp->nntp);
- free (f_nntp);
- folder->data = NULL;
- }
-}
-
-
-static int
-nntp_folder_list (mu_folder_t folder, const char *ref, void *pat, int flags,
- size_t max_depth, mu_list_t flist,
- mu_folder_enumerate_fp efp, void *edp)
-{
- return ENOTSUP;
-}
-#else
-#include <stdio.h>
-#include <mailutils/sys/registrar.h>
-mu_record_t mu_nntp_record = NULL;
-#endif
diff --git a/libproto/nntp/mbox.c b/libproto/nntp/mbox.c
deleted file mode 100644
index 46845f1..0000000
--- a/libproto/nntp/mbox.c
+++ b/dev/null
@@ -1,686 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef ENABLE_NNTP
-
-#include <termios.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdarg.h>
-
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-
-#include <mailutils/md5.h>
-#include <mailutils/body.h>
-#include <mailutils/debug.h>
-#include <mailutils/errno.h>
-#include <mailutils/error.h>
-#include <mailutils/header.h>
-#include <mailutils/message.h>
-#include <mailutils/observer.h>
-#include <mailutils/property.h>
-#include <mailutils/stream.h>
-#include <mailutils/iterator.h>
-#include <mailutils/url.h>
-#include <mailutils/nntp.h>
-
-#include <mailutils/sys/folder.h>
-#include <mailutils/sys/mailbox.h>
-#include "mailutils/sys/nntp.h"
-
-
-/* Functions/Methods that implements the mu_mailbox_t API. */
-static void nntp_mailbox_destroy (mu_mailbox_t);
-static int nntp_mailbox_open (mu_mailbox_t, int);
-static int nntp_mailbox_close (mu_mailbox_t);
-static int nntp_mailbox_get_message (mu_mailbox_t, size_t, mu_message_t *);
-static int nntp_mailbox_messages_count (mu_mailbox_t, size_t *);
-static int nntp_mailbox_scan (mu_mailbox_t, size_t, size_t *);
-/* FIXME
- static int nntp_mailbox_get_size (mu_mailbox_t, mu_off_t *); */
-
-static int nntp_message_get_transport2 (mu_stream_t, mu_transport_t *, mu_transport_t *);
-static int nntp_message_read (mu_stream_t, char *, size_t, mu_off_t, size_t *);
-static int nntp_message_size (mu_message_t, size_t *);
-/* FIXME
- static int nntp_message_line (mu_message_t, size_t *); */
-static int nntp_message_uidl (mu_message_t, char *, size_t, size_t *);
-static int nntp_message_uid (mu_message_t, size_t *);
-
-/* FIXME
- static int nntp_header_get_transport2 (mu_header_t, char *,
- size_t, mu_off_t, size_t *); */
-static int nntp_header_fill (mu_header_t, char *, size_t, mu_off_t, size_t *);
-
-static int nntp_body_get_transport2 (mu_stream_t, mu_transport_t *, mu_transport_t *);
-static int nntp_body_read (mu_stream_t, char *, size_t, mu_off_t, size_t *);
-static int nntp_body_size (mu_body_t, size_t *);
-static int nntp_body_lines (mu_body_t, size_t *);
-
-static int nntp_get_transport2 (msg_nntp_t, mu_transport_t *, mu_transport_t *);
-
-int
-_nntp_mailbox_init (mu_mailbox_t mbox)
-{
- m_nntp_t m_nntp;
- int status = 0;
-
- /* Allocate specifics for nntp data. */
- m_nntp = mbox->data = calloc (1, sizeof (*m_nntp));
- if (mbox->data == NULL)
- return ENOMEM;
-
- /* Get the back pointer of the concrete folder. */
- if (mbox->folder)
- m_nntp->f_nntp = mbox->folder->data;
-
- m_nntp->mailbox = mbox; /* Back pointer. */
-
- /* Retrieve the name of the newsgroup from the URL. */
- status = mu_url_aget_path (mbox->url, &m_nntp->name);
- if (status == MU_ERR_NOENT)
- {
- m_nntp->name = strdup ("INBOX");
- if (!m_nntp->name)
- return ENOMEM;
- }
- else if (status)
- return status;
- else
- {
- char *p;
- p = strchr (m_nntp->name, '/');
- if (p)
- *p = '\0';
- }
-
- /* Initialize the structure. */
- mbox->_destroy = nntp_mailbox_destroy;
-
- mbox->_open = nntp_mailbox_open;
- mbox->_close = nntp_mailbox_close;
-
- /* Messages. */
- mbox->_get_message = nntp_mailbox_get_message;
- mbox->_messages_count = nntp_mailbox_messages_count;
- mbox->_messages_recent = nntp_mailbox_messages_count;
- mbox->_message_unseen = nntp_mailbox_messages_count;
- /*mbox->_expunge = nntp_mailbox_expunge;*/
-
- mbox->_scan = nntp_mailbox_scan;
- /*mbox->_is_updated = nntp_mailbox_is_updated; */
-
- /*mbox->_get_size = nntp_mailbox_get_size; */
-
- /* Set our properties. */
- {
- mu_property_t property = NULL;
- mu_mailbox_get_property (mbox, &property);
- mu_property_set_value (property, "TYPE", "NNTP", 1);
- }
-
- return status;
-}
-
-/* Cleaning up all the ressources associate with a newsgroup/mailbox. */
-static void
-nntp_mailbox_destroy (mu_mailbox_t mbox)
-{
- if (mbox->data)
- {
- m_nntp_t m_nntp = mbox->data;
- f_nntp_t f_nntp = m_nntp->f_nntp;
- size_t i;
-
- /* Deselect. */
- if (m_nntp == f_nntp->selected)
- f_nntp->selected = NULL;
-
- mu_monitor_wrlock (mbox->monitor);
-
- if (m_nntp->name)
- free (m_nntp->name);
-
- /* Destroy the nntp messages and ressources associated to them. */
- for (i = 0; i < m_nntp->messages_count; i++)
- {
- if (m_nntp->messages[i])
- {
- mu_message_destroy (&(m_nntp->messages[i]->message), m_nntp->messages[i]);
- if (m_nntp->messages[i]->mid)
- free (m_nntp->messages[i]->mid);
- free (m_nntp->messages[i]);
- m_nntp->messages[i] = NULL;
- }
- }
- if (m_nntp->messages)
- free (m_nntp->messages);
- free (m_nntp);
- mbox->data = NULL;
- mu_monitor_unlock (mbox->monitor);
- }
-}
-
-/* If the connection was not up it is open by the folder since the stream
- socket is actually created by the folder. It is not necessary
- to set select the mailbox/newsgoup right away, there are maybe on going operations.
- But on any operation by a particular mailbox, it will be selected first. */
-static int
-nntp_mailbox_open (mu_mailbox_t mbox, int flags)
-{
- int status = 0;
- m_nntp_t m_nntp = mbox->data;
- f_nntp_t f_nntp = m_nntp->f_nntp;
- mu_iterator_t iterator;
-
- /* m_nntp must have been created during mailbox initialization. */
- /* assert (mbox->data);
- assert (m_nntp->name); */
-
- mbox->flags = flags;
-
- /* make sure the connection is up. */
- if ((status = mu_folder_open (f_nntp->folder, flags)))
- return status;
-
- mu_nntp_set_debug (f_nntp->nntp, mbox->debug);
-
- /* We might not have to SELECT the newsgroup, but we need to know it
- exists. */
- status = mu_nntp_list_active (f_nntp->nntp, m_nntp->name, &iterator);
- if (status == 0)
- {
- for (mu_iterator_first (iterator);
- !mu_iterator_is_done (iterator); mu_iterator_next (iterator))
- {
- char *buffer = NULL;
- mu_iterator_current (iterator, (void **) &buffer);
- mu_nntp_parse_list_active (buffer, NULL, &m_nntp->high, &m_nntp->low, &m_nntp->status);
- }
- mu_iterator_destroy (&iterator);
- }
- return status;
-}
-
-/* We can not close the folder in term of shuting down the connection but if
- we were the selected mailbox/newsgroup we deselect ourself. */
-static int
-nntp_mailbox_close (mu_mailbox_t mailbox)
-{
- m_nntp_t m_nntp = mailbox->data;
- f_nntp_t f_nntp = m_nntp->f_nntp;
- int i;
-
- mu_monitor_wrlock (mailbox->monitor);
-
- /* Destroy the nntp posts and ressources associated to them. */
- for (i = 0; i < m_nntp->messages_count; i++)
- {
- if (m_nntp->messages[i])
- {
- msg_nntp_t msg_nntp = m_nntp->messages[i];
- if (msg_nntp->message)
- mu_message_destroy (&(msg_nntp->message), msg_nntp);
- }
- free (m_nntp->messages[i]);
- }
- if (m_nntp->messages)
- free (m_nntp->messages);
- m_nntp->messages = NULL;
- m_nntp->messages_count = 0;
- m_nntp->number = 0;
- m_nntp->low = 0;
- m_nntp->high = 0;
- mu_monitor_unlock (mailbox->monitor);
-
- /* Deselect. */
- if (m_nntp != f_nntp->selected)
- f_nntp->selected = NULL;
-
- /* Decrement the ref count. */
- return mu_folder_close (mailbox->folder);
-}
-
-static int
-nntp_mailbox_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *pmsg)
-{
- m_nntp_t m_nntp = mbox->data;
- msg_nntp_t msg_nntp;
- mu_message_t msg = NULL;
- int status;
- size_t i;
-
- /* Sanity. */
- if (pmsg == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- msgno--;
- mu_monitor_rdlock (mbox->monitor);
- /* See if we have already this message. */
- for (i = 0; i < m_nntp->messages_count; i++)
- {
- if (m_nntp->messages[i])
- {
- if (m_nntp->messages[i]->msgno == msgno + m_nntp->low)
- {
- *pmsg = m_nntp->messages[i]->message;
- mu_monitor_unlock (mbox->monitor);
- return 0;
- }
- }
- }
- mu_monitor_unlock (mbox->monitor);
-
- msg_nntp = calloc (1, sizeof (*msg_nntp));
- if (msg_nntp == NULL)
- return ENOMEM;
-
- /* Back pointer. */
- msg_nntp->m_nntp = m_nntp;
- msg_nntp->msgno = msgno + m_nntp->low;
-
- /* Create the message. */
- {
- mu_stream_t stream = NULL;
- if ((status = mu_message_create (&msg, msg_nntp)) != 0
- || (status = mu_stream_create (&stream, mbox->flags, msg)) != 0)
- {
- mu_stream_destroy (&stream, msg);
- mu_message_destroy (&msg, msg_nntp);
- free (msg_nntp);
- return status;
- }
- /* Help for the readline()s */
- mu_stream_set_read (stream, nntp_message_read, msg);
- mu_stream_set_get_transport2 (stream, nntp_message_get_transport2, msg);
- mu_message_set_stream (msg, stream, msg_nntp);
- mu_message_set_size (msg, nntp_message_size, msg_nntp);
- }
-
- /* Create the header. */
- {
- mu_header_t header = NULL;
- if ((status = mu_header_create (&header, NULL, 0, msg)) != 0)
- {
- mu_message_destroy (&msg, msg_nntp);
- free (msg_nntp);
- return status;
- }
- mu_header_set_fill (header, nntp_header_fill, msg);
- mu_message_set_header (msg, header, msg_nntp);
- }
-
- /* Create the body and its stream. */
- {
- mu_body_t body = NULL;
- mu_stream_t stream = NULL;
- if ((status = mu_body_create (&body, msg)) != 0
- || (status = mu_stream_create (&stream, mbox->flags, body)) != 0)
- {
- mu_body_destroy (&body, msg);
- mu_stream_destroy (&stream, body);
- mu_message_destroy (&msg, msg_nntp);
- free (msg_nntp);
- return status;
- }
- /* Helps for the readline()s */
- mu_stream_set_read (stream, nntp_body_read, body);
- mu_stream_set_get_transport2 (stream, nntp_body_get_transport2, body);
- mu_body_set_size (body, nntp_body_size, msg);
- mu_body_set_lines (body, nntp_body_lines, msg);
- mu_body_set_stream (body, stream, msg);
- mu_message_set_body (msg, body, msg_nntp);
- }
-
- /* Set the UID on the message. */
- mu_message_set_uid (msg, nntp_message_uid, msg_nntp);
-
- /* Add it to the list. */
- mu_monitor_wrlock (mbox->monitor);
- {
- msg_nntp_t *m ;
- m = realloc (m_nntp->messages, (m_nntp->messages_count + 1)*sizeof (*m));
- if (m == NULL)
- {
- mu_message_destroy (&msg, msg_nntp);
- free (msg_nntp);
- mu_monitor_unlock (mbox->monitor);
- return ENOMEM;
- }
- m_nntp->messages = m;
- m_nntp->messages[m_nntp->messages_count] = msg_nntp;
- m_nntp->messages_count++;
- }
- mu_monitor_unlock (mbox->monitor);
-
- /* Save The message pointer. */
- mu_message_set_mailbox (msg, mbox, msg_nntp);
- *pmsg = msg_nntp->message = msg;
-
- return 0;
-}
-
-/* There is no explicit call to get the message count. The count is send on
- a "GROUP" command. The function is also use as a way to select newsgoupr by other functions. */
-static int
-nntp_mailbox_messages_count (mu_mailbox_t mbox, size_t *pcount)
-{
- m_nntp_t m_nntp = mbox->data;
- f_nntp_t f_nntp = m_nntp->f_nntp;
- int status = 0;
-
- status = mu_folder_open (mbox->folder, mbox->flags);
- if (status != 0)
- return status;
-
- /* Are we already selected ? */
- if (m_nntp == (f_nntp->selected))
- {
- if (pcount)
- *pcount = m_nntp->number;
- return 0;
- }
-
- /* Put the mailbox as selected. */
- f_nntp->selected = m_nntp;
-
- status = mu_nntp_group (f_nntp->nntp, m_nntp->name, &m_nntp->number, &m_nntp->low, &m_nntp->high, NULL);
-
- if (pcount)
- *pcount = m_nntp->number;
-
- return status;
-}
-
-/* Update and scanning. FIXME: Is not used */
-static int
-nntp_is_updated (mu_mailbox_t mbox)
-{
- return 1;
-}
-
-/* We just simulate by sending a notification for the total msgno. */
-/* FIXME is message is set deleted should we sent a notif ? */
-static int
-nntp_mailbox_scan (mu_mailbox_t mbox, size_t msgno, size_t *pcount)
-{
- int status;
- size_t i;
- size_t count = 0;
-
- /* Select first. */
- status = nntp_mailbox_messages_count (mbox, &count);
- if (pcount)
- *pcount = count;
- if (status != 0)
- return status;
- if (mbox->observable == NULL)
- return 0;
- for (i = msgno; i <= count; i++)
- {
- size_t tmp = i;
- if (mu_observable_notify (mbox->observable, MU_EVT_MESSAGE_ADD,
- &tmp) != 0)
- break;
- if ((i +1) % 10 == 0)
- mu_observable_notify (mbox->observable, MU_EVT_MAILBOX_PROGRESS, NULL);
- }
- return 0;
-}
-
-static int
-nntp_message_size (mu_message_t msg, size_t *psize)
-{
- if (psize)
- *psize = 0;
- return 0;
-}
-
-static int
-nntp_body_size (mu_body_t body, size_t *psize)
-{
- if (psize)
- *psize = 0;
-
- return 0;
-}
-
-/* Not know until the whole message get downloaded. */
-static int
-nntp_body_lines (mu_body_t body, size_t *plines)
-{
- if (plines)
- *plines = 0;
- return 0;
-}
-
-/* Stub to call the fd from body object. */
-static int
-nntp_body_get_transport2 (mu_stream_t stream, mu_transport_t *pin, mu_transport_t *pout)
-{
- mu_body_t body = mu_stream_get_owner (stream);
- mu_message_t msg = mu_body_get_owner (body);
- msg_nntp_t msg_nntp = mu_message_get_owner (msg);
- return nntp_get_transport2 (msg_nntp, pin, pout);
-}
-
-/* Stub to call the fd from message object. */
-static int
-nntp_message_get_transport2 (mu_stream_t stream, mu_transport_t *pin, mu_transport_t *pout)
-{
- mu_message_t msg = mu_stream_get_owner (stream);
- msg_nntp_t msg_nntp = mu_message_get_owner (msg);
- return nntp_get_transport2 (msg_nntp, pin, pout);
-}
-
-static int
-nntp_get_transport2 (msg_nntp_t msg_nntp, mu_transport_t *pin, mu_transport_t *pout)
-{
- int status = EINVAL;
- if (msg_nntp && msg_nntp->m_nntp
- && msg_nntp->m_nntp->f_nntp && msg_nntp->m_nntp->f_nntp->folder)
- {
- mu_stream_t carrier;
- status = mu_nntp_get_carrier (msg_nntp->m_nntp->f_nntp->nntp, &carrier);
- if (status == 0)
- return mu_stream_get_transport2 (carrier, pin, pout);
- }
- return status;
-}
-
-static int
-nntp_message_uid (mu_message_t msg, size_t *puid)
-{
- msg_nntp_t msg_nntp = mu_message_get_owner (msg);
- m_nntp_t m_nntp = msg_nntp->m_nntp;
- int status;
-
- if (puid)
- return 0;
-
- /* Select first. */
- status = nntp_mailbox_messages_count (m_nntp->mailbox, NULL);
- if (status != 0)
- return status;
-
- if (puid)
- *puid = msg_nntp->msgno;
- return 0;
-}
-
-static int
-nntp_message_uidl (mu_message_t msg, char *buffer, size_t buflen,
- size_t *pnwriten)
-{
- msg_nntp_t msg_nntp = mu_message_get_owner (msg);
- m_nntp_t m_nntp = msg_nntp->m_nntp;
- int status = 0;
-
- /* Select first. */
- status = nntp_mailbox_messages_count (m_nntp->mailbox, NULL);
- if (status != 0)
- return status;
-
- if (msg_nntp->mid)
- {
- size_t len = strlen (msg_nntp->mid);
- if (buffer)
- {
- buflen--; /* Leave space for the null. */
- buflen = (len > buflen) ? buflen : len;
- memcpy (buffer, msg_nntp->mid, buflen);
- buffer[buflen] = '\0';
- }
- else
- buflen = len;
- }
- else
- buflen = 0;
-
- if (pnwriten)
- *pnwriten = buflen;
- return status;
-}
-
-/* Message read overload */
-static int
-nntp_message_read (mu_stream_t stream, char *buffer, size_t buflen, mu_off_t offset, size_t *plen)
-{
- mu_message_t msg = mu_stream_get_owner (stream);
- msg_nntp_t msg_nntp = mu_message_get_owner (msg);
- m_nntp_t m_nntp = msg_nntp->m_nntp;
- f_nntp_t f_nntp = m_nntp->f_nntp;
- int status;
- size_t len = 0;
-
- /* Start over. */
- if (plen == NULL)
- plen = &len;
-
- /* Select first. */
- status = nntp_mailbox_messages_count (m_nntp->mailbox, NULL);
- if (status != 0)
- return status;
-
- if (msg_nntp->mstream == NULL)
- {
- status = mu_nntp_article (f_nntp->nntp, msg_nntp->msgno, NULL, &msg_nntp->mid, &msg_nntp->mstream);
- if (status != 0)
- return status;
- }
- status = mu_stream_read (msg_nntp->mstream, buffer, buflen, offset, plen);
- if (status == 0)
- {
- /* Destroy the stream. */
- if (*plen == 0)
- {
- mu_stream_destroy (&msg_nntp->mstream, NULL);
- }
- }
- return status;
-}
-
-/* Message read overload */
-static int
-nntp_body_read (mu_stream_t stream, char *buffer, size_t buflen, mu_off_t offset, size_t *plen)
-{
- mu_body_t body = mu_stream_get_owner (stream);
- mu_message_t msg = mu_body_get_owner (body);
- msg_nntp_t msg_nntp = mu_message_get_owner (msg);
- m_nntp_t m_nntp = msg_nntp->m_nntp;
- f_nntp_t f_nntp = m_nntp->f_nntp;
- int status;
- size_t len = 0;
-
- /* Start over. */
- if (plen == NULL)
- plen = &len;
-
- /* Select first. */
- status = nntp_mailbox_messages_count (m_nntp->mailbox, NULL);
- if (status != 0)
- return status;
-
- if (msg_nntp->bstream == NULL)
- {
- status = mu_nntp_body (f_nntp->nntp, msg_nntp->msgno, NULL, &msg_nntp->mid, &msg_nntp->bstream);
- if (status != 0)
- return status;
- }
- status = mu_stream_read (msg_nntp->bstream, buffer, buflen, offset, plen);
- if (status == 0)
- {
- /* Destroy the stream. */
- if (*plen == 0)
- {
- mu_stream_destroy (&msg_nntp->bstream, NULL);
- }
- }
- return status;
-}
-
-/* Header read overload */
-static int
-nntp_header_fill (mu_header_t header, char *buffer, size_t buflen, mu_off_t offset, size_t *plen)
-{
- mu_message_t msg = mu_header_get_owner (header);
- msg_nntp_t msg_nntp = mu_message_get_owner (msg);
- m_nntp_t m_nntp = msg_nntp->m_nntp;
- f_nntp_t f_nntp = m_nntp->f_nntp;
- int status;
- size_t len = 0;
-
- /* Start over. */
- if (plen == NULL)
- plen = &len;
-
- /* Select first. */
- status = nntp_mailbox_messages_count (m_nntp->mailbox, NULL);
- if (status != 0)
- return status;
-
- if (msg_nntp->hstream == NULL)
- {
- status = mu_nntp_head (f_nntp->nntp, msg_nntp->msgno, NULL, &msg_nntp->mid, &msg_nntp->hstream);
- if (status != 0)
- return status;
- }
- status = mu_stream_read (msg_nntp->hstream, buffer, buflen, offset, plen);
- if (status == 0)
- {
- /* Destroy the stream. */
- if (*plen == 0)
- {
- mu_stream_destroy (&msg_nntp->hstream, NULL);
- }
- }
- return status;
-}
-
-#endif
diff --git a/libproto/nntp/nntp0.h b/libproto/nntp/nntp0.h
deleted file mode 100644
index dced784..0000000
--- a/libproto/nntp/nntp0.h
+++ b/dev/null
@@ -1,92 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-struct _nntp_folder;
-struct _nntp_mailbox;
-struct _nntp_message;
-typedef struct _nntp_folder *f_nntp_t;
-typedef struct _nntp_mailbox *m_nntp_t;
-typedef struct _nntp_message *msg_nntp_t;
-
-extern int _nntp_url_init (mu_url_t);
-extern int _nntp_mailbox_init (mu_mailbox_t);
-extern int _nntp_folder_init (mu_folder_t);
-
-struct _nntp_folder
-{
- /* Refcount. */
- int isopen;
-
- /* Back pointer. */
- mu_folder_t folder;
-
- /* Selected newsgroup. */
- m_nntp_t selected;
-
- /* NNTP object. */
- mu_nntp_t nntp;
-};
-
-struct _nntp_mailbox
-{
- char status;
-
- char *name;
-
- /* Pointer back to the mailbox/newsgroup. */
- mu_mailbox_t mailbox;
-
- /* Our nntp folder. */
- f_nntp_t f_nntp;
-
- /* Read Messages on the newsgroup. */
- msg_nntp_t *messages;
- size_t messages_count;
-
- /* Estimated number of articles in the group. */
- unsigned long number;
- /* High water mark from "GROUP" command */
- unsigned long high;
- /* Low water mark from "GROUP" command */
- unsigned long low;
-};
-
-struct _nntp_message
-{
- /* Back pointer. */
- mu_message_t message;
-
- /* Our nntp folder. */
- m_nntp_t m_nntp;
-
- /* Message id. */
- char *mid;
-
- /* mesgno of the post. */
- unsigned long msgno;
-
- /* Stream for message. */
- mu_stream_t mstream;
- /* Stream for body. */
- mu_stream_t bstream;
- /* Stream for header. */
- mu_stream_t hstream;
-};
diff --git a/libproto/nntp/nntp_article.c b/libproto/nntp/nntp_article.c
deleted file mode 100644
index 2d3f6bf..0000000
--- a/libproto/nntp/nntp_article.c
+++ b/dev/null
@@ -1,141 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_article (mu_nntp_t nntp, unsigned long number, unsigned long *pnum, char **mid, mu_stream_t *pstream)
-{
- int status;
- char *message_id = NULL;
- if (number != 0)
- {
- message_id = malloc (128);
- if (message_id == NULL)
- {
- return ENOMEM;
- }
- snprintf (message_id, 127, "%lu", number);
- }
- status = mu_nntp_article_id (nntp, message_id, pnum, mid, pstream);
- if (message_id)
- {
- free (message_id);
- }
- return status;
-}
-
-int
-mu_nntp_article_id (mu_nntp_t nntp, const char *message_id, unsigned long *pnum, char **mid, mu_stream_t *pstream)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
- if (pstream == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (message_id == NULL || *message_id == '\0')
- {
- status = mu_nntp_writeline (nntp, "ARTICLE\r\n");
- }
- else
- {
- status = mu_nntp_writeline (nntp, "ARTICLE %s\r\n", message_id);
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_ARTICLE;
-
- case MU_NNTP_ARTICLE:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_ARTICLE_ACK;
-
- case MU_NNTP_ARTICLE_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE(nntp, MU_NNTP_RESP_CODE_ARTICLE_FOLLOW);
- nntp->state = MU_NNTP_ARTICLE_RX;
-
- /* parse the answer now. */
- status = mu_nntp_parse_article(nntp, MU_NNTP_RESP_CODE_ARTICLE_FOLLOW, pnum, mid);
- MU_NNTP_CHECK_ERROR (nntp, status);
-
- case MU_NNTP_ARTICLE_RX:
- status = mu_nntp_stream_create (nntp, pstream);
- MU_NNTP_CHECK_ERROR (nntp, status);
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-int
-mu_nntp_parse_article(mu_nntp_t nntp, int code, unsigned long *pnum, char **mid)
-{
- unsigned long dummy = 0;
- char *buf;
- char format[24];
-
- if (pnum == NULL)
- pnum = &dummy;
-
- /* Message ID should not be longer then 250 and smaller then 3. */
- buf = calloc(1, 256);
- if (buf == NULL)
- {
- return ENOMEM;
- }
-
- sprintf (format, "%d %%ld %%%ds", code, 250);
- sscanf (nntp->ack.buf, format, pnum, buf);
- if (*buf == '\0')
- {
- strcpy (buf, "<0>"); /* RFC 977 */
- }
- if (mid)
- {
- *mid = buf;
- }
- else
- {
- free (buf);
- }
- return 0;
-}
diff --git a/libproto/nntp/nntp_body.c b/libproto/nntp/nntp_body.c
deleted file mode 100644
index b1acd27..0000000
--- a/libproto/nntp/nntp_body.c
+++ b/dev/null
@@ -1,108 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_body (mu_nntp_t nntp, unsigned long number, unsigned long *pnum, char **mid, mu_stream_t *pstream)
-{
- int status;
- char *message_id = NULL;
- if (number != 0)
- {
- message_id = malloc (128);
- if (message_id == NULL)
- {
- return ENOMEM;
- }
- snprintf (message_id, 127, "%lu", number);
- }
- status = mu_nntp_body_id (nntp, message_id, pnum, mid, pstream);
- if (message_id)
- {
- free (message_id);
- }
- return status;
-}
-
-int
-mu_nntp_body_id (mu_nntp_t nntp, const char *message_id, unsigned long *pnum, char **mid, mu_stream_t *pstream)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
- if (pstream == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (message_id == 0 || *message_id == '\0')
- {
- status = mu_nntp_writeline (nntp, "BODY\r\n");
- }
- else
- {
- status = mu_nntp_writeline (nntp, "BODY %s\r\n", message_id);
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_BODY;
-
- case MU_NNTP_BODY:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_BODY_ACK;
-
- case MU_NNTP_BODY_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
-
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_BODY_FOLLOW);
-
- /* parse the answer now. */
- status = mu_nntp_parse_article (nntp, MU_NNTP_RESP_CODE_BODY_FOLLOW, pnum, mid);
- MU_NNTP_CHECK_ERROR (nntp, status);
-
- nntp->state = MU_NNTP_BODY_RX;
-
- case MU_NNTP_BODY_RX:
- status = mu_nntp_stream_create (nntp, pstream);
- MU_NNTP_CHECK_ERROR (nntp, status);
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_carrier.c b/libproto/nntp/nntp_carrier.c
deleted file mode 100644
index 48ad18d..0000000
--- a/libproto/nntp/nntp_carrier.c
+++ b/dev/null
@@ -1,55 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_set_carrier (mu_nntp_t nntp, mu_stream_t carrier)
-{
- /* Sanity checks. */
- if (nntp == NULL)
- return EINVAL;
-
- if (nntp->carrier)
- {
- /* Close any old carrier. */
- mu_nntp_disconnect (nntp);
- mu_stream_destroy (&nntp->carrier);
- }
- nntp->carrier = carrier;
- return 0;
-}
-
-int
-mu_nntp_get_carrier (mu_nntp_t nntp, mu_stream_t *pcarrier)
-{
- /* Sanity checks. */
- if (nntp == NULL)
- return EINVAL;
- if (pcarrier == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- *pcarrier = nntp->carrier;
- return 0;
-}
diff --git a/libproto/nntp/nntp_connect.c b/libproto/nntp/nntp_connect.c
deleted file mode 100644
index decba8d..0000000
--- a/libproto/nntp/nntp_connect.c
+++ b/dev/null
@@ -1,87 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-/* Open the connection to the server. */
-int
-mu_nntp_connect (mu_nntp_t nntp)
-{
- int status;
-
- /* Sanity checks. */
- if (nntp == NULL)
- return EINVAL;
-
- /* A networking stack. */
- if (nntp->carrier == NULL)
- return EINVAL;
-
- /* Enter the nntp state machine, and boogy */
- switch (nntp->state)
- {
- default:
- /* FALLTHROUGH */
- /* If nntp was in an error state going through here should clear it. */
-
- case MU_NNTP_NO_STATE:
- status = mu_nntp_disconnect (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->state = MU_NNTP_CONNECT;
-
- case MU_NNTP_CONNECT:
- /* Establish the connection. */
- if (!mu_stream_is_open (nntp->carrier))
- {
- status = mu_stream_open (nntp->carrier);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- }
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_GREETINGS;
-
- case MU_NNTP_GREETINGS:
- /* Get the greetings. */
- {
- size_t len = 0;
- int code;
- status = mu_nntp_response (nntp, NULL, 0, &len);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- /* 200 Service available, posting allowed */
- /* 201 Servie available, posting prohibited */
- code = mu_nntp_response_code(nntp);
- if (code != MU_NNTP_RESP_CODE_POSTING_ALLOWED && code != MU_NNTP_RESP_CODE_POSTING_PROHIBITED)
- {
- mu_stream_close (nntp->carrier);
- nntp->state = MU_NNTP_NO_STATE;
- return EACCES;
- }
- nntp->state = MU_NNTP_NO_STATE;
- }
- } /* End AUTHORISATION state. */
-
- return status;
-}
diff --git a/libproto/nntp/nntp_create.c b/libproto/nntp/nntp_create.c
deleted file mode 100644
index d9d8267..0000000
--- a/libproto/nntp/nntp_create.c
+++ b/dev/null
@@ -1,72 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/errno.h>
-#include <mailutils/sys/nntp.h>
-
-/* Initialise a mu_nntp_t handle. */
-
-int
-mu_nntp_create (mu_nntp_t *pnntp)
-{
- mu_nntp_t nntp;
-
- /* Sanity check. */
- if (pnntp == NULL)
- return EINVAL;
-
- nntp = calloc (1, sizeof *nntp);
- if (nntp == NULL)
- return ENOMEM;
-
- /* Reserve space for the ack(nowledgement) response.
- According to RFC 977: The maximum length of the first line of a
- command response (including the initial greeting) is unchanged at
- 512 octets (including the terminating CRLF). */
- nntp->ack.len = 512;
- nntp->ack.buf = calloc (nntp->ack.len, 1);
- if (nntp->ack.buf == NULL)
- {
- mu_nntp_destroy (&nntp);
- return ENOMEM;
- }
- nntp->ack.ptr = nntp->ack.buf;
-
- /* Reserve space for the data response/content.
- RFC 977 recommands 255, but we grow it as needed. */
- nntp->io.len = 255;
- nntp->io.buf = calloc (nntp->io.len, 1);
- if (nntp->io.buf == NULL)
- {
- mu_nntp_destroy (&nntp);
- return ENOMEM;
- }
- nntp->io.ptr = nntp->io.buf;
-
- nntp->state = MU_NNTP_NO_STATE; /* Init with no state. */
- nntp->timeout = (10 * 60) * 100; /* The default Timeout is 10 minutes. */
- nntp->acknowledge = 0; /* No Ack received. */
-
- *pnntp = nntp;
- return 0; /* Okdoke. */
-}
diff --git a/libproto/nntp/nntp_date.c b/libproto/nntp/nntp_date.c
deleted file mode 100644
index 22d3988..0000000
--- a/libproto/nntp/nntp_date.c
+++ b/dev/null
@@ -1,100 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-static int
-mu_nntp_parse_date (mu_nntp_t nntp, int code, unsigned int *year, unsigned int *month, unsigned int *day,
- unsigned int *hour, unsigned int *min, unsigned int *sec);
-
-int
-mu_nntp_date (mu_nntp_t nntp, unsigned int *year, unsigned int *month, unsigned int *day,
- unsigned int *hour, unsigned int *min, unsigned int *sec)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "DATE\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_DATE;
-
- case MU_NNTP_DATE:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_DATE_ACK;
-
- case MU_NNTP_DATE_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE(nntp, MU_NNTP_RESP_CODE_SERVER_DATE);
- nntp->state = MU_NNTP_NO_STATE;
-
- /* parse the answer now. */
- status = mu_nntp_parse_date(nntp, MU_NNTP_RESP_CODE_SERVER_DATE, year, month, day, hour, min, sec);
- MU_NNTP_CHECK_ERROR (nntp, status);
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-static int
-mu_nntp_parse_date (mu_nntp_t nntp, int code, unsigned int *year, unsigned int *month, unsigned int *day,
- unsigned int *hour, unsigned int *min, unsigned int *sec)
-{
- unsigned int dummy = 0;
- char format[32];
-
- if (year == NULL)
- year = &dummy;
- if (month == NULL)
- month = &dummy;
- if (day == NULL)
- day = &dummy;
- if (hour == NULL)
- hour = &dummy;
- if (min == NULL)
- min = &dummy;
- if (sec == NULL)
- sec = &dummy;
-
- sprintf (format, "%d %%4d%%2d%%2d%%2d%%2d%%2d", code);
- sscanf (nntp->ack.buf, format, year, month, day, hour, min, sec);
- return 0;
-}
diff --git a/libproto/nntp/nntp_debug.c b/libproto/nntp/nntp_debug.c
deleted file mode 100644
index e2b113f..0000000
--- a/libproto/nntp/nntp_debug.c
+++ b/dev/null
@@ -1,38 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_debug_cmd (mu_nntp_t nntp)
-{
- mu_debug (MU_DEBCAT_FOLDER, MU_DEBUG_PROT, ("%s", nntp->io.buf));
- return 0;
-}
-
-int
-mu_nntp_debug_ack (mu_nntp_t nntp)
-{
- mu_debug (MU_DEBCAT_FOLDER, MU_DEBUG_PROT, "%s", nntp->ack.buf);
- return 0;
-}
diff --git a/libproto/nntp/nntp_destroy.c b/libproto/nntp/nntp_destroy.c
deleted file mode 100644
index 7d0383d..0000000
--- a/libproto/nntp/nntp_destroy.c
+++ b/dev/null
@@ -1,52 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <mailutils/errno.h>
-#include <mailutils/sys/nntp.h>
-
-void
-mu_nntp_destroy (mu_nntp_t *pnntp)
-{
- if (pnntp && *pnntp)
- {
- mu_nntp_t nntp = *pnntp;
-
- /* Free the response buffer. */
- if (nntp->ack.buf)
- free (nntp->ack.buf);
-
- /* Free the io buffer. */
- if (nntp->io.buf)
- free (nntp->io.buf);
-
- /* Release the carrier. */
- if (nntp->carrier)
- mu_stream_destroy (&nntp->carrier);
-
- /* Any posting residue. */
- if (nntp->post.buf)
- free (nntp->post.buf);
- free (nntp);
-
- *pnntp = NULL;
- }
-}
diff --git a/libproto/nntp/nntp_disconnect.c b/libproto/nntp/nntp_disconnect.c
deleted file mode 100644
index b480e36..0000000
--- a/libproto/nntp/nntp_disconnect.c
+++ b/dev/null
@@ -1,47 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_disconnect (mu_nntp_t nntp)
-{
- /* Sanity checks. */
- if (nntp == NULL)
- return EINVAL;
-
- /* We can keep some of the fields, if they decide to nntp_connect() again but
- clear the states. */
- nntp->state = MU_NNTP_NO_STATE;
- nntp->acknowledge = 0;
-
- /* Clear the buffers. */
- memset (nntp->io.buf, '\0', nntp->io.len);
- nntp->io.ptr = nntp->io.buf;
- memset (nntp->ack.buf, '\0', nntp->ack.len);
- nntp->ack.ptr = nntp->ack.buf;
-
- /* Close the stream. */
- return mu_stream_close (nntp->carrier);
-}
diff --git a/libproto/nntp/nntp_group.c b/libproto/nntp/nntp_group.c
deleted file mode 100644
index c0f28ce..0000000
--- a/libproto/nntp/nntp_group.c
+++ b/dev/null
@@ -1,109 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <mailutils/sys/nntp.h>
-
-static int mu_nntp_parse_group(mu_nntp_t nntp, int code, unsigned long *ptotal, unsigned long *plow, unsigned long *phigh, char **name);
-
-int
-mu_nntp_group (mu_nntp_t nntp, const char *group, unsigned long *total, unsigned long *low, unsigned long *high, char **name)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
- if (group == NULL || *group == '\0')
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "GROUP %s\r\n", group);
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_GROUP;
-
- case MU_NNTP_GROUP:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_GROUP_ACK;
-
- case MU_NNTP_GROUP_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_GROUP_SELECTED);
- nntp->state = MU_NNTP_NO_STATE;
-
- /* parse group. */
- status = mu_nntp_parse_group (nntp, MU_NNTP_RESP_CODE_GROUP_SELECTED, total, low, high, name);
- MU_NNTP_CHECK_ERROR (nntp, status);
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-static int
-mu_nntp_parse_group(mu_nntp_t nntp, int code, unsigned long *ptotal, unsigned long *plow, unsigned long *phigh, char **name)
-{
- unsigned long dummy = 0;
- char *buf;
- char format[24];
-
- if (ptotal == NULL)
- ptotal = &dummy;
- if (plow == NULL)
- plow = &dummy;
- if (phigh == NULL)
- phigh = &dummy;
-
- /* An nntp response is not longer then 512. */
- buf = calloc(1, 512);
- if (buf == NULL)
- {
- return ENOMEM;
- }
-
- sprintf (format, "%d %%d %%d %%d %%%ds", code, 511);
- sscanf (nntp->ack.buf, format, ptotal, plow, phigh, buf);
- if (name)
- {
- *name = buf;
- }
- else
- {
- free (buf);
- }
- return 0;
-}
diff --git a/libproto/nntp/nntp_head.c b/libproto/nntp/nntp_head.c
deleted file mode 100644
index e50a8c4..0000000
--- a/libproto/nntp/nntp_head.c
+++ b/dev/null
@@ -1,106 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_head (mu_nntp_t nntp, unsigned long number, unsigned long *pnum, char **mid, mu_stream_t *pstream)
-{
- int status;
- char *message_id = NULL;
- if (number != 0)
- {
- message_id = malloc (128);
- if (message_id == NULL)
- {
- return ENOMEM;
- }
- snprintf (message_id, 127, "%lu", number);
- }
- status = mu_nntp_head_id (nntp, message_id, pnum, mid, pstream);
- if (message_id)
- {
- free (message_id);
- }
- return status;
-}
-
-int
-mu_nntp_head_id (mu_nntp_t nntp, const char *message_id, unsigned long *pnum, char **mid, mu_stream_t *pstream)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
- if (pstream == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (message_id == NULL || *message_id == '\0')
- {
- status = mu_nntp_writeline (nntp, "HEAD\r\n");
- }
- else
- {
- status = mu_nntp_writeline (nntp, "HEAD %s\r\n", message_id);
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_HEAD;
-
- case MU_NNTP_HEAD:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_HEAD_ACK;
-
- case MU_NNTP_HEAD_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_HEAD_FOLLOW);
- nntp->state = MU_NNTP_HEAD_RX;
-
- /* parse the answer now. */
- status = mu_nntp_parse_article (nntp, MU_NNTP_RESP_CODE_HEAD_FOLLOW, pnum, mid);
- MU_NNTP_CHECK_ERROR (nntp, status);
-
- case MU_NNTP_HEAD_RX:
- status = mu_nntp_stream_create (nntp, pstream);
- MU_NNTP_CHECK_ERROR (nntp, status);
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_help.c b/libproto/nntp/nntp_help.c
deleted file mode 100644
index f40da15..0000000
--- a/libproto/nntp/nntp_help.c
+++ b/dev/null
@@ -1,74 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_help (mu_nntp_t nntp, mu_stream_t *pstream)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- if (pstream == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "HELP\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_HELP;
-
- case MU_NNTP_HELP:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_HELP_ACK;
-
- case MU_NNTP_HELP_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
-
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_HELP_FOLLOW);
- nntp->state = MU_NNTP_HELP_RX;
-
- case MU_NNTP_HELP_RX:
- status = mu_nntp_stream_create (nntp, pstream);
- MU_NNTP_CHECK_ERROR (nntp, status);
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_ihave.c b/libproto/nntp/nntp_ihave.c
deleted file mode 100644
index 767d7b9..0000000
--- a/libproto/nntp/nntp_ihave.c
+++ b/dev/null
@@ -1,151 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_ihave (mu_nntp_t nntp, const char *mid, mu_stream_t stream)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "IHAVE %s\r\n", mid);
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_IHAVE;
-
- case MU_NNTP_IHAVE:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_IHAVE_ACK;
-
- case MU_NNTP_IHAVE_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_TRANSFER_ARTICLE);
- if (nntp->post.buf != NULL)
- {
- free (nntp->post.buf);
- }
- nntp->post.buf = calloc (1, 256);
- if (nntp->post.buf == NULL)
- {
- MU_NNTP_CHECK_ERROR (nntp, ENOMEM);
- }
- nntp->post.len = 256;
- nntp->post.offset = 0;
- nntp->post.nread = 0;
- nntp->post.sent_crlf = 0;
- nntp->state = MU_NNTP_IHAVE_0;
-
- ihave_loop:
- case MU_NNTP_IHAVE_0:
- status = mu_stream_readline (stream, nntp->post.buf, nntp->post.len,
- &nntp->post.nread);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- if (nntp->post.nread > 0)
- {
- if (nntp->post.buf[nntp->post.nread - 1] == '\n')
- {
- nntp->post.buf[nntp->post.nread - 1] = '\0';
- if (nntp->post.sent_crlf && nntp->post.buf[0] == '.')
- {
- status = mu_nntp_writeline (nntp, ".%s\r\n", nntp->post.buf);
- }
- else
- {
- status = mu_nntp_writeline (nntp, "%s\r\n", nntp->post.buf);
- }
- nntp->post.sent_crlf = 1;
- }
- else
- {
- if (nntp->post.sent_crlf && nntp->post.buf[0] == '.')
- {
- status = mu_nntp_writeline (nntp, ".%s", nntp->post.buf);
- }
- else
- {
- status = mu_nntp_writeline (nntp, "%s", nntp->post.buf);
- }
- nntp->post.sent_crlf = 0;
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- }
- nntp->state = MU_NNTP_IHAVE_1;
-
- case MU_NNTP_IHAVE_1:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- if (nntp->post.nread > 0)
- {
- goto ihave_loop;
- }
- if (nntp->post.sent_crlf)
- status = mu_nntp_writeline (nntp, ".\r\n");
- else
- status = mu_nntp_writeline (nntp, "\r\n.\r\n");
- if (nntp->post.buf != NULL)
- {
- free (nntp->post.buf);
- nntp->post.buf = NULL;
- nntp->post.len = 0;
- nntp->post.offset = 0;
- nntp->post.nread = 0;
- nntp->post.sent_crlf = 0;
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- nntp->state = MU_NNTP_IHAVE_2;
-
- case MU_NNTP_POST_2:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->state = MU_NNTP_IHAVE_3;
-
- case MU_NNTP_POST_3:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_TRANSFER_OK);
- nntp->state = MU_NNTP_NO_STATE;
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_iterator.c b/libproto/nntp/nntp_iterator.c
deleted file mode 100644
index d7f2ef6..0000000
--- a/libproto/nntp/nntp_iterator.c
+++ b/dev/null
@@ -1,185 +0,0 @@
-/* GNU mailutils - a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- GNU Mailutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Library Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- GNU Mailutils is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <strings.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-#include <mailutils/iterator.h>
-
-static int nntp_itr_dup (void **ptr, void *owner);
-static int nntp_itr_destroy (mu_iterator_t itr, void *owner);
-static int nntp_itr_first (void *owner);
-static int nntp_itr_next (void *woner);
-static int nntp_itr_getitem (void *owner, void **pret, const void **pkey);
-static int nntp_itr_curitem_p (void *owner, void *data);
-static int nntp_itr_finished_p (void *owner);
-
-struct nntp_iterator
-{
- mu_nntp_t nntp;
- int done;
- char *item;
-};
-
-int
-mu_nntp_iterator_create (mu_nntp_t nntp, mu_iterator_t *piterator)
-{
- struct nntp_iterator *nntp_iterator;
- mu_iterator_t iterator;
- int status;
-
- nntp_iterator = malloc (sizeof *nntp_iterator);
- if (nntp_iterator == NULL)
- return ENOMEM;
-
- nntp_iterator->item = NULL;
- nntp_iterator->done = 0;
- nntp_iterator->nntp= nntp;
-
- status = mu_iterator_create (&iterator, nntp_iterator);
- if (status != 0)
- {
- free (nntp_iterator);
- return status;
- }
- mu_iterator_set_first (iterator, nntp_itr_first);
- mu_iterator_set_next (iterator, nntp_itr_next);
- mu_iterator_set_getitem (iterator, nntp_itr_getitem);
- mu_iterator_set_finished_p (iterator, nntp_itr_finished_p);
- mu_iterator_set_curitem_p (iterator, nntp_itr_curitem_p);
- mu_iterator_set_destroy (iterator, nntp_itr_destroy);
- mu_iterator_set_dup (iterator, nntp_itr_dup);
-
- *piterator = iterator;
- return 0;
-}
-
-static int
-nntp_itr_dup (void **ptr, void *owner)
-{
- struct nntp_iterator *nntp_iterator = (struct nntp_iterator *)owner;
- struct nntp_iterator *clone = malloc (sizeof *nntp_iterator);
- if (clone == NULL)
- return ENOMEM;
- /* let the assignement operator copy the elements. */
- *clone = *nntp_iterator;
- *ptr = clone;
- return 0;
-}
-
-static int
-nntp_itr_destroy (mu_iterator_t iterator, void *owner)
-{
- struct nntp_iterator *nntp_iterator = (struct nntp_iterator *)owner;
- /* Delicate situation if they did not finish to drain the result
- We take te approach to do it for the user. FIXME: Not sure
- if this is the rigth thing to do. The other way is to close the stream */
- if (!nntp_iterator->done)
- {
- char buf[128];
- size_t n = 0;
- while (mu_nntp_readline (nntp_iterator->nntp, buf, sizeof buf, &n) > 0 && n > 0)
- n = 0;
- }
- if (nntp_iterator->item)
- free (nntp_iterator->item);
- nntp_iterator->nntp->state = MU_NNTP_NO_STATE;
- free (nntp_iterator);
- return 0;
-}
-
-static int
-nntp_itr_first (void *data)
-{
- return nntp_itr_next (data);
-}
-
-static int
-nntp_itr_next (void *owner)
-{
- struct nntp_iterator *nntp_iterator = (struct nntp_iterator *)owner;
- size_t n = 0;
- int status = 0;
-
- if (!nntp_iterator->done)
- {
- /* The first readline will not consume the buffer, we just need to
- know how much to read. */
- status = mu_nntp_readline (nntp_iterator->nntp, NULL, 0, &n);
- if (status == 0)
- {
- if (n)
- {
- char *buf;
- buf = calloc (n + 1, 1);
- if (buf)
- {
- /* Consume. */
- mu_nntp_readline (nntp_iterator->nntp, buf, n + 1, NULL);
- if (buf[n - 1] == '\n')
- buf[n - 1] = '\0';
- if (nntp_iterator->item)
- free (nntp_iterator->item);
- nntp_iterator->item = buf;
- }
- else
- status = ENOMEM;
- }
- else
- {
- nntp_iterator->done = 1;
- nntp_iterator->nntp->state = MU_NNTP_NO_STATE;
- }
- }
- }
- return status;
-}
-
-static int
-nntp_itr_getitem (void *owner, void **item, const void **pkey)
-{
- struct nntp_iterator *nntp_iterator = (struct nntp_iterator *)owner;
- if (item)
- {
- *((char **)item) = nntp_iterator->item;
- nntp_iterator->item = NULL;
- }
- if (pkey)
- *pkey = NULL;
- return 0;
-}
-
-static int
-nntp_itr_finished_p (void *owner)
-{
- struct nntp_iterator *nntp_iterator = (struct nntp_iterator *)owner;
- return nntp_iterator->done;
-}
-
-static int
-nntp_itr_curitem_p (void *owner, void *item)
-{
- struct nntp_iterator *nntp_iterator = (struct nntp_iterator *)owner;
- return *((char **)item) == nntp_iterator->item;
-}
diff --git a/libproto/nntp/nntp_last.c b/libproto/nntp/nntp_last.c
deleted file mode 100644
index 020f1a5..0000000
--- a/libproto/nntp/nntp_last.c
+++ b/dev/null
@@ -1,72 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_last (mu_nntp_t nntp, unsigned long *number, char **mid)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "LAST\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_LAST;
-
- case MU_NNTP_LAST:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_LAST_ACK;
-
- case MU_NNTP_LAST_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_ARTICLE_FOUND);
- nntp->state = MU_NNTP_NO_STATE;
-
- status = mu_nntp_parse_article (nntp, MU_NNTP_RESP_CODE_ARTICLE_FOUND, number, mid);
- MU_NNTP_CHECK_ERROR (nntp, status);
-
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
diff --git a/libproto/nntp/nntp_list_active.c b/libproto/nntp/nntp_list_active.c
deleted file mode 100644
index 6d025ce..0000000
--- a/libproto/nntp/nntp_list_active.c
+++ b/dev/null
@@ -1,113 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/error.h>
-#include <mailutils/sys/nntp.h>
-
-/*
- LIST EXTENSIONS command, return a iterator that contains the result.
- It is the responsability of the caller to destroy the iterator(mu_iterator_destroy).
- */
-int
-mu_nntp_list_active (mu_nntp_t nntp, const char *wildmat, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
- if (piterator == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (wildmat == NULL || *wildmat == '\0')
- status = mu_nntp_writeline (nntp, "LIST ACTIVE\r\n");
- else
- status = mu_nntp_writeline (nntp, "LIST ACTIVE %s\r\n", wildmat);
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_LIST_ACTIVE;
-
- case MU_NNTP_LIST_ACTIVE:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_LIST_ACTIVE_ACK;
-
- case MU_NNTP_LIST_ACTIVE_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_LIST_FOLLOW);
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_LIST_ACTIVE_RX;
-
- case MU_NNTP_LIST_ACTIVE_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-int
-mu_nntp_parse_list_active (const char *buffer, char **group, unsigned long *high, unsigned long *low, char *status)
-{
- unsigned long dummy;
- char cdummy;
- char *name;
-
- if (buffer == NULL || *buffer == '\0')
- return EINVAL;
-
- name = calloc(512, 1);
- if (name == NULL)
- return ENOMEM;
-
- if (high == NULL)
- high = &dummy;
- if (low == NULL)
- low = &dummy;
- if (status == NULL)
- status = &cdummy;
-
- sscanf (buffer, "%511s %ld %ld %c", name, high, low, status);
-
- if (group == NULL)
- free (name);
- else
- *group = name;
- return 0;
-}
diff --git a/libproto/nntp/nntp_list_distribpats.c b/libproto/nntp/nntp_list_distribpats.c
deleted file mode 100644
index 2c877d7..0000000
--- a/libproto/nntp/nntp_list_distribpats.c
+++ b/dev/null
@@ -1,118 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/error.h>
-#include <mailutils/sys/nntp.h>
-
-/*
- LIST xxxx command, return an iterator that contains the result.
- It is the responsability of the caller to destroy the iterator(mu_iterator_destroy).
- */
-int
-mu_nntp_list_distrib_pats (mu_nntp_t nntp, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
- if (piterator == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "LIST DISTRIB.PATS\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_LIST_DISTRIB_PATS;
-
- case MU_NNTP_LIST_DISTRIB_PATS:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_LIST_DISTRIB_PATS_ACK;
-
- case MU_NNTP_LIST_DISTRIB_PATS_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_LIST_FOLLOW);
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_LIST_DISTRIB_PATS_RX;
-
- case MU_NNTP_LIST_DISTRIB_PATS_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-int
-mu_nntp_parse_list_distrib_pats (const char *buffer, unsigned long *weight, char **wildmat, char **distrib)
-{
- char *w;
- char *d;
- unsigned long dummy;
-
- if (buffer == NULL || *buffer == '\0')
- return EINVAL;
-
- w = calloc(512, 1);
- if (w == NULL)
- return ENOMEM;
-
- d = calloc(512, 1);
- if (d == NULL)
- {
- free (w);
- return ENOMEM;
- }
-
- if (weight == NULL)
- weight = &dummy;
-
- sscanf (buffer, "%ld:%511s:%511s", weight, w, d);
-
- if (wildmat == NULL)
- free (w);
- else
- *wildmat = w;
-
- if (distrib == NULL)
- free (d);
- else
- *distrib = d;
- return 0;
-}
diff --git a/libproto/nntp/nntp_list_distributions.c b/libproto/nntp/nntp_list_distributions.c
deleted file mode 100644
index 2cbed57..0000000
--- a/libproto/nntp/nntp_list_distributions.c
+++ b/dev/null
@@ -1,117 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/error.h>
-#include <mailutils/sys/nntp.h>
-
-/*
- LIST xxxx command, return an iterator that contains the result.
- It is the responsability of the caller to destroy the iterator(mu_iterator_destroy).
- */
-int
-mu_nntp_list_distributions (mu_nntp_t nntp, const char *wildmat, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
- if (piterator == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (wildmat == NULL || *wildmat == '\0')
- status = mu_nntp_writeline (nntp, "LIST DISTRIBUTIONS\r\n");
- else
- status = mu_nntp_writeline (nntp, "LIST DISTRIBUTIONS %s\r\n", wildmat);
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_LIST_DISTRIBUTIONS;
-
- case MU_NNTP_LIST_DISTRIBUTIONS:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_LIST_DISTRIBUTIONS_ACK;
-
- case MU_NNTP_LIST_DISTRIBUTIONS_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_LIST_FOLLOW);
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_LIST_DISTRIBUTIONS_RX;
-
- case MU_NNTP_LIST_DISTRIBUTIONS_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-int
-mu_nntp_parse_list_distributions (const char *buffer, char **key, char **value)
-{
- char *k;
- char *v;
-
- if (buffer == NULL || *buffer == '\0')
- return EINVAL;
-
- k = calloc(512, 1);
- if (k == NULL)
- return ENOMEM;
-
- v = calloc(512, 1);
- if (v == NULL)
- {
- free (k);
- return ENOMEM;
- }
-
- sscanf (buffer, "%511s %511s", k, v);
-
- if (key == NULL)
- free (k);
- else
- *key = k;
-
- if (value == NULL)
- free (v);
- else
- *value = v;
- return 0;
-}
diff --git a/libproto/nntp/nntp_list_extensions.c b/libproto/nntp/nntp_list_extensions.c
deleted file mode 100644
index 73892ae..0000000
--- a/libproto/nntp/nntp_list_extensions.c
+++ b/dev/null
@@ -1,80 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/error.h>
-#include <mailutils/sys/nntp.h>
-
-/*
- LIST EXTENSIONS command, return an iterator that contains the result.
- It is the responsability of the caller to destroy the iterator(mu_iterator_destroy).
- */
-int
-mu_nntp_list_extensions (mu_nntp_t nntp, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
- if (piterator == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "LIST EXTENSIONS\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_LIST_EXTENSIONS;
-
- case MU_NNTP_LIST_EXTENSIONS:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_LIST_EXTENSIONS_ACK;
-
- case MU_NNTP_LIST_EXTENSIONS_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_EXTENSIONS_FOLLOW);
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_LIST_EXTENSIONS_RX;
-
- case MU_NNTP_LIST_EXTENSIONS_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_list_newsgroups.c b/libproto/nntp/nntp_list_newsgroups.c
deleted file mode 100644
index 0409cc9..0000000
--- a/libproto/nntp/nntp_list_newsgroups.c
+++ b/dev/null
@@ -1,117 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/error.h>
-#include <mailutils/sys/nntp.h>
-
-/*
- LIST NEWSGROUPS command, return an iterator that contains the result.
- It is the responsability of the caller to destroy the iterator(mu_iterator_destroy).
- */
-int
-mu_nntp_list_newsgroups (mu_nntp_t nntp, const char *wildmat, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
- if (piterator == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (wildmat == NULL || *wildmat == '\0')
- status = mu_nntp_writeline (nntp, "LIST NEWSGROUPS\r\n");
- else
- status = mu_nntp_writeline (nntp, "LIST NEWSGROUPS %s\r\n", wildmat);
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_LIST_NEWSGROUPS;
-
- case MU_NNTP_LIST_NEWSGROUPS:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_LIST_NEWSGROUPS_ACK;
-
- case MU_NNTP_LIST_NEWSGROUPS_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_LIST_FOLLOW);
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_LIST_NEWSGROUPS_RX;
-
- case MU_NNTP_LIST_NEWSGROUPS_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-int
-mu_nntp_parse_list_newsgroups (const char *buffer, char **group, char **description)
-{
- char *name;
- char *desc;
-
- if (buffer == NULL || *buffer == '\0')
- return EINVAL;
-
- name = calloc(512, 1);
- if (name == NULL)
- return ENOMEM;
-
- desc = calloc(512, 1);
- if (desc == NULL)
- {
- free (name);
- return ENOMEM;
- }
-
- sscanf (buffer, "%511s %511s", name, desc);
-
- if (group == NULL)
- free (name);
- else
- *group = name;
-
- if (description == NULL)
- free (desc);
- else
- *description = desc;
- return 0;
-}
diff --git a/libproto/nntp/nntp_list_times.c b/libproto/nntp/nntp_list_times.c
deleted file mode 100644
index c0f474d..0000000
--- a/libproto/nntp/nntp_list_times.c
+++ b/dev/null
@@ -1,122 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/error.h>
-#include <mailutils/sys/nntp.h>
-
-/*
- LIST EXTENSIONS command, return an iterator that contains the result.
- It is the responsability of the caller to destroy the iterator(mu_iterator_destroy).
- */
-int
-mu_nntp_list_active_times (mu_nntp_t nntp, const char *wildmat, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
- if (piterator == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (wildmat == NULL || *wildmat == '\0')
- status = mu_nntp_writeline (nntp, "LIST ACTIVE.TIMES\r\n");
- else
- status = mu_nntp_writeline (nntp, "LIST ACTIVE.TIMES %s\r\n", wildmat);
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_LIST_ACTIVE_TIMES;
-
- case MU_NNTP_LIST_ACTIVE_TIMES:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_LIST_ACTIVE_TIMES_ACK;
-
- case MU_NNTP_LIST_ACTIVE_TIMES_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_LIST_FOLLOW);
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_LIST_ACTIVE_TIMES_RX;
-
- case MU_NNTP_LIST_ACTIVE_TIMES_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-int
-mu_nntp_parse_list_active_times (const char *buffer, char **group, unsigned long *time, char **creator)
-{
- unsigned long dummy;
- char *name;
- char *owner;
-
- if (buffer == NULL || *buffer == '\0')
- return EINVAL;
-
- name = calloc(512, 1);
- if (name == NULL)
- return ENOMEM;
-
- owner = calloc(512, 1);
- if (owner == NULL)
- {
- free (name);
- return ENOMEM;
- }
-
- if (time == NULL)
- time = &dummy;
-
- sscanf (buffer, "%511s %ld %511s", name, time, owner);
-
- if (group == NULL)
- free (name);
- else
- *group = name;
-
- if (creator == NULL)
- free (owner);
- else
- *creator = owner;
-
- return 0;
-}
diff --git a/libproto/nntp/nntp_mode_reader.c b/libproto/nntp/nntp_mode_reader.c
deleted file mode 100644
index f9eae25..0000000
--- a/libproto/nntp/nntp_mode_reader.c
+++ b/dev/null
@@ -1,66 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_mode_reader (mu_nntp_t nntp)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "MODE READER\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_MODE_READER;
-
- case MU_NNTP_MODE_READER:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_MODE_READER_ACK;
-
- case MU_NNTP_MODE_READER_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE2(nntp, MU_NNTP_RESP_CODE_POSTING_ALLOWED, MU_NNTP_RESP_CODE_POSTING_PROHIBITED);
- nntp->state = MU_NNTP_NO_STATE;
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_newgroups.c b/libproto/nntp/nntp_newgroups.c
deleted file mode 100644
index c96f30a..0000000
--- a/libproto/nntp/nntp_newgroups.c
+++ b/dev/null
@@ -1,82 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_newgroups (mu_nntp_t nntp, unsigned int year, unsigned int month, unsigned int day,
- unsigned int hour, unsigned int minute, unsigned int second, int is_gmt, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (is_gmt > 0)
- status = mu_nntp_writeline (nntp, "NEWGROUPS %.4d%.2d%.2d %.2d%.2d%.2d GMT\r\n", year, month, day, hour, minute, second);
- else
- status = mu_nntp_writeline (nntp, "NEWGROUPS %.4d%.2d%.2d %.2d%.2d%.2d\r\n", year, month, day, hour, minute, second);
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_NEWGROUPS;
-
- case MU_NNTP_NEWGROUPS:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_NEWGROUPS_ACK;
-
- case MU_NNTP_NEWGROUPS_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_NEWGROUPS_FOLLOW);
-
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_NEWGROUPS_RX;
-
- case MU_NNTP_NEWGROUPS_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
-int
-mu_nntp_parse_newgroups (const char *buffer, char **group, unsigned long *high, unsigned long *low, char *status)
-{
- return mu_nntp_parse_list_active (buffer, group, high, low, status);
-}
diff --git a/libproto/nntp/nntp_newnews.c b/libproto/nntp/nntp_newnews.c
deleted file mode 100644
index 4f88f6c..0000000
--- a/libproto/nntp/nntp_newnews.c
+++ b/dev/null
@@ -1,92 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_newnews (mu_nntp_t nntp, const char *wildmat, unsigned int year, unsigned int month, unsigned int day,
- unsigned int hour, unsigned int minute, unsigned int second, int is_gmt, mu_iterator_t *piterator)
-{
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (wildmat == NULL || *wildmat == '\0')
- {
- if (is_gmt > 0)
- status = mu_nntp_writeline (nntp, "NEWNEWS %.4d%.2d%.2d %.2d%.2d%.2d GMT\r\n", year, month, day, hour, minute, second);
- else
- status = mu_nntp_writeline (nntp, "NEWNEWS %.4d%.2d%.2d %.2d%.2d%.2d\r\n", year, month, day, hour, minute, second);
- }
- else
- {
- if (is_gmt > 0)
- {
- status = mu_nntp_writeline (nntp, "NEWNEWS %s %.4d%.2d%.2d %.2d%.2d%.2d GMT\r\n", wildmat, year, month, day,
- hour, minute, second);
- }
- else
- {
- status = mu_nntp_writeline (nntp, "NEWNEWS %s %.4d%.2d%.2d %.2d%.2d%.2d\r\n", wildmat, year, month, day,
- hour, minute, second);
- }
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_NEWNEWS;
-
- case MU_NNTP_NEWNEWS:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_NEWNEWS_ACK;
-
- case MU_NNTP_NEWNEWS_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_NEWNEWS_FOLLOW);
-
- status = mu_nntp_iterator_create (nntp, piterator);
- MU_NNTP_CHECK_ERROR(nntp, status);
- nntp->state = MU_NNTP_NEWNEWS_RX;
-
- case MU_NNTP_NEWNEWS_RX:
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_next.c b/libproto/nntp/nntp_next.c
deleted file mode 100644
index 30847a7..0000000
--- a/libproto/nntp/nntp_next.c
+++ b/dev/null
@@ -1,72 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_next (mu_nntp_t nntp, unsigned long *number, char **mid)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "NEXT\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_NEXT;
-
- case MU_NNTP_NEXT:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_NEXT_ACK;
-
- case MU_NNTP_NEXT_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_ARTICLE_FOUND);
- nntp->state = MU_NNTP_NO_STATE;
-
- status = mu_nntp_parse_article (nntp, MU_NNTP_RESP_CODE_ARTICLE_FOUND, number, mid);
- MU_NNTP_CHECK_ERROR (nntp, status);
-
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
-
diff --git a/libproto/nntp/nntp_post.c b/libproto/nntp/nntp_post.c
deleted file mode 100644
index fd3079c..0000000
--- a/libproto/nntp/nntp_post.c
+++ b/dev/null
@@ -1,152 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_post (mu_nntp_t nntp, mu_stream_t stream)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "POST\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_POST;
-
- case MU_NNTP_POST:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_POST_ACK;
-
- case MU_NNTP_POST_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_SEND_ARTICLE);
- if (nntp->post.buf != NULL)
- {
- free (nntp->post.buf);
- }
- nntp->post.buf = calloc (1, 256);
- if (nntp->post.buf == NULL)
- {
- MU_NNTP_CHECK_ERROR (nntp, ENOMEM);
- }
- nntp->post.len = 256;
- nntp->post.offset = 0;
- nntp->post.nread = 0;
- nntp->post.sent_crlf = 0;
- nntp->state = MU_NNTP_POST_0;
-
- post_loop:
- case MU_NNTP_POST_0:
- status = mu_stream_readline (stream, nntp->post.buf, nntp->post.len,
- &nntp->post.nread);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->post.offset += nntp->post.nread;
- if (nntp->post.nread > 0)
- {
- if (nntp->post.buf[nntp->post.nread - 1] == '\n')
- {
- nntp->post.buf[nntp->post.nread - 1] = '\0';
- if (nntp->post.sent_crlf && nntp->post.buf[0] == '.')
- {
- status = mu_nntp_writeline (nntp, ".%s\r\n", nntp->post.buf);
- }
- else
- {
- status = mu_nntp_writeline (nntp, "%s\r\n", nntp->post.buf);
- }
- nntp->post.sent_crlf = 1;
- }
- else
- {
- if (nntp->post.sent_crlf && nntp->post.buf[0] == '.')
- {
- status = mu_nntp_writeline (nntp, ".%s", nntp->post.buf);
- }
- else
- {
- status = mu_nntp_writeline (nntp, "%s", nntp->post.buf);
- }
- nntp->post.sent_crlf = 0;
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- }
- nntp->state = MU_NNTP_POST_1;
-
- case MU_NNTP_POST_1:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- if (nntp->post.nread > 0)
- {
- goto post_loop;
- }
- if (nntp->post.sent_crlf)
- status = mu_nntp_writeline (nntp, ".\r\n");
- else
- status = mu_nntp_writeline (nntp, "\r\n.\r\n");
- if (nntp->post.buf != NULL)
- {
- free (nntp->post.buf);
- nntp->post.buf = NULL;
- nntp->post.len = 0;
- nntp->post.offset = 0;
- nntp->post.nread = 0;
- nntp->post.sent_crlf = 0;
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- nntp->state = MU_NNTP_POST_2;
-
- case MU_NNTP_POST_2:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->state = MU_NNTP_POST_3;
-
- case MU_NNTP_POST_3:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_ARTICLE_RECEIVED);
- nntp->state = MU_NNTP_NO_STATE;
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_quit.c b/libproto/nntp/nntp_quit.c
deleted file mode 100644
index f07da30..0000000
--- a/libproto/nntp/nntp_quit.c
+++ b/dev/null
@@ -1,61 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_quit (mu_nntp_t nntp)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- status = mu_nntp_writeline (nntp, "QUIT\r\n");
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_QUIT;
-
- case MU_NNTP_QUIT:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_QUIT_ACK;
-
- case MU_NNTP_QUIT_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE (nntp, MU_NNTP_RESP_CODE_CLOSING);
- nntp->state = MU_NNTP_NO_STATE;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_readline.c b/libproto/nntp/nntp_readline.c
deleted file mode 100644
index 7fb2be2..0000000
--- a/libproto/nntp/nntp_readline.c
+++ b/dev/null
@@ -1,193 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-#include <mailutils/error.h>
-
-int
-mu_nntp_carrier_is_ready (mu_stream_t carrier, int flag, int timeout)
-{
- struct timeval tv, *tvp = NULL;
- int wflags = flag;
- int status;
-
- if (timeout >= 0)
- {
- tv.tv_sec = timeout / 100;
- tv.tv_usec = (timeout % 1000) * 1000;
- tvp = &tv;
- }
- status = mu_stream_wait (carrier, &wflags, tvp);
- if (status)
- return 0; /* FIXME: provide a way to return error code! */
- return wflags & flag;
-}
-
-/* Read a complete line from the nntp server. Transform CRLF to LF, remove
- the stuff byte termination octet ".", put a null in the buffer
- when done. And Do a select() (stream_is_readready()) for the timeout. */
-static int
-mu_nntp_getline (mu_nntp_t nntp)
-{
- size_t n = 0;
- size_t total = nntp->io.ptr - nntp->io.buf;
- int status = 0;
-
- /* Must get a full line before bailing out. */
- do
- {
- /* Timeout with select(), note that we have to reset select()
- since on linux tv is modified when error. */
- if (nntp->timeout)
- {
- int ready = mu_nntp_carrier_is_ready (nntp->carrier,
- MU_STREAM_READY_RD,
- nntp->timeout);
- if (ready == 0)
- return ETIMEDOUT;
- }
-
- status = mu_stream_readline (nntp->carrier,
- nntp->io.buf + total,
- nntp->io.len - total, &n);
- if (status != 0)
- return status;
-
- /* The server went away: It maybe a timeout and some nntp server
- does not send the -ERR. Consider this like an error. */
- if (n == 0)
- return EIO;
-
- total += n;
- nntp->io.nl = memchr (nntp->io.buf, '\n', total);
- if (nntp->io.nl == NULL) /* Do we have a full line. */
- {
- /* Allocate a bigger buffer ? */
- if (total >= nntp->io.len - 1)
- {
- nntp->io.len *= 2;
- nntp->io.buf = realloc (nntp->io.buf, nntp->io.len + 1);
- if (nntp->io.buf == NULL)
- return ENOMEM;
- }
- }
- nntp->io.ptr = nntp->io.buf + total;
- }
- while (nntp->io.nl == NULL); /* Bail only if we have a complete line. */
-
- /* When examining a multi-line response, the client checks to see if the
- line begins with the termination octet "."(DOT). If yes and if octets
- other than CRLF follow, the first octet of the line (the termination
- octet) is stripped away. */
- if (total >= 3 && nntp->io.buf[0] == '.')
- {
- if (nntp->io.buf[1] != '\r' && nntp->io.buf[2] != '\n')
- {
- memmove (nntp->io.buf, nntp->io.buf + 1, total - 1);
- nntp->io.ptr--;
- nntp->io.nl--;
- }
- /* And if CRLF immediately follows the termination character, then
- the response from the NNTP server is ended and the line containing
- ".CRLF" is not considered part of the multi-line response. */
- else if (nntp->io.buf[1] == '\r' && nntp->io.buf[2] == '\n')
- {
- nntp->io.buf[0] = '\0';
- nntp->io.ptr = nntp->io.buf;
- nntp->io.nl = NULL;
- }
- }
- /* \r\n --> \n\0, conversion. */
- if (nntp->io.nl > nntp->io.buf)
- {
- *(nntp->io.nl - 1) = '\n';
- *(nntp->io.nl) = '\0';
- nntp->io.ptr = nntp->io.nl;
- }
- return status;
-}
-
-/* Call nntp_getline() for the dirty work, and consume i.e. put
- in the user buffer only buflen. If buflen == 0 or buffer == NULL
- nothing is consume, the data is save for another call to nntp_readline()
- with a buffer != NULL.
- */
-int
-mu_nntp_readline (mu_nntp_t nntp, char *buffer, size_t buflen, size_t *pnread)
-{
- size_t nread = 0;
- size_t n = 0;
- int status = 0;
-
- /* Do we need to fill up? Yes if no NL or the buffer is empty. */
- if (nntp->carrier && (nntp->io.nl == NULL || nntp->io.ptr == nntp->io.buf))
- {
- status = mu_nntp_getline (nntp);
- if (status != 0)
- return status;
- }
-
- /* How much we can copy ? */
- n = nntp->io.ptr - nntp->io.buf;
-
- /* Consume the line? */
- if (buffer && buflen)
- {
- buflen--; /* For the null. */
- if (buflen)
- {
- int nleft = buflen - n;
- /* We got more then requested. */
- if (nleft < 0)
- {
- size_t sentinel;
- nread = buflen;
- sentinel = nntp->io.ptr - (nntp->io.buf + nread);
- memcpy (buffer, nntp->io.buf, nread);
- memmove (nntp->io.buf, nntp->io.buf + nread, sentinel);
- nntp->io.ptr = nntp->io.buf + sentinel;
- }
- else
- {
- /* Drain our buffer. */;
- nread = n;
- memcpy (buffer, nntp->io.buf, nread);
- nntp->io.ptr = nntp->io.buf;
- /* Clear of all residue. */
- memset (nntp->io.buf, '\0', nntp->io.len);
- }
- }
- buffer[nread] = '\0';
- }
- else
- nread = n;
-
- if (pnread)
- *pnread = nread;
- return status;
-}
diff --git a/libproto/nntp/nntp_response.c b/libproto/nntp/nntp_response.c
deleted file mode 100644
index 282e0f7..0000000
--- a/libproto/nntp/nntp_response.c
+++ b/dev/null
@@ -1,86 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-/* If we did not grap the ack already, call nntp_readline() but handle
- Nonblocking also. */
-int
-mu_nntp_response (mu_nntp_t nntp, char *buffer, size_t buflen, size_t *pnread)
-{
- size_t n = 0;
- int status = 0;
-
- if (nntp == NULL)
- return EINVAL;
-
- if (!nntp->acknowledge)
- {
- size_t len = nntp->ack.len - (nntp->ack.ptr - nntp->ack.buf);
- status = mu_nntp_readline (nntp, nntp->ack.ptr, len, &n);
- nntp->ack.ptr += n;
- if (status == 0)
- {
- len = nntp->ack.ptr - nntp->ack.buf;
- if (len && nntp->ack.buf[len - 1] == '\n')
- nntp->ack.buf[len - 1] = '\0';
- nntp->acknowledge = 1; /* Flag that we have the ack. */
- nntp->ack.ptr = nntp->ack.buf;
- }
- else
- {
- /* Provide them with an error. */
- const char *econ = "500 NNTP IO ERROR";
- n = strlen (econ);
- strcpy (nntp->ack.buf, econ);
- }
- }
- else
- n = strlen (nntp->ack.buf);
-
- if (buffer)
- {
- buflen--; /* Leave space for the NULL. */
- n = (buflen < n) ? buflen : n;
- memcpy (buffer, nntp->ack.buf, n);
- buffer[n] = '\0';
- }
-
- if (pnread)
- *pnread = n;
- return status;
-}
-
-int
-mu_nntp_response_code(mu_nntp_t nntp)
-{
- char buffer[4];
- int code;
-
- memset (buffer, '\0', 4);
- mu_nntp_response(nntp, buffer, 4, NULL);
- /* translate the number, basically strtol() without the overhead. */
- code = (buffer[0] - '0')*100 + (buffer[1] - '0')*10 + (buffer[2] - '0');
- return code;
-}
diff --git a/libproto/nntp/nntp_sendline.c b/libproto/nntp/nntp_sendline.c
deleted file mode 100644
index 9ad5d70..0000000
--- a/libproto/nntp/nntp_sendline.c
+++ b/dev/null
@@ -1,122 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-/* A socket may write less then expected but stream.c:mu_stream_write() will
- always try to send the entire buffer unless an error is reported. We have
- to cope with nonblocking, it is done by keeping track with the nntp->ptr
- pointer if the write failed we keep track and restart where we left. */
-int
-mu_nntp_send (mu_nntp_t nntp)
-{
- int status = 0;
- if (nntp->carrier && (nntp->io.ptr > nntp->io.buf))
- {
- size_t n = 0;
- size_t len = nntp->io.ptr - nntp->io.buf;
-
- /* Timeout with select(), note that we have to reset select()
- since on linux tv is modified when error. */
- if (nntp->timeout)
- {
- int ready = mu_nntp_carrier_is_ready (nntp->carrier,
- MU_STREAM_READY_WR,
- nntp->timeout);
- if (ready == 0)
- return ETIMEDOUT;
- }
-
- status = mu_stream_write (nntp->carrier, nntp->io.buf, len, &n);
- if (n)
- {
- /* Consume what we sent. */
- memmove (nntp->io.buf, nntp->io.buf + n, len - n);
- nntp->io.ptr -= n;
- }
- }
- else
- nntp->io.ptr = nntp->io.buf;
- return status;
-}
-
-/* According to RFC 2449: The maximum length of a command is increased from
- 47 characters (4 character command, single space, 40 character argument,
- CRLF) to 255 octets, including the terminating CRLF. But we are flexible
- on this and realloc() as needed. NOTE: The terminated CRLF is not
- included. */
-int
-mu_nntp_writeline (mu_nntp_t nntp, const char *format, ...)
-{
- int len;
- va_list ap;
- int done = 1;
-
- va_start(ap, format);
- /* C99 says that a conforming implementation of snprintf () should
- return the number of char that would have been call but many old
- GNU/Linux && BSD implementations return -1 on error. Worse,
- QnX/Neutrino actually does not put the terminal null char. So
- let's try to cope. */
- do
- {
- va_list aq;
- va_copy(aq, ap);
- len = vsnprintf (nntp->io.buf, nntp->io.len - 1, format, aq);
- va_end(aq);
- if (len < 0 || len >= (int)nntp->io.len
- || !memchr (nntp->io.buf, '\0', len + 1))
- {
- nntp->io.len *= 2;
- nntp->io.buf = realloc (nntp->io.buf, nntp->io.len);
- if (nntp->io.buf == NULL)
- return ENOMEM;
- done = 0;
- }
- else
- done = 1;
- }
- while (!done);
- va_end(ap);
- nntp->io.ptr = nntp->io.buf + len;
- return 0;
-}
-
-int
-mu_nntp_sendline (mu_nntp_t nntp, const char *line)
-{
- if (line)
- {
- int status = mu_nntp_writeline (nntp, line);
- if (status)
- return status;
- }
- return mu_nntp_send (nntp);
-}
diff --git a/libproto/nntp/nntp_stat.c b/libproto/nntp/nntp_stat.c
deleted file mode 100644
index 08b5190..0000000
--- a/libproto/nntp/nntp_stat.c
+++ b/dev/null
@@ -1,100 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_stat (mu_nntp_t nntp, unsigned long number, unsigned long *pnumber, char **mid)
-{
- int status;
- char *message_id = NULL;
- if (number != 0)
- {
- message_id = malloc (128);
- if (message_id == NULL)
- {
- return ENOMEM;
- }
- snprintf (message_id, 127, "%ld", number);
- }
- status = mu_nntp_stat_id (nntp, message_id, pnumber, mid);
- if (message_id)
- {
- free (message_id);
- }
- return status;
-}
-
-int
-mu_nntp_stat_id (mu_nntp_t nntp, const char *message_id, unsigned long *number, char **mid)
-{
- int status;
-
- if (nntp == NULL)
- return EINVAL;
-
- switch (nntp->state)
- {
- case MU_NNTP_NO_STATE:
- if (message_id == NULL || *message_id == '\0')
- {
- status = mu_nntp_writeline (nntp, "STAT\r\n");
- }
- else
- {
- status = mu_nntp_writeline (nntp, "STAT %s\r\n", message_id);
- }
- MU_NNTP_CHECK_ERROR (nntp, status);
- mu_nntp_debug_cmd (nntp);
- nntp->state = MU_NNTP_STAT;
-
- case MU_NNTP_STAT:
- status = mu_nntp_send (nntp);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- nntp->acknowledge = 0;
- nntp->state = MU_NNTP_STAT_ACK;
-
- case MU_NNTP_STAT_ACK:
- status = mu_nntp_response (nntp, NULL, 0, NULL);
- MU_NNTP_CHECK_EAGAIN (nntp, status);
- mu_nntp_debug_ack (nntp);
- MU_NNTP_CHECK_CODE(nntp, MU_NNTP_RESP_CODE_ARTICLE_FOUND);
- nntp->state = MU_NNTP_NO_STATE;
-
- /* parse the answer now. */
- status = mu_nntp_parse_article(nntp, MU_NNTP_RESP_CODE_ARTICLE_FOUND, number, mid);
- MU_NNTP_CHECK_ERROR (nntp, status);
- break;
-
- /* They must deal with the error first by reopening. */
- case MU_NNTP_ERROR:
- status = ECANCELED;
- break;
-
- default:
- status = EINPROGRESS;
- }
-
- return status;
-}
diff --git a/libproto/nntp/nntp_stream.c b/libproto/nntp/nntp_stream.c
deleted file mode 100644
index 479ffce..0000000
--- a/libproto/nntp/nntp_stream.c
+++ b/dev/null
@@ -1,145 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2003-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <mailutils/sys/nntp.h>
-
-/* Implementation of the stream for HELP, ARTICLE, etc ... */
-struct mu_nntp_stream
-{
- mu_nntp_t nntp;
- int done;
-};
-
-static void
-mu_nntp_stream_destroy (mu_stream_t stream)
-{
- struct mu_nntp_stream *nntp_stream = mu_stream_get_owner (stream);
- if (nntp_stream)
- {
- free (nntp_stream);
- }
-}
-
-static int
-mu_nntp_stream_read (mu_stream_t stream, char *buf, size_t buflen, mu_off_t offset, size_t *pn)
-{
- struct mu_nntp_stream *nntp_stream = mu_stream_get_owner (stream);
- size_t n = 0;
- int status = 0;
- char *p = buf;
-
- (void)offset;
- if (nntp_stream)
- {
- if (!nntp_stream->done)
- {
- do
- {
- size_t nread = 0;
-
- /* The nntp_readline () function will always read one less to
- be able to null terminate the buffer, this will cause
- serious grief for mu_stream_read() where it is legitimate to
- have a buffer of 1 char. So we must catch it here. */
- if (buflen == 1)
- {
- char buffer[2];
- *buffer = '\0';
- status = mu_nntp_readline (nntp_stream->nntp, buffer, 2, &nread);
- *p = *buffer;
- }
- else
- status = mu_nntp_readline (nntp_stream->nntp, p, buflen, &nread);
-
- if (status != 0)
- break;
- if (nread == 0)
- {
- nntp_stream->nntp->state = MU_NNTP_NO_STATE;
- nntp_stream->done = 1;
- break;
- }
- n += nread;
- buflen -= nread;
- p += nread;
- }
- while (buflen > 0);
- }
- }
- if (pn)
- *pn = n;
- return status;
-}
-
-static int
-mu_nntp_stream_readline (mu_stream_t stream, char *buf, size_t buflen, mu_off_t offset, size_t *pn)
-{
- struct mu_nntp_stream *nntp_stream = mu_stream_get_owner (stream);
- size_t n = 0;
- int status = 0;
-
- (void)offset;
- if (nntp_stream)
- {
- if (!nntp_stream->done)
- {
- status = mu_nntp_readline (nntp_stream->nntp, buf, buflen, &n);
- if (n == 0)
- {
- nntp_stream->nntp->state = MU_NNTP_NO_STATE;
- nntp_stream->done = 1;
- }
- }
- }
- if (pn)
- *pn = n;
- return status;
-}
-
-int
-mu_nntp_stream_create (mu_nntp_t nntp, mu_stream_t *pstream)
-{
- struct mu_nntp_stream *nntp_stream;
- int status;
-
- nntp_stream = malloc (sizeof *nntp_stream);
- if (nntp_stream == NULL)
- return ENOMEM;
-
- nntp_stream->nntp = nntp;
- nntp_stream->done = 0;
-
- status = mu_stream_create (pstream, MU_STREAM_READ, nntp_stream);
- if (status != 0)
- {
- free (nntp_stream);
- return status;
- }
-
- mu_stream_set_read (*pstream, mu_nntp_stream_read, nntp_stream);
- mu_stream_set_readline (*pstream, mu_nntp_stream_readline, nntp_stream);
- mu_stream_set_destroy (*pstream, mu_nntp_stream_destroy, nntp_stream);
-
- return 0;
-}
diff --git a/libproto/nntp/nntp_timeout.c b/libproto/nntp/nntp_timeout.c
deleted file mode 100644
index c3f53ac..0000000
--- a/libproto/nntp/nntp_timeout.c
+++ b/dev/null
@@ -1,48 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <errno.h>
-#include <mailutils/sys/nntp.h>
-
-int
-mu_nntp_set_timeout (mu_nntp_t nntp, int timeout)
-{
- /* Sanity checks. */
- if (nntp == NULL)
- return EINVAL;
-
- nntp->timeout = timeout;
- return 0;
-}
-
-int
-mu_nntp_get_timeout (mu_nntp_t nntp, int *ptimeout)
-{
- /* Sanity checks. */
- if (nntp == NULL)
- return EINVAL;
- if (ptimeout == NULL)
- return MU_ERR_OUT_PTR_NULL;
-
- *ptimeout = nntp->timeout;
- return 0;
-}
diff --git a/libproto/nntp/url.c b/libproto/nntp/url.c
deleted file mode 100644
index 6057a34..0000000
--- a/libproto/nntp/url.c
+++ b/dev/null
@@ -1,50 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef ENABLE_NNTP
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-
-#include <mailutils/nntp.h>
-
-#include <mailutils/sys/url.h>
-
-/*
- POP URL:
- nntp://<host>:<port>/<newsgroup-name>/<article-number>
-*/
-
-int
-_nntp_url_init (mu_url_t url)
-{
- if (url->port == 0)
- url->port = MU_NNTP_DEFAULT_PORT;
-
- return status;
-}
-
-#endif
diff --git a/mapi/MAPIAddress.c b/mapi/MAPIAddress.c
deleted file mode 100644
index 3c8a15d..0000000
--- a/mapi/MAPIAddress.c
+++ b/dev/null
@@ -1,27 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPIAddress (LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszCaption,
- ULONG nEditFields, LPTSTR lpszLabels, ULONG nRecips,
- lpMapiRecipDesc lpRecips, FLAGS flFlags, ULONG ulReserved,
- LPULONG lpnNewRecips, lpMapiRecipDesc * lppNewRecips)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
diff --git a/mapi/MAPIDeleteMail.c b/mapi/MAPIDeleteMail.c
deleted file mode 100644
index 0f3a286..0000000
--- a/mapi/MAPIDeleteMail.c
+++ b/dev/null
@@ -1,25 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPIDeleteMail (LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszMessageID,
- FLAGS flFlags, ULONG ulReserved)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
diff --git a/mapi/MAPIDetails.c b/mapi/MAPIDetails.c
deleted file mode 100644
index 4985286..0000000
--- a/mapi/MAPIDetails.c
+++ b/dev/null
@@ -1,25 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPIDetails (LHANDLE lhSession, ULONG ulUIParam, lpMapiRecipDesc lpRecip,
- FLAGS flFlags, ULONG ulReserved)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
diff --git a/mapi/MAPIFindNext.c b/mapi/MAPIFindNext.c
deleted file mode 100644
index b9e886d..0000000
--- a/mapi/MAPIFindNext.c
+++ b/dev/null
@@ -1,27 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPIFindNext (LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszMessageType,
- LPTSTR lpszSeedMessageID, FLAGS flFlags, ULONG ulReserved,
- LPTSTR lpszMessageID)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
-
diff --git a/mapi/MAPIFreeBuffer.c b/mapi/MAPIFreeBuffer.c
deleted file mode 100644
index 3fdfa49..0000000
--- a/mapi/MAPIFreeBuffer.c
+++ b/dev/null
@@ -1,25 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPIFreeBuffer (LPVOID lpBuffer)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
-
diff --git a/mapi/MAPILogoff.c b/mapi/MAPILogoff.c
deleted file mode 100644
index 5182aa6..0000000
--- a/mapi/MAPILogoff.c
+++ b/dev/null
@@ -1,26 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPILogoff (LHANDLE lhSession, ULONG ulUIParam, FLAGS flFlags,
- ULONG ulReserved)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
-
diff --git a/mapi/MAPILogon.c b/mapi/MAPILogon.c
deleted file mode 100644
index 03de10d..0000000
--- a/mapi/MAPILogon.c
+++ b/dev/null
@@ -1,26 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPILogon (ULONG ulUIParam, LPTSTR lpszProfileName, LPTSTR lpszPassword,
- FLAGS flFlags, ULONG ulReserved, LPLHANDLE lplhSession)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
-
diff --git a/mapi/MAPIReadMail.c b/mapi/MAPIReadMail.c
deleted file mode 100644
index 1c6a4a5..0000000
--- a/mapi/MAPIReadMail.c
+++ b/dev/null
@@ -1,26 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not,
- see <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPIReadMail (LHANDLE lhSession, ULONG ulUIParam,
- LPTSTR lpszMessageID, FLAGS flFlags, ULONG ulReserved,
- lpMapiMessage * lppMessage)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
diff --git a/mapi/MAPISaveMail.c b/mapi/MAPISaveMail.c
deleted file mode 100644
index a3874b6..0000000
--- a/mapi/MAPISaveMail.c
+++ b/dev/null
@@ -1,25 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPISaveMail (LHANDLE lhSession, ULONG ulUIParam, lpMapiMessage lpMessage,
- FLAGS flFlags, ULONG ulReserved, LPTSTR lpszMessageID)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
diff --git a/mapi/MAPISendDocuments.c b/mapi/MAPISendDocuments.c
deleted file mode 100644
index 6fcbb26..0000000
--- a/mapi/MAPISendDocuments.c
+++ b/dev/null
@@ -1,27 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPISendDocuments (ULONG ulUIParam, LPTSTR lpszDelimChar,
- LPTSTR lpszFullPaths, LPTSTR lpszFileNames,
- ULONG ulReserved)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
-
diff --git a/mapi/MAPISendMail.c b/mapi/MAPISendMail.c
deleted file mode 100644
index de4b0ed..0000000
--- a/mapi/MAPISendMail.c
+++ b/dev/null
@@ -1,26 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <mailutils/mapi.h>
-
-ULONG
-MAPISendMail (LHANDLE lhSession, ULONG ulUIParam, lpMapiMessage lpMessage,
- FLAGS flFlags, ULONG ulReserved)
-{
- return MAPI_E_NOT_SUPPORTED;
-}
-
diff --git a/mapi/Makefile.am b/mapi/Makefile.am
deleted file mode 100644
index aff6c05..0000000
--- a/mapi/Makefile.am
+++ b/dev/null
@@ -1,41 +0,0 @@
-## This file is part of GNU Mailutils.
-## Copyright (C) 2001-2020 Free Software Foundation, Inc.
-##
-## GNU Mailutils is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License as
-## published by the Free Software Foundation; either version 3, or (at
-## your option) any later version.
-##
-## GNU Mailutils is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-
-AM_CPPFLAGS = $(MU_LIB_COMMON_INCLUDES)
-
-SUBDIRS = include
-
-lib_LTLIBRARIES = libmapi.la
-
-/* FIXME: This should be part of the default includes. */
-EXTRA_DIST = mapi.h
-
-libmapi_LDADD = ../lib/libmuaux.la $(MU_LIB_MAILUTILS)
-
-libmapi_la_SOURCES = \
- MAPIAddress.c \
- MAPIDeleteMail.c \
- MAPIDetails.c \
- MAPIFindNext.c \
- MAPIFreeBuffer.c \
- MAPILogoff.c \
- MAPILogon.c \
- MAPIReadMail.c \
- MAPISaveMail.c \
- MAPISendDocuments.c \
- MAPISendMail.c
-
-libmapi_la_LDFLAGS = -version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@
diff --git a/mapi/mapi.h b/mapi/mapi.h
deleted file mode 100644
index 9529606..0000000
--- a/mapi/mapi.h
+++ b/dev/null
@@ -1,185 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _MAPI_H
-#define _MAPI_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef char * LPTSTR;
-typedef void * LPVOID;
-
-typedef unsigned long ULONG;
-typedef unsigned long * LPULONG;
-typedef unsigned long FLAGS;
-typedef unsigned long LHANDLE;
-typedef unsigned long * LPLHANDLE;
-
-#define MAPI_OLE 1
-#define MAPI_OLE_STATIC 2
-
-/* Constant values. */
-#define MAPI_ORIG 0
-#define MAPI_TO 1
-#define MAPI_CC 2
-#define MAPI_BCC 3
-
-/* FIXME: What are the values ? */
-#define MAPI_RECEIPT_REQUESTED
-#define MAPI_SENT
-#define MAPI_UNREAD
-
-#define MAPI_FORCE_DOWNLOAD
-#define MAPI_NEW_SESSION
-#define MAPI_LOGON_UI
-#define MAPI_PASSWORD_UI
-
-#define MAPI_GUARANTEE_FIFO
-#define MAPI_LONG_MSGID
-#define MAPI_UNREAD_ONLY
-
-#define MAPI_BODY_AS_FILE
-#define MAPI_ENVELOPE_ONLY
-#define MAPI_PEEK
-#define MAPI_SUPPRESS_ATTACH
-
-#define MAPI_AB_NOMODIFY
-#define MAPI_LOGON_UI
-#define MAPI_NEW_SESSION
-#define MAPI_DIALOG
-
-typedef struct
-{
- ULONG ulReserved;
- ULONG flFlags;
- ULONG nPosition;
- LPTSTR lpszPathName;
- LPTSTR lpszFileName;
- LPVOID lpFileType;
-} MapiFileDesc, *lpMapiFileDesc;
-
-typedef struct
-{
- ULONG ulReserved;
- ULONG ulRecipClass;
- LPTSTR lpszName;
- LPTSTR lpszAddress;
- ULONG ulEIDSize;
- LPVOID lpEntryID;
-} MapiRecipDesc, *lpMapiRecipDesc;
-
-
-typedef struct
-{
- ULONG ulReserved;
- LPTSTR lpszSubject;
- LPTSTR lpszNoteText;
- LPTSTR lpszMessageType;
- LPTSTR lpszDateReceived;
- LPTSTR lpszConversationID;
- FLAGS flFlags;
- lpMapiRecipDesc lpOriginator;
- ULONG nRecipCount;
- lpMapiRecipDesc lpRecips;
- ULONG nFileCount;
- lpMapiFileDesc lpFiles;
-} MapiMessage, *lpMapiMessage;
-
-ULONG MAPILogon (ULONG ulUIParam, LPTSTR lpszProfileName,
- LPTSTR lpszPassword, FLAGS flFlags, ULONG ulReserved,
- LPLHANDLE lplhSession);
-
-
-ULONG MAPILogoff (LHANDLE lhSession, ULONG ulUIParam, FLAGS flFlags,
- ULONG ulReserved);
-
-ULONG MAPIFreeBuffer (LPVOID lpBuffer);
-
-ULONG MAPISendMail (LHANDLE lhSession, ULONG ulUIParam,
- lpMapiMessage lpMessage, FLAGS flFlags,
- ULONG ulReserved);
-
-ULONG MAPISendDocuments (ULONG ulUIParam, LPTSTR lpszDelimChar,
- LPTSTR lpszFullPaths, LPTSTR lpszFileNames,
- ULONG ulReserved);
-
-ULONG MAPIFindNext (LHANDLE lhSession, ULONG ulUIParam,
- LPTSTR lpszMessageType, LPTSTR lpszSeedMessageID,
- FLAGS flFlags, ULONG ulReserved, LPTSTR lpszMessageID);
-
-ULONG MAPIReadMail (LHANDLE lhSession, ULONG ulUIParam,
- LPTSTR lpszMessageID, FLAGS flFlags, ULONG ulReserved,
- lpMapiMessage * lppMessage);
-
-
-ULONG MAPISaveMail (LHANDLE lhSession, ULONG ulUIParam,
- lpMapiMessage lpMessage, FLAGS flFlags,
- ULONG ulReserved, LPTSTR lpszMessageID);
-
-ULONG MAPIDeleteMail (LHANDLE lhSession, ULONG ulUIParam,
- LPTSTR lpszMessageID, FLAGS flFlags,
- ULONG ulReserved);
-
-ULONG MAPIAddress (LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszCaption,
- ULONG nEditFields, LPTSTR lpszLabels, ULONG nRecips,
- lpMapiRecipDesc lpRecips, FLAGS flFlags,
- ULONG ulReserved, LPULONG lpnNewRecips,
- lpMapiRecipDesc * lppNewRecips);
-
-ULONG MAPIDetails (LHANDLE lhSession, ULONG ulUIParam,
- lpMapiRecipDesc lpRecip, FLAGS flFlags,
- ULONG ulReserved);
-
-ULONG MAPIResolveName (LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszName,
- FLAGS flFlags, ULONG ulReserved,
- lpMapiRecipDesc * lppRecip);
-
-#define SUCCESS_SUCCESS 0
-#define MAPI_USER_ABORT 1
-#define MAPI_E_FAILURE 2
-#define MAPI_E_LOGIN_FAILURE 3
-#define MAPI_E_DISK_FULL 4
-#define MAPI_E_INSUFFICIENT_MEMORY 5
-#define MAPI_E_ACCESS_DENIED 6
-#define MAPI_E_TOO_MANY_SESSIONS 8
-#define MAPI_E_TOO_MANY_FILES 9
-#define MAPI_E_TOO_MANY_RECIPIENTS 10
-#define MAPI_E_ATTACHMENT_NOT_FOUND 11
-#define MAPI_E_ATTACHMENT_OPEN_FAILURE 12
-#define MAPI_E_ATTACHMENT_WRITE_FAILURE 13
-#define MAPI_E_UNKNOWN_RECIPIENT 14
-#define MAPI_E_BAD_RECIPTYPE 15
-#define MAPI_E_NO_MESSAGES 16
-#define MAPI_E_INVALID_MESSAGE 17
-#define MAPI_E_TEXT_TOO_LARGE 18
-#define MAPI_E_INVALID_SESSION 19
-#define MAPI_E_TYPE_NOT_SUPPORTED 20
-#define MAPI_E_AMBIGUOUS_RECIPIENT 21
-#define MAPI_E_MESSAGE_IN_USE 22
-#define MAPI_E_NETWORK_FAILURE 23
-#define MAPI_E_INVALID_EDITFIELDS 24
-#define MAPI_E_INVALID_RECIPS 25
-#define MAPI_E_NOT_SUPPORTED 26
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MAPI_H */
diff --git a/mu/libexec/ldflags.c b/mu/libexec/ldflags.c
index 354eb32..85065e4 100644
--- a/mu/libexec/ldflags.c
+++ b/mu/libexec/ldflags.c
@@ -55,9 +55,6 @@ struct lib_descr {
{ "pop", "-lmu_pop", 0 },
{ "pop", NEEDAUTH, 2 },
#endif
-#ifdef ENABLE_NNTP
- { "nntp", "-lmu_nntp", 0 },
-#endif
#ifdef ENABLE_DBM
{ "dbm", "-lmu_dbm", 0 },
{ "dbm", DBMLIBS, 2 },
@@ -71,9 +68,10 @@ struct lib_descr {
#ifdef WITH_PYTHON
{ "python", "-lmu_py " PYTHON_LIBS, -1, NOTALL },
#endif
- { "compat", NULL, 0, 0 }, /* deprecated */
- { "cfg", NULL, 0, 0 }, /* deprecated */
- { "argp", NULL, 0, 0 }, /* deprecated */
+ { "compat" }, /* deprecated */
+ { "cfg" }, /* deprecated */
+ { "argp" }, /* deprecated */
+ { "nntp" }, /* deprecated */
{ NULL }
};

Return to:

Send suggestions and report system problems to the System administrator.