Changeset 722 in code
- Timestamp:
- Nov 19, 2021, 6:21:48 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r721 r722 259 259 realname string 260 260 hostname string 261 account string // RPL_LOGGEDIN/OUT state 261 262 password string // empty after authentication 262 263 network *network // can be nil … … 760 761 } else if done { 761 762 dc.saslServer = nil 762 dc.SendMessage(&irc.Message{ 763 Prefix: dc.srv.prefix(), 764 Command: irc.RPL_LOGGEDIN, 765 Params: []string{dc.nick, dc.prefix().String(), dc.user.Username, "You are now logged in"}, 766 }) 763 // Technically we should send RPL_LOGGEDIN here. However we use 764 // RPL_LOGGEDIN to mirror the upstream connection status. Let's see 765 // how many clients that breaks. See: 766 // https://github.com/ircv3/ircv3-specifications/pull/476 767 767 dc.SendMessage(&irc.Message{ 768 768 Prefix: dc.srv.prefix(), … … 1036 1036 dc.realname = uc.realname 1037 1037 } 1038 } 1039 1040 func (dc *downstreamConn) updateAccount() { 1041 uc := dc.upstream() 1042 if uc == nil || uc.account == dc.account || !dc.caps["sasl"] { 1043 return 1044 } 1045 1046 if uc.account != "" { 1047 dc.SendMessage(&irc.Message{ 1048 Prefix: dc.srv.prefix(), 1049 Command: irc.RPL_LOGGEDIN, 1050 Params: []string{dc.nick, dc.prefix().String(), uc.account, "You are logged in as " + uc.account}, 1051 }) 1052 } else { 1053 dc.SendMessage(&irc.Message{ 1054 Prefix: dc.srv.prefix(), 1055 Command: irc.RPL_LOGGEDOUT, 1056 Params: []string{dc.nick, dc.prefix().String(), "You are logged out"}, 1057 }) 1058 } 1059 1060 dc.account = uc.account 1038 1061 } 1039 1062 … … 1261 1284 dc.updateNick() 1262 1285 dc.updateRealname() 1286 dc.updateAccount() 1263 1287 1264 1288 if motd := dc.user.srv.Config().MOTD; motd != "" && dc.network == nil { -
trunk/upstream.go
r720 r722 587 587 } 588 588 uc.logger.Printf("logged in with account %q", uc.account) 589 uc.forEachDownstream(func(dc *downstreamConn) { 590 dc.updateAccount() 591 }) 589 592 case irc.RPL_LOGGEDOUT: 590 593 uc.account = "" 591 594 uc.logger.Printf("logged out") 595 uc.forEachDownstream(func(dc *downstreamConn) { 596 dc.updateAccount() 597 }) 592 598 case irc.ERR_NICKLOCKED, irc.RPL_SASLSUCCESS, irc.ERR_SASLFAIL, irc.ERR_SASLTOOLONG, irc.ERR_SASLABORTED: 593 599 var info string -
trunk/user.go
r710 r722 542 542 dc.updateNick() 543 543 dc.updateRealname() 544 dc.updateAccount() 544 545 }) 545 546 u.forEachDownstream(func(dc *downstreamConn) {
Note:
See TracChangeset
for help on using the changeset viewer.