dvander@1423: /**
dvander@1423: * vim: set ts=4 :
dvander@1423: * =============================================================================
dvander@1423: * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
dvander@1423: * =============================================================================
dvander@1423: *
dvander@1423: * This file is part of the SourceMod/SourcePawn SDK.
dvander@1423: *
dvander@1423: * This program is free software; you can redistribute it and/or modify it under
dvander@1423: * the terms of the GNU General Public License, version 3.0, as published by the
dvander@1423: * Free Software Foundation.
dvander@1423: *
dvander@1423: * This program is distributed in the hope that it will be useful, but WITHOUT
dvander@1423: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@1423: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dvander@1423: * details.
dvander@1423: *
dvander@1423: * You should have received a copy of the GNU General Public License along with
dvander@1423: * this program. If not, see .
dvander@1423: *
dvander@1423: * As a special exception, AlliedModders LLC gives you permission to link the
dvander@1423: * code of this program (as well as its derivative works) to "Half-Life 2," the
dvander@1423: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
dvander@1423: * by the Valve Corporation. You must obey the GNU General Public License in
dvander@1423: * all respects for all other code used. Additionally, AlliedModders LLC grants
dvander@1423: * this exception to all derivative works. AlliedModders LLC defines further
dvander@1423: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
dvander@1423: * or .
dvander@1423: *
dvander@1423: * Version: $Id$
dvander@1423: */
dvander@1423:
dvander@1423: #if defined _banning_included
dvander@1423: #endinput
dvander@1423: #endif
dvander@1423: #define _banning_included
dvander@1423:
dvander@1423: #define BANFLAG_AUTO (1<<0) /**< Auto-detects whether to ban by steamid or IP */
dvander@1423: #define BANFLAG_IP (1<<1) /**< Always ban by IP address */
dvander@1423: #define BANFLAG_AUTHID (1<<2) /**< Always ban by authstring (for BanIdentity) if possible */
dvander@1423: #define BANFLAG_NOKICK (1<<3) /**< Does not kick the client */
dvander@1423:
dvander@1423: /**
dvander@1423: * Called for calls to BanClient() with a non-empty command.
dvander@1423: *
dvander@1423: * @param client Client being banned.
dvander@1423: * @param time Time the client is being banned for (0 = permanent).
dvander@1423: * @param flags One if AUTHID or IP will be enabled. If AUTO is also
dvander@1423: * enabled, it means Core autodetected which to use.
dvander@1423: * @param reason Reason passed via BanClient().
dvander@1423: * @param kick_message Kick message passed via BanClient().
dvander@1423: * @param command Command string to identify the ban source.
dvander@1423: * @param source Source value passed via BanClient().
dvander@1423: * @noreturn
dvander@1423: */
dvander@1423: forward OnBanClient(client,
dvander@1423: time,
dvander@1423: flags,
dvander@1423: const String:reason[],
dvander@1423: const String:kick_message[],
dvander@1423: const String:command[],
dvander@1423: any:source);
dvander@1423:
dvander@1423: /**
dvander@1423: * Called for calls to BanIdentity() with a non-empty command.
dvander@1423: *
dvander@1423: * @param identity Identity string being banned (authstring or ip).
dvander@1423: * @param time Time the client is being banned for (0 = permanent).
dvander@1423: * @param flags Ban flags (only IP or AUTHID are valid here).
dvander@1423: * @param reason Reason passed via BanIdentity().
dvander@1423: * @param command Command string to identify the ban source.
dvander@1423: * @param source Source value passed via BanIdentity().
dvander@1423: * @noreturn
dvander@1423: */
dvander@1423: forward OnBanIdentity(const String:identity[],
dvander@1423: time,
dvander@1423: flags,
dvander@1423: const String:reason[],
dvander@1423: const String:command[],
dvander@1423: any:source);
dvander@1423:
dvander@1423: /**
dvander@1423: * Called for calls to RemoveBan() with a non-empty command.
dvander@1423: *
dvander@1423: * @param identity Identity string being banned (authstring or ip).
dvander@1423: * @param flags Ban flags (only IP or AUTHID are valid here).
dvander@1423: * @param command Command string to identify the ban source.
dvander@1423: * @param source Source value passed via BanIdentity().
dvander@1423: * @noreturn
dvander@1423: */
dvander@1423: forward OnRemoveBan(const String:identity[],
dvander@1423: flags,
dvander@1423: const String:command[],
dvander@1423: any:source);
dvander@1423:
dvander@1423: /**
dvander@1423: * Bans a client.
dvander@1423: *
dvander@1423: * @param client Client being banned.
dvander@1423: * @param time Time (in minutes) to ban (0 = permanent).
dvander@1423: * @param flags Flags for controlling the ban mechanism. If AUTHID
dvander@1423: * is set and no AUTHID is available, the ban will fail
dvander@1423: * unless AUTO is also flagged.
dvander@1423: * @param reason Reason to ban the client for.
dvander@1423: * @param kick_message Message to display to the user when kicking.
dvander@1423: * @param command Command string to identify the source. If this is left
dvander@1423: * empty, then the OnBanClient forward will not be called.
dvander@1423: * @param source A source value that could be interpreted as a player
dvander@1423: * index of any sort (not actually checked by Core).
dvander@1423: * @return True on success, false on failure.
dvander@1423: * @error Invalid client index or client not in game.
dvander@1423: */
dvander@1423: native bool:BanClient(client,
dvander@1423: time,
dvander@1423: flags,
dvander@1423: const String:reason[],
dvander@1423: const String:kick_message[]="",
dvander@1423: const String:command[]="",
dvander@1423: any:source=0);
dvander@1423:
dvander@1423: /**
dvander@1423: * Bans an identity (either an IP address or auth string).
dvander@1423: *
dvander@1423: * @param identity String to ban (ip or authstring).
dvander@1423: * @param time Time to ban for (0 = permanent).
dvander@1423: * @param flags Flags (only IP and AUTHID are valid flags here).
dvander@1423: * @param reason Ban reason string.
dvander@1423: * @param command Command string to identify the source. If this is left
dvander@1423: * empty, then the OnBanIdentity forward will not be called.
dvander@1423: * @param source A source value that could be interpreted as a player
dvander@1423: * index of any sort (not actually checked by Core).
dvander@1423: * @return True on success, false on failure.
dvander@1423: */
dvander@1423: native bool:BanIdentity(const String:identity[],
dvander@1423: time,
dvander@1423: flags,
dvander@1423: const String:reason[],
dvander@1423: const String:command[]="",
dvander@1423: any:source=0);
dvander@1423:
dvander@1423: /**
dvander@1423: * Removes a ban that was written to the server (either in memory or on disk).
dvander@1423: *
dvander@1423: * @param identity String to unban (ip or authstring).
dvander@1423: * @param flags Flags (only IP and AUTHID are valid flags here).
dvander@1423: * @param command Command strnig to identify the source. If this is left
dvander@1423: * empty, then OnRemoveBan will not be called.
dvander@1423: * @param source A source value that could be interpreted as a player
dvander@1423: * index of any sort (not actually checked by Core).
dvander@1423: * @return True on success, false on failure.
dvander@1423: */
dvander@1423: native bool:RemoveBan(const String:identity[],
dvander@1423: flags,
dvander@1423: const String:command[]="",
dvander@1423: any:source=0);
dvander@1423: