merged trunk back into 1.1.0 branch for "safety"

--HG--
branch : sourcemod-1.1.0
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.1.0%401721
This commit is contained in:
David Anderson
2007-11-23 05:10:33 +00:00
parent 0601988e80
commit 3f49d29274
75 changed files with 3382 additions and 2175 deletions
+2 -2
View File
@@ -624,7 +624,7 @@ namespace SourceMod
/**
* @brief Reads a single character as a flag.
*
* @param flag Flag character.
* @param c Flag character.
* @param pAdmFlag Pointer to store the admin flag.
* @return True on success, false if invalid.
*/
@@ -707,7 +707,7 @@ namespace SourceMod
* @brief Computers access to an override.
*
* @param client Client index.
* @param override Override name.
* @param cmd Override name.
* @param flags Default flags.
* @param override_only If false, if a command matches the override,
* then its flags will override the default.
+7 -2
View File
@@ -36,6 +36,11 @@
#include <IHandleSys.h>
#include <string.h>
/**
* @file IDBDriver.h
* @brief Defines interfaces for interacting with relational databases.
*/
#define SMINTERFACE_DBI_NAME "IDBI"
#define SMINTERFACE_DBI_VERSION 5
@@ -784,7 +789,7 @@ namespace SourceMod
* @param type A DBHandleType value.
* @param ptr A pointer corrresponding to a DBHandleType
* object.
* @param token Identity pointer of the owning identity.
* @param pToken Identity pointer of the owning identity.
* @return A new Handle_t handle, or 0 on failure.
*/
virtual Handle_t CreateHandle(DBHandleType type, void *ptr, IdentityToken_t *pToken) =0;
@@ -814,7 +819,7 @@ namespace SourceMod
* @brief Given a driver name, attempts to find it. If it is not found, SourceMod
* will attempt to load it. This function is not thread safe.
*
* @param name Driver identifier name.
* @param driver Driver identifier name.
* @return IDBDriver pointer on success, NULL otherwise.
*/
virtual IDBDriver *FindOrLoadDriver(const char *driver) =0;
+4 -2
View File
@@ -127,8 +127,11 @@ namespace SourceMod
/**
* @brief Version code of the IExtensionInterface API itself.
*
* Note: This is bumped when IShareSys is changed, because IShareSys
* itself is not versioned.
*/
#define SMINTERFACE_EXTENSIONAPI_VERSION 2
#define SMINTERFACE_EXTENSIONAPI_VERSION 3
/**
* @brief The interface an extension must expose.
@@ -337,7 +340,6 @@ namespace SourceMod
*
* @param path Path to extension file, relative to the
* extensions folder.
* @param lifetime Lifetime of the extension (currently ignored).
* @param error Error buffer.
* @param maxlength Maximum error buffer length.
* @return New IExtension on success, NULL on failure.
+5
View File
@@ -37,6 +37,11 @@
#define SMINTERFACE_MEMORYUTILS_NAME "IMemoryUtils"
#define SMINTERFACE_MEMORYUTILS_VERSION 1
/**
* @file IMemoryUtils.h
* @brief Interface for finding patterns in memory.
*/
namespace SourceMod
{
class IMemoryUtils : public SMInterface
+5 -2
View File
@@ -265,7 +265,7 @@ namespace SourceMod
* @brief Returns whether the display is capable of rendering an item
* with the given flags.
*
* @param flags ITEMDRAW flags.
* @param drawFlags ITEMDRAW flags.
* @return True if renderable, false otherwise.
*/
virtual bool CanDrawItem(unsigned int drawFlags) =0;
@@ -289,7 +289,7 @@ namespace SourceMod
* @brief Sets the selectable key map. Returns false if the function
* is not supported.
*
* @param keys A bit string where each bit N-1 specifies
* @param keymap A bit string where each bit N-1 specifies
* that key N is selectable (key 0 is bit 9).
* If the selectable key map is 0, it will be
* automatically set to allow 0.
@@ -662,6 +662,7 @@ namespace SourceMod
* @brief A display/selection cycle has ended.
*
* @param menu Menu pointer.
* @param reason MenuEndReason reason.
*/
virtual void OnMenuEnd(IBaseMenu *menu, MenuEndReason reason)
{
@@ -740,6 +741,7 @@ namespace SourceMod
* always be called.
*
* @param menu Menu pointer.
* @param reason VoteCancelReason reason.
*/
virtual void OnMenuVoteCancel(IBaseMenu *menu, VoteCancelReason reason)
{
@@ -823,6 +825,7 @@ namespace SourceMod
*
* @param client Client index.
* @param states Menu states.
* @param order Order to search for items.
* @return IMenuPanel pointer, or NULL if no items could be
* found in the IBaseMenu pointer, or NULL if any
* other error occurred. Any valid pointer must
+72 -1
View File
@@ -41,7 +41,7 @@
#include <IAdminSystem.h>
#define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager"
#define SMINTERFACE_PLAYERMANAGER_VERSION 6
#define SMINTERFACE_PLAYERMANAGER_VERSION 7
struct edict_t;
class IPlayerInfo;
@@ -147,6 +147,42 @@ namespace SourceMod
* @return IPlayerInfo pointer, or NULL if none.
*/
virtual IPlayerInfo *GetPlayerInfo() =0;
/**
* @brief Runs through Core's admin authorization checks. If the
* client is already an admin, no checks are performed.
*
* Note that this function operates solely against the in-memory admin
* cache. It will check steamids, IPs, names, and verify a password
* if one exists. To implement other authentication schemes, simply
* don't call this function and use IGamePlayer::SetAdminId() instead.
*
* @return True if access changed, false otherwise.
*/
virtual bool RunAdminCacheChecks() =0;
/**
* @brief Notifies all listeners that the client has completed
* all of your post-connection (in-game, auth, admin) checks.
*
* If you returned "false" from OnClientPreAdminCheck(), you must
* ALWAYS manually invoke this function, even if RunAdminCacheChecks()
* failed or you did not assign an AdminId. Failure to call this
* function could result in plugins (such as reservedslots) not
* working properly.
*
* If you are implementing asynchronous fetches, and the client
* disconnects during your fetching process, you should make sure to
* recognize that case and not call this function. That is, do not
* call this function on mismatched PreCheck calls, or on disconnected
* clients. A good way to check this is to pass userids around, which
* are unique per client connection.
*
* Calling this has no effect if it has already been called on the
* given client (thus it is safe for multiple asynchronous plugins to
* call it at various times).
*/
virtual void NotifyPostAdminChecks() =0;
};
/**
@@ -230,6 +266,41 @@ namespace SourceMod
virtual void OnServerActivated(int max_clients)
{
}
/**
* @brief Called once a client is authorized and fully in-game, but
* before admin checks are done. This can be used to override the
* default admin checks for a client.
*
* By default, this function allows the authentication process to
* continue as normal. If you need to delay the cache searching
* process in order to get asynchronous data, then return false here.
*
* If you return false, you must call IPlayerManager::NotifyPostAdminCheck
* for the same client, or else the OnClientPostAdminCheck callback will
* never be called.
*
* @param client Client index.
* @return True to continue normally, false to override
* the authentication process.
*/
virtual bool OnClientPreAdminCheck(int client)
{
return true;
}
/**
* @brief Called once a client is authorized and fully in-game, and
* after all post-connection authorizations have been passed. If the
* client does not have an AdminId by this stage, it means that no
* admin entry was in the cache that matched, and the user could not
* be authenticated as an admin.
*
* @param client Client index.
*/
virtual void OnClientPostAdminCheck(int client)
{
}
};
#define COMMAND_FILTER_ALIVE (1<<0) /**< Only allow alive players */
+23
View File
@@ -200,6 +200,29 @@ namespace SourceMod
* @param name Library name.
*/
virtual void RegisterLibrary(IExtension *myself, const char *name) =0;
/**
* @brief Adds a list of natives to the global native pool, to be
* bound on plugin load.
*
* Unlike AddNatives(), this function implements natives that are
* ALWAYS bound, regardless of whether a previous function is bound.
* That means extensions can override Core natives.
*
* A Core version of each native must exist. If one does not, then
* Core will simply ignore that entry.
*
* Override natives represent a weak coupling. If the extension is
* unloaded, the native will be re-bound to the Core version.
*
* @param myself Identity token of parent object.
* @param natives Array of natives to add. The last entry in
* the array must be filled with NULLs to
* terminate the array. The array must be static
* as Core will cache the pointer for the
* lifetime of the extension.
*/
virtual void OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives) =0;
};
}
+18 -1
View File
@@ -43,7 +43,7 @@
#include <time.h>
#define SMINTERFACE_SOURCEMOD_NAME "ISourceMod"
#define SMINTERFACE_SOURCEMOD_VERSION 3
#define SMINTERFACE_SOURCEMOD_VERSION 4
/**
* @brief Forward declaration of the KeyValues class.
@@ -199,6 +199,23 @@ namespace SourceMod
* @return Adjusted server time.
*/
virtual time_t GetAdjustedTime() =0;
/**
* @brief Sets the global client SourceMod will use for assisted
* translations (that is, %t).
*
* @param index Client index.
* @return Old global client value.
*/
virtual unsigned int SetGlobalTarget(unsigned int index) =0;
/**
* @brief Returns the global client SourceMod is currently using
* for assisted translations (that is, %t).
*
* @return Global client value.
*/
virtual unsigned int GetGlobalTarget() const =0;
};
}
+1 -2
View File
@@ -280,7 +280,6 @@ namespace SourceMod
* @param key Key string.
* @param value Value string. If no quotes were specified, this will be NULL,
* and key will contain the entire string.
* @param Number of line in file.
* @return SMCResult directive.
*/
virtual SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
@@ -291,7 +290,7 @@ namespace SourceMod
/**
* @brief Called when leaving the current section.
*
* @param Parsing states.
* @param states Parsing states.
* @return SMCResult directive.
*/
virtual SMCResult ReadSMC_LeavingSection(const SMCStates *states)
+1 -1
View File
@@ -144,7 +144,7 @@ namespace SourceMod
* @param flags Flags to use for sending the message.
* @return bf_write structure to write message with, or NULL on failure.
*/
virtual bf_write *StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags) =0;
virtual bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags) =0;
/**
* @brief Wrapper around UserMessageEnd for use with StartMessage().
+9 -1
View File
@@ -43,7 +43,7 @@
*/
#define SMINTERFACE_TOPMENUS_NAME "ITopMenus"
#define SMINTERFACE_TOPMENUS_VERSION 3
#define SMINTERFACE_TOPMENUS_VERSION 4
namespace SourceMod
{
@@ -268,6 +268,14 @@ namespace SourceMod
* @return Object's info string, or NULL if none.
*/
virtual const char *GetObjectInfoString(unsigned int object_id) =0;
/**
* @brief Returns an object's name string.
*
* @param object_id Object ID.
* @return Object's name string, or NULL if none.
*/
virtual const char *GetObjectName(unsigned int object_id) =0;
};
/**
+1
View File
@@ -74,5 +74,6 @@
//#define SMEXT_ENABLE_PLUGINSYS
//#define SMEXT_ENABLE_ADMINSYS
//#define SMEXT_ENABLE_TEXTPARSERS
#define SMEXT_ENABLE_USERMSGS
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
+6
View File
@@ -91,6 +91,9 @@ IAdminSystem *adminsys = NULL;
#if defined SMEXT_ENABLE_TEXTPARSERS
ITextParsers *textparsers = NULL;
#endif
#if defined SMEXT_ENABLE_USERMSGS
IUserMessages *usermsgs = NULL;
#endif
/** Exports the main interface */
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
@@ -173,6 +176,9 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
#if defined SMEXT_ENABLE_TEXTPARSERS
SM_GET_IFACE(TEXTPARSERS, textparsers);
#endif
#if defined SMEXT_ENABLE_USERMSGS
SM_GET_IFACE(USERMSGS, usermsgs);
#endif
if (SDK_OnLoad(error, maxlength, late))
{
+6
View File
@@ -85,6 +85,9 @@
#if defined SMEXT_ENABLE_TEXTPARSERS
#include <ITextParsers.h>
#endif
#if defined SMEXT_ENABLE_USERMSGS
#include <IUserMessages.h>
#endif
#if defined SMEXT_CONF_METAMOD
#include <ISmmPlugin.h>
@@ -277,6 +280,9 @@ extern IMenuManager *menus;
#if defined SMEXT_ENABLE_ADMINSYS
extern IAdminSystem *adminsys;
#endif
#if defined SMEXT_ENABLE_USERMSGS
extern IUserMessages *usermsgs;
#endif
#if defined SMEXT_CONF_METAMOD
PLUGIN_GLOBALVARS();