Changeset 636 in code for trunk/downstream.go


Ignore:
Timestamp:
Oct 13, 2021, 8:58:34 AM (4 years ago)
Author:
contact
Message:

Add bouncer MOTD

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r629 r636  
    11201120                dc.SendMessage(msg)
    11211121        }
    1122         motdHint := "No MOTD"
    11231122        if uc := dc.upstream(); uc != nil {
    1124                 motdHint = "Use /motd to read the message of the day"
    11251123                dc.SendMessage(&irc.Message{
    11261124                        Prefix:  dc.srv.prefix(),
     
    11291127                })
    11301128        }
    1131         dc.SendMessage(&irc.Message{
    1132                 Prefix:  dc.srv.prefix(),
    1133                 Command: irc.ERR_NOMOTD,
    1134                 Params:  []string{dc.nick, motdHint},
    1135         })
     1129
     1130        if motd := dc.user.srv.MOTD(); motd != "" && dc.network == nil {
     1131                for _, msg := range generateMOTD(dc.srv.prefix(), dc.nick, motd) {
     1132                        dc.SendMessage(msg)
     1133                }
     1134        } else {
     1135                motdHint := "No MOTD"
     1136                if dc.network != nil {
     1137                        motdHint = "Use /motd to read the message of the day"
     1138                }
     1139                dc.SendMessage(&irc.Message{
     1140                        Prefix:  dc.srv.prefix(),
     1141                        Command: irc.ERR_NOMOTD,
     1142                        Params:  []string{dc.nick, motdHint},
     1143                })
     1144        }
    11361145
    11371146        dc.updateNick()
Note: See TracChangeset for help on using the changeset viewer.