void Voting::cancel(Vote &vote, const Chan &chan, const User &user) { if(user.get_acct() != vote.get_user_acct()) throw Exception() << "You can't cancel a vote by " << vote.get_user_acct() << "."; if(vote.total() > 1) throw Exception("You can't cancel after someone else has voted."); const auto &cfg(vote.get_cfg()); if(!cfg.get("cancel",true)) throw Exception("You can't cancel votes of this type."); vote.cancel(); del(vote.get_id()); }