1 /* {{{ irc-seven: Cows like it.
3 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center.
4 * Copyright (C) 1996-2002 Hybrid Development Team.
5 * Copyright (C) 2002-2005 ircd-ratbox development team.
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.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to:
20 * Free Software Foundation, Inc.
21 * 51 Franklin St - Fifth Floor
22 * Boston, MA 02110-1301
41 static int m_admin (struct Client
*, struct Client
*, int, const char **);
42 static int mr_admin (struct Client
*, struct Client
*, int, const char **);
43 static int ms_admin (struct Client
*, struct Client
*, int, const char **);
45 static int do_admin (struct Client
*source_p
);
47 /* {{{ static struct Message = { ... } */
48 static struct Message admin_msgtab
=
50 "ADMIN", 0, 0, 0, MFLG_SLOW
| MFLG_UNREG
,
52 {mr_admin
, 0}, {m_admin
, 0}, {ms_admin
, 0},
53 mg_ignore
, mg_ignore
, {ms_admin
, 0},
58 /* {{{ mapi_clist_av1 admin_clist[] = { ... } */
59 mapi_clist_av1 admin_clist
[] =
66 /* {{{ DECLARE_MODULE_AV1(...) */
79 /* {{{ static int mr_admin()
81 * ADMIN message handler.
89 mr_admin (struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
91 static time_t last_used
= 0;
93 if ((last_used
+ ConfigFileEntry
.pace_wait
) > CurrentTime
)
95 sendto_one(source_p
, form_str(RPL_LOAD2HI
), me
.name
,
96 EmptyString(source_p
->name
) ? "*" : source_p
->name
,
101 last_used
= CurrentTime
;
103 return do_admin(source_p
);
107 /* {{{ static int m_admin()
109 * ADMIN message handler.
118 m_admin (struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
120 static time_t last_used
= 0;
125 if ((last_used
+ ConfigFileEntry
.pace_wait
) > CurrentTime
)
127 sendto_one(source_p
, form_str(RPL_LOAD2HI
), me
.name
,
128 source_p
->name
, "ADMIN");
132 last_used
= CurrentTime
;
134 hunted
= hunt_server(client_p
, source_p
, ":%s ADMIN :%s", 1, parc
, parv
);
135 if (hunted
!= HUNTED_ISME
)
139 return do_admin(source_p
);
143 /* {{{ static int ms_admin()
145 * ADMIN oper/server message handler.
154 ms_admin (struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
158 hunted
= hunt_server(client_p
, source_p
, ":%s ADMIN :%s", 1, parc
, parv
);
159 if (hunted
!= HUNTED_ISME
)
162 return do_admin(source_p
);
166 /* {{{ static int do_admin()
168 * Perform actual ADMIN work.
171 do_admin (struct Client
*source_p
)
173 const char *myname
= NULL
;
174 const char *nick
= NULL
;
176 myname
= get_id(&me
, source_p
);
177 nick
= EmptyString(source_p
->name
) ? "*" : get_id(source_p
, source_p
);
179 sendto_one(source_p
, form_str(RPL_ADMINME
), myname
, nick
, me
.name
);
180 if(AdminInfo
.name
!= NULL
)
181 sendto_one(source_p
, form_str(RPL_ADMINLOC1
), myname
, nick
,
183 if(AdminInfo
.description
!= NULL
)
184 sendto_one(source_p
, form_str(RPL_ADMINLOC2
), myname
, nick
,
185 AdminInfo
.description
);
186 if(AdminInfo
.email
!= NULL
)
187 sendto_one(source_p
, form_str(RPL_ADMINEMAIL
), myname
, nick
,
195 * vim: ts=8 sw=8 noet fdm=marker tw=80