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