mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-11 06:29:29 +01:00
add +u and +U to CHANMODES token
This commit is contained in:
parent
f019f62167
commit
a30e369225
@ -184,3 +184,14 @@ We also support grabbing translations directly from CrowdIn. To do this:
|
|||||||
4. Run `crowdin download`
|
4. Run `crowdin download`
|
||||||
|
|
||||||
This will download a bunch of updated files and put them in the right place
|
This will download a bunch of updated files and put them in the right place
|
||||||
|
|
||||||
|
|
||||||
|
## Adding a mode
|
||||||
|
|
||||||
|
When adding a mode, keep in mind the following places it may need to be referenced:
|
||||||
|
|
||||||
|
1. The mode needs to be defined in the `irc/modes` subpackage
|
||||||
|
1. It may need to be special-cased in `modes.RplMyInfo()`
|
||||||
|
1. It may need to be added to the `CHANMODES` ISUPPORT token
|
||||||
|
1. It may need special handling in `ApplyUserModeChanges` or `ApplyChannelModeChanges`
|
||||||
|
1. It may need special persistence handling code
|
||||||
|
@ -1287,7 +1287,7 @@ func (config *Config) generateISupport() (err error) {
|
|||||||
isupport.Add("BOT", "B")
|
isupport.Add("BOT", "B")
|
||||||
isupport.Add("CASEMAPPING", "ascii")
|
isupport.Add("CASEMAPPING", "ascii")
|
||||||
isupport.Add("CHANLIMIT", fmt.Sprintf("%s:%d", chanTypes, config.Channels.MaxChannelsPerClient))
|
isupport.Add("CHANLIMIT", fmt.Sprintf("%s:%d", chanTypes, config.Channels.MaxChannelsPerClient))
|
||||||
isupport.Add("CHANMODES", strings.Join([]string{modes.Modes{modes.BanMask, modes.ExceptMask, modes.InviteMask}.String(), modes.Modes{modes.Key}.String(), modes.Modes{modes.UserLimit}.String(), modes.Modes{modes.InviteOnly, modes.Moderated, modes.NoOutside, modes.OpOnlyTopic, modes.ChanRoleplaying, modes.Secret, modes.NoCTCP, modes.RegisteredOnly, modes.RegisteredOnlySpeak}.String()}, ","))
|
isupport.Add("CHANMODES", chanmodesToken)
|
||||||
if config.History.Enabled && config.History.ChathistoryMax > 0 {
|
if config.History.Enabled && config.History.ChathistoryMax > 0 {
|
||||||
isupport.Add("draft/CHATHISTORY", strconv.Itoa(config.History.ChathistoryMax))
|
isupport.Add("draft/CHATHISTORY", strconv.Itoa(config.History.ChathistoryMax))
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
package modes
|
package modes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -450,3 +451,22 @@ func RplMyInfo() (param1, param2, param3 string) {
|
|||||||
|
|
||||||
return userModes.String(), channelModes.String(), channelParametrizedModes.String()
|
return userModes.String(), channelModes.String(), channelParametrizedModes.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ChanmodesToken() (result string) {
|
||||||
|
// https://modern.ircdocs.horse#chanmodes-parameter
|
||||||
|
// type A: listable modes with parameters
|
||||||
|
A := Modes{BanMask, ExceptMask, InviteMask}
|
||||||
|
// type B: modes with parameters
|
||||||
|
B := Modes{Key}
|
||||||
|
// type C: modes that take a parameter only when set, never when unset
|
||||||
|
C := Modes{UserLimit}
|
||||||
|
// type D: modes without parameters
|
||||||
|
D := Modes{InviteOnly, Moderated, NoOutside, OpOnlyTopic, ChanRoleplaying, Secret, NoCTCP, RegisteredOnly, RegisteredOnlySpeak, Auditorium, OpModerated}
|
||||||
|
|
||||||
|
sort.Sort(ByCodepoint(A))
|
||||||
|
sort.Sort(ByCodepoint(B))
|
||||||
|
sort.Sort(ByCodepoint(C))
|
||||||
|
sort.Sort(ByCodepoint(D))
|
||||||
|
|
||||||
|
return fmt.Sprintf("%s,%s,%s,%s", A.String(), B.String(), C.String(), D.String())
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@ package modes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -219,6 +220,15 @@ func TestHighestChannelUserMode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestChanmodesToken(t *testing.T) {
|
||||||
|
tok := ChanmodesToken()
|
||||||
|
for _, mode := range SupportedChannelModes {
|
||||||
|
if strings.IndexRune(tok, rune(mode)) == -1 {
|
||||||
|
t.Errorf("+%s not included in ChanmodesToken()", mode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestModeChangesString(t *testing.T) {
|
func TestModeChangesString(t *testing.T) {
|
||||||
m := ModeChanges{
|
m := ModeChanges{
|
||||||
ModeChange{Op: Add, Mode: RegisteredOnly},
|
ModeChange{Op: Add, Mode: RegisteredOnly},
|
||||||
|
@ -39,6 +39,9 @@ var (
|
|||||||
// three final parameters of 004 RPL_MYINFO, enumerating our supported modes
|
// three final parameters of 004 RPL_MYINFO, enumerating our supported modes
|
||||||
rplMyInfo1, rplMyInfo2, rplMyInfo3 = modes.RplMyInfo()
|
rplMyInfo1, rplMyInfo2, rplMyInfo3 = modes.RplMyInfo()
|
||||||
|
|
||||||
|
// CHANMODES isupport token
|
||||||
|
chanmodesToken = modes.ChanmodesToken()
|
||||||
|
|
||||||
// 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:
|
||||||
stsOnlyCaps = caps.NewSet(caps.STS, caps.MessageTags, caps.ServerTime, caps.Batch, caps.LabeledResponse, caps.EchoMessage, caps.Nope)
|
stsOnlyCaps = caps.NewSet(caps.STS, caps.MessageTags, caps.ServerTime, caps.Batch, caps.LabeledResponse, caps.EchoMessage, caps.Nope)
|
||||||
|
Loading…
Reference in New Issue
Block a user