~taiite/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 2

[PATCH senpai v2] Add option to disable join/part/quit messages

Details
Message ID
<20211128003810.24113-1-amk@amk.ie>
DKIM signature
pass
Download raw message
Patch: +33 -2
---
Remove AddNonZeroLine and drop empty lines by default.

 app.go           | 15 +++++++++++++++
 config.go        | 14 ++++++++++++--
 doc/senpai.5.scd |  3 +++
 ui/ui.go         |  3 +++
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/app.go b/app.go
index f50f8bd..b25bc90 100644
--- a/app.go
+++ b/app.go
@@ -942,6 +942,9 @@ func (app *App) completions(cursorIdx int, text []rune) []ui.Completion {
func (app *App) formatEvent(ev irc.Event) ui.Line {
	switch ev := ev.(type) {
	case irc.UserNickEvent:
		if app.cfg.HideEvents {
			return ui.Line{}
		}
		var body ui.StyledStringBuilder
		body.WriteString(fmt.Sprintf("%s\u2192%s", ev.FormerNick, ev.User))
		textStyle := tcell.StyleDefault.Foreground(tcell.ColorGray)
@@ -958,6 +961,9 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
			Mergeable: true,
		}
	case irc.UserJoinEvent:
		if app.cfg.HideEvents {
			return ui.Line{}
		}
		var body ui.StyledStringBuilder
		body.Grow(len(ev.User) + 1)
		body.SetStyle(tcell.StyleDefault.Foreground(tcell.ColorGreen))
@@ -972,6 +978,9 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
			Mergeable: true,
		}
	case irc.UserPartEvent:
		if app.cfg.HideEvents {
			return ui.Line{}
		}
		var body ui.StyledStringBuilder
		body.Grow(len(ev.User) + 1)
		body.SetStyle(tcell.StyleDefault.Foreground(tcell.ColorRed))
@@ -986,6 +995,9 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
			Mergeable: true,
		}
	case irc.UserQuitEvent:
		if app.cfg.HideEvents {
			return ui.Line{}
		}
		var body ui.StyledStringBuilder
		body.Grow(len(ev.User) + 1)
		body.SetStyle(tcell.StyleDefault.Foreground(tcell.ColorRed))
@@ -1009,6 +1021,9 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
			Body:      ui.Styled(body, tcell.StyleDefault.Foreground(tcell.ColorGray)),
		}
	case irc.ModeChangeEvent:
		if app.cfg.HideEvents {
			return ui.Line{}
		}
		body := fmt.Sprintf("[%s]", ev.Mode)
		return ui.Line{
			At:        ev.Time,
diff --git a/config.go b/config.go
index d232cf4..a86e4b2 100644
--- a/config.go
+++ b/config.go
@@ -59,8 +59,9 @@ type Config struct {
	TLS      bool
	Channels []string

	Typings bool
	Mouse   bool
	Typings    bool
	Mouse      bool
	HideEvents bool

	Highlights      []string
	OnHighlightPath string
@@ -97,6 +98,7 @@ func Defaults() (cfg Config, err error) {
		NickColWidth:    16,
		ChanColWidth:    0,
		MemberColWidth:  0,
		HideEvents:      false,
		Colors: ConfigColors{
			Prompt: Color(tcell.ColorDefault),
		},
@@ -269,6 +271,14 @@ func unmarshal(filename string, cfg *Config) (err error) {
					return fmt.Errorf("unknown directive %q", child.Name)
				}
			}
		case "hide-events":
			var hideEvents string
			if err := d.ParseParams(&hideEvents); err != nil {
				return err
			}
			if cfg.HideEvents, err = strconv.ParseBool(hideEvents); err != nil {
				return err
			}
		case "debug":
			var debug string
			if err := d.ParseParams(&debug); err != nil {
diff --git a/doc/senpai.5.scd b/doc/senpai.5.scd
index 79b923a..e8b3dbb 100644
--- a/doc/senpai.5.scd
+++ b/doc/senpai.5.scd
@@ -131,6 +131,9 @@ pane-widths {
*mouse*
	Enable or disable mouse support.  Defaults to true.

*hide-events*
	Hide join/part/quit/nick/mode messages in channels. Defaults to false.

*colors* { ... }
	Settings for colors of different UI elements.

diff --git a/ui/ui.go b/ui/ui.go
index fe5ceef..0057002 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -187,6 +187,9 @@ func (ui *UI) RemoveBuffer(netID, title string) {
}

func (ui *UI) AddLine(netID, buffer string, notify NotifyType, line Line) {
	if line.IsZero() {
		return
	}
	ui.bs.AddLine(netID, buffer, notify, line)
}

-- 
2.34.1
Details
Message ID
<e52ac1cd-abba-5902-9c39-b1b317a162a8@hirtz.pm>
In-Reply-To
<20211128003810.24113-1-amk@amk.ie> (view parent)
DKIM signature
pass
Download raw message
Well I don't really know what to do with this.

delthas wanted join/parts/... to be shown even in history, thus sent a 
patch[0] to add support for event-playback[1].  If people actually don't 
want join/parts/... then I can revert the patch?

[0] https://lists.sr.ht/~taiite/public-inbox/patches/26813
[1] https://ircv3.net/specs/extensions/chathistory
Details
Message ID
<38c9c02e6b555a5c2c2b8b825cee3253@dille.cc>
In-Reply-To
<e52ac1cd-abba-5902-9c39-b1b317a162a8@hirtz.pm> (view parent)
DKIM signature
pass
Download raw message
> Well I don't really know what to do with this.
This is orthogonal to event-playback. Some people use IRC for technical 
support rather than chatting with friends, and for them user event 
traffic isn't really needed.

So to me we should just merge this as is. And keep event-playback.
Details
Message ID
<afee8544-4ebf-0b16-5d46-824281f86dac@hirtz.pm>
In-Reply-To
<38c9c02e6b555a5c2c2b8b825cee3253@dille.cc> (view parent)
DKIM signature
pass
Download raw message
On 29/11/2021 15:43, delthas wrote:
>> Well I don't really know what to do with this.
> This is orthogonal to event-playback. Some people use IRC for technical 
> support rather than chatting with friends, and for them user event 
> traffic isn't really needed.

1/ senpai and its purposely lightweight UI is not the kind of client 
you'd use for technical support or as a chanop, rather one like irssi or 
weechat is better suited.

2/ this is the kind of setting you'd want to have per-channel, which is 
not something I would like to have to maintain.  Again, other clients do 
that perfectly, no need for senpai here.

I agree the amount of join/part/modes is too much now that we negotiate 
event-playback, this is why #56 is opened.
Details
Message ID
<9a9e3d4c7543a8ecdfb12c33cd85a417@dille.cc>
In-Reply-To
<afee8544-4ebf-0b16-5d46-824281f86dac@hirtz.pm> (view parent)
DKIM signature
pass
Download raw message
Alex: what is the use case for this option? Is it because of the new 
join/part events in the channel history?
Reply to thread Export thread (mbox)