3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 13:29:27 +01:00
Also add +C no-ctcp mode, since it's not conflicted
This commit is contained in:
Shivaram Lingamneni 2020-01-26 20:50:27 -05:00
parent 66e2710ba2
commit 166dc60729
4 changed files with 18 additions and 1 deletions

View File

@ -608,6 +608,10 @@ This mode is enabled by default, and means that only channel operators can chang
If this mode is unset, anyone will be able to change the channel topic.
### +C - No CTCPs
This mode means that [client-to-client protocol](https://tools.ietf.org/id/draft-oakley-irc-ctcp-01.html) messages other than `ACTION` (`/me`) cannot be sent to the channel.
## Channel Prefixes

View File

@ -1070,6 +1070,14 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
return
}
isCTCP := message.IsRestrictedCTCPMessage()
if isCTCP && channel.flags.HasMode(modes.NoCTCP) {
if histType != history.Notice {
rb.Add(nil, client.server.name, ERR_CANNOTSENDTOCHAN, client.Nick(), channel.Name(), fmt.Sprintf(client.t("Cannot send to channel (+%s)"), "C"))
}
return
}
nickmask := client.NickMaskString()
account := client.AccountName()
chname := channel.Name()
@ -1116,6 +1124,9 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
// STATUSMSG
continue
}
if isCTCP && member.isTor {
continue // #753
}
for _, session := range member.Sessions() {
var tagsToUse map[string]string

View File

@ -221,7 +221,7 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
applied = append(applied, change)
}
case modes.InviteOnly, modes.Moderated, modes.NoOutside, modes.OpOnlyTopic, modes.RegisteredOnly, modes.Secret, modes.ChanRoleplaying:
case modes.InviteOnly, modes.Moderated, modes.NoOutside, modes.OpOnlyTopic, modes.RegisteredOnly, modes.Secret, modes.ChanRoleplaying, modes.NoCTCP:
if change.Op == modes.List {
continue
}

View File

@ -21,6 +21,7 @@ var (
SupportedChannelModes = Modes{
BanMask, ChanRoleplaying, ExceptMask, InviteMask, InviteOnly, Key,
Moderated, NoOutside, OpOnlyTopic, RegisteredOnly, Secret, UserLimit,
NoCTCP,
}
)
@ -132,6 +133,7 @@ const (
// RegisteredOnly mode is reused here from umode definition
Secret Mode = 's' // flag
UserLimit Mode = 'l' // flag arg
NoCTCP Mode = 'C' // flag
)
var (