X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fpopsbr.c;h=bfc39eaa5482f42e2516f26f887036acaac18a11;hb=985869792a2afcc507d8bbd43f88680e81e3cc20;hp=6b026c6ecf57161d331ff0ba643198ec47c4a0cf;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/uip/popsbr.c b/uip/popsbr.c index 6b026c6..bfc39ea 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -7,6 +7,9 @@ #include +extern int client(char *args, char *protocol, char *service, int rproto, + char *response, int len_response); + #if defined(NNTP) && !defined(PSHSBR) # undef NNTP #endif @@ -22,12 +25,11 @@ #include #include #include +#include #define TRM "." #define TRMLEN (sizeof TRM - 1) -extern int errno; - static int poprint = 0; static int pophack = 0; @@ -116,7 +118,7 @@ pop_auth (char *user, char *pass) int -pop_init (char *host, char *user, char *pass, int snoop, int rpop) +pop_init (char *host, char *user, char *pass, int snoop, int rpop, int kpop) { int fd1, fd2; char buffer[BUFSIZ]; @@ -129,16 +131,23 @@ pop_init (char *host, char *user, char *pass, int snoop, int rpop) #endif #ifndef NNTP -# ifndef KPOP - if ((fd1 = client (host, "tcp", POPSERVICE, rpop, response, sizeof(response))) == NOTOK) -# else /* KPOP */ - snprintf (buffer, sizeof(buffer), "%s/%s", KPOP_PRINCIPAL, POPSERVICE); - if ((fd1 = client (host, "tcp", buffer, rpop, response, sizeof(response))) == NOTOK) -# endif +# ifdef KPOP + if ( kpop ) { + snprintf (buffer, sizeof(buffer), "%s/%s", KPOP_PRINCIPAL, "kpop"); + if ((fd1 = client (host, "tcp", buffer, 0, response, sizeof(response))) == NOTOK) { + return NOTOK; + } + } else { +# endif /* KPOP */ + if ((fd1 = client (host, "tcp", POPSERVICE, rpop, response, sizeof(response))) == NOTOK) + return NOTOK; +# ifdef KPOP + } +# endif /* KPOP */ #else /* NNTP */ if ((fd1 = client (host, "tcp", "nntp", rpop, response, sizeof(response))) == NOTOK) -#endif return NOTOK; +#endif if ((fd2 = dup (fd1)) == NOTOK) { char *s; @@ -570,7 +579,7 @@ vcommand (const char *fmt, va_list ap) char *cp, buffer[BUFSIZ]; vsnprintf (buffer, sizeof(buffer), fmt, ap); - if (poprint) + if (poprint) { if (pophack) { if ((cp = strchr (buffer, ' '))) *cp = 0; @@ -581,6 +590,7 @@ vcommand (const char *fmt, va_list ap) } else fprintf (stderr, "---> %s\n", buffer); + } if (putline (buffer, output) == NOTOK) return NOTOK;