Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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;
    }
}