-
-
-#ifdef POP
-extern char response[];
-
-static int
-remotemail (char *host, char *user, int rpop, int kpop, int notifysw, int personal, int snoop)
-{
- int nmsgs, nbytes, status;
- char *pass = NULL;
-
- if (user == NULL)
- user = getusername ();
- if (kpop || (rpop > 0))
- pass = getusername ();
- else
- ruserpass (host, &user, &pass);
-
- /* open the POP connection */
- if (pop_init (host, user, pass, snoop, kpop ? 1 : rpop, kpop) == NOTOK
- || pop_stat (&nmsgs, &nbytes) == NOTOK /* check for messages */
- || pop_quit () == NOTOK) { /* quit POP connection */
- advise (NULL, "%s", response);
- return 1;
- }
-
- if (nmsgs) {
- if (notifysw & NT_MAIL) {
- printf (personal ? "You have " : "%s has ", user);
- printf ("%d message%s (%d bytes)",
- nmsgs, nmsgs != 1 ? "s" : "", nbytes);
- }
- else
- notifysw = 0;
-
- status = 0;
- } else {
- if (notifysw & NT_NMAI)
- printf (personal ? "You don't %s%s" : "%s doesn't %s",
- personal ? "" : user, "have any mail waiting");
- else
- notifysw = 0;
- status = 1;
- }
- if (notifysw)
- printf (" on %s\n", host);
-
- return status;
-}
-#endif /* POP */