238 lines
8.9 KiB
C
238 lines
8.9 KiB
C
#ifndef __ACE_SDK_SERVER_TEXT_CHECK_H__
|
|
#define __ACE_SDK_SERVER_TEXT_CHECK_H__
|
|
|
|
#include "ace_sdk_account.h"
|
|
#include "ace_sdk_server_uic.h"
|
|
#include "ace_sdk_server_text_check_impl.h"
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
#define ACE_SDK_UIC_MAX_MESSAGE_LEN 15000
|
|
#define ACE_SDK_UIC_MAX_TITLE_LEN 300
|
|
#define ACE_SDK_UIC_MAX_INTRODUCTION_LEN 1000
|
|
#define ACE_SDK_UIC_MAX_BATCH_MULTI_TEXT_LEN 10
|
|
#define ACE_SDK_UIC_MAX_EXTRA_DATA_LEN 4095
|
|
|
|
typedef enum
|
|
{
|
|
ACE_LANGUAGE_NON = 0, // No language distinction
|
|
ACE_LANGUAGE_EN = 1, // English
|
|
ACE_LANGUAGE_CHT = 2, // Traditional Chinese
|
|
ACE_LANGUAGE_VN = 3, // Vietnamese
|
|
ACE_LANGUAGE_CHS = 4, // Simplified Chinese
|
|
ACE_LANGUAGE_TH = 5, // Thai
|
|
ACE_LANGUAGE_KO = 6, // Korean
|
|
ACE_LANGUAGE_FR = 7, // French
|
|
ACE_LANGUAGE_DE = 8, // German
|
|
ACE_LANGUAGE_RU = 9, // Russian
|
|
ACE_LANGUAGE_TR = 10, // Turkish
|
|
ACE_LANGUAGE_PTEU = 11, // Portugal (Europe)
|
|
ACE_LANGUAGE_PTLT = 12, // Portugal (Latin America)
|
|
ACE_LANGUAGE_ESEU = 13, // Spain (Europe)
|
|
ACE_LANGUAGE_ESLT = 14, // Spain (Latin America)
|
|
ACE_LANGUAGE_IT = 15, // Italy
|
|
ACE_LANGUAGE_NL = 16, // Dutch
|
|
ACE_LANGUAGE_MY = 17, // Malay
|
|
ACE_LANGUAGE_ID = 18, // Indonesian
|
|
ACE_LANGUAGE_AR = 19, // Arabic
|
|
ACE_LANGUAGE_INDIA = 20, // Hindi
|
|
ACE_LANGUAGE_JP = 21, // Japanese
|
|
ACE_LANGUAGE_MAX_DEFINE = 100
|
|
|
|
} AceSdkTextMsglanguage;
|
|
|
|
typedef struct
|
|
{
|
|
/**
|
|
* It represents the text usage scene id, segmentation principle refer to AceSdkUicMsgCategory
|
|
* For specific values, refer to the registration scenario on the ACE official website
|
|
* Required
|
|
*/
|
|
uint32_t scene_id_;
|
|
/**
|
|
* It represents message content, maximum length is ACE_SDK_UIC_MAX_MESSAGE_LEN
|
|
* Required
|
|
*/
|
|
char text_[ACE_SDK_UIC_MAX_MESSAGE_LEN];
|
|
/**
|
|
* It represents title of message content, maximum length is ACE_SDK_UIC_MAX_TITLE_LEN
|
|
* Optional, if no need, recommend clear it
|
|
*/
|
|
char title_[ACE_SDK_UIC_MAX_TITLE_LEN];
|
|
/**
|
|
* It represents introduction of message content, maximum length is ACE_SDK_UIC_MAX_INTRODUCTION_LEN
|
|
* Optional, if no need, recommend clear it
|
|
*/
|
|
char introduction_[ACE_SDK_UIC_MAX_INTRODUCTION_LEN];
|
|
/**
|
|
* It represents language of message content, refer to AceSdkTextMsglanguage
|
|
* By default, fill in ACE_LANGUAGE_NON(0) to indicate no language distinction
|
|
* Required
|
|
*/
|
|
int32_t local_language_;
|
|
/**
|
|
* Reserved for extended content, generally in json format, maximum length is ACE_SDK_UIC_MAX_EXTRA_DATA_LEN
|
|
* Optional, if no need, recommend clear it
|
|
*/
|
|
char extra_data_[ACE_SDK_UIC_MAX_EXTRA_DATA_LEN];
|
|
} AceSdkMultiTextInputInfo;
|
|
|
|
typedef struct __AceSdkBatchMultiTextInputInfo
|
|
{
|
|
/**
|
|
* It indicates the account to which the input belongs
|
|
* Required
|
|
*/
|
|
AceSdkAccount account_info_;
|
|
/**
|
|
* It represents the area id of the account, refer to AceSdkUicAreaID
|
|
* Required
|
|
*/
|
|
uint32_t area_id_;
|
|
/**
|
|
* It represents the role id of the account
|
|
* Required
|
|
*/
|
|
uint32_t role_id_;
|
|
/**
|
|
* It represents the role level of the account
|
|
* Required
|
|
*/
|
|
uint32_t role_level_;
|
|
/**
|
|
* It represents the role name of the account
|
|
* Required
|
|
*/
|
|
char role_name_[ACE_SDK_UIC_MAX_ROLE_NAME_LEN];
|
|
/**
|
|
* It represents the url of user avatar, maximum length is ACE_SDK_UIC_MAX_HEAD_PIC_URL_LEN
|
|
* Optional, if no need, recommend clear it
|
|
*/
|
|
char head_pic_url_[ACE_SDK_UIC_MAX_HEAD_PIC_URL_LEN];
|
|
/**
|
|
* It represents the length of 'multi_text_array_', maximum length is ACE_SDK_UIC_MAX_BATCH_MULTI_TEXT_LEN
|
|
* Required
|
|
*/
|
|
int32_t multi_text_cnt_;
|
|
/**
|
|
* It contains several sets of input text
|
|
* Required
|
|
*/
|
|
AceSdkMultiTextInputInfo multi_text_array_[ACE_SDK_UIC_MAX_BATCH_MULTI_TEXT_LEN];
|
|
/**
|
|
* callback_len_ is the length of 'callback_data_', maximum length is ACE_SDK_UIC_MAX_CALLBACK_DATA_LEN
|
|
* When the asynchronous interface is called back, the 'callback_data_' is returned as it is
|
|
* Optional, if none fill in Zero and NULL
|
|
*/
|
|
int32_t callback_len_;
|
|
uint8_t callback_data_[ACE_SDK_UIC_MAX_CALLBACK_DATA_LEN];
|
|
} AceSdkBatchMultiTextInputInfo;
|
|
|
|
|
|
typedef enum
|
|
{
|
|
/**
|
|
* Legal text
|
|
*/
|
|
ACE_SDK_MSG_NORMAL_FLAG = 0,
|
|
/**
|
|
* Illegal text contains malicious words
|
|
* 1. user profile scenarios such as naming: failed to name
|
|
* 2. instant messaging scenarios: only the sender self can see it, and the visible content is the filtered text
|
|
*/
|
|
ACE_SDK_MSG_EVIL_FLAG = 1,
|
|
/**
|
|
* Illegal text contains sensitive words
|
|
* 1. user profile scenarios such as naming: failed to name
|
|
* 2. instant messaging scenarios: both the receiver and sender can see it, and the visible content is the filtered text
|
|
*/
|
|
ACE_SDK_MSG_DIRTY_FLAG = 2,
|
|
} AceSdkUicMsgResultFlag;
|
|
|
|
typedef struct
|
|
{
|
|
/**
|
|
* Return the scene id entered before
|
|
*/
|
|
uint32_t scene_id_;
|
|
/**
|
|
* The judgment result of the user input text from ACE Backend
|
|
* Please display the user input text as required in AceSdkUicMsgResultFlag
|
|
*/
|
|
uint32_t check_result_;
|
|
/**
|
|
* Label of the user input text from ACE Backend
|
|
*/
|
|
uint32_t lable_;
|
|
/**
|
|
* Judgement Description of the user input text from ACE Backend
|
|
*/
|
|
char check_desc_[ACE_SDK_UIC_MAX_CHECK_DESC_LEN];
|
|
/**
|
|
* Filtered text of the user input replaced by ACE Backend
|
|
*/
|
|
char filtered_text_[ACE_SDK_UIC_MAX_MESSAGE_LEN];
|
|
} AceSdkUicJudegeResultInfoMultiText;
|
|
|
|
typedef struct __AceSdkUicJudgeResultInfoBatchMultiText
|
|
{
|
|
/**
|
|
* Return the account entered before
|
|
*/
|
|
AceSdkAccount account_info_;
|
|
/**
|
|
* Zero represents judgement of ACE Backend success
|
|
* Not Zero represents judgement of ACE Backend fail
|
|
*/
|
|
uint32_t err_code_;
|
|
/**
|
|
* Error Description of ACE Backend judgement
|
|
*/
|
|
char err_msg_[ACE_SDK_UIC_MAX_ERR_MSG_LEN];
|
|
/**
|
|
* It represents the length of 'multi_text_array_', maximum length is ACE_SDK_UIC_MAX_BATCH_MULTI_TEXT_LEN
|
|
* If err_code_ == 0, it is the same as entered before
|
|
*/
|
|
int32_t multext_result_cnt_;
|
|
/**
|
|
* It contains several sets of judgement result from ACE Backend
|
|
*/
|
|
AceSdkUicJudegeResultInfoMultiText multext_result_array_[ACE_SDK_UIC_MAX_BATCH_MULTI_TEXT_LEN];
|
|
/**
|
|
* callback_len_ is the length of 'callback_data_', maximum length is ACE_SDK_UIC_MAX_CALLBACK_DATA_LEN
|
|
* It is the same as entered before
|
|
*/
|
|
int32_t callback_len_;
|
|
uint8_t callback_data_[ACE_SDK_UIC_MAX_CALLBACK_DATA_LEN];
|
|
} AceSdkUicJudgeResultInfoBatchMultiText;
|
|
|
|
/**
|
|
* @brief Callback function of gamesvr to receive the judgement result of user input texts
|
|
* @param result_info The judgement result from ACE SDK
|
|
* @return 0 Processing Successfully
|
|
* @return other value Processing Failed
|
|
*/
|
|
typedef int(*OnRecvAceSdkUicJudgeResultInfoBatchMultiText)(const AceSdkUicJudgeResultInfoBatchMultiText* result_info);
|
|
|
|
#pragma pack(pop)
|
|
|
|
/**
|
|
* @brief Set the callback function to receive the judgement result of user input texts
|
|
* @brief The callback function must be set firstly before call 'ace_sdk_server_judge_batch_multi_text' in order to get judgement result
|
|
* @brief A single autonomous thread propelling the callback interface within the SDK is distinct from the game server thread invoking 'ace_sdk_server_judge_batch_multi_text'. Please pay attention to potential thread safety concerns.
|
|
* The callback function should be designed to be lightweight. It is recommended to transfer time-consuming operations to the business layer working thread for processing to avoid blocking the callback thread inside the SDK.
|
|
* @brief After the SDK executes the callback function, it will immediately reclaim the data returned to the callback function.
|
|
* It is recommended that the game copy the returned data to the business layer memory space within the callback function to avoid memory security issues such as out-of-bounds access.
|
|
* @param on_result_func The callback function pointer
|
|
*/
|
|
AceSdkResult ace_sdk_server_set_recv_batch_multi_text_result_callback(OnRecvAceSdkUicJudgeResultInfoBatchMultiText on_result_func);
|
|
|
|
/**
|
|
* @brief Asynchronous interface to review batch multi-text of an account
|
|
* @brief Before calling this function, you must first set 'OnRecvAceSdkUicJudgeResultInfoBatchMultiText'
|
|
* @brief All texts will be sent to ACE Backend for review, and even if the backend review times out(500 ms), ACE SDK has local policies to cover it
|
|
* @param input_info A group of texts to review
|
|
*/
|
|
AceSdkResult ace_sdk_server_judge_batch_multi_text(const AceSdkBatchMultiTextInputInfo* input_info);
|
|
|
|
#endif // __ACE_SDK_SERVER_TEXT_CHECK_H__
|