2 * ircd-ratbox: A slightly useful ircd.
3 * m_admin.c: Sends administrative information to a user.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * $Id: m_admin.c 3368 2007-04-03 10:11:06Z nenolod $
39 static int m_admin(struct Client
*, struct Client
*, int, const char **);
40 static int mr_admin(struct Client
*, struct Client
*, int, const char **);
41 static int ms_admin(struct Client
*, struct Client
*, int, const char **);
42 static void do_admin(struct Client
*source_p
);
44 static void admin_spy(struct Client
*);
46 struct Message admin_msgtab
= {
47 "ADMIN", 0, 0, 0, MFLG_SLOW
| MFLG_UNREG
,
48 {{mr_admin
, 0}, {m_admin
, 0}, {ms_admin
, 0}, mg_ignore
, mg_ignore
, {ms_admin
, 0}}
53 mapi_clist_av1 admin_clist
[] = { &admin_msgtab
, NULL
};
54 mapi_hlist_av1 admin_hlist
[] = {
55 { "doing_admin", &doing_admin_hook
},
59 DECLARE_MODULE_AV1(admin
, NULL
, NULL
, admin_clist
, admin_hlist
, NULL
, "$Revision: 3368 $");
62 * mr_admin - ADMIN command handler
63 * parv[0] = sender prefix
64 * parv[1] = servername
67 mr_admin(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
69 static time_t last_used
= 0L;
71 if((last_used
+ ConfigFileEntry
.pace_wait
) > rb_current_time())
73 sendto_one(source_p
, form_str(RPL_LOAD2HI
),
75 EmptyString(source_p
->name
) ? "*" : source_p
->name
,
80 last_used
= rb_current_time();
88 * m_admin - ADMIN command handler
89 * parv[0] = sender prefix
90 * parv[1] = servername
93 m_admin(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
95 static time_t last_used
= 0L;
99 if((last_used
+ ConfigFileEntry
.pace_wait
) > rb_current_time())
101 sendto_one(source_p
, form_str(RPL_LOAD2HI
),
102 me
.name
, source_p
->name
, "ADMIN");
106 last_used
= rb_current_time();
108 if(hunt_server(client_p
, source_p
, ":%s ADMIN :%s", 1, parc
, parv
) != HUNTED_ISME
)
119 * ms_admin - ADMIN command handler, used for OPERS as well
120 * parv[0] = sender prefix
121 * parv[1] = servername
124 ms_admin(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
126 if(hunt_server(client_p
, source_p
, ":%s ADMIN :%s", 1, parc
, parv
) != HUNTED_ISME
)
138 * inputs - pointer to client to report to
140 * side effects - admin info is sent to client given
143 do_admin(struct Client
*source_p
)
145 if(IsPerson(source_p
))
148 sendto_one_numeric(source_p
, RPL_ADMINME
, form_str(RPL_ADMINME
), me
.name
);
149 if(AdminInfo
.name
!= NULL
)
150 sendto_one_numeric(source_p
, RPL_ADMINLOC1
, form_str(RPL_ADMINLOC1
), AdminInfo
.name
);
151 if(AdminInfo
.description
!= NULL
)
152 sendto_one_numeric(source_p
, RPL_ADMINLOC2
, form_str(RPL_ADMINLOC2
), AdminInfo
.description
);
153 if(AdminInfo
.email
!= NULL
)
154 sendto_one_numeric(source_p
, RPL_ADMINEMAIL
, form_str(RPL_ADMINEMAIL
), AdminInfo
.email
);
159 * input - pointer to client
161 * side effects - event doing_admin is called
164 admin_spy(struct Client
*source_p
)
168 hd
.client
= source_p
;
169 hd
.arg1
= hd
.arg2
= NULL
;
171 call_hook(doing_admin_hook
, &hd
);