~taiite/senpai

b7f3fa18f954b0ad65de5b234b45097e18d881d2 — delthas 2 months ago b813210
Merge MODE messages

Also, fix an issue where mode strings only displayed the first
parameter.
2 files changed, 6 insertions(+), 4 deletions(-)

M app.go
M irc/session.go
M app.go => app.go +2 -1
@@ 1009,12 1009,13 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
			Body:      ui.Styled(body, tcell.StyleDefault.Foreground(tcell.ColorGray)),
		}
	case irc.ModeChangeEvent:
		body := fmt.Sprintf("Mode change: %s", ev.Mode)
		body := fmt.Sprintf("[%s]", ev.Mode)
		return ui.Line{
			At:        ev.Time,
			Head:      "--",
			HeadColor: tcell.ColorGray,
			Body:      ui.Styled(body, tcell.StyleDefault.Foreground(tcell.ColorGray)),
			Mergeable: true,
		}
	default:
		return ui.Line{}

M irc/session.go => irc/session.go +4 -3
@@ 927,10 927,11 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
			}, nil
		}
	case "MODE":
		var channel, mode string
		if err := msg.ParseParams(&channel, &mode); err != nil {
		var channel string
		if err := msg.ParseParams(&channel, nil); err != nil {
			return nil, err
		}
		mode := strings.Join(msg.Params[1:], " ")

		if playback {
			return ModeChangeEvent{


@@ 943,7 944,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
		channelCf := s.Casemap(channel)

		if c, ok := s.channels[channelCf]; ok {
			modeChanges, err := ParseChannelMode(mode, msg.Params[2:], s.chanmodes, s.prefixModes)
			modeChanges, err := ParseChannelMode(msg.Params[1], msg.Params[2:], s.chanmodes, s.prefixModes)
			if err != nil {
				return nil, err
			}