Commit df548046 df54804695f8cf0b34733edb5f6375d4d82284e5 by Alain Magloire

Adjust example to new API.

1 parent 34bf14af
......@@ -31,7 +31,8 @@ noinst_PROGRAMS = \
mta\
decode2047\
mailcap\
pop3client
pop3client \
nntpclient
## NOTE: Numaddr must be an installable target, otherwise libtool
## will not create a shared library and `make check' will fail in
......@@ -47,8 +48,8 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib\
AM_LDFLAGS = ../mailbox/libmailbox.la ../lib/libmailutils.la @MU_COMMON_LIBRARIES@
numaddr_la_SOURCES = numaddr.c
numaddr_la_LIBADD = ../libsieve/libsieve.la
numaddr_la_LDFLAGS = -module -avoid-version -no-undefined
numaddr_la_LIBADD = ../libsieve/libsieve.la
numaddr_la_LDFLAGS = -module -avoid-version -no-undefined
mimetest_LDADD =\
../mailbox/mbox/libmu_mbox.la\
......@@ -56,7 +57,7 @@ mimetest_LDADD =\
../mailbox/pop/libmu_pop.la\
../mailbox/libmailbox.la\
../lib/libmailutils.la\
@AUTHLIBS@
@AUTHLIBS@
mta_LDADD =\
../mailbox/mbox/libmu_mbox.la\
......@@ -71,14 +72,19 @@ sfrom_LDADD =\
../mailbox/maildir/libmu_maildir.la\
../mailbox/libmailbox.la\
../lib/libmailutils.la\
@AUTHLIBS@
@AUTHLIBS@
pop3client_LDADD = \
../mailbox/pop/libmu_pop.la\
../mailbox/libmailbox.la\
../lib/libmailutils.la\
@AUTHLIBS@ @READLINE_LIBS@
@AUTHLIBS@ @READLINE_LIBS@
nntpclient_LDADD = \
../mailbox/nntp/libmu_nntp.la\
../mailbox/libmailbox.la\
../lib/libmailutils.la\
@AUTHLIBS@ @READLINE_LIBS@
EXTRA_DIST = comsat.conf dot.biffrc gnu-imap4d.pam gnu-pop3d.pam\
mailutils.rc reply.scm
......
......@@ -563,13 +563,11 @@ int com_list (char *arg)
int
com_list_extensions (char *arg ARG_UNUSED)
{
list_t list = NULL;
int status = mu_nntp_list_extensions (nntp, &list);
iterator_t iterator = NULL;
int status = mu_nntp_list_extensions (nntp, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("List Extension:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -579,7 +577,6 @@ com_list_extensions (char *arg ARG_UNUSED)
printf (" %s\n", extension);
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -587,14 +584,11 @@ com_list_extensions (char *arg ARG_UNUSED)
int
com_list_active (char *arg)
{
list_t list = NULL;
int status = mu_nntp_list_active (nntp, arg, &list);
iterator_t iterator = NULL;
int status = mu_nntp_list_active (nntp, arg, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("List Active:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -614,7 +608,6 @@ com_list_active (char *arg)
printf (" high(%ld) low(%ld) status(%c)\n", high, low, stat);
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -622,13 +615,11 @@ com_list_active (char *arg)
int
com_list_active_times (char *arg)
{
list_t list = NULL;
int status = mu_nntp_list_active_times (nntp, arg, &list);
iterator_t iterator = NULL;
int status = mu_nntp_list_active_times (nntp, arg, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("List Active.Times:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -664,7 +655,6 @@ com_list_active_times (char *arg)
printf ("\n");
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -672,13 +662,11 @@ com_list_active_times (char *arg)
int
com_list_distributions (char *arg ARG_UNUSED)
{
list_t list = NULL;
int status = mu_nntp_list_distributions (nntp, arg, &list);
iterator_t iterator = NULL;
int status = mu_nntp_list_distributions (nntp, arg, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("List Distributions:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -701,7 +689,6 @@ com_list_distributions (char *arg ARG_UNUSED)
printf ("\n");
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -709,13 +696,11 @@ com_list_distributions (char *arg ARG_UNUSED)
int
com_list_distrib_pats (char *arg ARG_UNUSED)
{
list_t list = NULL;
int status = mu_nntp_list_distrib_pats (nntp, &list);
iterator_t iterator = NULL;
int status = mu_nntp_list_distrib_pats (nntp, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("List Distrib Pats:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -740,7 +725,6 @@ com_list_distrib_pats (char *arg ARG_UNUSED)
printf ("\n");
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -748,13 +732,11 @@ com_list_distrib_pats (char *arg ARG_UNUSED)
int
com_list_newsgroups (char *arg)
{
list_t list = NULL;
int status = mu_nntp_list_newsgroups (nntp, arg, &list);
iterator_t iterator = NULL;
int status = mu_nntp_list_newsgroups (nntp, arg, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("Newsgroups:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -777,7 +759,6 @@ com_list_newsgroups (char *arg)
printf ("\n");
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -815,7 +796,7 @@ com_next (char *arg ARG_UNUSED)
int
com_newgroups (char *arg)
{
list_t list = NULL;
iterator_t iterator = NULL;
struct tm stime;
int year, month, day, hour, min, sec, is_gmt;
year = month = day = hour = min = sec = is_gmt = 0;
......@@ -841,11 +822,9 @@ com_newgroups (char *arg)
year = stime->tm_year + 1900; /* year */
}
int status = mu_nntp_newgroups (nntp, year, month, day, hour, min, sec, is_gmt, &list);
int status = mu_nntp_newgroups (nntp, year, month, day, hour, min, sec, is_gmt, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("New Groups:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -865,7 +844,6 @@ com_newgroups (char *arg)
printf (" hig(%d) low(%d) status(%c)\n", high, low, stat);
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -873,7 +851,7 @@ com_newgroups (char *arg)
int
com_newnews (char *arg)
{
list_t list = NULL;
iterator_t iterator = NULL;
struct tm stime;
char *wildmat;
char gmt[4];
......@@ -901,11 +879,9 @@ com_newnews (char *arg)
year = stime->tm_year + 1900; /* year */
}
int status = mu_nntp_newnews (nntp, wildmat, year, month, day, hour, min, sec, is_gmt, &list);
int status = mu_nntp_newnews (nntp, wildmat, year, month, day, hour, min, sec, is_gmt, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
printf ("New News:\n");
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
......@@ -915,7 +891,6 @@ com_newnews (char *arg)
printf (" %s\n", mid);
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......
......@@ -400,13 +400,11 @@ com_apop (char *arg)
int
com_capa (char *arg ARG_UNUSED)
{
list_t list = NULL;
int status = mu_pop3_capa (pop3, &list);
iterator_t iterator = NULL;
int status = mu_pop3_capa (pop3, &iterator);
if (status == 0)
{
iterator_t iterator = NULL;
list_get_iterator (list, &iterator);
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
{
......@@ -415,7 +413,6 @@ com_capa (char *arg ARG_UNUSED)
printf ("Capa: %s\n", (capa) ? capa : "");
}
iterator_destroy (&iterator);
list_destroy (&list);
}
return status;
}
......@@ -426,12 +423,10 @@ com_uidl (char *arg)
int status = 0;
if (arg == NULL || *arg == '\0')
{
list_t list = NULL;
status = mu_pop3_uidl_all (pop3, &list);
iterator_t uidl_iterator = NULL;
status = mu_pop3_uidl_all (pop3, &uidl_iterator);
if (status == 0)
{
iterator_t uidl_iterator = NULL;
list_get_iterator (list, &uidl_iterator);
for (iterator_first (uidl_iterator);
!iterator_is_done (uidl_iterator);
iterator_next (uidl_iterator))
......@@ -441,7 +436,6 @@ com_uidl (char *arg)
printf ("UIDL: %s\n", (uidl) ? uidl : "");
}
iterator_destroy (&uidl_iterator);
list_destroy (&list);
}
}
else
......@@ -462,12 +456,10 @@ com_list (char *arg)
int status = 0;
if (arg == NULL || *arg == '\0')
{
list_t list = NULL;
status = mu_pop3_list_all (pop3, &list);
iterator_t list_iterator;
status = mu_pop3_list_all (pop3, &list_iterator);
if (status == 0)
{
iterator_t list_iterator;
list_get_iterator (list, &list_iterator);
for (iterator_first (list_iterator);
!iterator_is_done (list_iterator);
iterator_next (list_iterator))
......@@ -477,7 +469,6 @@ com_list (char *arg)
printf ("LIST: %s\n", (list) ? list : "");
}
iterator_destroy (&list_iterator);
list_destroy (&list);
}
}
else
......