Implement the filtertext functions.

merge-requests/48/head
Mr_Goldberg 2022-05-29 15:51:53 -04:00
parent bfe8e156f0
commit 3dab666dd8
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
1 changed files with 11 additions and 2 deletions

View File

@ -380,7 +380,7 @@ bool InitFilterText( uint32 unFilterOptions )
int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly ) int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly )
{ {
PRINT_DEBUG("FilterText old\n"); PRINT_DEBUG("FilterText old\n");
return 0; return FilterText(k_ETextFilteringContextUnknown, CSteamID(), pchInputMessage, pchOutFilteredText, nByteSizeOutFilteredText );
} }
// Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings // Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings
@ -393,7 +393,16 @@ int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const
int FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText ) int FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText )
{ {
PRINT_DEBUG("FilterText\n"); PRINT_DEBUG("FilterText\n");
return 0; if (!nByteSizeOutFilteredText) return 0;
unsigned len = strlen(pchInputMessage);
if (!len) return 0;
len += 1;
if (len > nByteSizeOutFilteredText) len = nByteSizeOutFilteredText;
len -= 1;
memcpy(pchOutFilteredText, pchInputMessage, len);
pchOutFilteredText[len] = 0;
return len;
} }