14 #include <QGlobalStatic>
46 struct packet_chat_msg_req packet;
50 va_start(args, format);
51 auto str = QString::vasprintf(format, args);
54 ba = str.toLocal8Bit();
55 qstrncpy(packet.message, ba.data(),
sizeof(packet.message));
57 return send_packet_chat_msg_req(&
client.
conn, &packet);
85 const char *featured_text)
88 struct text_tag_list *tags;
101 text_tag_list_prepend(tags, ptag);
104 "Failed to create a color text tag (fg = %s, bg = %s).",
105 (
nullptr !=
color.foreground ?
color.foreground :
"nullptr"),
106 (
nullptr !=
color.background ?
color.background :
"nullptr"));
113 text_tag_list_destroy(tags);
125 fc_vsnprintf(featured_text,
sizeof(featured_text), format, args);
138 va_start(args, format);
147 const struct text_tag_list *tags)
160 "welcome to distribute copies of it "
161 "under certain conditions;"));
162 if (gui_has_copying_mitem) {
void real_output_window_append(const QString &astring, const text_tag_list *tags)
Appends the string to the chat output window.
int send_chat_printf(const char *format,...)
Send the message as a chat to the server.
void fc_release_ow_mutex()
Release output window mutex.
void fc_destroy_ow_mutex()
Destroy output window mutex.
void output_window_event(const char *plain_text, const struct text_tag_list *tags)
Add a line of text to the output ("chatline") window from server event.
int send_chat(const char *message)
Send the message as a chat to the server.
void output_window_append(const struct ft_color color, const char *featured_text)
Add a line of text to the output ("chatline") window, like puts() would do it in the console.
void fc_allocate_ow_mutex()
Allocate output window mutex.
void output_window_vprintf(const struct ft_color color, const char *format, va_list args)
Add a line of text to the output ("chatline") window.
void output_window_printf(const struct ft_color color, const char *format,...)
Add a line of text to the output ("chatline") window.
void fc_init_ow_mutex()
Initialize output window mutex.
void chat_welcome_message(bool gui_has_copying_mitem)
Standard welcome message.
Q_GLOBAL_STATIC(QMutex, ow_mutex)
size_t featured_text_to_plain_text(const char *featured_text, char *plain_text, size_t plain_text_len, struct text_tag_list **tags, bool replace_link_text)
Separate the text from the text features.
struct text_tag * text_tag_new(enum text_tag_type tag_type, ft_offset_t start_offset, ft_offset_t stop_offset,...)
Returns a new text_tag or nullptr on error.
const struct ft_color ftc_any
static bool ft_color_requested(const struct ft_color color)
struct text_tag::@23::@25 color
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)