Changeset 499 in code for trunk/user.go


Ignore:
Timestamp:
Apr 13, 2021, 5:11:05 PM (4 years ago)
Author:
contact
Message:

Relay detached channel backlog as BouncerServ NOTICE if necessary

Instead of ignoring detached channels wehn replaying backlog,
process them as usual and relay messages as BouncerServ NOTICEs
if necessary. Advance the delivery receipts as if the channel was
attached.

Closes: https://todo.sr.ht/~emersion/soju/98

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user.go

    r497 r499  
    352352}
    353353
     354func (net *network) isHighlight(msg *irc.Message) bool {
     355        if msg.Command != "PRIVMSG" && msg.Command != "NOTICE" {
     356                return false
     357        }
     358
     359        text := msg.Params[1]
     360
     361        nick := net.Nick
     362        if net.conn != nil {
     363                nick = net.conn.nick
     364        }
     365
     366        // TODO: use case-mapping aware comparison here
     367        return msg.Prefix.Name != nick && isHighlight(text, nick)
     368}
     369
     370func (net *network) detachedMessageNeedsRelay(ch *Channel, msg *irc.Message) bool {
     371        highlight := net.isHighlight(msg)
     372        return ch.RelayDetached == FilterMessage || ((ch.RelayDetached == FilterHighlight || ch.RelayDetached == FilterDefault) && highlight)
     373}
     374
    354375type user struct {
    355376        User
Note: See TracChangeset for help on using the changeset viewer.