plugins/include/banning.inc
author Fyren <fyrenmoo@gmail.com>
Sun Mar 01 16:48:55 2009 -0500 (2009-03-01)
changeset 2639 021fbd7a8cf6
parent 2289 44045ead61cd
permissions -rw-r--r--
Improved docs of TIMER_HNDL_CLOSE (bug 3641, r=dvander).
dvander@1423
     1
/**
dvander@1423
     2
 * vim: set ts=4 :
dvander@1423
     3
 * =============================================================================
ds@1947
     4
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
dvander@1423
     5
 * =============================================================================
dvander@1423
     6
 *
dvander@1423
     7
 * This file is part of the SourceMod/SourcePawn SDK.
dvander@1423
     8
 *
dvander@1423
     9
 * This program is free software; you can redistribute it and/or modify it under
dvander@1423
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
dvander@1423
    11
 * Free Software Foundation.
dvander@1423
    12
 * 
dvander@1423
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
dvander@1423
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@1423
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
dvander@1423
    16
 * details.
dvander@1423
    17
 *
dvander@1423
    18
 * You should have received a copy of the GNU General Public License along with
dvander@1423
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1423
    20
 *
dvander@1423
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
dvander@1423
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
dvander@1423
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
dvander@1423
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
dvander@1423
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
dvander@1423
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
dvander@1423
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
dvander@1423
    28
 * or <http://www.sourcemod.net/license.php>.
dvander@1423
    29
 *
dvander@1423
    30
 * Version: $Id$
dvander@1423
    31
 */
dvander@1423
    32
dvander@1423
    33
#if defined _banning_included
dvander@1423
    34
 #endinput
dvander@1423
    35
#endif
dvander@1423
    36
#define _banning_included
dvander@1423
    37
dvander@1423
    38
#define BANFLAG_AUTO		(1<<0)	/**< Auto-detects whether to ban by steamid or IP */
dvander@1423
    39
#define BANFLAG_IP			(1<<1)	/**< Always ban by IP address */
dvander@1423
    40
#define BANFLAG_AUTHID		(1<<2)	/**< Always ban by authstring (for BanIdentity) if possible */
dvander@1423
    41
#define BANFLAG_NOKICK		(1<<3)	/**< Does not kick the client */
dvander@1423
    42
dvander@1423
    43
/**
dvander@1423
    44
 * Called for calls to BanClient() with a non-empty command.
dvander@1423
    45
 *
dvander@1423
    46
 * @param client		Client being banned.
dvander@1423
    47
 * @param time			Time the client is being banned for (0 = permanent).
dvander@1423
    48
 * @param flags			One if AUTHID or IP will be enabled.  If AUTO is also 
dvander@1423
    49
 *						enabled, it means Core autodetected which to use.
dvander@1423
    50
 * @param reason		Reason passed via BanClient().
dvander@1423
    51
 * @param kick_message	Kick message passed via BanClient().
dvander@1423
    52
 * @param command		Command string to identify the ban source.
dvander@1423
    53
 * @param source		Source value passed via BanClient().
dvander@1450
    54
 * @return				Plugin_Handled to block the actual server banning.
dvander@1450
    55
 *						Kicking will still occur.
dvander@1423
    56
 */
dvander@1450
    57
forward Action:OnBanClient(client,
dvander@1450
    58
						   time, 
dvander@1450
    59
						   flags, 
dvander@1450
    60
						   const String:reason[], 
dvander@1450
    61
						   const String:kick_message[], 
dvander@1450
    62
						   const String:command[],
dvander@1450
    63
						   any:source);
dvander@1423
    64
dvander@1423
    65
/**
dvander@1423
    66
 * Called for calls to BanIdentity() with a non-empty command.
dvander@1423
    67
 *
dvander@1423
    68
 * @param identity		Identity string being banned (authstring or ip).
dvander@1423
    69
 * @param time			Time the client is being banned for (0 = permanent).
dvander@1423
    70
 * @param flags			Ban flags (only IP or AUTHID are valid here).
dvander@1423
    71
 * @param reason		Reason passed via BanIdentity().
dvander@1423
    72
 * @param command		Command string to identify the ban source.
dvander@1423
    73
 * @param source		Source value passed via BanIdentity().
dvander@1450
    74
 * @return				Plugin_Handled to block the actual server banning.
dvander@1423
    75
 */
dvander@1450
    76
forward Action:OnBanIdentity(const String:identity[],
dvander@1450
    77
							 time,
dvander@1450
    78
							 flags,
dvander@1450
    79
							 const String:reason[],
dvander@1450
    80
							 const String:command[],
dvander@1450
    81
							 any:source);
