timeq_del(game->timer);
game->timer = NULL;
game->state = FOURWINS_STATE_RUNNING;
+ if((game->player[0]->user->flags & USERFLAG_ISAUTHED) && (game->player[1]->user->flags & USERFLAG_ISAUTHED) && !stricmp(game->player[0]->user->auth, game->player[1]->user->auth)) {
+ fourwins_reply(game, "NF_4WINS_SELF");
+ fourwins_free_game(game);
+ return;
+ }
fourwins_reply(game, "NF_4WINS_START", user->nick);
if((game->player[0]->user->flags & USERFLAG_ISAUTHED)) {
char *tmp;
game->timer = timeq_add(120, module_id, fourwins_timeout, game);
} else {
if(!argc) {
- reply(getTextBot(), user, "NF_4WINS_ENTER_OPPONENT");
+ reply(textclient, user, "NF_4WINS_ENTER_OPPONENT");
return;
}
struct UserNode *opp_user = getUserByNick(argv[0]);
if(!opp_user) {
- reply(getTextBot(), user, "NS_USER_UNKNOWN", argv[0]);
+ reply(textclient, user, "NS_USER_UNKNOWN", argv[0]);
+ return;
+ }
+ if(opp_user == user) {
+ reply(textclient, user, "NF_4WINS_SELF");
return;
}
struct ChanUser *opponent = getChanUser(opp_user, chan);
if(!opponent) {
- reply(getTextBot(), user, "NF_4WINS_OPPONENT_NOT_IN_CHAN", opp_user->nick);
+ reply(textclient, user, "NF_4WINS_OPPONENT_NOT_IN_CHAN", opp_user->nick);
return;
}
game = calloc(1,sizeof(*game));
game->player[0] = chanuser;
game->player[1] = opponent;
- game->textbot = getTextBot();
+ game->textbot = textclient;
game->state = FOURWINS_STATE_WAITING;
game->timer = timeq_add(120, module_id, fourwins_timeout, game);
game->next = fourwins_active_games;
fourwins_active_games = game;
- reply(getTextBot(), user, "NF_4WINS_REQUESTED", opp_user->nick);
- reply(getTextBot(), opp_user, "NF_4WINS_REQUEST", user->nick);
+ reply(textclient, user, "NF_4WINS_REQUESTED", opp_user->nick);
+ reply(textclient, opp_user, "NF_4WINS_REQUEST", user->nick);
}
}