5d54cf48a49ea288a6f9cf0fe969f5777f8cef19
[ircu2.10.12-pk.git] / doc / api / motd.txt
1 The server has a Message of the Day (MOTD) which is often used for
2 describing the Acceptable Usage Policy, where to get help if you have
3 problems, and so on.  Older versions of ircd had a lot of duplicated
4 code, as well as some inefficiencies, all related to sending the
5 MOTD.  As of u2.10.11, there is an API specifically for MOTDs.  This
6 API caches the MOTDs in memory for efficiency.  Sending a MOTD to a
7 client is as simple as calling a single function.
8
9 <function>
10 void motd_init(void);
11
12 This function initializes the MOTD subsystem.  It will also read in
13 the default MOTD (usually ircd.motd) and the remote MOTD (usually
14 remote.motd) files.
15 </function>
16
17 <function>
18 int motd_send(struct Client* cptr);
19
20 This function sends an appropriate MOTD to the client specified by
21 _cptr_.  If _cptr_ is not a local client, the remote MOTD will be
22 sent; otherwise, an attempt will be made to find a T-line in the
23 configuration file that matches the client.  If no T-line can be
24 found, the default MOTD will be sent to the client.  This function
25 returns 0 for the convenience of other functions that must have an
26 integer return value.
27 </function>
28
29 <function>
30 void motd_signon(struct Client* cptr);
31
32 This function is similar to motd_send(), described above, except that
33 it will only send a message to the client indicating when the MOTD was
34 last modified if the FEAT_NODEFAULTMOTD feature is set to TRUE.
35 </function>
36
37 <function>
38 void motd_recache(void);
39
40 The MOTD system will not automatically detect when MOTD files have
41 been modified.  This function causes the MOTD system to clear the MOTD
42 cache and re-read the files.
43 </function>
44
45 <function>
46 void motd_add(const char *hostmask, const char *path);
47
48 This function is used to add a MOTD to be sent to clients possessing a
49 given _hostmask_.  If _hostmask_ is a numerical string, it is
50 interpreted as a connection class.
51 </function>
52
53 <function>
54 void motd_clear(void);
55
56 This function clears the list of special MOTDs.  Only the default MOTD
57 and remote MOTD are not affected by this function.
58 </function>
59
60 <function>
61 void motd_report(struct Client *to);
62
63 The motd_report() function sends a list of the T-lines stored in
64 memory to the client specified by _to_.  Access control should be
65 handled by the caller.
66 </function>
67
68 <authors>
69 Kev <klmitch@mit.edu>
70 </authors>
71
72 <changelog>
73 [2001-6-15 Kev] Initial documentation of the MOTD interface.
74 </changelog>