Skip to content

Commit

Permalink
Made banning send out more error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Fernandez committed Nov 1, 2010
1 parent f916524 commit e703085
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ class ErrorMessage : public OutMessage {
public:
enum TYPE {
NONEXISTENT_USER = 0,

USER_NOT_ONLINE = 1,
BAD_CHALLENGE = 2
BAD_CHALLENGE = 2,
UNAUTHORIZED_ACTION = 3
};
ErrorMessage(const TYPE type, const string &details = string()):
OutMessage(ERROR_MESSAGE) {
Expand Down Expand Up @@ -1741,7 +1741,7 @@ void ClientImpl::handleBanMessage(InMessage &msg) {

// Escape if the target doesn't exist.
if (!registry->userExists(target)) {
sendMessage(ErrorMessage(ErrorMessage::NONEXISTENT_USER));
sendMessage(ErrorMessage(ErrorMessage::NONEXISTENT_USER, target));
return;
}

Expand All @@ -1751,6 +1751,7 @@ void ClientImpl::handleBanMessage(InMessage &msg) {
if (!auth[Channel::OP] || uauth[Channel::PROTECTED]
|| (!auth[Channel::PROTECTED] && uauth[Channel::OP])) {
// You don't have the authority to do anything to this user
sendMessage(ErrorMessage(ErrorMessage::UNAUTHORIZED_ACTION));
return;
}

Expand All @@ -1760,7 +1761,7 @@ void ClientImpl::handleBanMessage(InMessage &msg) {
kickUser(m_server, channel, m_name, client, date, id);
} else if (!client) {
// The user isn't online, so inform the kicker.
sendMessage(ErrorMessage(ErrorMessage::USER_NOT_ONLINE));
sendMessage(ErrorMessage(ErrorMessage::USER_NOT_ONLINE, target));
}
} else {
int ban;
Expand All @@ -1775,6 +1776,7 @@ void ClientImpl::handleBanMessage(InMessage &msg) {
// Can't change ban made by user with a higher level.
Channel::FLAGS flags = setter;
if (!auth[Channel::PROTECTED] && flags[Channel::PROTECTED]) {
sendMessage(ErrorMessage(ErrorMessage::UNAUTHORIZED_ACTION));
return;
}

Expand Down

0 comments on commit e703085

Please sign in to comment.