summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conf.h5
-rw-r--r--include/message.h63
-rw-r--r--include/motd.h95
-rw-r--r--include/numeric.h3
4 files changed, 131 insertions, 35 deletions
diff --git a/include/conf.h b/include/conf.h
index 311ad38..e1090bb 100644
--- a/include/conf.h
+++ b/include/conf.h
@@ -26,7 +26,7 @@
#define INCLUDED_s_conf_h
#include "config.h"
#include "ircd_defs.h"
-#include "motd.h" /* MessageFile */
+#include "message.h" /* MessageFile */
#include "client.h"
#include "hook.h"
#include "conf_class.h"
@@ -209,11 +209,12 @@ struct config_file_entry
const char *xlinefile;
const char *dlinefile;
const char *resvfile;
+ char *mpath;
+ char *rpath;
char *egdpool_path;
char *service_name;
- MessageFile motd;
MessageFile linksfile;
int gline_min_cidr;
diff --git a/include/message.h b/include/message.h
new file mode 100644
index 0000000..0b76cb0
--- /dev/null
+++ b/include/message.h
@@ -0,0 +1,63 @@
+/*
+ * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
+ * motd.h: A header for the MOTD functions.
+ *
+ * Copyright (C) 2002 by the past and present ircd coders, and others.
+ *
+ * This program 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * $Id: motd.h 1737 2013-01-14 17:37:55Z michael $
+ */
+
+#ifndef INCLUDED_message_h
+#define INCLUDED_message_h
+#include "ircd_defs.h"
+
+
+#define MESSAGELINELEN 256
+
+struct MessageFileLine
+{
+ struct MessageFileLine *next;
+ char line[MESSAGELINELEN + 1];
+};
+
+typedef struct MessageFileLine MessageFileLine;
+
+typedef enum {
+ USER_LINKS,
+ ISSUPPORT
+} MessageType;
+
+struct MessageFile
+{
+ MessageFileLine *contentsOfFile;
+ MessageType msgType;
+ char fileName[HYB_PATH_MAX + 1];
+};
+
+typedef struct MessageFile MessageFile;
+
+struct Client;
+
+extern void init_message_file(MessageType, const char *, MessageFile *);
+extern int send_message_file(struct Client *, MessageFile *);
+extern int read_message_file(MessageFile *);
+extern MessageFile *init_MessageLine(void);
+extern void addto_MessageLine(MessageFile *, const char *);
+extern void destroy_MessageLine(MessageFile *);
+
+#endif /* INCLUDED_motd_h */
diff --git a/include/motd.h b/include/motd.h
index 4490b17..e78b64a 100644
--- a/include/motd.h
+++ b/include/motd.h
@@ -1,8 +1,8 @@
/*
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * motd.h: A header for the MOTD functions.
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (C) 2000 Kevin L. Mitchell <klmitch@mit.edu>
+ * Copyright (C) 2013 by the Hybrid Development Team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,48 +18,81 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file motd.h
+ * \brief Message-of-the-day manipulation implementation.
+ * \version $Id$
*/
#ifndef INCLUDED_motd_h
#define INCLUDED_motd_h
-#include "ircd_defs.h"
-
+struct Client;
-#define MESSAGELINELEN 256
+/** 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 */
+};
-struct MessageFileLine
+/** Entry for a single Message Of The Day (MOTD). */
+struct Motd
{
- struct MessageFileLine *next;
- char line[MESSAGELINELEN + 1];
+ dlink_node node; /**< 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_ssaddr address; /**< Address if type==MOTD_IPMASK. */
+ int 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. */
};
-typedef struct MessageFileLine MessageFileLine;
+/** Length of one MOTD line(80 chars + '\\0'). */
+#define MOTD_LINESIZE 81
+/** Maximum number of lines for MOTD */
+#define MOTD_MAXLINES 100
-typedef enum {
- USER_MOTD,
- USER_LINKS,
- ISSUPPORT
-} MotdType;
-
-struct MessageFile
+
+/** Cache entry for the contents of a MOTD file. */
+struct MotdCache
{
- MessageFileLine *contentsOfFile;
- MotdType motdType;
- char fileName[HYB_PATH_MAX + 1];
- char lastChangedDate[MAX_DATE_STRING + 1];
+ dlink_node node; /**< Next MotdCache in list. */
+ 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. */
};
-typedef struct MessageFile MessageFile;
+/* motd_send sends a MOTD off to a user */
+extern void motd_send(struct Client *);
-struct Client;
+/* motd_signon sends a MOTD off to a newly-registered user */
+extern void motd_signon(struct Client *);
+
+/* motd_recache causes all the MOTD caches to be cleared */
+extern void motd_recache(void);
+
+/* motd_init initializes the MOTD routines, including reading the
+ * ircd.motd and remote.motd files into cache
+ */
+extern void motd_init(void);
+
+/* This routine adds a MOTD */
+extern void motd_add(const char *, const char *);
+
+/* This routine clears the list of MOTDs */
+extern void motd_clear(void);
-extern void init_message_file(MotdType, const char *, struct MessageFile *);
-extern int send_message_file(struct Client *, struct MessageFile *);
-extern int read_message_file(MessageFile *);
-extern MessageFile *init_MessageLine(void);
-extern void addto_MessageLine(MessageFile *, const char *);
-extern void destroy_MessageLine(MessageFile *);
+/* This is called to report T-lines */
+extern void motd_report(struct Client *);
+extern void motd_memory_count(struct Client *);
-#endif /* INCLUDED_motd_h */
+#endif
diff --git a/include/numeric.h b/include/numeric.h
index 0f9bca6..6e9cad9 100644
--- a/include/numeric.h
+++ b/include/numeric.h
@@ -86,8 +86,7 @@ extern const char *form_str(unsigned int);
#define RPL_STATSUPTIME 242
#define RPL_STATSOLINE 243
#define RPL_STATSHLINE 244
-/* 245 No longer used in ircd-hybrid */
-#define RPL_STATSSLINE 245
+#define RPL_STATSTLINE 245
#define RPL_STATSSERVICE 246
#define RPL_STATSXLINE 247
#define RPL_STATSULINE 248