qboolean SV_RemoveBan(int uid, char* guid, char* name){

    banList_t *this;
    int i;
    int type;
    qboolean succ = qfalse;
    char* printguid;
    char* banreason;
    char* printnick;

    if(uid > 0){
        type = 0;
    }else if(strlen(guid) == 8){
        type = 1;
    }else if(strlen(name) > 2){
        type = 2;
    }else{
        return qfalse;
    }

    this = banlist;
    if(!this)
        return qfalse;

    if(!SV_ReloadBanlist())
        return qfalse;

    for(i = 0 ; i < current_banindex; this++, i++)
    {
        switch(type)
        {
                case 0:
                    if(uid != this->playeruid)
                        continue;

                    break;
                case 1:
                    if(Q_stricmp(guid, this->pbguid))
                        continue;

                    break;
                case 2:
                    if(!Q_stricmp(name, this->playername))
                        continue;
        }
        this->expire = (time_t) 0;
        SV_RemoveBanByip(NULL, this->playeruid, this->pbguid);
        succ = qtrue;

        if(!*this->pbguid){
            printguid = "N/A";
        }else{
            printguid = this->pbguid;
        }

        if(!*this->reason){
            banreason = "N/A";
        }else{
            banreason = this->reason;
        }

        if(!*this->playername){
            printnick = "N/A";
        }else{
            printnick = this->playername;
        }

        Com_Printf("Removing ban for Nick: %s, UID: %i, GUID: %s, Banreason: %s\n", printnick, this->playeruid, printguid, banreason);
        SV_PrintAdministrativeLog("Removing ban for Nick: %s, UID: %i, GUID: %s, Banreason: %s\n", printnick, this->playeruid, printguid, banreason);
    }
    if(succ)
        SV_WriteBanlist();

    return succ;
}
qboolean SV_AddBan(int uid, int auid, char* guid, char* name, time_t expire, char* banreason){

    if(!SV_OversizeBanlistAlign())
        return qfalse;

    banList_t *this;
    int i;


    this = banlist;
    if(!this)
        return qfalse;

    int type;

    if(uid > 0){
        type = 0;
    }else if(guid && strlen(guid) == 8){
        type = 1;
    }else{
        return qfalse;
    }

    if(!SV_ReloadBanlist())
        return qfalse;

    for(i = 0 ; i < current_banindex; this++, i++){
        switch(type)
        {
            case 0:
                if(uid != this->playeruid)
                    continue;

            break;
            case 1:
                if(Q_stricmp(guid, this->pbguid))
                    continue;
        }
        break;
    }
    if(i == current_banindex){
        current_banindex++; //Rise the array index

    }else{
        if(type == 0){
            Com_Printf( "Modifying banrecord for player uid: %i\n", uid);
            SV_PrintAdministrativeLog( "modified banrecord of player uid: %i:", uid);
        }else{
            Com_Printf( "Modifying banrecord for player guid: %s\n", guid);
            SV_PrintAdministrativeLog( "modified banrecord of player guid: %s:", guid);
        }
    }

    this->playeruid = uid;
    this->adminuid = auid;
    this->expire = expire;

    if(banreason)
        Q_strncpyz(this->reason, banreason, sizeof(this->reason));
    else
        *this->reason = 0;

    if(guid && type)
        Q_strncpyz(this->pbguid, guid, sizeof(this->pbguid));
    else
        *this->pbguid = 0;

    if(name)
        Q_strncpyz(this->playername, name, sizeof(this->playername));
    else
        *this->playername = 0;

    SV_WriteBanlist();
    return qtrue;
}
Beispiel #3
0
qboolean SV_RemoveBanFromInternalList(uint64_t playerid, char* name){

    banList_t *this;
    int i;
    qboolean succ = qfalse;
    char* banreason;
    char* printnick;
    char pid[128];

    if(name == NULL)
    {
      name = "";
    }

    if(playerid == 0 && name[0] == 0)
    {
      return qfalse;
    }

    this = banlist;
    if(!this)
        return qfalse;

    if(!SV_ReloadBanlist())
        return qfalse;

    for(i = 0 ; i < current_banindex; this++, i++)
    {
        if(playerid)
        {
          if(playerid != this->playerid)
          {
            continue;
          }
        }else if(name[0]){
          if(Q_stricmp(name, this->playername))
          {
            continue;
          }
        }else{
          continue;
        }

        this->expire = (time_t) 0;
        Plugin_RemoveBanByip(&this->remote);
        succ = qtrue;

        if(!*this->reason){
            banreason = "N/A";
        }else{
            banreason = this->reason;
        }

        if(!*this->playername){
            printnick = "N/A";
        }else{
            printnick = this->playername;
        }
        Plugin_SteamIDToString(this->playerid, pid, sizeof(pid));
        Plugin_Printf("Removing ban for Nick: %s, PlayerID: %s, Banreason: %s\n", printnick, pid, banreason);
        Plugin_PrintAdministrativeLog("Removing ban for Nick: %s, PlayerID: %s, Banreason: %s\n", printnick, pid, banreason);
    }
    if(succ)
        SV_WriteBanlist();

    return succ;
}
static qboolean SV_RemoveBanFromInternalList(char* guid, char* name)
{

    banList_t *this;
    int i;
    qboolean succ = qfalse;
    char* banreason;
    char* printnick;


    if(name == NULL)
    {
      name = "";
    }
    if(guid == NULL)
    {
        guid = "";
    }

    if(guid[0] == 0 && name[0] == 0)
    {
      return qfalse;
    }

    if(guid[0] && strlen(guid) == 32)
    {
      guid += 24;
    }

    if(guid[0] && strlen(guid) != 8)
    {
      return qfalse;
    }

    this = banlist;
    if(!this)
        return qfalse;

    if(!SV_ReloadBanlist())
        return qfalse;

    for(i = 0 ; i < current_banindex; this++, i++)
    {
        if(guid[0])
        {
          if(Q_stricmpn(guid, this->guid, 8))
          {
            continue;
          }
        }else if(name[0]){
          if(Q_stricmp(name, this->playername))
          {
            continue;
          }
        }else{
          continue;
        }

        this->expire = (time_t) 0;
        Plugin_RemoveBanByip(&this->remote);
        succ = qtrue;

        if(!*this->reason){
            banreason = "N/A";
        }else{
            banreason = this->reason;
        }

        if(!*this->playername){
            printnick = "N/A";
        }else{
            printnick = this->playername;
        }
        Plugin_Printf("Removing ban for Nick: %s, GUID: %s, Banreason: %s\n", printnick, guid, banreason);
        Plugin_PrintAdministrativeLog("Removing ban for Nick: %s, UID: %s, Banreason: %s\n", printnick, guid, banreason);
    }
    if(succ)
        SV_WriteBanlist();

    return succ;
}
Beispiel #5
0
qboolean SV_AddBanToInternalList(uint64_t playerid, uint64_t adminsteamid, char* name, netadr_t* adr, time_t expire, char* banreason)
{
    char pid[128];
    time_t aclock;

    if(!SV_OversizeBanlistAlign())
        return qfalse;

    time(&aclock);

    banList_t *this;
    int i;

    this = banlist;
    if(!this)
        return qfalse;

    if(playerid == 0)
    {
        return qfalse;
    }

    if(!SV_ReloadBanlist())
        return qfalse;

    for(i = 0 ; i < current_banindex; this++, i++){
        if(playerid == this->playerid)
            break;
    }
    if(i == current_banindex)
    {
        current_banindex++; //Rise the array index
    }else{
      Plugin_SteamIDToString(playerid, pid, sizeof(pid));
      Plugin_Printf( "Modifying banrecord for player id: %s\n", pid);
      Plugin_PrintAdministrativeLog( "modified banrecord of player id: %s:", pid);
    }

    this->playerid = playerid;
    this->adminsteamid = adminsteamid;
    this->expire = expire;
    this->created = aclock;
    if(adr && adr->type != NA_BAD)
    {
      this->remote = *adr;
    }else{
      memset(&this->remote, 0, sizeof(netadr_t));
    }
    if(banreason)
        Q_strncpyz(this->reason, banreason, sizeof(this->reason));
    else
        *this->reason = 0;

    if(name)
        Q_strncpyz(this->playername, name, sizeof(this->playername));
    else
        *this->playername = 0;

    SV_WriteBanlist();
    return qtrue;
}