unsigned commandPrivCheck (RunningCommand *command, ChatBot *bot) { long userID = command->message->user->userID; int isPrivileged = checkPrivUser (bot, userID); int commandPriv = command->command->privileges; if ((isPrivileged & commandPriv) != commandPriv) { postReply(bot->room, "You do not have priveleges to run that command", command->message); return 0; } return 1; }
void Codri::JsonResource::doJsonReply(int iSessionId, int iRequestId, QVariant& iReply, Result iResult) { switch (iResult) { case VALID: postReply(iSessionId, iRequestId, iReply); break; case CONFLICT: postConflictingPayload(iSessionId, iRequestId); break; case INVALID: postInvalidPayload(iSessionId, iRequestId, "Invalid Payload"); break; case UNSUPPORTED: postUnsupportedMethod(iSessionId, iRequestId); break; } }