Changeset 552 in code for trunk


Ignore:
Timestamp:
Jun 9, 2021, 7:29:36 PM (4 years ago)
Author:
greg
Message:

Forward MOTD messages downstream

The first MOTD upon connection is ignored, but subsequent MOTD messages
(requested by the "MOTD" message from the client, typically using a
/motd command) are forwarded.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r551 r552  
    11061106                Prefix:  dc.srv.prefix(),
    11071107                Command: irc.ERR_NOMOTD,
    1108                 Params:  []string{dc.nick, "No MOTD"},
     1108                Params:  []string{dc.nick, "Use /motd to read the message of the day"},
    11091109        })
    11101110
  • trunk/upstream.go

    r540 r552  
    104104        // set of LIST commands in progress, per downstream
    105105        pendingLISTDownstreamSet map[uint64]struct{}
     106
     107        gotMotd bool
    106108}
    107109
     
    663665                        uc.nickCM = uc.network.casemap(uc.nick)
    664666                }
     667
     668                if !uc.gotMotd {
     669                        // Ignore the initial MOTD upon connection, but forward
     670                        // subsequent MOTD messages downstream
     671                        uc.gotMotd = true
     672                        return nil
     673                }
     674
     675                uc.forEachDownstreamByID(downstreamID, func (dc *downstreamConn) {
     676                        dc.SendMessage(&irc.Message {
     677                                Prefix: uc.srv.prefix(),
     678                                Command: msg.Command,
     679                                Params: msg.Params,
     680                        })
     681                })
    665682        case "BATCH":
    666683                var tag string
     
    14221439                // Ignore
    14231440        case irc.RPL_MOTDSTART, irc.RPL_MOTD:
    1424                 // Ignore
     1441                if !uc.gotMotd {
     1442                        return nil
     1443                }
     1444
     1445                uc.forEachDownstreamByID(downstreamID, func (dc *downstreamConn) {
     1446                        dc.SendMessage(&irc.Message {
     1447                                Prefix: uc.srv.prefix(),
     1448                                Command: msg.Command,
     1449                                Params: msg.Params,
     1450                        })
     1451                })
    14251452        case irc.RPL_LISTSTART:
    14261453                // Ignore
Note: See TracChangeset for help on using the changeset viewer.