mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
XEP-0392: theme, ui: conditionally colorize user nicks
* add theme_hash_attrs() * when printing a user message check PREF_COLOR_NICK to decide whether to colorize it or not ideally we should hash the jid instead of the nick but this is already a first step.
This commit is contained in:
parent
4a672bda22
commit
7a0a578a8a
@ -670,6 +670,12 @@ theme_free_string(char *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
theme_hash_attrs(const char *str)
|
||||||
|
{
|
||||||
|
return COLOR_PAIR(color_pair_cache_hash_str(str));
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
theme_attrs(theme_item_t attrs)
|
theme_attrs(theme_item_t attrs)
|
||||||
{
|
{
|
||||||
|
@ -147,6 +147,7 @@ gboolean theme_load(const char *const theme_name);
|
|||||||
gboolean theme_exists(const char *const theme_name);
|
gboolean theme_exists(const char *const theme_name);
|
||||||
GSList* theme_list(void);
|
GSList* theme_list(void);
|
||||||
void theme_close(void);
|
void theme_close(void);
|
||||||
|
int theme_hash_attrs(const char *str);
|
||||||
int theme_attrs(theme_item_t attrs);
|
int theme_attrs(theme_item_t attrs);
|
||||||
char* theme_get_string(char *str);
|
char* theme_get_string(char *str);
|
||||||
void theme_free_string(char *str);
|
void theme_free_string(char *str);
|
||||||
|
@ -1453,6 +1453,10 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
|
|||||||
colour = theme_attrs(THEME_THEM);
|
colour = theme_attrs(THEME_THEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prefs_get_boolean(PREF_COLOR_NICK)) {
|
||||||
|
colour = theme_hash_attrs(from);
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & NO_COLOUR_FROM) {
|
if (flags & NO_COLOUR_FROM) {
|
||||||
colour = 0;
|
colour = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user