| 1 |
adx |
30 |
/* |
| 2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
|
|
* |
| 4 |
michael |
2150 |
* Copyright (C) 2000 Kevin L. Mitchell <klmitch@mit.edu> |
| 5 |
|
|
* Copyright (C) 2013 by the Hybrid Development Team. |
| 6 |
adx |
30 |
* |
| 7 |
|
|
* This program is free software; you can redistribute it and/or modify |
| 8 |
|
|
* it under the terms of the GNU General Public License as published by |
| 9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
|
|
* (at your option) any later version. |
| 11 |
|
|
* |
| 12 |
|
|
* This program is distributed in the hope that it will be useful, |
| 13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
|
|
* GNU General Public License for more details. |
| 16 |
|
|
* |
| 17 |
|
|
* You should have received a copy of the GNU General Public License |
| 18 |
|
|
* along with this program; if not, write to the Free Software |
| 19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 20 |
|
|
* USA |
| 21 |
|
|
*/ |
| 22 |
|
|
|
| 23 |
michael |
2150 |
/*! \file motd.h |
| 24 |
|
|
* \brief Message-of-the-day manipulation implementation. |
| 25 |
|
|
* \version $Id$ |
| 26 |
|
|
*/ |
| 27 |
|
|
|
| 28 |
adx |
30 |
#ifndef INCLUDED_motd_h |
| 29 |
|
|
#define INCLUDED_motd_h |
| 30 |
michael |
2150 |
struct Client; |
| 31 |
adx |
30 |
|
| 32 |
michael |
2150 |
/** Type of MOTD. */ |
| 33 |
|
|
enum MotdType |
| 34 |
|
|
{ |
| 35 |
|
|
MOTD_UNIVERSAL, /**< MOTD for all users */ |
| 36 |
|
|
MOTD_HOSTMASK, /**< MOTD selected by hostmask */ |
| 37 |
|
|
MOTD_IPMASK, /**< MOTD selected by IP mask */ |
| 38 |
|
|
MOTD_CLASS /**< MOTD selected by connection class */ |
| 39 |
|
|
}; |
| 40 |
adx |
30 |
|
| 41 |
michael |
2150 |
/** Entry for a single Message Of The Day (MOTD). */ |
| 42 |
|
|
struct Motd |
| 43 |
adx |
30 |
{ |
| 44 |
michael |
2150 |
dlink_node node; /**< Next MOTD in the linked list. */ |
| 45 |
|
|
enum MotdType type; /**< Type of MOTD. */ |
| 46 |
|
|
char *hostmask; /**< Hostmask if type==MOTD_HOSTMASK, |
| 47 |
|
|
class name if type==MOTD_CLASS, |
| 48 |
|
|
text IP mask if type==MOTD_IPMASK. */ |
| 49 |
|
|
struct irc_ssaddr address; /**< Address if type==MOTD_IPMASK. */ |
| 50 |
|
|
int addrbits; /**< Number of bits checked in Motd::address. */ |
| 51 |
|
|
char *path; /**< Pathname of MOTD file. */ |
| 52 |
|
|
int maxcount; /**< Number of lines for MOTD. */ |
| 53 |
|
|
struct MotdCache *cache; /**< MOTD cache entry. */ |
| 54 |
adx |
30 |
}; |
| 55 |
|
|
|
| 56 |
michael |
2150 |
/** Length of one MOTD line(80 chars + '\\0'). */ |
| 57 |
|
|
#define MOTD_LINESIZE 81 |
| 58 |
|
|
/** Maximum number of lines for MOTD */ |
| 59 |
|
|
#define MOTD_MAXLINES 100 |
| 60 |
adx |
30 |
|
| 61 |
michael |
2150 |
|
| 62 |
|
|
/** Cache entry for the contents of a MOTD file. */ |
| 63 |
|
|
struct MotdCache |
| 64 |
adx |
30 |
{ |
| 65 |
michael |
2150 |
dlink_node node; /**< Next MotdCache in list. */ |
| 66 |
|
|
int ref; /**< Number of references to this entry. */ |
| 67 |
|
|
char *path; /**< Pathname of file. */ |
| 68 |
|
|
int maxcount; /**< Number of lines allocated for message. */ |
| 69 |
|
|
struct tm modtime; /**< Last modification time from file. */ |
| 70 |
|
|
int count; /**< Actual number of lines used in message. */ |
| 71 |
|
|
char motd[1][MOTD_LINESIZE]; /**< Message body. */ |
| 72 |
adx |
30 |
}; |
| 73 |
|
|
|
| 74 |
michael |
2150 |
/* motd_send sends a MOTD off to a user */ |
| 75 |
|
|
extern void motd_send(struct Client *); |
| 76 |
adx |
30 |
|
| 77 |
michael |
2150 |
/* motd_signon sends a MOTD off to a newly-registered user */ |
| 78 |
|
|
extern void motd_signon(struct Client *); |
| 79 |
adx |
30 |
|
| 80 |
michael |
2150 |
/* motd_recache causes all the MOTD caches to be cleared */ |
| 81 |
|
|
extern void motd_recache(void); |
| 82 |
adx |
30 |
|
| 83 |
michael |
2150 |
/* motd_init initializes the MOTD routines, including reading the |
| 84 |
|
|
* ircd.motd and remote.motd files into cache |
| 85 |
|
|
*/ |
| 86 |
|
|
extern void motd_init(void); |
| 87 |
|
|
|
| 88 |
|
|
/* This routine adds a MOTD */ |
| 89 |
|
|
extern void motd_add(const char *, const char *); |
| 90 |
|
|
|
| 91 |
|
|
/* This routine clears the list of MOTDs */ |
| 92 |
|
|
extern void motd_clear(void); |
| 93 |
|
|
|
| 94 |
|
|
/* This is called to report T-lines */ |
| 95 |
|
|
extern void motd_report(struct Client *); |
| 96 |
|
|
extern void motd_memory_count(struct Client *); |
| 97 |
|
|
|
| 98 |
|
|
#endif |