1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/plugins/include/banning.inc Sun Jul 06 04:49:55 2008 +0000
1.3 @@ -0,0 +1,157 @@
1.4 +/**
1.5 + * vim: set ts=4 :
1.6 + * =============================================================================
1.7 + * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
1.8 + * =============================================================================
1.9 + *
1.10 + * This file is part of the SourceMod/SourcePawn SDK.
1.11 + *
1.12 + * This program is free software; you can redistribute it and/or modify it under
1.13 + * the terms of the GNU General Public License, version 3.0, as published by the
1.14 + * Free Software Foundation.
1.15 + *
1.16 + * This program is distributed in the hope that it will be useful, but WITHOUT
1.17 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.18 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.19 + * details.
1.20 + *
1.21 + * You should have received a copy of the GNU General Public License along with
1.22 + * this program. If not, see <http://www.gnu.org/licenses/>.
1.23 + *
1.24 + * As a special exception, AlliedModders LLC gives you permission to link the
1.25 + * code of this program (as well as its derivative works) to "Half-Life 2," the
1.26 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.27 + * by the Valve Corporation. You must obey the GNU General Public License in
1.28 + * all respects for all other code used. Additionally, AlliedModders LLC grants
1.29 + * this exception to all derivative works. AlliedModders LLC defines further
1.30 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.31 + * or <http://www.sourcemod.net/license.php>.
1.32 + *
1.33 + * Version: $Id$
1.34 + */
1.35 +
1.36 +#if defined _banning_included
1.37 + #endinput
1.38 +#endif
1.39 +#define _banning_included
1.40 +
1.41 +#define BANFLAG_AUTO (1<<0) /**< Auto-detects whether to ban by steamid or IP */
1.42 +#define BANFLAG_IP (1<<1) /**< Always ban by IP address */
1.43 +#define BANFLAG_AUTHID (1<<2) /**< Always ban by authstring (for BanIdentity) if possible */
1.44 +#define BANFLAG_NOKICK (1<<3) /**< Does not kick the client */
1.45 +
1.46 +/**
1.47 + * Called for calls to BanClient() with a non-empty command.
1.48 + *
1.49 + * @param client Client being banned.
1.50 + * @param time Time the client is being banned for (0 = permanent).
1.51 + * @param flags One if AUTHID or IP will be enabled. If AUTO is also
1.52 + * enabled, it means Core autodetected which to use.
1.53 + * @param reason Reason passed via BanClient().
1.54 + * @param kick_message Kick message passed via BanClient().
1.55 + * @param command Command string to identify the ban source.
1.56 + * @param source Source value passed via BanClient().
1.57 + * @return Plugin_Handled to block the actual server banning.
1.58 + * Kicking will still occur.
1.59 + */
1.60 +forward Action:OnBanClient(client,
1.61 + time,
1.62 + flags,
1.63 + const String:reason[],
1.64 + const String:kick_message[],
1.65 + const String:command[],
1.66 + any:source);
1.67 +
1.68 +/**
1.69 + * Called for calls to BanIdentity() with a non-empty command.
1.70 + *
1.71 + * @param identity Identity string being banned (authstring or ip).
1.72 + * @param time Time the client is being banned for (0 = permanent).
1.73 + * @param flags Ban flags (only IP or AUTHID are valid here).
1.74 + * @param reason Reason passed via BanIdentity().
1.75 + * @param command Command string to identify the ban source.
1.76 + * @param source Source value passed via BanIdentity().
1.77 + * @return Plugin_Handled to block the actual server banning.
1.78 + */
1.79 +forward Action:OnBanIdentity(const String:identity[],
1.80 + time,
1.81 + flags,
1.82 + const String:reason[],
1.83 + const String:command[],
1.84 + any:source);
1.85 +
1.86 +/**
1.87 + * Called for calls to RemoveBan() with a non-empty command.
1.88 + *
1.89 + * @param identity Identity string being banned (authstring or ip).
1.90 + * @param flags Ban flags (only IP or AUTHID are valid here).
1.91 + * @param command Command string to identify the ban source.
1.92 + * @param source Source value passed via BanIdentity().
1.93 + * @return Plugin_Handled to block the actual server banning.
1.94 + */
1.95 +forward Action:OnRemoveBan(const String:identity[],
1.96 + flags,
1.97 + const String:command[],
1.98 + any:source);
1.99 +
1.100 +/**
1.101 + * Bans a client.
1.102 + *
1.103 + * @param client Client being banned.
1.104 + * @param time Time (in minutes) to ban (0 = permanent).
1.105 + * @param flags Flags for controlling the ban mechanism. If AUTHID
1.106 + * is set and no AUTHID is available, the ban will fail
1.107 + * unless AUTO is also flagged.
1.108 + * @param reason Reason to ban the client for.
1.109 + * @param kick_message Message to display to the user when kicking.
1.110 + * @param command Command string to identify the source. If this is left
1.111 + * empty, then the OnBanClient forward will not be called.
1.112 + * @param source A source value that could be interpreted as a player
1.113 + * index of any sort (not actually checked by Core).
1.114 + * @return True on success, false on failure.
1.115 + * @error Invalid client index or client not in game.
1.116 + */
1.117 +native bool:BanClient(client,
1.118 + time,
1.119 + flags,
1.120 + const String:reason[],
1.121 + const String:kick_message[]="",
1.122 + const String:command[]="",
1.123 + any:source=0);
1.124 +
1.125 +/**
1.126 + * Bans an identity (either an IP address or auth string).
1.127 + *
1.128 + * @param identity String to ban (ip or authstring).
1.129 + * @param time Time to ban for (0 = permanent).
1.130 + * @param flags Flags (only IP and AUTHID are valid flags here).
1.131 + * @param reason Ban reason string.
1.132 + * @param command Command string to identify the source. If this is left
1.133 + * empty, then the OnBanIdentity forward will not be called.
1.134 + * @param source A source value that could be interpreted as a player
1.135 + * index of any sort (not actually checked by Core).
1.136 + * @return True on success, false on failure.
1.137 + */
1.138 +native bool:BanIdentity(const String:identity[],
1.139 + time,
1.140 + flags,
1.141 + const String:reason[],
1.142 + const String:command[]="",
1.143 + any:source=0);
1.144 +
1.145 +/**
1.146 + * Removes a ban that was written to the server (either in memory or on disk).
1.147 + *
1.148 + * @param identity String to unban (ip or authstring).
1.149 + * @param flags Flags (only IP and AUTHID are valid flags here).
1.150 + * @param command Command string to identify the source. If this is left
1.151 + * empty, then OnRemoveBan will not be called.
1.152 + * @param source A source value that could be interpreted as a player
1.153 + * index of any sort (not actually checked by Core).
1.154 + * @return True on success, false on failure.
1.155 + */
1.156 +native bool:RemoveBan(const String:identity[],
1.157 + flags,
1.158 + const String:command[]="",
1.159 + any:source=0);
1.160 +