Freeciv-3.3
Loading...
Searching...
No Matches
Functions
handchat.h File Reference

Go to the source code of this file.

Functions

void handle_chat_msg_req (struct connection *pc, const char *message)
 

Function Documentation

◆ handle_chat_msg_req()

void handle_chat_msg_req ( struct connection pconn,
const char message 
)

Handle a chat message packet from client:

  1. Work out whether it is a server command and if so run it;
  2. Otherwise work out whether it is directed to a single player, or to a single connection, and send there. (For a player, send to all clients connected as that player, in multi-connect case);
  3. Or it may be intended for all allied players.
  4. Else send to all connections (game.est_connections).

In case 2, there can sometimes be ambiguity between player and connection names. By default this tries to match player name first, and only if that fails tries to match connection name. User can override this and specify connection only by using two colons ("::") after the destination name/prefix, instead of one.

The message sent will name the sender, and via format differences also indicates whether the recipient is either all connections, a single connection, or multiple connections to a single player.

Message is also echoed back to sender (with different format), avoiding sending both original and echo if sender is in destination set.

Definition at line 320 of file handchat.c.