X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=include%2Fmotd.h;h=6de178eb01b3005d3021ac143f94041e67e4fc30;hb=refs%2Fheads%2Fupstream-ssl;hp=5ee6e050e149336c1606a5c08a70896802d4bfa4;hpb=b44912de1e1373e7d4dd30d532618a5cbef621e9;p=ircu2.10.12-pk.git diff --git a/include/motd.h b/include/motd.h index 5ee6e05..6de178e 100644 --- a/include/motd.h +++ b/include/motd.h @@ -19,9 +19,12 @@ * 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. - * - * $Id$ */ +/** @file + * @brief Message-of-the-day manipulation interface and declarations. + * @version $Id$ + */ + #ifndef INCLUDED_time_h #include /* struct tm */ #define INCLUDED_time_h @@ -30,38 +33,53 @@ #include #define INCLUDED_sys_types_h #endif - +#ifndef INCLUDED_res_H +#include "res.h" +#endif struct Client; struct TRecord; +struct StatDesc; -struct Motd { - struct Motd* next; - int type; - /* Used for classname if it is a class. */ - char* hostmask; - char* path; - int maxcount; - struct MotdCache* cache; +/** Type of MOTD. */ +enum MotdType { + MOTD_UNIVERSAL, /**< MOTD for all users */ + MOTD_HOSTMASK, /**< MOTD selected by hostmask */ + MOTD_IPMASK, /**< MOTD selected by IP mask */ + MOTD_CLASS /**< MOTD selected by connection class */ }; -#define MOTD_UNIVERSAL 0 /* MOTD selected by no criteria */ -#define MOTD_HOSTMASK 1 /* MOTD selected by hostmask */ -#define MOTD_CLASS 2 /* MOTD selected by connection class */ +/** Entry for a single Message Of The Day (MOTD). */ +struct Motd { + struct Motd* next; /**< Next MOTD in the linked list. */ + enum MotdType type; /**< Type of MOTD. */ + char* hostmask; /**< Hostmask if type==MOTD_HOSTMASK, + class name if type==MOTD_CLASS, + text IP mask if type==MOTD_IPMASK. */ + struct irc_in_addr address; /**< Address if type==MOTD_IPMASK. */ + unsigned char addrbits; /**< Number of bits checked in Motd::address. */ + char* path; /**< Pathname of MOTD file. */ + int maxcount; /**< Number of lines for MOTD. */ + struct MotdCache* cache; /**< MOTD cache entry. */ +}; -#define MOTD_LINESIZE 81 /* 80 chars + '\0' */ +/** Length of one MOTD line(80 chars + '\\0'). */ +#define MOTD_LINESIZE 81 +/** Maximum number of lines for local MOTD */ #define MOTD_MAXLINES 100 +/** Maximum number of lines for remote MOTD */ #define MOTD_MAXREMOTE 3 +/** Cache entry for the contents of a MOTD file. */ struct MotdCache { - struct MotdCache* next; /* these fields let us read MOTDs only once */ - struct MotdCache** prev_p; - int ref; - char* path; - int maxcount; - struct tm modtime; - int count; - char motd[1][MOTD_LINESIZE]; + struct MotdCache* next; /**< Next MotdCache in list. */ + struct MotdCache** prev_p; /**< Pointer to previous node's next pointer. */ + int ref; /**< Number of references to this entry. */ + char* path; /**< Pathname of file. */ + int maxcount; /**< Number of lines allocated for message. */ + struct tm modtime; /**< Last modification time from file. */ + int count; /**< Actual number of lines used in message. */ + char motd[1][MOTD_LINESIZE]; /**< Message body. */ }; /* motd_send sends a MOTD off to a user */ @@ -85,6 +103,8 @@ void motd_add(const char *hostmask, const char *path); void motd_clear(void); /* This is called to report T-lines */ -void motd_report(struct Client *to); +void motd_report(struct Client *to, const struct StatDesc *sd, + char *param); +void motd_memory_count(struct Client *cptr); #endif /* INCLUDED_motd_h */