]> jfr.im git - irc/gameservirc.git/blame - gameserv/do_admin.cpp
Added do_register.cpp, do_identify.cpp, do_list.cpp, do_help.cpp, do_refresh.cpp...
[irc/gameservirc.git] / gameserv / do_admin.cpp
CommitLineData
37a0eb1d 1#include "extern.h"
2#include "aClient.h"
3#include "flags.h"
4
5void do_admin(char *u)
6{
7 aClient *user;
8 char *pass = strtok(NULL, " ");
9
10 if (!(user = find(u)))
11 {
12 log("Error: aClient not found: %s", u);
13 notice(s_GameServ, u, "Error: aClient not found. Contact <S admin.");
14 return;
15 }
16
17 if (!pass)
18 {
19 notice(s_GameServ, u, "SYNTAX: \ 2ADMIN\ 2 \ 2\1fpassword\1f\ 2");
20 return;
21 }
22
23 if (isAdmin(user))
24 {
25 notice(s_GameServ, u, "You already have administrator privledges.");
26 return;
27 }
28 else if (strcmp(pass, adminpass) == 0)
29 {
30 notice(s_GameServ, u, "Password accepted. You now have administrator privledges.");
31 setAdmin(user);
32#ifdef P10
33 log("%s became an administrator.", user->getRealNick());
34#else
35 log("%s became an administrator.", user->getNick());
36#endif
37 }
38 else
39 {
40 notice(s_GameServ, u, "Invalid password. Remember: case sensitive");
41 return;
42 }
43}