コード例 #1
0
ファイル: main.c プロジェクト: D4edalus/CoD4x_Server
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;
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: main.c プロジェクト: D4edalus/CoD4x_Server
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;
}