mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Replaced colours with theme_item_t
This commit is contained in:
parent
90dd1de91a
commit
ed4391ec8a
@ -2265,10 +2265,10 @@ cmd_subject(gchar **args, struct cmd_help_t help)
|
||||
if (args[0] == NULL) {
|
||||
char *subject = muc_subject(room);
|
||||
if (subject) {
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Room subject: ");
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: ");
|
||||
win_save_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", subject);
|
||||
} else {
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Room has no subject");
|
||||
win_save_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room has no subject");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -2466,12 +2466,12 @@ cmd_room(gchar **args, struct cmd_help_t help)
|
||||
if (g_strcmp0(args[0], "accept") == 0) {
|
||||
gboolean requires_config = muc_requires_config(room);
|
||||
if (!requires_config) {
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Current room does not require configuration.");
|
||||
win_save_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Current room does not require configuration.");
|
||||
return TRUE;
|
||||
} else {
|
||||
iq_confirm_instant_room(room);
|
||||
muc_set_requires_config(room, FALSE);
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Room unlocked.");
|
||||
win_save_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room unlocked.");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -529,3 +529,58 @@ _theme_find(const char * const theme_name)
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
int
|
||||
theme_attrs(theme_item_t attrs)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
switch (attrs) {
|
||||
case THEME_TEXT: result = COLOR_PAIR(1); break;
|
||||
case THEME_TEXT_ME: result = COLOR_PAIR(2); break;
|
||||
case THEME_TEXT_THEM: result = COLOR_PAIR(3); break;
|
||||
case THEME_SPLASH: result = COLOR_PAIR(4); break;
|
||||
case THEME_ERROR: result = COLOR_PAIR(5); break;
|
||||
case THEME_INCOMING: result = COLOR_PAIR(6); break;
|
||||
case THEME_INPUT_TEXT: result = COLOR_PAIR(7); break;
|
||||
case THEME_TIME: result = COLOR_PAIR(8); break;
|
||||
case THEME_TITLE_TEXT: result = COLOR_PAIR(9); break;
|
||||
case THEME_TITLE_BRACKET: result = COLOR_PAIR(10); break;
|
||||
case THEME_TITLE_UNENCRYPTED: result = COLOR_PAIR(11); break;
|
||||
case THEME_TITLE_ENCRYPTED: result = COLOR_PAIR(12); break;
|
||||
case THEME_TITLE_UNTRUSTED: result = COLOR_PAIR(13); break;
|
||||
case THEME_TITLE_TRUSTED: result = COLOR_PAIR(14); break;
|
||||
case THEME_TITLE_ONLINE: result = COLOR_PAIR(15); break;
|
||||
case THEME_TITLE_OFFLINE: result = COLOR_PAIR(16); break;
|
||||
case THEME_TITLE_AWAY: result = COLOR_PAIR(17); break;
|
||||
case THEME_TITLE_CHAT: result = COLOR_PAIR(18); break;
|
||||
case THEME_TITLE_DND: result = COLOR_PAIR(19); break;
|
||||
case THEME_TITLE_XA: result = COLOR_PAIR(20); break;
|
||||
case THEME_STATUS_TEXT: result = COLOR_PAIR(21); break;
|
||||
case THEME_STATUS_BRACKET: result = COLOR_PAIR(22); break;
|
||||
case THEME_STATUS_ACTIVE: result = COLOR_PAIR(23); break;
|
||||
case THEME_STATUS_NEW: result = COLOR_PAIR(24); break;
|
||||
case THEME_ME: result = COLOR_PAIR(25); break;
|
||||
case THEME_THEM: result = COLOR_PAIR(26); break;
|
||||
case THEME_ROOMINFO: result = COLOR_PAIR(27); break;
|
||||
case THEME_ROOMMENTION: result = COLOR_PAIR(28); break;
|
||||
case THEME_ONLINE: result = COLOR_PAIR(29); break;
|
||||
case THEME_OFFLINE: result = COLOR_PAIR(30); break;
|
||||
case THEME_AWAY: result = COLOR_PAIR(31); break;
|
||||
case THEME_CHAT: result = COLOR_PAIR(32); break;
|
||||
case THEME_DND: result = COLOR_PAIR(33); break;
|
||||
case THEME_XA: result = COLOR_PAIR(34); break;
|
||||
case THEME_TYPING: result = COLOR_PAIR(35); break;
|
||||
case THEME_GONE: result = COLOR_PAIR(36); break;
|
||||
case THEME_SUBSCRIBED: result = COLOR_PAIR(37); break;
|
||||
case THEME_UNSUBSCRIBED: result = COLOR_PAIR(38); break;
|
||||
case THEME_OTR_STARTED_TRUSTED: result = COLOR_PAIR(39); break;
|
||||
case THEME_OTR_STARTED_UNTRUSTED: result = COLOR_PAIR(40); break;
|
||||
case THEME_OTR_ENDED: result = COLOR_PAIR(41); break;
|
||||
case THEME_OTR_TRUSTED: result = COLOR_PAIR(42); break;
|
||||
case THEME_OTR_UNTRUSTED: result = COLOR_PAIR(43); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -44,54 +44,57 @@
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
|
||||
#define COLOUR_TEXT COLOR_PAIR(1)
|
||||
#define COLOUR_TEXT_ME COLOR_PAIR(2)
|
||||
#define COLOUR_TEXT_THEM COLOR_PAIR(3)
|
||||
#define COLOUR_SPLASH COLOR_PAIR(4)
|
||||
#define COLOUR_ERROR COLOR_PAIR(5)
|
||||
#define COLOUR_INCOMING COLOR_PAIR(6)
|
||||
#define COLOUR_INPUT_TEXT COLOR_PAIR(7)
|
||||
#define COLOUR_TIME COLOR_PAIR(8)
|
||||
#define COLOUR_TITLE_TEXT COLOR_PAIR(9)
|
||||
#define COLOUR_TITLE_BRACKET COLOR_PAIR(10)
|
||||
#define COLOUR_TITLE_UNENCRYPTED COLOR_PAIR(11)
|
||||
#define COLOUR_TITLE_ENCRYPTED COLOR_PAIR(12)
|
||||
#define COLOUR_TITLE_UNTRUSTED COLOR_PAIR(13)
|
||||
#define COLOUR_TITLE_TRUSTED COLOR_PAIR(14)
|
||||
#define COLOUR_TITLE_ONLINE COLOR_PAIR(15)
|
||||
#define COLOUR_TITLE_OFFLINE COLOR_PAIR(16)
|
||||
#define COLOUR_TITLE_AWAY COLOR_PAIR(17)
|
||||
#define COLOUR_TITLE_CHAT COLOR_PAIR(18)
|
||||
#define COLOUR_TITLE_DND COLOR_PAIR(19)
|
||||
#define COLOUR_TITLE_XA COLOR_PAIR(20)
|
||||
#define COLOUR_STATUS_TEXT COLOR_PAIR(21)
|
||||
#define COLOUR_STATUS_BRACKET COLOR_PAIR(22)
|
||||
#define COLOUR_STATUS_ACTIVE COLOR_PAIR(23)
|
||||
#define COLOUR_STATUS_NEW COLOR_PAIR(24)
|
||||
#define COLOUR_ME COLOR_PAIR(25)
|
||||
#define COLOUR_THEM COLOR_PAIR(26)
|
||||
#define COLOUR_ROOMINFO COLOR_PAIR(27)
|
||||
#define COLOUR_ROOMMENTION COLOR_PAIR(28)
|
||||
#define COLOUR_ONLINE COLOR_PAIR(29)
|
||||
#define COLOUR_OFFLINE COLOR_PAIR(30)
|
||||
#define COLOUR_AWAY COLOR_PAIR(31)
|
||||
#define COLOUR_CHAT COLOR_PAIR(32)
|
||||
#define COLOUR_DND COLOR_PAIR(33)
|
||||
#define COLOUR_XA COLOR_PAIR(34)
|
||||
#define COLOUR_TYPING COLOR_PAIR(35)
|
||||
#define COLOUR_GONE COLOR_PAIR(36)
|
||||
#define COLOUR_SUBSCRIBED COLOR_PAIR(37)
|
||||
#define COLOUR_UNSUBSCRIBED COLOR_PAIR(38)
|
||||
#define COLOUR_OTR_STARTED_TRUSTED COLOR_PAIR(39)
|
||||
#define COLOUR_OTR_STARTED_UNTRUSTED COLOR_PAIR(40)
|
||||
#define COLOUR_OTR_ENDED COLOR_PAIR(41)
|
||||
#define COLOUR_OTR_TRUSTED COLOR_PAIR(42)
|
||||
#define COLOUR_OTR_UNTRUSTED COLOR_PAIR(43)
|
||||
typedef enum {
|
||||
THEME_TEXT,
|
||||
THEME_TEXT_ME,
|
||||
THEME_TEXT_THEM,
|
||||
THEME_SPLASH,
|
||||
THEME_ERROR,
|
||||
THEME_INCOMING,
|
||||
THEME_INPUT_TEXT,
|
||||
THEME_TIME,
|
||||
THEME_TITLE_TEXT,
|
||||
THEME_TITLE_BRACKET,
|
||||
THEME_TITLE_UNENCRYPTED,
|
||||
THEME_TITLE_ENCRYPTED,
|
||||
THEME_TITLE_UNTRUSTED,
|
||||
THEME_TITLE_TRUSTED,
|
||||
THEME_TITLE_ONLINE,
|
||||
THEME_TITLE_OFFLINE,
|
||||
THEME_TITLE_AWAY,
|
||||
THEME_TITLE_CHAT,
|
||||
THEME_TITLE_DND,
|
||||
THEME_TITLE_XA,
|
||||
THEME_STATUS_TEXT,
|
||||
THEME_STATUS_BRACKET,
|
||||
THEME_STATUS_ACTIVE,
|
||||
THEME_STATUS_NEW,
|
||||
THEME_ME,
|
||||
THEME_THEM,
|
||||
THEME_ROOMINFO,
|
||||
THEME_ROOMMENTION,
|
||||
THEME_ONLINE,
|
||||
THEME_OFFLINE,
|
||||
THEME_AWAY,
|
||||
THEME_CHAT,
|
||||
THEME_DND,
|
||||
THEME_XA,
|
||||
THEME_TYPING,
|
||||
THEME_GONE,
|
||||
THEME_SUBSCRIBED,
|
||||
THEME_UNSUBSCRIBED,
|
||||
THEME_OTR_STARTED_TRUSTED,
|
||||
THEME_OTR_STARTED_UNTRUSTED,
|
||||
THEME_OTR_ENDED,
|
||||
THEME_OTR_TRUSTED,
|
||||
THEME_OTR_UNTRUSTED
|
||||
} theme_item_t;
|
||||
|
||||
void theme_init(const char * const theme_name);
|
||||
void theme_init_colours(void);
|
||||
gboolean theme_load(const char * const theme_name);
|
||||
GSList* theme_list(void);
|
||||
void theme_close(void);
|
||||
int theme_attrs(theme_item_t attrs);
|
||||
|
||||
#endif
|
||||
|
@ -81,12 +81,12 @@ buffer_free(ProfBuff buffer)
|
||||
|
||||
void
|
||||
buffer_push(ProfBuff buffer, const char show_char, GDateTime *time,
|
||||
int flags, int attrs, const char * const from, const char * const message)
|
||||
int flags, theme_item_t theme_item, const char * const from, const char * const message)
|
||||
{
|
||||
ProfBuffEntry *e = malloc(sizeof(struct prof_buff_entry_t));
|
||||
e->show_char = show_char;
|
||||
e->flags = flags;
|
||||
e->attrs = attrs;
|
||||
e->theme_item = theme_item;
|
||||
e->time = time;
|
||||
e->from = strdup(from);
|
||||
e->message = strdup(message);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#define UI_BUFFER_H
|
||||
|
||||
#include "config.h"
|
||||
#include "config/theme.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@ -43,7 +44,7 @@ typedef struct prof_buff_entry_t {
|
||||
char show_char;
|
||||
GDateTime *time;
|
||||
int flags;
|
||||
int attrs;
|
||||
theme_item_t theme_item;
|
||||
char *from;
|
||||
char *message;
|
||||
} ProfBuffEntry;
|
||||
@ -52,7 +53,7 @@ typedef struct prof_buff_t *ProfBuff;
|
||||
|
||||
ProfBuff buffer_create();
|
||||
void buffer_free(ProfBuff buffer);
|
||||
void buffer_push(ProfBuff buffer, const char show_char, GDateTime *time, int flags, int attrs, const char * const from, const char * const message);
|
||||
void buffer_push(ProfBuff buffer, const char show_char, GDateTime *time, int flags, theme_item_t theme_item, const char * const from, const char * const message);
|
||||
int buffer_size(ProfBuff buffer);
|
||||
ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry);
|
||||
#endif
|
||||
|
@ -113,7 +113,7 @@ _cons_show_error(const char * const msg, ...)
|
||||
va_start(arg, msg);
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, msg, arg);
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_ERROR, "", fmt_msg->str);
|
||||
win_save_print(console, '-', NULL, 0, THEME_ERROR, "", fmt_msg->str);
|
||||
g_string_free(fmt_msg, TRUE);
|
||||
va_end(arg);
|
||||
|
||||
@ -136,7 +136,7 @@ _cons_show_typing(const char * const barejid)
|
||||
display_usr = barejid;
|
||||
}
|
||||
|
||||
win_save_vprint(console, '-', NULL, 0, COLOUR_TYPING, "", "!! %s is typing a message...", display_usr);
|
||||
win_save_vprint(console, '-', NULL, 0, THEME_TYPING, "", "!! %s is typing a message...", display_usr);
|
||||
cons_alert();
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ _cons_show_incoming_message(const char * const short_from, const int win_index)
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
win_save_vprint(console, '-', NULL, 0, COLOUR_INCOMING, "", "<< incoming from %s (%d)", short_from, ui_index);
|
||||
win_save_vprint(console, '-', NULL, 0, THEME_INCOMING, "", "<< incoming from %s (%d)", short_from, ui_index);
|
||||
|
||||
cons_alert();
|
||||
}
|
||||
@ -453,10 +453,10 @@ _cons_show_bookmarks(const GList *list)
|
||||
while (list != NULL) {
|
||||
Bookmark *item = list->data;
|
||||
|
||||
int presence_colour = 0;
|
||||
theme_item_t presence_colour = THEME_TEXT;
|
||||
|
||||
if (muc_active(item->jid)) {
|
||||
presence_colour = COLOUR_ONLINE;
|
||||
presence_colour = THEME_ONLINE;
|
||||
}
|
||||
win_save_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s", item->jid);
|
||||
if (item->nick != NULL) {
|
||||
@ -1485,14 +1485,14 @@ _cons_splash_logo(void)
|
||||
ProfWin *console = wins_get_console();
|
||||
win_save_println(console, "Welcome to");
|
||||
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", " ___ _ ");
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", " / __) (_)_ ");
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", " ____ ____ ___ | |__ ____ ____ _| |_ _ _ ");
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |");
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", "| | | | | | |_| | | ( ( | | | | | | |_| |_| |");
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |");
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", "|_| (____/ ");
|
||||
win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", "");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", " ___ _ ");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", " / __) (_)_ ");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", " ____ ____ ___ | |__ ____ ____ _| |_ _ _ ");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", "| | | | | | |_| | | ( ( | | | | | | |_| |_| |");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", "|_| (____/ ");
|
||||
win_save_print(console, '-', NULL, 0, THEME_SPLASH, "", "");
|
||||
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
@ -1522,7 +1522,7 @@ _show_roster_contacts(GSList *list, gboolean show_groups)
|
||||
}
|
||||
|
||||
const char *presence = p_contact_presence(contact);
|
||||
int presence_colour;
|
||||
theme_item_t presence_colour = THEME_TEXT;
|
||||
if (p_contact_subscribed(contact)) {
|
||||
presence_colour = win_presence_colour(presence);
|
||||
} else {
|
||||
@ -1542,9 +1542,9 @@ _show_roster_contacts(GSList *list, gboolean show_groups)
|
||||
sub = g_string_append(sub, ", request received");
|
||||
}
|
||||
if (p_contact_subscribed(contact)) {
|
||||
presence_colour = COLOUR_SUBSCRIBED;
|
||||
presence_colour = THEME_SUBSCRIBED;
|
||||
} else {
|
||||
presence_colour = COLOUR_UNSUBSCRIBED;
|
||||
presence_colour = THEME_UNSUBSCRIBED;
|
||||
}
|
||||
|
||||
if (show_groups) {
|
||||
|
286
src/ui/core.c
286
src/ui/core.c
@ -248,12 +248,12 @@ _ui_handle_stanza(const char * const msg)
|
||||
|
||||
if (g_str_has_prefix(msg, "SENT:")) {
|
||||
win_save_print(xmlconsole, '-', NULL, 0, 0, "", "SENT:");
|
||||
win_save_print(xmlconsole, '-', NULL, 0, COLOUR_ONLINE, "", &msg[6]);
|
||||
win_save_print(xmlconsole, '-', NULL, 0, COLOUR_ONLINE, "", "");
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_ONLINE, "", &msg[6]);
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_ONLINE, "", "");
|
||||
} else if (g_str_has_prefix(msg, "RECV:")) {
|
||||
win_save_print(xmlconsole, '-', NULL, 0, 0, "", "RECV:");
|
||||
win_save_print(xmlconsole, '-', NULL, 0, COLOUR_AWAY, "", &msg[6]);
|
||||
win_save_print(xmlconsole, '-', NULL, 0, COLOUR_AWAY, "", "");
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_AWAY, "", &msg[6]);
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_AWAY, "", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -517,13 +517,13 @@ _ui_handle_recipient_not_found(const char * const recipient, const char * const
|
||||
} else if (win->type == WIN_MUC) {
|
||||
g_string_printf(msg, "Room %s not found: %s", recipient, err_msg);
|
||||
cons_show_error(msg->str);
|
||||
win_save_print(win, '!', NULL, 0, COLOUR_ERROR, "", msg->str);
|
||||
win_save_print(win, '!', NULL, 0, THEME_ERROR, "", msg->str);
|
||||
|
||||
// unknown chat recipient
|
||||
} else {
|
||||
g_string_printf(msg, "Recipient %s not found: %s", recipient, err_msg);
|
||||
cons_show_error(msg->str);
|
||||
win_save_print(win, '!', NULL, 0, COLOUR_ERROR, "", msg->str);
|
||||
win_save_print(win, '!', NULL, 0, THEME_ERROR, "", msg->str);
|
||||
}
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
@ -541,7 +541,7 @@ _ui_handle_recipient_error(const char * const recipient, const char * const err_
|
||||
|
||||
// show in window if exists for recipient
|
||||
if (win != NULL) {
|
||||
win_save_print(win, '!', NULL, 0, COLOUR_ERROR, "", msg->str);
|
||||
win_save_print(win, '!', NULL, 0, THEME_ERROR, "", msg->str);
|
||||
}
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
@ -838,9 +838,9 @@ _ui_gone_secure(const char * const recipient, gboolean trusted)
|
||||
window->is_otr = TRUE;
|
||||
window->is_trusted = trusted;
|
||||
if (trusted) {
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_OTR_STARTED_TRUSTED, "", "OTR session started (trusted).");
|
||||
win_save_print(window, '!', NULL, 0, THEME_OTR_STARTED_TRUSTED, "", "OTR session started (trusted).");
|
||||
} else {
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_OTR_STARTED_UNTRUSTED, "", "OTR session started (untrusted).");
|
||||
win_save_print(window, '!', NULL, 0, THEME_OTR_STARTED_UNTRUSTED, "", "OTR session started (untrusted).");
|
||||
}
|
||||
|
||||
if (wins_is_current(window)) {
|
||||
@ -957,7 +957,7 @@ _ui_gone_insecure(const char * const recipient)
|
||||
if (window != NULL) {
|
||||
window->is_otr = FALSE;
|
||||
window->is_trusted = FALSE;
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_OTR_ENDED, "", "OTR session ended.");
|
||||
win_save_print(window, '!', NULL, 0, THEME_OTR_ENDED, "", "OTR session ended.");
|
||||
|
||||
if (wins_is_current(window)) {
|
||||
GString *recipient_str = _get_recipient_string(window);
|
||||
@ -974,7 +974,7 @@ _ui_trust(const char * const recipient)
|
||||
if (window != NULL) {
|
||||
window->is_otr = TRUE;
|
||||
window->is_trusted = TRUE;
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_OTR_TRUSTED, "", "OTR session trusted.");
|
||||
win_save_print(window, '!', NULL, 0, THEME_OTR_TRUSTED, "", "OTR session trusted.");
|
||||
|
||||
if (wins_is_current(window)) {
|
||||
GString *recipient_str = _get_recipient_string(window);
|
||||
@ -991,7 +991,7 @@ _ui_untrust(const char * const recipient)
|
||||
if (window != NULL) {
|
||||
window->is_otr = TRUE;
|
||||
window->is_trusted = FALSE;
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_OTR_UNTRUSTED, "", "OTR session untrusted.");
|
||||
win_save_print(window, '!', NULL, 0, THEME_OTR_UNTRUSTED, "", "OTR session untrusted.");
|
||||
|
||||
if (wins_is_current(window)) {
|
||||
GString *recipient_str = _get_recipient_string(window);
|
||||
@ -1197,7 +1197,7 @@ static void
|
||||
_ui_current_error_line(const char * const msg)
|
||||
{
|
||||
ProfWin *current = wins_get_current();
|
||||
win_save_print(current, '-', NULL, 0, COLOUR_ERROR, "", msg);
|
||||
win_save_print(current, '-', NULL, 0, THEME_ERROR, "", msg);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1247,7 +1247,7 @@ _ui_recipient_gone(const char * const barejid)
|
||||
|
||||
ProfWin *window = wins_get_by_recipient(barejid);
|
||||
if (window != NULL) {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_GONE, "", "<- %s has left the conversation.", display_usr);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_GONE, "", "<- %s has left the conversation.", display_usr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1351,7 +1351,7 @@ _ui_outgoing_msg(const char * const from, const char * const to,
|
||||
num = wins_get_num(window);
|
||||
}
|
||||
|
||||
win_save_print(window, '-', NULL, 0, COLOUR_TEXT_ME, from, message);
|
||||
win_save_print(window, '-', NULL, 0, THEME_TEXT_ME, from, message);
|
||||
ui_switch_win(num);
|
||||
}
|
||||
|
||||
@ -1367,18 +1367,18 @@ _ui_room_join(const char * const room, gboolean focus)
|
||||
}
|
||||
|
||||
char *nick = muc_nick(room);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "-> You have joined the room as %s", nick);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "-> You have joined the room as %s", nick);
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
char *role = muc_role_str(room);
|
||||
char *affiliation = muc_affiliation_str(room);
|
||||
if (role) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", role: %s", role);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", role: %s", role);
|
||||
}
|
||||
if (affiliation) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", affiliation: %s", affiliation);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", affiliation: %s", affiliation);
|
||||
}
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
|
||||
num = wins_get_num(window);
|
||||
|
||||
@ -1388,7 +1388,7 @@ _ui_room_join(const char * const room, gboolean focus)
|
||||
status_bar_active(num);
|
||||
ProfWin *console = wins_get_console();
|
||||
char *nick = muc_nick(room);
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "-> Autojoined %s as %s (%d).", room, nick, num);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_TYPING, "", "-> Autojoined %s as %s (%d).", room, nick, num);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1406,14 +1406,14 @@ _ui_room_role_change(const char * const room, const char * const role, const cha
|
||||
const char * const reason)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Your role has been changed to: %s", role);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Your role has been changed to: %s", role);
|
||||
if (actor) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
}
|
||||
if (reason) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason);
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1421,14 +1421,14 @@ _ui_room_affiliation_change(const char * const room, const char * const affiliat
|
||||
const char * const reason)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation);
|
||||
if (actor) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
}
|
||||
if (reason) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason);
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1436,14 +1436,14 @@ _ui_room_role_and_affiliation_change(const char * const room, const char * const
|
||||
const char * const actor, const char * const reason)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation);
|
||||
if (actor) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
}
|
||||
if (reason) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason);
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
|
||||
|
||||
@ -1452,14 +1452,14 @@ _ui_room_occupant_role_change(const char * const room, const char * const nick,
|
||||
const char * const actor, const char * const reason)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%s's role has been changed to: %s", nick, role);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role has been changed to: %s", nick, role);
|
||||
if (actor) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
}
|
||||
if (reason) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason);
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1467,14 +1467,14 @@ _ui_room_occupant_affiliation_change(const char * const room, const char * const
|
||||
const char * const actor, const char * const reason)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation);
|
||||
if (actor) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
}
|
||||
if (reason) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason);
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1482,14 +1482,14 @@ _ui_room_occupant_role_and_affiliation_change(const char * const room, const cha
|
||||
const char * const affiliation, const char * const actor, const char * const reason)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation);
|
||||
if (actor) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
}
|
||||
if (reason) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason);
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1552,16 +1552,16 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
|
||||
} else {
|
||||
if ((roster == NULL) || (g_list_length(roster) == 0)) {
|
||||
if (presence == NULL) {
|
||||
win_save_print(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Room is empty.");
|
||||
win_save_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room is empty.");
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "No occupants %s.", presence);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", "No occupants %s.", presence);
|
||||
}
|
||||
} else {
|
||||
int length = g_list_length(roster);
|
||||
if (presence == NULL) {
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d occupants: ", length);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%d occupants: ", length);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d %s: ", length, presence);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%d %s: ", length, presence);
|
||||
}
|
||||
|
||||
while (roster != NULL) {
|
||||
@ -1577,7 +1577,7 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
|
||||
|
||||
roster = g_list_next(roster);
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ONLINE, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ONLINE, "", "");
|
||||
|
||||
}
|
||||
}
|
||||
@ -1596,7 +1596,7 @@ _ui_room_member_offline(const char * const room, const char * const nick)
|
||||
if (window == NULL) {
|
||||
log_error("Received offline presence for room participant %s, but no window open for %s.", nick, room);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_OFFLINE, "", "<- %s has left the room.", nick);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_OFFLINE, "", "<- %s has left the room.", nick);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1619,7 +1619,7 @@ _ui_room_member_kicked(const char * const room, const char * const nick, const c
|
||||
g_string_append(message, reason);
|
||||
}
|
||||
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_OFFLINE, "", "<- %s", message->str);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_OFFLINE, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
}
|
||||
@ -1643,7 +1643,7 @@ _ui_room_member_banned(const char * const room, const char * const nick, const c
|
||||
g_string_append(message, reason);
|
||||
}
|
||||
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_OFFLINE, "", "<- %s", message->str);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_OFFLINE, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
}
|
||||
@ -1656,16 +1656,16 @@ _ui_room_member_online(const char * const room, const char * const nick, const c
|
||||
if (window == NULL) {
|
||||
log_error("Received online presence for room participant %s, but no window open for %s.", nick, room);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ONLINE, "", "-> %s has joined the room", nick);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ONLINE, "", "-> %s has joined the room", nick);
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
if (role) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", ", role: %s", role);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", role: %s", role);
|
||||
}
|
||||
if (affiliation) {
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", ", affiliation: %s", affiliation);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", affiliation: %s", affiliation);
|
||||
}
|
||||
}
|
||||
win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", "");
|
||||
win_save_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1689,7 +1689,7 @@ _ui_room_member_nick_change(const char * const room,
|
||||
if (window == NULL) {
|
||||
log_error("Received nick change for room participant %s, but no window open for %s.", old_nick, room);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_THEM, "", "** %s is now known as %s", old_nick, nick);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_THEM, "", "** %s is now known as %s", old_nick, nick);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1700,7 +1700,7 @@ _ui_room_nick_change(const char * const room, const char * const nick)
|
||||
if (window == NULL) {
|
||||
log_error("Received self nick change %s, but no window open for %s.", nick, room);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ME, "", "** You are now known as %s", nick);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ME, "", "** You are now known as %s", nick);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1742,12 +1742,12 @@ _ui_room_message(const char * const room_jid, const char * const nick,
|
||||
|
||||
if (g_strcmp0(nick, my_nick) != 0) {
|
||||
if (g_strrstr(message, my_nick) != NULL) {
|
||||
win_save_print(window, '-', NULL, NO_ME, COLOUR_ROOMMENTION, nick, message);
|
||||
win_save_print(window, '-', NULL, NO_ME, THEME_ROOMMENTION, nick, message);
|
||||
} else {
|
||||
win_save_print(window, '-', NULL, NO_ME, COLOUR_TEXT_THEM, nick, message);
|
||||
win_save_print(window, '-', NULL, NO_ME, THEME_TEXT_THEM, nick, message);
|
||||
}
|
||||
} else {
|
||||
win_save_print(window, '-', NULL, 0, COLOUR_TEXT_ME, nick, message);
|
||||
win_save_print(window, '-', NULL, 0, THEME_TEXT_ME, nick, message);
|
||||
}
|
||||
|
||||
// currently in groupchat window
|
||||
@ -1824,13 +1824,13 @@ _ui_room_requires_config(const char * const room_jid)
|
||||
}
|
||||
|
||||
win_save_print(window, '-', NULL, 0, 0, "", "");
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "",
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "",
|
||||
"Room locked, requires configuration.");
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "",
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "",
|
||||
"Use '/room accept' to accept the defaults");
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "",
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "",
|
||||
"Use '/room destroy' to cancel and destroy the room");
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "",
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "",
|
||||
"Use '/room config' to edit the room configuration");
|
||||
win_save_print(window, '-', NULL, 0, 0, "", "");
|
||||
|
||||
@ -1881,16 +1881,16 @@ _ui_room_destroyed(const char * const room, const char * const reason, const cha
|
||||
ProfWin *console = wins_get_console();
|
||||
|
||||
if (reason) {
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "<- Room destroyed: %s, reason: %s", room, reason);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- Room destroyed: %s, reason: %s", room, reason);
|
||||
} else {
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "<- Room destroyed: %s", room);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- Room destroyed: %s", room);
|
||||
}
|
||||
|
||||
if (new_jid) {
|
||||
if (password) {
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "Replacement room: %s, password: %s", new_jid, password);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_TYPING, "", "Replacement room: %s, password: %s", new_jid, password);
|
||||
} else {
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "Replacement room: %s", new_jid);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_TYPING, "", "Replacement room: %s", new_jid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1918,7 +1918,7 @@ _ui_room_kicked(const char * const room, const char * const actor, const char *
|
||||
}
|
||||
|
||||
ProfWin *console = wins_get_console();
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "<- %s", message->str);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
}
|
||||
@ -1945,7 +1945,7 @@ _ui_room_banned(const char * const room, const char * const actor, const char *
|
||||
}
|
||||
|
||||
ProfWin *console = wins_get_console();
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "<- %s", message->str);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
}
|
||||
@ -1961,17 +1961,17 @@ _ui_room_subject(const char * const room, const char * const nick, const char *
|
||||
|
||||
if (subject) {
|
||||
if (nick) {
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "*%s has set the room subject: ", nick);
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "*%s has set the room subject: ", nick);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", subject);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Room subject: ");
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: ");
|
||||
win_save_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", subject);
|
||||
}
|
||||
} else {
|
||||
if (nick) {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "*%s has cleared the room subject: ", nick);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject: ", nick);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Room subject cleared");
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room subject cleared");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1993,7 +1993,7 @@ _ui_handle_room_kick_error(const char * const room, const char * const nick, con
|
||||
if (window == NULL) {
|
||||
log_error("Kick error received for %s, but no window open for %s.", nick, room);
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ERROR, "", "Error kicking %s: %s", nick, error);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error kicking %s: %s", nick, error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2006,7 +2006,7 @@ _ui_room_broadcast(const char * const room_jid, const char * const message)
|
||||
} else {
|
||||
int num = wins_get_num(window);
|
||||
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Room message: ");
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room message: ");
|
||||
win_save_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", message);
|
||||
|
||||
// currently in groupchat window
|
||||
@ -2026,7 +2026,7 @@ _ui_handle_room_affiliation_list_error(const char * const room, const char * con
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
if (window) {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ERROR, "", "Error retrieving %s list: %s", affiliation, error);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", affiliation, error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2056,7 +2056,7 @@ _ui_handle_room_role_list_error(const char * const room, const char * const role
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
if (window) {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ERROR, "", "Error retrieving %s list: %s", role, error);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", role, error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2096,7 +2096,7 @@ _ui_handle_room_affiliation_set_error(const char * const room, const char * cons
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
if (window) {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ERROR, "", "Error setting %s affiliation for %s: %s", affiliation, jid, error);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error setting %s affiliation for %s: %s", affiliation, jid, error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2106,7 +2106,7 @@ _ui_handle_room_role_set_error(const char * const room, const char * const nick,
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
if (window) {
|
||||
win_save_vprint(window, '!', NULL, 0, COLOUR_ERROR, "", "Error setting %s role for %s: %s", role, nick, error);
|
||||
win_save_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error setting %s role for %s: %s", role, nick, error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2425,7 +2425,7 @@ _ui_show_room_affiliation_list(ProfWin *window, const char * const room, muc_aff
|
||||
static void
|
||||
_ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
{
|
||||
win_save_vprint(window, '-', NULL, NO_EOL, COLOUR_AWAY, "", "[%s] ", tag);
|
||||
win_save_vprint(window, '-', NULL, NO_EOL, THEME_AWAY, "", "[%s] ", tag);
|
||||
win_save_vprint(window, '-', NULL, NO_EOL | NO_DATE, 0, "", "%s", field->label);
|
||||
if (field->required) {
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " (required): ");
|
||||
@ -2444,9 +2444,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
char *value = curr_value->data;
|
||||
if (value != NULL) {
|
||||
if (g_strcmp0(field->var, "muc#roomconfig_roomsecret") == 0) {
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", "[hidden]");
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]");
|
||||
} else {
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", value);
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2456,7 +2456,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
if (curr_value != NULL) {
|
||||
char *value = curr_value->data;
|
||||
if (value != NULL) {
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", "[hidden]");
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]");
|
||||
}
|
||||
}
|
||||
win_save_newline(window);
|
||||
@ -2468,23 +2468,23 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
char *value = curr_value->data;
|
||||
GString *val_tag = g_string_new("");
|
||||
g_string_printf(val_tag, "val%d", index++);
|
||||
win_save_vprint(window, '-', NULL, 0, COLOUR_ONLINE, "", " [%s] %s", val_tag->str, value);
|
||||
win_save_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", val_tag->str, value);
|
||||
g_string_free(val_tag, TRUE);
|
||||
curr_value = g_slist_next(curr_value);
|
||||
}
|
||||
break;
|
||||
case FIELD_BOOLEAN:
|
||||
if (curr_value == NULL) {
|
||||
win_save_print(window, '-', NULL, NO_DATE, COLOUR_OFFLINE, "", "FALSE");
|
||||
win_save_print(window, '-', NULL, NO_DATE, THEME_OFFLINE, "", "FALSE");
|
||||
} else {
|
||||
char *value = curr_value->data;
|
||||
if (value == NULL) {
|
||||
win_save_print(window, '-', NULL, NO_DATE, COLOUR_OFFLINE, "", "FALSE");
|
||||
win_save_print(window, '-', NULL, NO_DATE, THEME_OFFLINE, "", "FALSE");
|
||||
} else {
|
||||
if (g_strcmp0(value, "0") == 0) {
|
||||
win_save_print(window, '-', NULL, NO_DATE, COLOUR_OFFLINE, "", "FALSE");
|
||||
win_save_print(window, '-', NULL, NO_DATE, THEME_OFFLINE, "", "FALSE");
|
||||
} else {
|
||||
win_save_print(window, '-', NULL, NO_DATE, COLOUR_ONLINE, "", "TRUE");
|
||||
win_save_print(window, '-', NULL, NO_DATE, THEME_ONLINE, "", "TRUE");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2498,9 +2498,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
while (curr_option != NULL) {
|
||||
FormOption *option = curr_option->data;
|
||||
if (g_strcmp0(option->value, value) == 0) {
|
||||
win_save_vprint(window, '-', NULL, 0, COLOUR_ONLINE, "", " [%s] %s", option->value, option->label);
|
||||
win_save_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label);
|
||||
} else {
|
||||
win_save_vprint(window, '-', NULL, 0, COLOUR_OFFLINE, "", " [%s] %s", option->value, option->label);
|
||||
win_save_vprint(window, '-', NULL, 0, THEME_OFFLINE, "", " [%s] %s", option->value, option->label);
|
||||
}
|
||||
curr_option = g_slist_next(curr_option);
|
||||
}
|
||||
@ -2514,9 +2514,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
while (curr_option != NULL) {
|
||||
FormOption *option = curr_option->data;
|
||||
if (g_slist_find_custom(curr_value, option->value, (GCompareFunc)g_strcmp0) != NULL) {
|
||||
win_save_vprint(window, '-', NULL, 0, COLOUR_ONLINE, "", " [%s] %s", option->value, option->label);
|
||||
win_save_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label);
|
||||
} else {
|
||||
win_save_vprint(window, '-', NULL, 0, COLOUR_OFFLINE, "", " [%s] %s", option->value, option->label);
|
||||
win_save_vprint(window, '-', NULL, 0, THEME_OFFLINE, "", " [%s] %s", option->value, option->label);
|
||||
}
|
||||
curr_option = g_slist_next(curr_option);
|
||||
}
|
||||
@ -2526,7 +2526,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
if (curr_value != NULL) {
|
||||
char *value = curr_value->data;
|
||||
if (value != NULL) {
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", value);
|
||||
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value);
|
||||
}
|
||||
}
|
||||
win_save_newline(window);
|
||||
@ -2535,7 +2535,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
|
||||
win_save_newline(window);
|
||||
while (curr_value != NULL) {
|
||||
char *value = curr_value->data;
|
||||
win_save_vprint(window, '-', NULL, 0, COLOUR_ONLINE, "", " %s", value);
|
||||
win_save_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " %s", value);
|
||||
curr_value = g_slist_next(curr_value);
|
||||
}
|
||||
break;
|
||||
@ -2634,7 +2634,7 @@ _ui_handle_room_configuration_form_error(const char * const room, const char * c
|
||||
g_string_append(message_str, message);
|
||||
}
|
||||
|
||||
win_save_print(window, '-', NULL, 0, COLOUR_ERROR, "", message_str->str);
|
||||
win_save_print(window, '-', NULL, 0, THEME_ERROR, "", message_str->str);
|
||||
|
||||
g_string_free(message_str, TRUE);
|
||||
}
|
||||
@ -2662,7 +2662,7 @@ _ui_handle_room_config_submit_result(const char * const room)
|
||||
if (muc_window) {
|
||||
int num = wins_get_num(muc_window);
|
||||
ui_switch_win(num);
|
||||
win_save_print(muc_window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Room configuration successful");
|
||||
win_save_print(muc_window, '!', NULL, 0, THEME_ROOMINFO, "", "Room configuration successful");
|
||||
} else {
|
||||
ui_switch_win(1);
|
||||
cons_show("Room configuration successful: %s", room);
|
||||
@ -2689,25 +2689,25 @@ _ui_handle_room_config_submit_result_error(const char * const room, const char *
|
||||
|
||||
if (form_window) {
|
||||
if (message) {
|
||||
win_save_vprint(form_window, '!', NULL, 0, COLOUR_ERROR, "", "Configuration error: %s", message);
|
||||
win_save_vprint(form_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error: %s", message);
|
||||
} else {
|
||||
win_save_print(form_window, '!', NULL, 0, COLOUR_ERROR, "", "Configuration error");
|
||||
win_save_print(form_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error");
|
||||
}
|
||||
} else if (muc_window) {
|
||||
if (message) {
|
||||
win_save_vprint(muc_window, '!', NULL, 0, COLOUR_ERROR, "", "Configuration error: %s", message);
|
||||
win_save_vprint(muc_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error: %s", message);
|
||||
} else {
|
||||
win_save_print(muc_window, '!', NULL, 0, COLOUR_ERROR, "", "Configuration error");
|
||||
win_save_print(muc_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error");
|
||||
}
|
||||
} else {
|
||||
if (message) {
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_ERROR, "", "Configuration error for %s: %s", room, message);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_ERROR, "", "Configuration error for %s: %s", room, message);
|
||||
} else {
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_ERROR, "", "Configuration error for %s", room);
|
||||
win_save_vprint(console, '!', NULL, 0, THEME_ERROR, "", "Configuration error for %s", room);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
win_save_print(console, '!', NULL, 0, COLOUR_ERROR, "", "Configuration error");
|
||||
win_save_print(console, '!', NULL, 0, THEME_ERROR, "", "Configuration error");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2822,16 +2822,16 @@ _ui_roster_contact(PContact contact)
|
||||
|
||||
if ((g_strcmp0(presence, "offline") != 0) || ((g_strcmp0(presence, "offline") == 0) &&
|
||||
(prefs_get_boolean(PREF_ROSTER_OFFLINE)))) {
|
||||
int presence_colour = win_presence_colour(presence);
|
||||
theme_item_t presence_colour = win_presence_colour(presence);
|
||||
|
||||
wattron(window->subwin, presence_colour);
|
||||
wattron(window->subwin, theme_attrs(presence_colour));
|
||||
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, name);
|
||||
win_printline_nowrap(window->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
wattroff(window->subwin, presence_colour);
|
||||
wattroff(window->subwin, theme_attrs(presence_colour));
|
||||
|
||||
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
|
||||
GList *resources = p_contact_get_available_resources(contact);
|
||||
@ -2839,15 +2839,15 @@ _ui_roster_contact(PContact contact)
|
||||
while (curr_resource) {
|
||||
Resource *resource = curr_resource->data;
|
||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||
int resource_presence_colour = win_presence_colour(resource_presence);
|
||||
wattron(window->subwin, resource_presence_colour);
|
||||
theme_item_t resource_presence_colour = win_presence_colour(resource_presence);
|
||||
wattron(window->subwin, theme_attrs(resource_presence_colour));
|
||||
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, resource->name);
|
||||
win_printline_nowrap(window->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
wattroff(window->subwin, resource_presence_colour);
|
||||
wattroff(window->subwin, theme_attrs(resource_presence_colour));
|
||||
|
||||
curr_resource = g_list_next(curr_resource);
|
||||
}
|
||||
@ -2861,9 +2861,9 @@ static void
|
||||
_ui_roster_contacts_by_presence(const char * const presence, char *title)
|
||||
{
|
||||
ProfWin *window = wins_get_console();
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
win_printline_nowrap(window->subwin, title);
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
GSList *contacts = roster_get_contacts_by_presence(presence);
|
||||
if (contacts) {
|
||||
GSList *curr_contact = contacts;
|
||||
@ -2880,12 +2880,12 @@ static void
|
||||
_ui_roster_contacts_by_group(char *group)
|
||||
{
|
||||
ProfWin *window = wins_get_console();
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
GString *title = g_string_new(" -");
|
||||
g_string_append(title, group);
|
||||
win_printline_nowrap(window->subwin, title->str);
|
||||
g_string_free(title, TRUE);
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
GSList *contacts = roster_get_group(group);
|
||||
if (contacts) {
|
||||
GSList *curr_contact = contacts;
|
||||
@ -2904,9 +2904,9 @@ _ui_roster_contacts_by_no_group(void)
|
||||
ProfWin *window = wins_get_console();
|
||||
GSList *contacts = roster_get_nogroup();
|
||||
if (contacts) {
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
win_printline_nowrap(window->subwin, " -no group");
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
GSList *curr_contact = contacts;
|
||||
while (curr_contact) {
|
||||
PContact contact = curr_contact->data;
|
||||
@ -2947,9 +2947,9 @@ _ui_roster(void)
|
||||
GSList *contacts = roster_get_contacts();
|
||||
if (contacts) {
|
||||
werase(window->subwin);
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
win_printline_nowrap(window->subwin, " -Roster");
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
GSList *curr_contact = contacts;
|
||||
while (curr_contact) {
|
||||
PContact contact = curr_contact->data;
|
||||
@ -2973,85 +2973,85 @@ _ui_muc_roster(const char * const room)
|
||||
werase(window->subwin);
|
||||
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
win_printline_nowrap(window->subwin, " -Moderators");
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
GList *roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
if (occupant->role == MUC_ROLE_MODERATOR) {
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
int presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, presence_colour);
|
||||
theme_item_t presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, theme_attrs(presence_colour));
|
||||
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, occupant->nick);
|
||||
win_printline_nowrap(window->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
wattroff(window->subwin, presence_colour);
|
||||
wattroff(window->subwin, theme_attrs(presence_colour));
|
||||
}
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
win_printline_nowrap(window->subwin, " -Participants");
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
if (occupant->role == MUC_ROLE_PARTICIPANT) {
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
int presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, presence_colour);
|
||||
theme_item_t presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, theme_attrs(presence_colour));
|
||||
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, occupant->nick);
|
||||
win_printline_nowrap(window->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
wattroff(window->subwin, presence_colour);
|
||||
wattroff(window->subwin, theme_attrs(presence_colour));
|
||||
}
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
win_printline_nowrap(window->subwin, " -Visitors");
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
if (occupant->role == MUC_ROLE_VISITOR) {
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
int presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, presence_colour);
|
||||
theme_item_t presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, theme_attrs(presence_colour));
|
||||
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, occupant->nick);
|
||||
win_printline_nowrap(window->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
wattroff(window->subwin, presence_colour);
|
||||
wattroff(window->subwin, theme_attrs(presence_colour));
|
||||
}
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
} else {
|
||||
wattron(window->subwin, COLOUR_ROOMINFO);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
win_printline_nowrap(window->subwin, " -Occupants\n");
|
||||
wattroff(window->subwin, COLOUR_ROOMINFO);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
GList *roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
int presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, presence_colour);
|
||||
theme_item_t presence_colour = win_presence_colour(presence_str);
|
||||
wattron(window->subwin, theme_attrs(presence_colour));
|
||||
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, occupant->nick);
|
||||
win_printline_nowrap(window->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, occupant->nick);
|
||||
win_printline_nowrap(window->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
wattroff(window->subwin, presence_colour);
|
||||
wattroff(window->subwin, theme_attrs(presence_colour));
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ create_input_window(void)
|
||||
#endif
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
inp_win = newpad(1, INP_WIN_MAX);
|
||||
wbkgd(inp_win, COLOUR_INPUT_TEXT);
|
||||
wbkgd(inp_win, theme_attrs(THEME_INPUT_TEXT));;
|
||||
keypad(inp_win, TRUE);
|
||||
wmove(inp_win, 0, 0);
|
||||
_inp_win_update_virtual();
|
||||
|
@ -85,12 +85,14 @@ create_status_bar(void)
|
||||
remaining_new = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
|
||||
current = 1;
|
||||
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
status_bar = newwin(1, cols, rows-2, 0);
|
||||
wbkgd(status_bar, COLOUR_STATUS_TEXT);
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT));
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, cols - 34, _active);
|
||||
mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
|
||||
if (last_time != NULL) {
|
||||
g_date_time_unref(last_time);
|
||||
@ -114,13 +116,15 @@ status_bar_resize(void)
|
||||
|
||||
werase(status_bar);
|
||||
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
mvwin(status_bar, rows-2, 0);
|
||||
wresize(status_bar, 1, cols);
|
||||
wbkgd(status_bar, COLOUR_STATUS_TEXT);
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT));
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, cols - 34, _active);
|
||||
mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
|
||||
if (message != NULL) {
|
||||
mvwprintw(status_bar, 0, 10, message);
|
||||
@ -160,10 +164,11 @@ status_bar_current(int i)
|
||||
current = i;
|
||||
}
|
||||
int cols = getmaxx(stdscr);
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, cols - 34, _active);
|
||||
mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
|
||||
_status_bar_draw();
|
||||
}
|
||||
@ -291,11 +296,12 @@ status_bar_print_message(const char * const msg)
|
||||
mvwprintw(status_bar, 0, 10, message);
|
||||
|
||||
int cols = getmaxx(stdscr);
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, cols - 34, _active);
|
||||
mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
|
||||
_status_bar_draw();
|
||||
}
|
||||
@ -311,11 +317,12 @@ status_bar_clear(void)
|
||||
werase(status_bar);
|
||||
|
||||
int cols = getmaxx(stdscr);
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, cols - 34, _active);
|
||||
mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
|
||||
_status_bar_draw();
|
||||
}
|
||||
@ -331,11 +338,12 @@ status_bar_clear_message(void)
|
||||
werase(status_bar);
|
||||
|
||||
int cols = getmaxx(stdscr);
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, cols - 34, _active);
|
||||
mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket);
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
|
||||
_status_bar_draw();
|
||||
}
|
||||
@ -362,7 +370,8 @@ _mark_new(int num)
|
||||
{
|
||||
int active_pos = 1 + ((num-1) * 3);
|
||||
int cols = getmaxx(stdscr);
|
||||
wattron(status_bar, COLOUR_STATUS_NEW);
|
||||
int status_attrs = theme_attrs(THEME_STATUS_NEW);
|
||||
wattron(status_bar, status_attrs);
|
||||
wattron(status_bar, A_BLINK);
|
||||
if (num == 10) {
|
||||
mvwprintw(status_bar, 0, cols - 34 + active_pos, "0");
|
||||
@ -371,7 +380,7 @@ _mark_new(int num)
|
||||
} else {
|
||||
mvwprintw(status_bar, 0, cols - 34 + active_pos, "%d", num);
|
||||
}
|
||||
wattroff(status_bar, COLOUR_STATUS_NEW);
|
||||
wattroff(status_bar, status_attrs);
|
||||
wattroff(status_bar, A_BLINK);
|
||||
}
|
||||
|
||||
@ -380,7 +389,8 @@ _mark_active(int num)
|
||||
{
|
||||
int active_pos = 1 + ((num-1) * 3);
|
||||
int cols = getmaxx(stdscr);
|
||||
wattron(status_bar, COLOUR_STATUS_ACTIVE);
|
||||
int status_attrs = theme_attrs(THEME_STATUS_ACTIVE);
|
||||
wattron(status_bar, status_attrs);
|
||||
if (num == 10) {
|
||||
mvwprintw(status_bar, 0, cols - 34 + active_pos, "0");
|
||||
} else if (num > 10) {
|
||||
@ -388,7 +398,7 @@ _mark_active(int num)
|
||||
} else {
|
||||
mvwprintw(status_bar, 0, cols - 34 + active_pos, "%d", num);
|
||||
}
|
||||
wattroff(status_bar, COLOUR_STATUS_ACTIVE);
|
||||
wattroff(status_bar, status_attrs);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -409,13 +419,15 @@ _status_bar_draw(void)
|
||||
gchar *date_fmt = g_date_time_format(last_time, "%H:%M");
|
||||
assert(date_fmt != NULL);
|
||||
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwaddch(status_bar, 0, 1, '[');
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, 2, date_fmt);
|
||||
wattron(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwaddch(status_bar, 0, 7, ']');
|
||||
wattroff(status_bar, COLOUR_STATUS_BRACKET);
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
g_free(date_fmt);
|
||||
|
||||
_update_win_statuses();
|
||||
|
@ -65,7 +65,7 @@ create_title_bar(void)
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
win = newwin(1, cols, 0, 0);
|
||||
wbkgd(win, COLOUR_TITLE_TEXT);
|
||||
wbkgd(win, theme_attrs(THEME_TITLE_TEXT));
|
||||
title_bar_console();
|
||||
title_bar_set_presence(CONTACT_OFFLINE);
|
||||
wnoutrefresh(win);
|
||||
@ -98,7 +98,7 @@ title_bar_resize(void)
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
wresize(win, 1, cols);
|
||||
wbkgd(win, COLOUR_TITLE_TEXT);
|
||||
wbkgd(win, theme_attrs(THEME_TITLE_TEXT));
|
||||
|
||||
_title_bar_draw();
|
||||
}
|
||||
@ -174,6 +174,8 @@ _title_bar_draw(void)
|
||||
waddch(win, ' ');
|
||||
mvwprintw(win, 0, 0, " %s", current_title);
|
||||
|
||||
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
|
||||
|
||||
// show presence
|
||||
if (prefs_get_boolean(PREF_PRESENCE) && current_recipient) {
|
||||
char *recipient_jid = NULL;
|
||||
@ -190,29 +192,31 @@ _title_bar_draw(void)
|
||||
PContact contact = roster_get_contact(recipient_jid);
|
||||
const char *presence = p_contact_presence(contact);
|
||||
|
||||
int presence_colour = COLOUR_TITLE_ONLINE;
|
||||
theme_item_t presence_colour = THEME_TITLE_ONLINE;
|
||||
if (g_strcmp0(presence, "offline") == 0) {
|
||||
presence_colour = COLOUR_TITLE_OFFLINE;
|
||||
presence_colour = THEME_TITLE_OFFLINE;
|
||||
} else if (g_strcmp0(presence, "away") == 0) {
|
||||
presence_colour = COLOUR_TITLE_AWAY;
|
||||
presence_colour = THEME_TITLE_AWAY;
|
||||
} else if (g_strcmp0(presence, "xa") == 0) {
|
||||
presence_colour = COLOUR_TITLE_XA;
|
||||
presence_colour = THEME_TITLE_XA;
|
||||
} else if (g_strcmp0(presence, "chat") == 0) {
|
||||
presence_colour = COLOUR_TITLE_CHAT;
|
||||
presence_colour = THEME_TITLE_CHAT;
|
||||
} else if (g_strcmp0(presence, "dnd") == 0) {
|
||||
presence_colour = COLOUR_TITLE_DND;
|
||||
presence_colour = THEME_TITLE_DND;
|
||||
}
|
||||
|
||||
int presence_attrs = theme_attrs(presence_colour);
|
||||
|
||||
wprintw(win, " ");
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, presence_colour);
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, presence_attrs);
|
||||
wprintw(win, presence);
|
||||
wattroff(win, presence_colour);
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, presence_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -233,50 +237,54 @@ _title_bar_draw(void)
|
||||
if (current->type == WIN_CHAT) {
|
||||
if (!current->is_otr) {
|
||||
if (prefs_get_boolean(PREF_OTR_WARN)) {
|
||||
int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED);
|
||||
wprintw(win, " ");
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, COLOUR_TITLE_UNENCRYPTED);
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, unencrypted_attrs);
|
||||
wprintw(win, "unencrypted");
|
||||
wattroff(win, COLOUR_TITLE_UNENCRYPTED);
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, unencrypted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
} else {
|
||||
int encrypted_attrs = theme_attrs(THEME_TITLE_ENCRYPTED);
|
||||
wprintw(win, " ");
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, COLOUR_TITLE_ENCRYPTED);
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, encrypted_attrs);
|
||||
wprintw(win, "OTR");
|
||||
wattroff(win, COLOUR_TITLE_ENCRYPTED);
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, encrypted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, bracket_attrs);
|
||||
if (current->is_trusted) {
|
||||
int trusted_attrs = theme_attrs(THEME_TITLE_TRUSTED);
|
||||
wprintw(win, " ");
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, COLOUR_TITLE_TRUSTED);
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, trusted_attrs);
|
||||
wprintw(win, "trusted");
|
||||
wattroff(win, COLOUR_TITLE_TRUSTED);
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, trusted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, bracket_attrs);
|
||||
} else {
|
||||
int untrusted_attrs = theme_attrs(THEME_TITLE_UNTRUSTED);
|
||||
wprintw(win, " ");
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "[");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, COLOUR_TITLE_UNTRUSTED);
|
||||
wattroff(win, bracket_attrs);
|
||||
wattron(win, untrusted_attrs);
|
||||
wprintw(win, "untrusted");
|
||||
wattroff(win, COLOUR_TITLE_UNTRUSTED);
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, untrusted_attrs);
|
||||
wattron(win, bracket_attrs);
|
||||
wprintw(win, "]");
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, bracket_attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -300,47 +308,55 @@ _title_bar_draw(void)
|
||||
// show presence
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, bracket_attrs);
|
||||
mvwaddch(win, 0, cols - 14, '[');
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, bracket_attrs);
|
||||
|
||||
int presence_attrs = 0;
|
||||
|
||||
switch (current_presence)
|
||||
{
|
||||
case CONTACT_ONLINE:
|
||||
wattron(win, COLOUR_TITLE_ONLINE);
|
||||
presence_attrs = theme_attrs(THEME_TITLE_ONLINE);
|
||||
wattron(win, presence_attrs);
|
||||
mvwprintw(win, 0, cols - 13, " ...online ");
|
||||
wattroff(win, COLOUR_TITLE_ONLINE);
|
||||
wattroff(win, presence_attrs);
|
||||
break;
|
||||
case CONTACT_AWAY:
|
||||
wattron(win, COLOUR_TITLE_AWAY);
|
||||
presence_attrs = theme_attrs(THEME_TITLE_AWAY);
|
||||
wattron(win, presence_attrs);
|
||||
mvwprintw(win, 0, cols - 13, " .....away ");
|
||||
wattroff(win, COLOUR_TITLE_AWAY);
|
||||
wattroff(win, presence_attrs);
|
||||
break;
|
||||
case CONTACT_DND:
|
||||
wattron(win, COLOUR_TITLE_DND);
|
||||
presence_attrs = theme_attrs(THEME_TITLE_DND);
|
||||
wattron(win, presence_attrs);
|
||||
mvwprintw(win, 0, cols - 13, " ......dnd ");
|
||||
wattroff(win, COLOUR_TITLE_DND);
|
||||
wattroff(win, presence_attrs);
|
||||
break;
|
||||
case CONTACT_CHAT:
|
||||
wattron(win, COLOUR_TITLE_CHAT);
|
||||
presence_attrs = theme_attrs(THEME_TITLE_CHAT);
|
||||
wattron(win, presence_attrs);
|
||||
mvwprintw(win, 0, cols - 13, " .....chat ");
|
||||
wattroff(win, COLOUR_TITLE_CHAT);
|
||||
wattroff(win, presence_attrs);
|
||||
break;
|
||||
case CONTACT_XA:
|
||||
wattron(win, COLOUR_TITLE_XA);
|
||||
presence_attrs = theme_attrs(THEME_TITLE_XA);
|
||||
wattron(win, presence_attrs);
|
||||
mvwprintw(win, 0, cols - 13, " .......xa ");
|
||||
wattroff(win, COLOUR_TITLE_XA);
|
||||
wattroff(win, presence_attrs);
|
||||
break;
|
||||
case CONTACT_OFFLINE:
|
||||
wattron(win, COLOUR_TITLE_OFFLINE);
|
||||
presence_attrs = theme_attrs(THEME_TITLE_OFFLINE);
|
||||
wattron(win, presence_attrs);
|
||||
mvwprintw(win, 0, cols - 13, " ..offline ");
|
||||
wattroff(win, COLOUR_TITLE_OFFLINE);
|
||||
wattroff(win, presence_attrs);
|
||||
break;
|
||||
}
|
||||
|
||||
wattron(win, COLOUR_TITLE_BRACKET);
|
||||
wattron(win, bracket_attrs);
|
||||
mvwaddch(win, 0, cols - 2, ']');
|
||||
wattroff(win, COLOUR_TITLE_BRACKET);
|
||||
wattroff(win, bracket_attrs);
|
||||
|
||||
wnoutrefresh(win);
|
||||
inp_put_back();
|
||||
|
@ -54,7 +54,7 @@
|
||||
#define CEILING(X) (X-(int)(X) > 0 ? (int)(X+1) : (int)(X))
|
||||
|
||||
static void _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
int flags, int attrs, const char * const from, const char * const message);
|
||||
int flags, theme_item_t theme_item, const char * const from, const char * const message);
|
||||
static void _win_print_wrapped(WINDOW *win, const char * const message);
|
||||
|
||||
int
|
||||
@ -83,13 +83,13 @@ win_create(const char * const title, win_type_t type)
|
||||
if (type == WIN_MUC && prefs_get_boolean(PREF_OCCUPANTS)) {
|
||||
int subwin_cols = win_occpuants_cols();
|
||||
new_win->win = newpad(PAD_SIZE, cols - subwin_cols);
|
||||
wbkgd(new_win->win, COLOUR_TEXT);
|
||||
wbkgd(new_win->win, theme_attrs(THEME_TEXT));
|
||||
|
||||
new_win->subwin = newpad(PAD_SIZE, subwin_cols);
|
||||
wbkgd(new_win->subwin, COLOUR_TEXT);
|
||||
wbkgd(new_win->subwin, theme_attrs(THEME_TEXT));
|
||||
} else {
|
||||
new_win->win = newpad(PAD_SIZE, (cols));
|
||||
wbkgd(new_win->win, COLOUR_TEXT);
|
||||
wbkgd(new_win->win, theme_attrs(THEME_TEXT));
|
||||
|
||||
new_win->subwin = NULL;
|
||||
}
|
||||
@ -136,7 +136,7 @@ win_show_subwin(ProfWin *window)
|
||||
}
|
||||
|
||||
window->subwin = newpad(PAD_SIZE, subwin_cols);
|
||||
wbkgd(window->subwin, COLOUR_TEXT);
|
||||
wbkgd(window->subwin, theme_attrs(THEME_TEXT));
|
||||
|
||||
wresize(window->win, PAD_SIZE, cols - subwin_cols);
|
||||
win_redraw(window);
|
||||
@ -191,21 +191,21 @@ win_move_to_end(ProfWin *window)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
theme_item_t
|
||||
win_presence_colour(const char * const presence)
|
||||
{
|
||||
if (g_strcmp0(presence, "online") == 0) {
|
||||
return COLOUR_ONLINE;
|
||||
return THEME_ONLINE;
|
||||
} else if (g_strcmp0(presence, "away") == 0) {
|
||||
return COLOUR_AWAY;
|
||||
return THEME_AWAY;
|
||||
} else if (g_strcmp0(presence, "chat") == 0) {
|
||||
return COLOUR_CHAT;
|
||||
return THEME_CHAT;
|
||||
} else if (g_strcmp0(presence, "dnd") == 0) {
|
||||
return COLOUR_DND;
|
||||
return THEME_DND;
|
||||
} else if (g_strcmp0(presence, "xa") == 0) {
|
||||
return COLOUR_XA;
|
||||
return THEME_XA;
|
||||
} else {
|
||||
return COLOUR_OFFLINE;
|
||||
return THEME_OFFLINE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ win_show_occupant(ProfWin *window, Occupant *occupant)
|
||||
{
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
|
||||
int presence_colour = win_presence_colour(presence_str);
|
||||
theme_item_t presence_colour = win_presence_colour(presence_str);
|
||||
|
||||
win_save_print(window, '-', NULL, NO_EOL, presence_colour, "", occupant->nick);
|
||||
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str);
|
||||
@ -235,7 +235,7 @@ win_show_contact(ProfWin *window, PContact contact)
|
||||
const char *status = p_contact_status(contact);
|
||||
GDateTime *last_activity = p_contact_last_activity(contact);
|
||||
|
||||
int presence_colour = win_presence_colour(presence);
|
||||
theme_item_t presence_colour = win_presence_colour(presence);
|
||||
|
||||
if (name != NULL) {
|
||||
win_save_print(window, '-', NULL, NO_EOL, presence_colour, "", name);
|
||||
@ -277,7 +277,7 @@ win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occup
|
||||
const char *occupant_affiliation = muc_occupant_affiliation_str(occupant);
|
||||
const char *occupant_role = muc_occupant_role_str(occupant);
|
||||
|
||||
int presence_colour = win_presence_colour(presence_str);
|
||||
theme_item_t presence_colour = win_presence_colour(presence_str);
|
||||
|
||||
win_save_print(window, '!', NULL, NO_EOL, presence_colour, "", occupant->nick);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str);
|
||||
@ -355,7 +355,7 @@ win_show_info(ProfWin *window, PContact contact)
|
||||
GList *ordered_resources = NULL;
|
||||
GDateTime *last_activity = p_contact_last_activity(contact);
|
||||
|
||||
int presence_colour = win_presence_colour(presence);
|
||||
theme_item_t presence_colour = win_presence_colour(presence);
|
||||
|
||||
win_save_print(window, '-', NULL, 0, 0, "", "");
|
||||
win_save_print(window, '-', NULL, NO_EOL, presence_colour, "", barejid);
|
||||
@ -466,14 +466,14 @@ win_show_status_string(ProfWin *window, const char * const from,
|
||||
GDateTime *last_activity, const char * const pre,
|
||||
const char * const default_show)
|
||||
{
|
||||
int presence_colour;
|
||||
theme_item_t presence_colour;
|
||||
|
||||
if (show != NULL) {
|
||||
presence_colour = win_presence_colour(show);
|
||||
} else if (strcmp(default_show, "online") == 0) {
|
||||
presence_colour = COLOUR_ONLINE;
|
||||
presence_colour = THEME_ONLINE;
|
||||
} else {
|
||||
presence_colour = COLOUR_OFFLINE;
|
||||
presence_colour = THEME_OFFLINE;
|
||||
}
|
||||
|
||||
|
||||
@ -518,7 +518,7 @@ win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
|
||||
{
|
||||
case WIN_CHAT:
|
||||
case WIN_PRIVATE:
|
||||
win_save_print(window, '-', tv_stamp, NO_ME, COLOUR_TEXT_THEM, from, message);
|
||||
win_save_print(window, '-', tv_stamp, NO_ME, THEME_TEXT_THEM, from, message);
|
||||
break;
|
||||
default:
|
||||
assert(FALSE);
|
||||
@ -528,19 +528,19 @@ win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
|
||||
|
||||
void
|
||||
win_save_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp,
|
||||
int flags, int attrs, const char * const from, const char * const message, ...)
|
||||
int flags, theme_item_t theme_item, const char * const from, const char * const message, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, message);
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
win_save_print(window, show_char, tstamp, flags, attrs, from, fmt_msg->str);
|
||||
win_save_print(window, show_char, tstamp, flags, theme_item, from, fmt_msg->str);
|
||||
g_string_free(fmt_msg, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
win_save_print(ProfWin *window, const char show_char, GTimeVal *tstamp,
|
||||
int flags, int attrs, const char * const from, const char * const message)
|
||||
int flags, theme_item_t theme_item, const char * const from, const char * const message)
|
||||
{
|
||||
GDateTime *time;
|
||||
|
||||
@ -550,8 +550,8 @@ win_save_print(ProfWin *window, const char show_char, GTimeVal *tstamp,
|
||||
time = g_date_time_new_from_timeval_utc(tstamp);
|
||||
}
|
||||
|
||||
buffer_push(window->buffer, show_char, time, flags, attrs, from, message);
|
||||
_win_print(window, show_char, time, flags, attrs, from, message);
|
||||
buffer_push(window->buffer, show_char, time, flags, theme_item, from, message);
|
||||
_win_print(window, show_char, time, flags, theme_item, from, message);
|
||||
}
|
||||
|
||||
void
|
||||
@ -568,7 +568,7 @@ win_save_newline(ProfWin *window)
|
||||
|
||||
static void
|
||||
_win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
int flags, int attrs, const char * const from, const char * const message)
|
||||
int flags, theme_item_t theme_item, const char * const from, const char * const message)
|
||||
{
|
||||
// flags : 1st bit = 0/1 - me/not me
|
||||
// 2nd bit = 0/1 - date/no date
|
||||
@ -577,7 +577,7 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
// 5th bit = 0/1 - color date/no date
|
||||
int unattr_me = 0;
|
||||
int offset = 0;
|
||||
int colour = COLOUR_ME;
|
||||
int colour = theme_attrs(THEME_ME);
|
||||
|
||||
if ((flags & NO_DATE) == 0) {
|
||||
gchar *date_fmt = NULL;
|
||||
@ -591,11 +591,11 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
|
||||
if (date_fmt) {
|
||||
if ((flags & NO_COLOUR_DATE) == 0) {
|
||||
wattron(window->win, COLOUR_TIME);
|
||||
wattron(window->win, theme_attrs(THEME_TIME));
|
||||
}
|
||||
wprintw(window->win, "%s %c ", date_fmt, show_char);
|
||||
if ((flags & NO_COLOUR_DATE) == 0) {
|
||||
wattroff(window->win, COLOUR_TIME);
|
||||
wattroff(window->win, theme_attrs(THEME_TIME));
|
||||
}
|
||||
}
|
||||
g_free(date_fmt);
|
||||
@ -603,7 +603,7 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
|
||||
if (strlen(from) > 0) {
|
||||
if (flags & NO_ME) {
|
||||
colour = COLOUR_THEM;
|
||||
colour = theme_attrs(THEME_THEM);
|
||||
}
|
||||
|
||||
if (flags & NO_COLOUR_FROM) {
|
||||
@ -621,7 +621,7 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
}
|
||||
}
|
||||
|
||||
wattron(window->win, attrs);
|
||||
wattron(window->win, theme_attrs(theme_item));
|
||||
|
||||
if (prefs_get_boolean(PREF_WRAP)) {
|
||||
_win_print_wrapped(window->win, message+offset);
|
||||
@ -633,7 +633,7 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
|
||||
wprintw(window->win, "\n");
|
||||
}
|
||||
|
||||
wattroff(window->win, attrs);
|
||||
wattroff(window->win, theme_attrs(theme_item));
|
||||
|
||||
if (unattr_me) {
|
||||
wattroff(window->win, colour);
|
||||
@ -718,7 +718,7 @@ win_redraw(ProfWin *window)
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
ProfBuffEntry *e = buffer_yield_entry(window->buffer, i);
|
||||
_win_print(window, e->show_char, e->time, e->flags, e->attrs, e->from, e->message);
|
||||
_win_print(window, e->show_char, e->time, e->flags, e->theme_item, e->from, e->message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ ProfWin* win_create(const char * const title, win_type_t type);
|
||||
void win_free(ProfWin *window);
|
||||
void win_update_virtual(ProfWin *window);
|
||||
void win_move_to_end(ProfWin *window);
|
||||
int win_presence_colour(const char * const presence);
|
||||
theme_item_t win_presence_colour(const char * const presence);
|
||||
void win_show_contact(ProfWin *window, PContact contact);
|
||||
void win_show_occupant(ProfWin *window, Occupant *occupant);
|
||||
void win_show_status_string(ProfWin *window, const char * const from,
|
||||
@ -97,8 +97,8 @@ void win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
|
||||
const char * const from, const char * const message);
|
||||
void win_show_info(ProfWin *window, PContact contact);
|
||||
void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant);
|
||||
void win_save_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, int attrs, const char * const from, const char * const message, ...);
|
||||
void win_save_print(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, int attrs, const char * const from, const char * const message);
|
||||
void win_save_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...);
|
||||
void win_save_print(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message);
|
||||
void win_save_println(ProfWin *window, const char * const message);
|
||||
void win_save_newline(ProfWin *window);
|
||||
void win_redraw(ProfWin *window);
|
||||
|
@ -438,7 +438,7 @@ wins_lost_connection(void)
|
||||
while (curr != NULL) {
|
||||
ProfWin *window = curr->data;
|
||||
if (window->type != WIN_CONSOLE) {
|
||||
win_save_print(window, '-', NULL, 0, COLOUR_ERROR, "", "Lost connection.");
|
||||
win_save_print(window, '-', NULL, 0, THEME_ERROR, "", "Lost connection.");
|
||||
|
||||
// if current win, set current_win_dirty
|
||||
if (wins_is_current(window)) {
|
||||
|
Loading…
Reference in New Issue
Block a user