mirror of
https://github.com/profanity-im/profanity.git
synced 2025-07-26 12:14:28 -04:00
Added roommention.term theme option
This commit is contained in:
parent
71679a3159
commit
2f82f50a35
@ -107,6 +107,7 @@ theme_init(const char *const theme_name)
|
|||||||
g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red"));
|
g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red"));
|
||||||
g_hash_table_insert(defaults, strdup("roominfo"), strdup("yellow"));
|
g_hash_table_insert(defaults, strdup("roominfo"), strdup("yellow"));
|
||||||
g_hash_table_insert(defaults, strdup("roommention"), strdup("yellow"));
|
g_hash_table_insert(defaults, strdup("roommention"), strdup("yellow"));
|
||||||
|
g_hash_table_insert(defaults, strdup("roommention.term"), strdup("yellow"));
|
||||||
g_hash_table_insert(defaults, strdup("roomtrigger"), strdup("yellow"));
|
g_hash_table_insert(defaults, strdup("roomtrigger"), strdup("yellow"));
|
||||||
g_hash_table_insert(defaults, strdup("online"), strdup("green"));
|
g_hash_table_insert(defaults, strdup("online"), strdup("green"));
|
||||||
g_hash_table_insert(defaults, strdup("offline"), strdup("red"));
|
g_hash_table_insert(defaults, strdup("offline"), strdup("red"));
|
||||||
@ -751,6 +752,7 @@ theme_attrs(theme_item_t attrs)
|
|||||||
case THEME_RECEIPT_SENT: _theme_prep_fgnd("receipt.sent", lookup_str, &bold); break;
|
case THEME_RECEIPT_SENT: _theme_prep_fgnd("receipt.sent", lookup_str, &bold); break;
|
||||||
case THEME_ROOMINFO: _theme_prep_fgnd("roominfo", lookup_str, &bold); break;
|
case THEME_ROOMINFO: _theme_prep_fgnd("roominfo", lookup_str, &bold); break;
|
||||||
case THEME_ROOMMENTION: _theme_prep_fgnd("roommention", lookup_str, &bold); break;
|
case THEME_ROOMMENTION: _theme_prep_fgnd("roommention", lookup_str, &bold); break;
|
||||||
|
case THEME_ROOMMENTION_TERM: _theme_prep_fgnd("roommention.term", lookup_str, &bold); break;
|
||||||
case THEME_ROOMTRIGGER: _theme_prep_fgnd("roomtrigger", lookup_str, &bold); break;
|
case THEME_ROOMTRIGGER: _theme_prep_fgnd("roomtrigger", lookup_str, &bold); break;
|
||||||
case THEME_ONLINE: _theme_prep_fgnd("online", lookup_str, &bold); break;
|
case THEME_ONLINE: _theme_prep_fgnd("online", lookup_str, &bold); break;
|
||||||
case THEME_OFFLINE: _theme_prep_fgnd("offline", lookup_str, &bold); break;
|
case THEME_OFFLINE: _theme_prep_fgnd("offline", lookup_str, &bold); break;
|
||||||
|
@ -70,6 +70,7 @@ typedef enum {
|
|||||||
THEME_THEM,
|
THEME_THEM,
|
||||||
THEME_ROOMINFO,
|
THEME_ROOMINFO,
|
||||||
THEME_ROOMMENTION,
|
THEME_ROOMMENTION,
|
||||||
|
THEME_ROOMMENTION_TERM,
|
||||||
THEME_ROOMTRIGGER,
|
THEME_ROOMTRIGGER,
|
||||||
THEME_ONLINE,
|
THEME_ONLINE,
|
||||||
THEME_OFFLINE,
|
THEME_OFFLINE,
|
||||||
|
@ -2215,6 +2215,7 @@ cons_theme_properties(void)
|
|||||||
|
|
||||||
_cons_theme_prop(THEME_ROOMINFO, "roominfo");
|
_cons_theme_prop(THEME_ROOMINFO, "roominfo");
|
||||||
_cons_theme_prop(THEME_ROOMMENTION, "roommention");
|
_cons_theme_prop(THEME_ROOMMENTION, "roommention");
|
||||||
|
_cons_theme_prop(THEME_ROOMMENTION_TERM, "roommention.term");
|
||||||
_cons_theme_prop(THEME_ROOMTRIGGER, "roomtrigger");
|
_cons_theme_prop(THEME_ROOMTRIGGER, "roomtrigger");
|
||||||
|
|
||||||
_cons_theme_prop(THEME_ROSTER_HEADER, "roster.header");
|
_cons_theme_prop(THEME_ROSTER_HEADER, "roster.header");
|
||||||
|
@ -355,6 +355,36 @@ mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp,
|
|||||||
g_string_free(line, TRUE);
|
g_string_free(line, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mucwin_print_mention(ProfWin *window, const char *const message, const char *const my_nick)
|
||||||
|
{
|
||||||
|
char *mynick_lower = g_utf8_strdown(my_nick, -1);
|
||||||
|
char *message_lower = g_utf8_strdown(message, -1);
|
||||||
|
char message_section[strlen(message) + 1];
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while(!g_str_has_prefix(&message_lower[i], mynick_lower) && i < strlen(message)) {
|
||||||
|
message_section[i] = message[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
message_section[i] = '\0';
|
||||||
|
|
||||||
|
char *mention_section = strndup(&message[i], strlen(my_nick));
|
||||||
|
int used = strlen(message_section) + strlen(mention_section);
|
||||||
|
|
||||||
|
win_print(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION, "", message_section);
|
||||||
|
if (strlen(message) > used) {
|
||||||
|
win_print(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION_TERM, "", mention_section);
|
||||||
|
_mucwin_print_mention(window, &message[used], my_nick);
|
||||||
|
} else {
|
||||||
|
win_print(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMMENTION_TERM, "", mention_section);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(mention_section);
|
||||||
|
g_free(mynick_lower);
|
||||||
|
g_free(message_lower);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, gboolean mention,
|
mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, gboolean mention,
|
||||||
gboolean trigger_found)
|
gboolean trigger_found)
|
||||||
@ -366,7 +396,8 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes
|
|||||||
|
|
||||||
if (g_strcmp0(nick, my_nick) != 0) {
|
if (g_strcmp0(nick, my_nick) != 0) {
|
||||||
if (mention) {
|
if (mention) {
|
||||||
win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMMENTION, nick, message);
|
win_print(window, '-', 0, NULL, NO_ME | NO_EOL, THEME_ROOMMENTION, nick, "");
|
||||||
|
_mucwin_print_mention(window, message, my_nick);
|
||||||
} else if (trigger_found) {
|
} else if (trigger_found) {
|
||||||
win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMTRIGGER, nick, message);
|
win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMTRIGGER, nick, message);
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,6 +45,7 @@ gone=
|
|||||||
error=
|
error=
|
||||||
roominfo=
|
roominfo=
|
||||||
roommention=
|
roommention=
|
||||||
|
roommention.term=
|
||||||
roomtrigger=
|
roomtrigger=
|
||||||
me=
|
me=
|
||||||
them=
|
them=
|
||||||
|
@ -45,6 +45,7 @@ gone=blue
|
|||||||
error=bold_white
|
error=bold_white
|
||||||
roominfo=white
|
roominfo=white
|
||||||
roommention=bold_blue
|
roommention=bold_blue
|
||||||
|
roommention.term=bold_blue
|
||||||
roomtrigger=bold_blue
|
roomtrigger=bold_blue
|
||||||
me=cyan
|
me=cyan
|
||||||
them=white
|
them=white
|
||||||
|
@ -47,6 +47,7 @@ main.text.them=white
|
|||||||
subscribed=magenta
|
subscribed=magenta
|
||||||
unsubscribed=black_bold
|
unsubscribed=black_bold
|
||||||
roommention=cyan
|
roommention=cyan
|
||||||
|
roommention.term=cyan
|
||||||
roomtrigger=cyan
|
roomtrigger=cyan
|
||||||
roster.header=yellow
|
roster.header=yellow
|
||||||
roster.chat=green
|
roster.chat=green
|
||||||
|
@ -45,6 +45,7 @@ gone=bold_red
|
|||||||
error=bold_red
|
error=bold_red
|
||||||
roominfo=bold_yellow
|
roominfo=bold_yellow
|
||||||
roommention=bold_green
|
roommention=bold_green
|
||||||
|
roommention.term=bold_green
|
||||||
roomtrigger=bold_green
|
roomtrigger=bold_green
|
||||||
me=bold_cyan
|
me=bold_cyan
|
||||||
them=bold_magenta
|
them=bold_magenta
|
||||||
|
@ -44,7 +44,8 @@ typing=yellow
|
|||||||
gone=red
|
gone=red
|
||||||
error=red
|
error=red
|
||||||
roominfo=yellow
|
roominfo=yellow
|
||||||
roommention=bold_cyan
|
roommention=bold_white
|
||||||
|
roommention.term=bold_cyan
|
||||||
roomtrigger=bold_blue
|
roomtrigger=bold_blue
|
||||||
me=blue
|
me=blue
|
||||||
them=bold_green
|
them=bold_green
|
||||||
|
@ -44,7 +44,8 @@ typing=yellow
|
|||||||
gone=red
|
gone=red
|
||||||
error=red
|
error=red
|
||||||
roominfo=yellow
|
roominfo=yellow
|
||||||
roommention=bold_cyan
|
roommention=bold_white
|
||||||
|
roommention.term=bold_cyan
|
||||||
roomtrigger=bold_blue
|
roomtrigger=bold_blue
|
||||||
me=blue
|
me=blue
|
||||||
them=bold_green
|
them=bold_green
|
||||||
|
@ -45,6 +45,7 @@ gone=bold_black
|
|||||||
error=bold_black
|
error=bold_black
|
||||||
roominfo=yellow
|
roominfo=yellow
|
||||||
roommention=bold_cyan
|
roommention=bold_cyan
|
||||||
|
roommention.term=bold_cyan
|
||||||
roomtrigger=bold_cyan
|
roomtrigger=bold_cyan
|
||||||
me=blue
|
me=blue
|
||||||
them=bold_blue
|
them=bold_blue
|
||||||
|
@ -45,6 +45,7 @@ gone=green
|
|||||||
error=bold_green
|
error=bold_green
|
||||||
roominfo=green
|
roominfo=green
|
||||||
roommention=bold_green
|
roommention=bold_green
|
||||||
|
roommention.term=bold_green
|
||||||
roomtrigger=bold_green
|
roomtrigger=bold_green
|
||||||
me=green
|
me=green
|
||||||
them=bold_green
|
them=bold_green
|
||||||
|
@ -45,6 +45,7 @@ gone=yellow
|
|||||||
error=red
|
error=red
|
||||||
roominfo=white
|
roominfo=white
|
||||||
roommention=bold_green
|
roommention=bold_green
|
||||||
|
roommention.term=bold_green
|
||||||
roomtrigger=bold_green
|
roomtrigger=bold_green
|
||||||
me=white
|
me=white
|
||||||
them=white
|
them=white
|
||||||
|
@ -45,6 +45,7 @@ gone=red
|
|||||||
error=red
|
error=red
|
||||||
roominfo=green
|
roominfo=green
|
||||||
roommention=green
|
roommention=green
|
||||||
|
roommention.term=green
|
||||||
roomtrigger=green
|
roomtrigger=green
|
||||||
me=magenta
|
me=magenta
|
||||||
them=green
|
them=green
|
||||||
|
@ -45,6 +45,7 @@ gone=white
|
|||||||
error=white
|
error=white
|
||||||
roominfo=white
|
roominfo=white
|
||||||
roommention=white
|
roommention=white
|
||||||
|
roommention.term=white
|
||||||
roomtrigger=white
|
roomtrigger=white
|
||||||
me=white
|
me=white
|
||||||
them=white
|
them=white
|
||||||
|
@ -45,6 +45,7 @@ gone=green
|
|||||||
error=red
|
error=red
|
||||||
roominfo=blue
|
roominfo=blue
|
||||||
roommention=blue
|
roommention=blue
|
||||||
|
roommention.term=blue
|
||||||
roomtrigger=blue
|
roomtrigger=blue
|
||||||
me=black
|
me=black
|
||||||
them=black
|
them=black
|
||||||
|
@ -45,6 +45,7 @@ gone=yellow
|
|||||||
error=red
|
error=red
|
||||||
roominfo=yellow
|
roominfo=yellow
|
||||||
roommention=yellow
|
roommention=yellow
|
||||||
|
roommention.term=yellow
|
||||||
roomtrigger=yellow
|
roomtrigger=yellow
|
||||||
me=yellow
|
me=yellow
|
||||||
them=green
|
them=green
|
||||||
|
@ -45,6 +45,7 @@ gone=bold_yellow
|
|||||||
error=bold_red
|
error=bold_red
|
||||||
roominfo=bold_yellow
|
roominfo=bold_yellow
|
||||||
roommention=bold_yellow
|
roommention=bold_yellow
|
||||||
|
roommention.term=bold_yellow
|
||||||
roomtrigger=bold_yellow
|
roomtrigger=bold_yellow
|
||||||
me=bold_yellow
|
me=bold_yellow
|
||||||
them=bold_green
|
them=bold_green
|
||||||
|
@ -45,6 +45,7 @@ gone=red
|
|||||||
error=red
|
error=red
|
||||||
roominfo=green
|
roominfo=green
|
||||||
roommention=green
|
roommention=green
|
||||||
|
roommention.term=green
|
||||||
roomtrigger=green
|
roomtrigger=green
|
||||||
me=bold_black
|
me=bold_black
|
||||||
them=magenta
|
them=magenta
|
||||||
|
@ -45,6 +45,7 @@ gone=red
|
|||||||
error=red
|
error=red
|
||||||
roominfo=green
|
roominfo=green
|
||||||
roommention=red
|
roommention=red
|
||||||
|
roommention.term=red
|
||||||
roomtrigger=red
|
roomtrigger=red
|
||||||
me=green
|
me=green
|
||||||
them=yellow
|
them=yellow
|
||||||
|
@ -45,6 +45,7 @@ gone=red
|
|||||||
error=red
|
error=red
|
||||||
roominfo=yellow
|
roominfo=yellow
|
||||||
roommention=yellow
|
roommention=yellow
|
||||||
|
roommention.term=yellow
|
||||||
roomtrigger=yellow
|
roomtrigger=yellow
|
||||||
me=black
|
me=black
|
||||||
them=black
|
them=black
|
||||||
|
Loading…
x
Reference in New Issue
Block a user