summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-05 22:53:34 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-05 23:22:09 +0200
commitd7b0b447b7e254d4af37f09acfa258956d24a7e0 (patch)
tree134f30af2bacc49239a7397574a2d1ea7871aa9c
parent25ad5ae0ec8afe0a8f60d7602ca2357f561246d6 (diff)
downloadxK-d7b0b447b7e254d4af37f09acfa258956d24a7e0.tar.gz
xK-d7b0b447b7e254d4af37f09acfa258956d24a7e0.tar.xz
xK-d7b0b447b7e254d4af37f09acfa258956d24a7e0.zip
xC/xP: turn the action asterisk into a rendition
-rw-r--r--xC-proto1
-rw-r--r--xC.c18
-rw-r--r--xP/public/xP.css3
-rw-r--r--xP/public/xP.js11
4 files changed, 20 insertions, 13 deletions
diff --git a/xC-proto b/xC-proto
index 31534d4..526cd0f 100644
--- a/xC-proto
+++ b/xC-proto
@@ -69,6 +69,7 @@ struct EventMessage {
ERROR,
JOIN,
PART,
+ ACTION,
} rendition;
// Unix timestamp in seconds.
u64 when;
diff --git a/xC.c b/xC.c
index 6f0a7ae..082b9fe 100644
--- a/xC.c
+++ b/xC.c
@@ -1536,6 +1536,7 @@ enum buffer_line_rendition
BUFFER_LINE_ERROR, ///< Error message
BUFFER_LINE_JOIN, ///< Join arrow
BUFFER_LINE_PART, ///< Part arrow
+ BUFFER_LINE_ACTION, ///< Highlighted asterisk
};
struct buffer_line
@@ -4475,9 +4476,10 @@ buffer_line_flush (struct buffer_line *line, struct formatter *f, FILE *output,
case BUFFER_LINE_BARE: break;
case BUFFER_LINE_INDENT: formatter_add (f, " "); break;
case BUFFER_LINE_STATUS: formatter_add (f, " - "); break;
- case BUFFER_LINE_ERROR: formatter_add (f, "#a=!=#r ", ATTR_ERROR); break;
- case BUFFER_LINE_JOIN: formatter_add (f, "#a-->#r ", ATTR_JOIN); break;
- case BUFFER_LINE_PART: formatter_add (f, "#a<--#r ", ATTR_PART); break;
+ case BUFFER_LINE_ERROR: formatter_add (f, "#a=!=#r ", ATTR_ERROR); break;
+ case BUFFER_LINE_JOIN: formatter_add (f, "#a-->#r ", ATTR_JOIN); break;
+ case BUFFER_LINE_PART: formatter_add (f, "#a<--#r ", ATTR_PART); break;
+ case BUFFER_LINE_ACTION: formatter_add (f, " #a*#r ", ATTR_ACTION); break;
}
for (struct formatter_item *iter = line->items; iter->type; iter++)
@@ -4694,16 +4696,16 @@ log_full (struct app_context *ctx, struct server *s, struct buffer *buffer,
#define log_outcoming_privmsg(s, buffer, prefixes, who, text) \
log_server ((s), (buffer), 0, 0, "<#s#n> #m", (prefixes), (who), (text))
#define log_outcoming_action(s, buffer, who, text) \
- log_server ((s), (buffer), 0, 0, " #a*#r #n #m", \
- ATTR_ACTION, (who), (text))
+ log_server ((s), (buffer), 0, BUFFER_LINE_ACTION, "#n #m", (who), (text))
#define log_outcoming_orphan_notice(s, target, text) \
log_server_status ((s), (s)->buffer, "Notice -> #n: #m", (target), (text))
#define log_outcoming_orphan_privmsg(s, target, text) \
- log_server_status ((s), (s)->buffer, "MSG(#n): #m", (target), (text))
+ log_server ((s), (s)->buffer, 0, BUFFER_LINE_STATUS, \
+ "MSG(#n): #m", (target), (text))
#define log_outcoming_orphan_action(s, target, text) \
- log_server_status ((s), (s)->buffer, "MSG(#n): #a*#r #m", (target), \
- ATTR_ACTION, (text))
+ log_server ((s), (s)->buffer, 0, BUFFER_LINE_ACTION, \
+ "MSG(#n): #m", (target), (text))
#define log_ctcp_query(s, target, tag) \
log_server_status ((s), (s)->buffer, "CTCP query to #S: #S", target, tag)
diff --git a/xP/public/xP.css b/xP/public/xP.css
index 9a98c13..3aaff10 100644
--- a/xP/public/xP.css
+++ b/xP/public/xP.css
@@ -79,6 +79,9 @@ body {
.mark.part {
color: red;
}
+.mark.action {
+ color: darkred;
+}
.content {
padding: .1rem .3rem;
white-space: pre-wrap;
diff --git a/xP/public/xP.js b/xP/public/xP.js
index 7517ef8..13507d6 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -120,11 +120,12 @@ let Content = {
let line = vnode.children[0]
let content = []
switch (line.rendition) {
- case 'Indent': content.push(m('span.mark', {}, '')); break
- case 'Status': content.push(m('span.mark', {}, '–')); break
- case 'Error': content.push(m('span.mark.error', {}, '⚠')); break
- case 'Join': content.push(m('span.mark.join', {}, '→')); break
- case 'Part': content.push(m('span.mark.part', {}, '←')); break
+ case 'Indent': content.push(m('span.mark', {}, '')); break
+ case 'Status': content.push(m('span.mark', {}, '–')); break
+ case 'Error': content.push(m('span.mark.error', {}, '⚠')); break
+ case 'Join': content.push(m('span.mark.join', {}, '→')); break
+ case 'Part': content.push(m('span.mark.part', {}, '←')); break
+ case 'Action': content.push(m('span.mark.action', {}, '✶')); break
}
let classes = new Set()