]>
jfr.im git - irc/gameservirc.git/blob - gameserv/do_identify.cpp
11 void do_identify(char *u
)
13 char *password
, *name
;
16 name
= strtok(NULL
, " ");
17 password
= strtok(NULL
, " ");
18 if (!password
|| !name
)
20 notice(s_GameServ
, u
, "SYNTAX: /msg <S IDENTIFY NAME PASSWORD");
22 else if (!(user
= find(u
)))
24 notice(s_GameServ
, u
, "Fatal error. Cannot find aClient. Buf: %s", strtok(NULL
, ""));
25 log("Error: aClient not found: %s", u
);
27 else if (isIgnore(user
))
30 log("Ignoring %s.", user
->getNick());
34 else if (!(p
= findplayer(name
)))
36 notice(s_GameServ
, u
, "Player %s not found", name
);
38 else if (is_playing(user
))
40 notice(s_GameServ
, u
, "You are already playing!");
42 else if (is_playing(p
->getClient()) && !isAdmin(user
))
44 notice(s_GameServ
, u
, "That player has already identified.");
46 else if (!check_password(name
, password
) && !isAdmin(user
))
48 notice(s_GameServ
, u
, "Password incorrect");
52 list
<Player
*>::iterator iter
;
53 unsigned long hv
= iHASH((unsigned char *) p
->getName().c_str());
55 iter
= find(players
[hv
].begin(), players
[hv
].end(), p
);
57 if (iter
== players
[hv
].end())
59 notice(s_GameServ
, u
, "Fatal error. Contact <S Admin. Buf: %s",
63 // Make sure the other user is logged out
64 logout(p
->getClient());
72 log("Player %s IRC: %s Identified", user
->stats
->getName().c_str(),
75 //Set the playing flag
78 // Update the last login time
79 user
->stats
->lastlogin
= time(NULL
);
81 notice(s_GameServ
, u
, "Password Accepted. Identified.");
82 showNews(u
, todaysnews
);