/* $Id: plugin_pop3.c,v 1.9 2005/05/08 04:32:44 reinelt Exp $ * * Plugin to check POP3 mail accounts * * Copyright (C) 2004 Javi Garcia Dominguez (aka Stolz) * Based on code from pop3check (C) 1999 http://sourceforge.net/projects/pop3check * Simon Liddington is the pop3check current maintainer. * The pop3check original author is Steven Radack . * * Copyright (C) 2004 The LCD4Linux Team * * This file is a pluging for LCD4Linux. * * LCD4Linux 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 2, or (at your option) * any later version. * * LCD4Linux 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 this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * $Log: plugin_pop3.c,v $ * Revision 1.9 2005/05/08 04:32:44 reinelt * CodingStyle added and applied * * Revision 1.8 2005/04/01 05:16:04 reinelt * moved plugin init stuff to a seperate function called on first use * * Revision 1.7 2005/01/18 06:30:23 reinelt * added (C) to all copyright statements * * Revision 1.6 2004/06/26 12:05:00 reinelt * * uh-oh... the last CVS log message messed up things a lot... * * Revision 1.5 2004/06/26 09:27:21 reinelt * * added '-W' to CFLAGS * changed all C++ comments to C ones * cleaned up a lot of signed/unsigned mistakes * * Revision 1.4 2004/05/31 21:05:13 reinelt * * fixed lots of bugs in the Cwlinux driver * do not emit EAGAIN error on the first retry * made plugin_i2c_sensors a bit less 'chatty' * moved init and exit functions to the bottom of plugin_pop3 * * Revision 1.3 2004/05/20 07:14:46 reinelt * made all local functions static * * Revision 1.2 2004/04/17 13:03:34 nicowallmeier * minor bugfix * * Revision 1.1 2004/04/08 11:59:26 reinelt * added plugin_pop3 from Javi * */ #include "config.h" #include #include #include #include "debug.h" #include "plugin.h" #include "cfg.h" /*added */ #include #include /*#include */ #include #include /*#include */ #include #ifdef WITH_DMALLOC #include #endif /*POP 3 */ #define POPERR "-ERR" #define LOCKEDERR "-ERR account is locked by another session or for maintenance, try again." #define BUFSIZE 8192 #define POP3PORT 110 #define MAX_NUM_ACCOUNTS 3 struct check { int id; char *username; char *password; char *server; int port; int messages; struct check *next; }; /************************ PROTOTYPES ********************************/ /* list */ static struct check *check_node_alloc(void); static void check_node_add(struct check **head, struct check *new_check); static void check_destroy(struct check **head); /* pop3 */ static void pop3_check_messages(struct check *hi, int verbose); static void pop3_recv_crlf_terminated(int sockfd, char *buf, int size); /* socket */ static int tcp_connect(struct check *hi); /************************ GLOBAL ***********************************/ static char Section[] = "Plugin:POP3"; st
# Intelsat Americas 7 @ 129W
# freq pol sr fec

S 11989000 H 02821000 AUTO
g(); /* by now, head should point to a list of all our accounts */ if (head) { info("[POP3] %d POP3 accounts have been succesfully defined", n); configured = 1; } else { configured = -1; } return configured; } static void my_POP3check(RESULT * result, RESULT * check) { double param = R2N(check); struct check *node = NULL; double value; if (configure_pop3() < 0) { value = -1; SetResult(&result, R_NUMBER, &value); return; } for (node = head; node; node = node->next) { if (node->id == param) break; } if (node == NULL) { /*Inexistent account */ value = -1; } else { pop3_check_messages(node, 0); value = (double) node->messages; } SetResult(&result, R_NUMBER, &value); } int plugin_init_pop3(void) { AddFunction("POP3check", 1, my_POP3check); return 0; } void plugin_exit_pop3(void) { check_destroy(&head); }