text: #include "repsheet.h"
  #include "common.h"
  
  /**
   * @file marked.c
   * @author Aaron Bedra
   * @date 12/09/2014
   */
  
  /**
   * Adds the actor to the Repsheet
   *
   * @param context the Redis connection
   * @param actor the actors user data or ip address
   * @param type IP or USER
   * @reason string to describe the reason for marking
   *
   * @returns an integer result
   */
  int mark(redisContext *context, const char *actor, int type, const char *reason)
  {
    redisReply *reply;
  
    switch(type) {
    case IP:
      return set_list(context, actor, "ip", "marked", reason);
      break;
    case USER:
      return set_list(context, actor, "user", "marked", reason);
      break;
    case BLOCK:
      return set_block(context, actor, "marked", reason);
    default:
      return UNSUPPORTED;
      break;
    }
  }
  
  /**
   * Checks to see if an ip is on the Repsheet
   *
   * @param context the Redis connection
   * @param actor the IP address of the actor
   * @param reason returns the reason for marking.
   *
   * @returns TRUE if yes, FALSE if no, DISCONNECTED if error
   */
  int is_ip_marked(redisContext *context, const char *actor, char *reason)
  {
    redisReply *reply;
  
    reply = redisCommand(context, "GET %s:repsheet:ip:marked", actor);
    if (reply) {
      if (reply->type == REDIS_REPLY_STRING) {
        populate_reason(reply, reason);
        freeReplyObject(reply);
        return TRUE;
      } else {
        freeReplyObject(reply);
        return FALSE;
      }
    } else {
      return DISCONNECTED;
    }
  }
  
  /**
   * Checks to see if a user is on the Repsheet
   *
   * @param context the Redis connection
   * @param actor the user
   * @param reason returns the reason for marking.
   *
   * @returns TRUE if yes, FALSE if no, DISCONNECTED if error
   */
  int is_user_marked(redisContext *context, const char *actor, char *reason)
  {
    redisReply *reply;
  
    reply = redisCommand(context, "GET %s:repsheet:user:marked", actor);
    if (reply) {
      if (reply->type == REDIS_REPLY_STRING) {
        populate_reason(reply, reason);
        freeReplyObject(reply);
        return TRUE;
      } else {
        freeReplyObject(reply);
        return FALSE;
      }
    } else {
      return DISCONNECTED;
    }
  }
  