]> jfr.im git - irc/quakenet/newserv.git/blob - miscreply/admin.c
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / miscreply / admin.c
1 /* admin.c */
2
3 #include "miscreply.h"
4 #include "../irc/irc.h"
5 #include "../core/error.h"
6
7
8
9 /* handle remote admin request
10 *
11 * <source numeric> ADMIN/AD <target server numeric>
12 *
13 * cargv[0] = target server numeric
14 *
15 */
16 int handleadminmsg(void *source, int cargc, char **cargv) {
17
18 nick *snick; /* struct nick for source nick */
19 char *sourcenum = (char *)source; /* source user numeric */
20
21 /* check parameters */
22 if (cargc < 1) {
23 miscreply_needmoreparams(sourcenum, "ADMIN");
24 return CMD_OK;
25 }
26
27 /* find source user */
28 if (!(snick = miscreply_finduser(sourcenum, "ADMIN")))
29 return CMD_OK;
30
31 /*
32 * 256 RPL_ADMINME "source 256 target :Administrative info about server"
33 * "irc.netsplit.net 256 foobar :Administrative info about irc.netsplit.net"
34 */
35 irc_send("%s 256 %s :Administrative info about %s", getmynumeric(), sourcenum, myserver->content);
36
37 /*
38 * 257 RPL_ADMINLOC1 "source 257 target :text"
39 * "irc.netsplit.net 257 foobar :Located at someplace"
40 */
41 irc_send("%s 257 %s :%s", getmynumeric(), sourcenum, admin1->content);
42
43 /*
44 * 258 RPL_ADMINLOC2 "source 258 target :text"
45 * "irc.netsplit.net 258 foobar :NetSplit IRC Server"
46 */
47 irc_send("%s 258 %s :%s", getmynumeric(), sourcenum, admin2->content);
48
49 /*
50 * 259 RPL_ADMINEMAIL "source 259 target :text"
51 * "irc.netsplit.net 259 foobar :IRC Admins <mail@host>"
52 */
53 irc_send("%s 259 %s :%s", getmynumeric(), sourcenum, admin3->content);
54
55 return CMD_OK;
56 }