mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
fix #1058
This commit is contained in:
parent
c1d4c5596d
commit
beea32adfe
@ -6,6 +6,7 @@
|
|||||||
package modes
|
package modes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/oragono/oragono/irc/utils"
|
"github.com/oragono/oragono/irc/utils"
|
||||||
@ -418,3 +419,27 @@ func (set *ModeSet) HighestChannelUserMode() (result Mode) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ByCodepoint Modes
|
||||||
|
|
||||||
|
func (a ByCodepoint) Len() int { return len(a) }
|
||||||
|
func (a ByCodepoint) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
|
func (a ByCodepoint) Less(i, j int) bool { return a[i] < a[j] }
|
||||||
|
|
||||||
|
func RplMyInfo() (param1, param2, param3 string) {
|
||||||
|
userModes := make(Modes, len(SupportedUserModes))
|
||||||
|
copy(userModes, SupportedUserModes)
|
||||||
|
sort.Sort(ByCodepoint(userModes))
|
||||||
|
|
||||||
|
channelModes := make(Modes, len(SupportedChannelModes)+len(ChannelUserModes))
|
||||||
|
copy(channelModes, SupportedChannelModes)
|
||||||
|
copy(channelModes[len(SupportedChannelModes):], ChannelUserModes)
|
||||||
|
sort.Sort(ByCodepoint(channelModes))
|
||||||
|
|
||||||
|
// XXX enumerate these by hand, i can't see any way to DRY this
|
||||||
|
channelParametrizedModes := Modes{BanMask, ExceptMask, InviteMask, Key, UserLimit}
|
||||||
|
channelParametrizedModes = append(channelParametrizedModes, ChannelUserModes...)
|
||||||
|
sort.Sort(ByCodepoint(channelParametrizedModes))
|
||||||
|
|
||||||
|
return userModes.String(), channelModes.String(), channelParametrizedModes.String()
|
||||||
|
}
|
||||||
|
@ -36,10 +36,8 @@ var (
|
|||||||
// common error line to sub values into
|
// common error line to sub values into
|
||||||
errorMsg = "ERROR :%s\r\n"
|
errorMsg = "ERROR :%s\r\n"
|
||||||
|
|
||||||
// supportedUserModesString acts as a cache for when we introduce users
|
// three final parameters of 004 RPL_MYINFO, enumerating our supported modes
|
||||||
supportedUserModesString = modes.SupportedUserModes.String()
|
rplMyInfo1, rplMyInfo2, rplMyInfo3 = modes.RplMyInfo()
|
||||||
// supportedChannelModesString acts as a cache for when we introduce users
|
|
||||||
supportedChannelModesString = modes.SupportedChannelModes.String()
|
|
||||||
|
|
||||||
// whitelist of caps to serve on the STS-only listener. In particular,
|
// whitelist of caps to serve on the STS-only listener. In particular,
|
||||||
// never advertise SASL, to discourage people from sending their passwords:
|
// never advertise SASL, to discourage people from sending their passwords:
|
||||||
@ -290,8 +288,7 @@ func (server *Server) playRegistrationBurst(session *Session) {
|
|||||||
session.Send(nil, server.name, RPL_WELCOME, d.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), d.nick))
|
session.Send(nil, server.name, RPL_WELCOME, d.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), d.nick))
|
||||||
session.Send(nil, server.name, RPL_YOURHOST, d.nick, fmt.Sprintf(c.t("Your host is %[1]s, running version %[2]s"), server.name, Ver))
|
session.Send(nil, server.name, RPL_YOURHOST, d.nick, fmt.Sprintf(c.t("Your host is %[1]s, running version %[2]s"), server.name, Ver))
|
||||||
session.Send(nil, server.name, RPL_CREATED, d.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
|
session.Send(nil, server.name, RPL_CREATED, d.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
|
||||||
//TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
|
session.Send(nil, server.name, RPL_MYINFO, d.nick, server.name, Ver, rplMyInfo1, rplMyInfo2, rplMyInfo3)
|
||||||
session.Send(nil, server.name, RPL_MYINFO, d.nick, server.name, Ver, supportedUserModesString, supportedChannelModesString)
|
|
||||||
|
|
||||||
if c.isSTSOnly {
|
if c.isSTSOnly {
|
||||||
for _, line := range server.Config().Server.STS.bannerLines {
|
for _, line := range server.Config().Server.STS.bannerLines {
|
||||||
|
Loading…
Reference in New Issue
Block a user