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