> On Jul 13, 2021, at 17:30, Klemens Nanni <klemens@posteo.de> wrote:
>
> Silencing all windows with `M-+' (across multiple catgirl instances)
> can be cumbersome, so provide an option to hide events, JOIN/PART noise,
> etc. by default (each window's threshold will persist across load/save
> cycles, i.e. when using the `-s/save' option).
I think this needs some special cases: raising the threshold on
<network> hides too much, I think (though maybe those messages
should be bumped to Warm), and setting it on <debug> makes it not
work at all. I’m also not sure it should be set on query windows,
where the only Cold message that might show up is a quit, which imo
you want to see.
It’s also rather strange to join a channel and not see your own
join, but that’s something to fix separately.
Otherwise I think this is good. (I suggested doing the flag like
this rather than the previous -V patch, for those observing.)
On Thu, Jul 15, 2021 at 03:45:07PM -0400, june wrote:
> > On Jul 13, 2021, at 17:30, Klemens Nanni <klemens@posteo.de> wrote:
> >
> > Silencing all windows with `M-+' (across multiple catgirl instances)
> > can be cumbersome, so provide an option to hide events, JOIN/PART noise,
> > etc. by default (each window's threshold will persist across load/save
> > cycles, i.e. when using the `-s/save' option).
>
> I think this needs some special cases: raising the threshold on
> <network> hides too much, I think (though maybe those messages
> should be bumped to Warm), and setting it on <debug> makes it not
> work at all. I’m also not sure it should be set on query windows,
> where the only Cold message that might show up is a quit, which imo
> you want to see.
<debug> was an oversight on my side, thanks. Note however that <debug>
set to ++ still hides everything: I think this should be handled
separately such that debug always logs regardless of the threshold
(simply setting it to Hot does not seem feasibly as it rings the bell
every time, just like a highlight).
For queries the noise is much less by default anyway, so whether or not
quit/leaves appear make no big difference to me.
Would you only disregard query windows for `-q/quiet' and still filter
quits on manual `M-+' or always show them unconditionally?
> It’s also rather strange to join a channel and not see your own
> join, but that’s something to fix separately.
Doesn't bother me, personally. Afterall it is a normal JOIN like any
other and the fact that one just joined a channel is noticable anyway.
> Otherwise I think this is good. (I suggested doing the flag like
> this rather than the previous -V patch, for those observing.)
Oops, wanted to mention that in the commit message and then forgot...
New diff with debug fixed and proper message; I also omitted the hunk
mentioned in your other mail.
-- >8 --
Silencing all windows with `M-+' (across multiple catgirl instances)
can be cumbersome, so provide an option to hide events, JOIN/PART noise,
etc. by default (each window's threshold will persist across load/save
cycles, i.e. when using the `-s/save' option).
Started out as `-v | visibility = threshold' to set a specific level,
the idea of a simpler toggle comes from june, who also squashed other
bugs (as usual).
---
catgirl.1 | 8 +++++++-
chat.c | 2 ++
chat.h | 1 +
irc.c | 2 +-
ui.c | 4 +++-
5 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/catgirl.1 b/catgirl.1
index b8c42c2..779d74a 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -8,7 +8,7 @@
.
.Sh SYNOPSIS
.Nm
-.Op Fl KRelv
+.Op Fl KRelqv
.Op Fl C Ar copy
.Op Fl H Ar hash
.Op Fl I Ar highlight
@@ -323,6 +323,12 @@ Connect to
.Ar port .
The default port is 6697.
.
+.It Fl q | Cm quiet
+Raise the default message visibility threshold for new windows,
+hiding ignored messages,
+general events,
+or non-highlighted messages.
+.
.It Fl r Ar real | Cm real No = Ar real
Set realname to
.Ar real .
diff --git a/chat.c b/chat.c
index 106e05f..3141052 100644
--- a/chat.c
+++ b/chat.c
@@ -257,6 +257,7 @@ int main(int argc, char *argv[]) {
{ .val = 'n', .name = "nick", required_argument },
{ .val = 'o', .name = "print-chain", no_argument },
{ .val = 'p', .name = "port", required_argument },
+ { .val = 'q', .name = "quiet", no_argument },
{ .val = 'r', .name = "real", required_argument },
{ .val = 's', .name = "save", required_argument },
{ .val = 't', .name = "trust", required_argument },
@@ -300,6 +301,7 @@ int main(int argc, char *argv[]) {
break; case 'n': nick = optarg;
break; case 'o': printCert = true;
break; case 'p': port = optarg;
+ break; case 'q': uiThreshold = Warm;
break; case 'r': real = optarg;
break; case 's': save = optarg;
break; case 't': trust = optarg;
diff --git a/chat.h b/chat.h
index c247dd7..dd9c823 100644
--- a/chat.h
+++ b/chat.h
@@ -292,6 +292,7 @@ void commandCompleteAdd(void);
enum Heat { Ice, Cold, Warm, Hot };
enum { TimeCap = 64 };
+extern enum Heat uiThreshold;
extern struct Time {
bool enable;
const char *format;
diff --git a/irc.c b/irc.c
index e1e5bf9..3dc701e 100644
--- a/irc.c
+++ b/irc.c
@@ -189,7 +189,7 @@ static void debug(const char *pre, const char *line) {
if (!self.debug) return;
size_t len = strcspn(line, "\r\n");
uiFormat(
- Debug, Cold, NULL, "\3%02d%s\3\t%.*s",
+ Debug, uiThreshold, NULL, "\3%02d%s\3\t%.*s",
Gray, pre, (int)len, line
);
if (!isatty(STDERR_FILENO)) {
diff --git a/ui.c b/ui.c
index da06342..3604057 100644
--- a/ui.c
+++ b/ui.c
@@ -127,6 +127,8 @@ static struct Window *windowRemove(uint num) {
return window;
}
+enum Heat uiThreshold = Cold;
+
static uint windowFor(uint id) {
for (uint num = 0; num < windows.len; ++num) {
if (windows.ptrs[num]->id == id) return num;
@@ -136,7 +138,7 @@ static uint windowFor(uint id) {
window->id = id;
window->mark = true;
window->time = uiTime.enable;
- window->thresh = Cold;
+ window->thresh = uiThreshold;
window->buffer = bufferAlloc();
completeAdd(None, idNames[id], idColors[id]);
return windowPush(window);
--
2.32.0
> On Jul 17, 2021, at 16:04, Klemens Nanni <klemens@posteo.de> wrote:
>
> <debug> was an oversight on my side, thanks. Note however that <debug>
> set to ++ still hides everything: I think this should be handled
> separately such that debug always logs regardless of the threshold
> (simply setting it to Hot does not seem feasibly as it rings the bell
> every time, just like a highlight).
Applied, but I left out the change to debug messages, since making
them Warm causes <debug> to constantly appear in the status line.
I added a change on top which hardcodes the <network> and <debug>
windows default threshold to Cold, as they used to be, which seems
reasonable since they’re not really “new windows” or affected by
join/quit spam.
> For queries the noise is much less by default anyway, so whether or not
> quit/leaves appear make no big difference to me.
>
> Would you only disregard query windows for `-q/quiet' and still filter
> quits on manual `M-+' or always show them unconditionally?
True. I think it’s fine to leave it as is, since you can always M--
query windows if you’re worried about quits, and otherwise you’ll
just get an error next time you try to send a message to a nonexistent
user.
>> It’s also rather strange to join a channel and not see your own
>> join, but that’s something to fix separately.
>
> Doesn't bother me, personally. Afterall it is a normal JOIN like any
> other and the fact that one just joined a channel is noticable anyway.
Fair.