parent
352f078b07
commit
527a998740
@ -40,9 +40,9 @@
|
|||||||
*/
|
*/
|
||||||
enum CookieAccess
|
enum CookieAccess
|
||||||
{
|
{
|
||||||
CookieAccess_Public, /**< Visible and Changeable by users */
|
CookieAccess_Public, /**< Visible and Changeable by users */
|
||||||
CookieAccess_Protected, /**< Read only to users */
|
CookieAccess_Protected, /**< Read only to users */
|
||||||
CookieAccess_Private, /**< Completely hidden cookie */
|
CookieAccess_Private /**< Completely hidden cookie */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,10 +50,10 @@ enum CookieAccess
|
|||||||
*/
|
*/
|
||||||
enum CookieMenu
|
enum CookieMenu
|
||||||
{
|
{
|
||||||
CookieMenu_YesNo, /**< Yes/No menu with "yes"/"no" results saved into the cookie */
|
CookieMenu_YesNo, /**< Yes/No menu with "yes"/"no" results saved into the cookie */
|
||||||
CookieMenu_YesNo_Int, /**< Yes/No menu with 1/0 saved into the cookie */
|
CookieMenu_YesNo_Int, /**< Yes/No menu with 1/0 saved into the cookie */
|
||||||
CookieMenu_OnOff, /**< On/Off menu with "on"/"off" results saved into the cookie */
|
CookieMenu_OnOff, /**< On/Off menu with "on"/"off" results saved into the cookie */
|
||||||
CookieMenu_OnOff_Int, /**< On/Off menu with 1/0 saved into the cookie */
|
CookieMenu_OnOff_Int /**< On/Off menu with 1/0 saved into the cookie */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CookieMenuAction
|
enum CookieMenuAction
|
||||||
@ -71,17 +71,17 @@ enum CookieMenuAction
|
|||||||
*
|
*
|
||||||
* INPUT : Client index and any data if available.
|
* INPUT : Client index and any data if available.
|
||||||
*/
|
*/
|
||||||
CookieMenuAction_SelectOption = 1,
|
CookieMenuAction_SelectOption = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cookie Menu Callback prototype
|
* Cookie Menu Callback prototype
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
* @param action CookieMenuAction being performed.
|
* @param action CookieMenuAction being performed.
|
||||||
* @param info Info data passed.
|
* @param info Info data passed.
|
||||||
* @param buffer Outbut buffer.
|
* @param buffer Outbut buffer.
|
||||||
* @param maxlen Max length of the output buffer.
|
* @param maxlen Max length of the output buffer.
|
||||||
*/
|
*/
|
||||||
typedef CookieMenuHandler = function void (
|
typedef CookieMenuHandler = function void (
|
||||||
int client,
|
int client,
|
||||||
@ -176,12 +176,12 @@ methodmap Cookie < Handle {
|
|||||||
* Handles returned by RegClientCookie can be closed via CloseHandle() when
|
* Handles returned by RegClientCookie can be closed via CloseHandle() when
|
||||||
* no longer needed.
|
* no longer needed.
|
||||||
*
|
*
|
||||||
* @param name Name of the new preference cookie.
|
* @param name Name of the new preference cookie.
|
||||||
* @param description Optional description of the preference cookie.
|
* @param description Optional description of the preference cookie.
|
||||||
* @param access What CookieAccess level to assign to this cookie.
|
* @param access What CookieAccess level to assign to this cookie.
|
||||||
* @return A handle to the newly created cookie. If the cookie already
|
* @return A handle to the newly created cookie. If the cookie already
|
||||||
* exists, a handle to it will still be returned.
|
* exists, a handle to it will still be returned.
|
||||||
* @error Cookie name is blank.
|
* @error Cookie name is blank.
|
||||||
*/
|
*/
|
||||||
native Handle RegClientCookie(const char[] name, const char[] description, CookieAccess access);
|
native Handle RegClientCookie(const char[] name, const char[] description, CookieAccess access);
|
||||||
|
|
||||||
@ -191,70 +191,69 @@ native Handle RegClientCookie(const char[] name, const char[] description, Cooki
|
|||||||
* Handles returned by FindClientCookie can be closed via CloseHandle() when
|
* Handles returned by FindClientCookie can be closed via CloseHandle() when
|
||||||
* no longer needed.
|
* no longer needed.
|
||||||
*
|
*
|
||||||
* @param name Name of cookie to find.
|
* @param name Name of cookie to find.
|
||||||
* @return A handle to the cookie if it is found. INVALID_HANDLE otherwise.
|
* @return A handle to the cookie if it is found. INVALID_HANDLE otherwise.
|
||||||
*/
|
*/
|
||||||
native Handle FindClientCookie(const char[] name);
|
native Handle FindClientCookie(const char[] name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of a Client preference cookie.
|
* Set the value of a Client preference cookie.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
* @param cookie Client preference cookie handle.
|
* @param cookie Client preference cookie handle.
|
||||||
* @param value String value to set.
|
* @param value String value to set.
|
||||||
* @error Invalid cookie handle or invalid client index.
|
* @error Invalid cookie handle or invalid client index.
|
||||||
*/
|
*/
|
||||||
native void SetClientCookie(int client, Handle cookie, const char[] value);
|
native void SetClientCookie(int client, Handle cookie, const char[] value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the value of a Client preference cookie.
|
* Retrieve the value of a Client preference cookie.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
* @param cookie Client preference cookie handle.
|
* @param cookie Client preference cookie handle.
|
||||||
* @param buffer Copyback buffer for value.
|
* @param buffer Copyback buffer for value.
|
||||||
* @param maxlen Maximum length of the buffer.
|
* @param maxlen Maximum length of the buffer.
|
||||||
* @error Invalid cookie handle or invalid client index.
|
* @error Invalid cookie handle or invalid client index.
|
||||||
*/
|
*/
|
||||||
native void GetClientCookie(int client, Handle cookie, char[] buffer, int maxlen);
|
native void GetClientCookie(int client, Handle cookie, char[] buffer, int maxlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of a Client preference cookie based on an authID string.
|
* Sets the value of a Client preference cookie based on an authID string.
|
||||||
*
|
*
|
||||||
* @param authID String Auth/STEAM ID of player to set.
|
* @param authID String Auth/STEAM ID of player to set.
|
||||||
* @param cookie Client preference cookie handle.
|
* @param cookie Client preference cookie handle.
|
||||||
* @param value String value to set.
|
* @param value String value to set.
|
||||||
* @error Invalid cookie handle.
|
* @error Invalid cookie handle.
|
||||||
*/
|
*/
|
||||||
native void SetAuthIdCookie(const char[] authID, Handle cookie, const char[] value);
|
native void SetAuthIdCookie(const char[] authID, Handle cookie, const char[] value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a clients cookies have been loaded from the database.
|
* Checks if a clients cookies have been loaded from the database.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
* @return True if loaded, false otherwise.
|
* @return True if loaded, false otherwise.
|
||||||
* @error Invalid client index.
|
* @error Invalid client index.
|
||||||
*/
|
*/
|
||||||
native bool AreClientCookiesCached(int client);
|
native bool AreClientCookiesCached(int client);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called once a client's saved cookies have been loaded from the database.
|
* Called once a client's saved cookies have been loaded from the database.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
*/
|
*/
|
||||||
forward void OnClientCookiesCached(int client);
|
forward void OnClientCookiesCached(int client);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new prefab item to the client cookie settings menu.
|
* Add a new prefab item to the client cookie settings menu.
|
||||||
*
|
*
|
||||||
* Note: This handles everything automatically and does not require a callback
|
* Note: This handles everything automatically and does not require a callback
|
||||||
*
|
*
|
||||||
* @param cookie Client preference cookie handle.
|
* @param cookie Client preference cookie handle.
|
||||||
* @param type A CookieMenu prefab menu type.
|
* @param type A CookieMenu prefab menu type.
|
||||||
* @param display Text to show on the menu.
|
* @param display Text to show on the menu.
|
||||||
* @param handler Optional handler callback for translations and output on selection
|
* @param handler Optional handler callback for translations and output on selection
|
||||||
* @param info Info data to pass to the callback.
|
* @param info Info data to pass to the callback.
|
||||||
* @error Invalid cookie handle.
|
* @error Invalid cookie handle.
|
||||||
*/
|
*/
|
||||||
native void SetCookiePrefabMenu(Handle cookie, CookieMenu type, const char[] display, CookieMenuHandler handler=INVALID_FUNCTION, any info=0);
|
native void SetCookiePrefabMenu(Handle cookie, CookieMenu type, const char[] display, CookieMenuHandler handler=INVALID_FUNCTION, any info=0);
|
||||||
|
|
||||||
@ -263,37 +262,37 @@ native void SetCookiePrefabMenu(Handle cookie, CookieMenu type, const char[] dis
|
|||||||
*
|
*
|
||||||
* Note: This only adds the top level menu item. You need to handle any submenus from the callback.
|
* Note: This only adds the top level menu item. You need to handle any submenus from the callback.
|
||||||
*
|
*
|
||||||
* @param handler A MenuHandler callback function.
|
* @param handler A MenuHandler callback function.
|
||||||
* @param info Data to pass to the callback.
|
* @param info Data to pass to the callback.
|
||||||
* @param display Text to show on the menu.
|
* @param display Text to show on the menu.
|
||||||
* @error Invalid cookie handle.
|
* @error Invalid cookie handle.
|
||||||
*/
|
*/
|
||||||
native void SetCookieMenuItem(CookieMenuHandler handler, any info, const char[] display);
|
native void SetCookieMenuItem(CookieMenuHandler handler, any info, const char[] display);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the settings menu to a client.
|
* Displays the settings menu to a client.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
*/
|
*/
|
||||||
native void ShowCookieMenu(int client);
|
native void ShowCookieMenu(int client);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a cookie iterator. Must be freed with CloseHandle().
|
* Gets a cookie iterator. Must be freed with CloseHandle().
|
||||||
*
|
*
|
||||||
* @return A new cookie iterator.
|
* @return A new cookie iterator.
|
||||||
*/
|
*/
|
||||||
native Handle GetCookieIterator();
|
native Handle GetCookieIterator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a cookie iterator, then advances to the next cookie if any.
|
* Reads a cookie iterator, then advances to the next cookie if any.
|
||||||
*
|
*
|
||||||
* @param iter Cookie iterator Handle.
|
* @param iter Cookie iterator Handle.
|
||||||
* @param name Name buffer.
|
* @param name Name buffer.
|
||||||
* @param nameLen Name buffer size.
|
* @param nameLen Name buffer size.
|
||||||
* @param access Access level of the cookie.
|
* @param access Access level of the cookie.
|
||||||
* @param desc Cookie description buffer.
|
* @param desc Cookie description buffer.
|
||||||
* @param descLen Cookie description buffer size.
|
* @param descLen Cookie description buffer size.
|
||||||
* @return True on success, false if there are no more commands.
|
* @return True on success, false if there are no more commands.
|
||||||
*/
|
*/
|
||||||
native bool ReadCookieIterator(Handle iter,
|
native bool ReadCookieIterator(Handle iter,
|
||||||
char[] name,
|
char[] name,
|
||||||
@ -301,22 +300,22 @@ native bool ReadCookieIterator(Handle iter,
|
|||||||
CookieAccess &access,
|
CookieAccess &access,
|
||||||
char[] desc="",
|
char[] desc="",
|
||||||
int descLen=0);
|
int descLen=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the access level of a cookie
|
* Returns the access level of a cookie
|
||||||
*
|
*
|
||||||
* @param cookie Client preference cookie handle.
|
* @param cookie Client preference cookie handle.
|
||||||
* @return CookieAccess access level.
|
* @return CookieAccess access level.
|
||||||
* @error Invalid cookie handle.
|
* @error Invalid cookie handle.
|
||||||
*/
|
*/
|
||||||
native CookieAccess GetCookieAccess(Handle cookie);
|
native CookieAccess GetCookieAccess(Handle cookie);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last updated timestamp for a client cookie
|
* Returns the last updated timestamp for a client cookie
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
* @param cookie Cookie handle.
|
* @param cookie Cookie handle.
|
||||||
* @return Last updated timestamp.
|
* @return Last updated timestamp.
|
||||||
*/
|
*/
|
||||||
native int GetClientCookieTime(int client, Handle cookie);
|
native int GetClientCookieTime(int client, Handle cookie);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user