Anyone an idea how we write a logfile of chat-posters with IP-address so they can be banned via iptables?
Some people keep posting nasty stuff, I want to ban them from using the websdr in total.
How do we write a log with IP via chat.cpp? Anyone?
Hello Bas
I've not find the solution but something useful.
In /src/chat.cpp
std::string ChatClient::get_or_generate_username(const std::string& user_id) {
auto it = user_id_to_name.find(user_id);
if (it != user_id_to_name.end()) {
return it->second;
} else {
std::hash<std::string> hasher;
auto hashed = hasher(user_id);
std::string numeric_part = std::to_string(hashed).substr(0, 6);
std::string username = "Call?" + numeric_part;
// Check if the username is blocked
if (!is_valid_username(username)) {
// Generate a random username
std::string random_username = "Call?" + std::to_string(rand() % 1000000);
printf("Blocked username '%s' detected. Assigned random username: %s\n", username.c_str(), random_username.c_str());
username = random_username;
I've replaced "user" by "Call?"
Now the Chatbox show : Chatting as [Anonymous] and you can't post a message
This force a name or Call to be registred before posting
I will study Chat.cpp for made something better but i'm not an expert with code ! :) :)
73's
Sorry ! Don't Work on a new session ! Bad way ! ::)