Changeset 636 in code for trunk/server.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/server.go

    r612 r636  
    6464        listeners map[net.Listener]struct{}
    6565        users     map[string]*user
     66
     67        motd atomic.Value // string
    6668}
    6769
    6870func NewServer(db Database) *Server {
    69         return &Server{
     71        srv := &Server{
    7072                Logger:          log.New(log.Writer(), "", log.LstdFlags),
    7173                HistoryLimit:    1000,
     
    7577                users:           make(map[string]*user),
    7678        }
     79        srv.motd.Store("")
     80        return srv
    7781}
    7882
     
    269273        return &stats
    270274}
     275
     276func (s *Server) SetMOTD(motd string) {
     277        s.motd.Store(motd)
     278}
     279
     280func (s *Server) MOTD() string {
     281        return s.motd.Load().(string)
     282}
Note: See TracChangeset for help on using the changeset viewer.