dvander@1423
    82
dvander@1423
    83
/**
dvander@1423
    84
 * Called for calls to RemoveBan() with a non-empty command.
dvander@1423
    85
 *
dvander@1423
    86
 * @param identity		Identity string being banned (authstring or ip).
dvander@1423
    87
 * @param flags			Ban flags (only IP or AUTHID are valid here).
dvander@1423
    88
 * @param command		Command string to identify the ban source.
dvander@1423
    89
 * @param source		Source value passed via BanIdentity().
dvander@1450
    90
 * @return				Plugin_Handled to block the actual server banning.
dvander@1423
    91
 */
dvander@1450
    92
forward Action:OnRemoveBan(const String:identity[],
dvander@1450
    93
						   flags,
dvander@1450
    94
						   const String:command[],
dvander@1450
    95
						   any:source);
dvander@1423
    96
dvander@1423
    97
/**
dvander@1423
    98
 * Bans a client.
dvander@1423
    99
 *
dvander@1423
   100
 * @param client		Client being banned.
dvander@1423
   101
 * @param time			Time (in minutes) to ban (0 = permanent).
dvander@1423
   102
 * @param flags			Flags for controlling the ban mechanism.  If AUTHID 
dvander@1423
   103
 *						is set and no AUTHID is available, the ban will fail 
dvander@1423
   104
 *						unless AUTO is also flagged.
dvander@1423
   105
 * @param reason		Reason to ban the client for.
dvander@1423
   106
 * @param kick_message	Message to display to the user when kicking.
dvander@1423
   107
 * @param command		Command string to identify the source.  If this is left 
dvander@1423
   108
 *						empty, then the OnBanClient forward will not be called.
dvander@1423
   109
 * @param source		A source value that could be interpreted as a player 
dvander@1423
   110
 *						index of any sort (not actually checked by Core).
dvander@1423
   111
 * @return				True on success, false on failure.
dvander@1423
   112
 * @error				Invalid client index or client not in game.
dvander@1423
   113
 */
dvander@1423
   114
native bool:BanClient(client, 
dvander@1423
   115
					  time, 
dvander@1423
   116
					  flags, 
dvander@1423
   117
					  const String:reason[], 
dvander@1423
   118
					  const String:kick_message[]="", 
dvander@1423
   119
					  const String:command[]="",
dvander@1423
   120
					  any:source=0);
dvander@1423
   121
dvander@1423
   122
/**
dvander@1423
   123
 * Bans an identity (either an IP address or auth string).
dvander@1423
   124
 *
dvander@1423
   125
 * @param identity		String to ban (ip or authstring).
dvander@1423
   126
 * @param time			Time to ban for (0 = permanent).
dvander@1423
   127
 * @param flags			Flags (only IP and AUTHID are valid flags here).
dvander@1423
   128
 * @param reason		Ban reason string.
dvander@1423
   129
 * @param command		Command string to identify the source.  If this is left 
dvander@1423
   130
 *						empty, then the OnBanIdentity forward will not be called.
dvander@1423
   131
 * @param source		A source value that could be interpreted as a player
dvander@1423
   132
 *						index of any sort (not actually checked by Core).
dvander@1423
   133
 * @return				True on success, false on failure.
dvander@1423
   134
 */
dvander@1423
   135
native bool:BanIdentity(const String:identity[], 
dvander@1423
   136
						time, 
dvander@1423
   137
						flags, 
dvander@1423
   138
						const String:reason[],
dvander@1423
   139
						const String:command[]="",
dvander@1423
   140
						any:source=0);
dvander@1423
   141
dvander@1423
   142
/**
dvander@1423
   143
 * Removes a ban that was written to the server (either in memory or on disk).
dvander@1423
   144
 *
dvander@1423
   145
 * @param identity		String to unban (ip or authstring).
dvander@1423
   146
 * @param flags			Flags (only IP and AUTHID are valid flags here).
pred@2111
   147
 * @param command		Command string to identify the source.  If this is left 
dvander@1423
   148
 *						empty, then OnRemoveBan will not be called.
dvander@1423
   149
 * @param source		A source value that could be interpreted as a player 
dvander@1423
   150
 *						index of any sort (not actually checked by Core).
dvander@1423
   151
 * @return				True on success, false on failure.
dvander@1423
   152
 */
dvander@1423
   153
native bool:RemoveBan(const String:identity[], 
dvander@1423
   154
					  flags, 
dvander@1423
   155
					  const String:command[]="", 
dvander@1423
   156
					  any:source=0);
dvander@1423
   157