3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-26 04:32:36 +01:00

Merge pull request #756 from slingamn/issue753_channel_ctcp

fix #753
This commit is contained in:
Shivaram Lingamneni 2020-01-27 18:09:44 -08:00 committed by GitHub
commit 1ac3381623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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-02.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 (