mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-18 15:17:23 +08:00
52 lines
1.0 KiB
C++
52 lines
1.0 KiB
C++
![]() |
#pragma once
|
||
|
#include "services/players/player_service.hpp"
|
||
|
#include "file_manager/file.hpp"
|
||
|
|
||
|
namespace
|
||
|
{
|
||
|
static const char* spam_texts[] =
|
||
|
{
|
||
|
"QQ",
|
||
|
"WWW.",
|
||
|
"www.",
|
||
|
".cn",
|
||
|
".CN",
|
||
|
".TOP",
|
||
|
".COM",
|
||
|
"\xE3\x80\x90",
|
||
|
"/Menu",
|
||
|
"Money/",
|
||
|
"Money\\\\",
|
||
|
"Money\\",
|
||
|
".gg",
|
||
|
"--->",
|
||
|
"shopgta5",
|
||
|
"doit#"
|
||
|
};
|
||
|
}
|
||
|
|
||
|
namespace big::spam
|
||
|
{
|
||
|
inline bool is_text_spam(const char* text)
|
||
|
{
|
||
|
for (auto e : spam_texts)
|
||
|
if (strstr(text, e) != 0)
|
||
|
return true;
|
||
|
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
inline void log_chat(char* msg, player_ptr player, bool is_spam)
|
||
|
{
|
||
|
std::ofstream spam_log(g_file_manager->get_project_file(is_spam ? "./spam.log" : "./chat.log").get_path(), std::ios::app);
|
||
|
|
||
|
auto& plData = *player->get_net_data();
|
||
|
|
||
|
spam_log << player->get_name() << " (" << plData.m_gamer_handle_2.m_rockstar_id << ") <"
|
||
|
<< (int)plData.m_external_ip.m_field1 << "." << (int)plData.m_external_ip.m_field2 << "." << (int)plData.m_external_ip.m_field3 << "." << (int)plData.m_external_ip.m_field4 <<
|
||
|
">: " << msg <<
|
||
|
std::endl;
|
||
|
|
||
|
spam_log.close();
|
||
|
}
|
||
|
}
|