![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <cstdarg>#include <cstring>#include "fcintl.h"#include "log.h"#include "shared.h"#include "support.h"#include "chat.h"#include "game.h"#include "packets.h"#include "player.h"#include "console.h"#include "notify.h"#include "stdinhand.h"#include "handchat.h"
Include dependency graph for handchat.cpp:Go to the source code of this file.
Macros | |
| #define | MAX_LEN_CHAT_NAME (2 * MAX_LEN_NAME + 10) |
Functions | |
| static void | send_chat_msg (struct connection *pconn, const struct connection *sender, const struct ft_color color, const char *format,...) |
| Send a chat message packet. More... | |
| static void static bool | conn_is_ignored (const struct connection *sender, const struct connection *dest) |
| Returns whether 'dest' is ignoring the 'sender' connection. More... | |
| static void | form_chat_name (struct connection *pconn, char *buffer, size_t len) |
| Formulate a name for this connection, prefering the player name when available and unambiguous (since this is the "standard" case), else use the username. More... | |
| static void | complain_ambiguous (struct connection *pconn, const char *name, int player_conn) |
| Complain to sender that name was ambiguous. More... | |
| static void | chat_msg_to_conn (struct connection *sender, struct connection *dest, char *msg) |
| Send private message to single connection. More... | |
| static void | chat_msg_to_player (struct connection *sender, struct player *pdest, char *msg) |
| Send private message to multi-connected player. More... | |
| static void | chat_msg_to_allies (struct connection *sender, char *msg) |
| Send private message to player allies. More... | |
| static void | chat_msg_to_global_observers (struct connection *sender, char *msg) |
| Send private message to all global observers. More... | |
| static void | chat_msg_to_all (struct connection *sender, char *msg) |
| Send private message to all connections. More... | |
| void | handle_chat_msg_req (struct connection *pconn, const char *message) |
| Handle a chat message packet from client: More... | |
| #define MAX_LEN_CHAT_NAME (2 * MAX_LEN_NAME + 10) |
Definition at line 36 of file handchat.cpp.
|
static |
Send private message to all connections.
Definition at line 286 of file handchat.cpp.
Referenced by handle_chat_msg_req().
|
static |
Send private message to player allies.
Definition at line 222 of file handchat.cpp.
Referenced by handle_chat_msg_req().
|
static |
Send private message to single connection.
Definition at line 122 of file handchat.cpp.
Referenced by handle_chat_msg_req().
|
static |
Send private message to all global observers.
Definition at line 258 of file handchat.cpp.
Referenced by handle_chat_msg_req().
|
static |
Send private message to multi-connected player.
Definition at line 151 of file handchat.cpp.
Referenced by handle_chat_msg_req().
|
static |
Complain to sender that name was ambiguous.
'player_conn' is 0 for player names, 1 for connection names, 2 for attempt to send to an anonymous player.
Definition at line 98 of file handchat.cpp.
Referenced by handle_chat_msg_req().
|
inlinestatic |
Returns whether 'dest' is ignoring the 'sender' connection.
Definition at line 47 of file handchat.cpp.
Referenced by chat_msg_to_allies(), chat_msg_to_conn(), chat_msg_to_global_observers(), and chat_msg_to_player().
|
static |
Formulate a name for this connection, prefering the player name when available and unambiguous (since this is the "standard" case), else use the username.
Definition at line 62 of file handchat.cpp.
Referenced by chat_msg_to_all(), chat_msg_to_allies(), chat_msg_to_conn(), chat_msg_to_global_observers(), and chat_msg_to_player().
| void handle_chat_msg_req | ( | struct connection * | pconn, |
| const char * | message | ||
| ) |
Handle a chat message packet from client:
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 326 of file handchat.cpp.
|
static |
Send a chat message packet.
Definition at line 78 of file handchat.cpp.
Referenced by chat_msg_to_conn(), and chat_msg_to_player().