Freeciv-3.3
|
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#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"
Go to the source code of this file.
Macros | |
#define | MAX_LEN_CHAT_NAME (2*MAX_LEN_NAME+10) /* for form_chat_name() names */ |
Functions | |
static void | send_chat_msg (struct connection *pconn, const struct connection *sender, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__ |
static void static bool | conn_is_ignored (const struct connection *sender, const struct connection *dest) |
static void | form_chat_name (struct connection *pconn, char *buffer, size_t len) |
static void | complain_ambiguous (struct connection *pconn, const char *name, int player_conn) |
static void | chat_msg_to_conn (struct connection *sender, struct connection *dest, char *msg) |
static void | chat_msg_to_player (struct connection *sender, struct player *pdest, char *msg) |
static void | chat_msg_to_allies (struct connection *sender, char *msg) |
static void | chat_msg_to_global_observers (struct connection *sender, char *msg) |
static void | chat_msg_to_all (struct connection *sender, char *msg) |
void | handle_chat_msg_req (struct connection *pconn, const char *message) |
#define MAX_LEN_CHAT_NAME (2*MAX_LEN_NAME+10) /* for form_chat_name() names */ |
Definition at line 41 of file handchat.c.
|
static |
Send private message to all connections.
Definition at line 280 of file handchat.c.
Referenced by handle_chat_msg_req().
|
static |
Send private message to player allies.
Definition at line 222 of file handchat.c.
Referenced by handle_chat_msg_req().
|
static |
Send private message to single connection.
Definition at line 127 of file handchat.c.
Referenced by handle_chat_msg_req().
|
static |
Send private message to all global observers.
Definition at line 254 of file handchat.c.
Referenced by handle_chat_msg_req().
|
static |
Send private message to multi-connected player.
Definition at line 156 of file handchat.c.
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 103 of file handchat.c.
Referenced by handle_chat_msg_req().
|
inlinestatic |
Returns whether 'dest' is ignoring the 'sender' connection.
Definition at line 52 of file handchat.c.
Referenced by chat_msg_to_allies(), chat_msg_to_conn(), chat_msg_to_global_observers(), and chat_msg_to_player().
Formulate a name for this connection, preferring the player name when available and unambiguous (since this is the "standard" case), else use the username.
Definition at line 67 of file handchat.c.
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 320 of file handchat.c.
Referenced by server_handle_packet().
|
static |
Send a chat message packet.
Definition at line 83 of file handchat.c.
Referenced by chat_msg_to_conn(), and chat_msg_to_player().