mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-26 05:49:25 +01:00
channel 'no outside messages' flag
This commit is contained in:
parent
a3b7441939
commit
04f881a617
@ -113,8 +113,11 @@ func (channel *Channel) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// <mode> <mode params>
|
// <mode> <mode params>
|
||||||
func (channel *Channel) ModeString() string {
|
func (channel *Channel) ModeString() (str string) {
|
||||||
return ""
|
if channel.noOutside {
|
||||||
|
str += NoOutside.String()
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (channel *Channel) Join(client *Client) {
|
func (channel *Channel) Join(client *Client) {
|
||||||
@ -181,7 +184,12 @@ func (m *TopicCommand) HandleChannel(channel *Channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *PrivMsgCommand) HandleChannel(channel *Channel) {
|
func (m *PrivMsgCommand) HandleChannel(channel *Channel) {
|
||||||
channel.replies <- RplPrivMsg(m.Client(), channel, m.message)
|
client := m.Client()
|
||||||
|
if channel.noOutside && !channel.members.Has(client) {
|
||||||
|
client.replies <- ErrCannotSendToChan(channel)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
channel.replies <- RplPrivMsg(client, channel, m.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (msg *ChannelModeCommand) HandleChannel(channel *Channel) {
|
func (msg *ChannelModeCommand) HandleChannel(channel *Channel) {
|
||||||
@ -195,6 +203,14 @@ func (msg *ChannelModeCommand) HandleChannel(channel *Channel) {
|
|||||||
client.replies <- RplBanList(channel, banMask)
|
client.replies <- RplBanList(channel, banMask)
|
||||||
}
|
}
|
||||||
client.replies <- RplEndOfBanList(channel)
|
client.replies <- RplEndOfBanList(channel)
|
||||||
|
case NoOutside:
|
||||||
|
// TODO perms
|
||||||
|
switch modeOp.op {
|
||||||
|
case Add:
|
||||||
|
channel.noOutside = true
|
||||||
|
case Remove:
|
||||||
|
channel.noOutside = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,20 +171,20 @@ const (
|
|||||||
ServerNotice UserMode = 's'
|
ServerNotice UserMode = 's'
|
||||||
WallOps UserMode = 'w'
|
WallOps UserMode = 'w'
|
||||||
|
|
||||||
Anonymous ChannelMode = 'a'
|
Anonymous ChannelMode = 'a' // flag
|
||||||
BanMask ChannelMode = 'b' // arg
|
BanMask ChannelMode = 'b' // arg
|
||||||
ExceptionMask ChannelMode = 'e' // arg
|
ExceptionMask ChannelMode = 'e' // arg
|
||||||
InviteMask ChannelMode = 'I' // arg
|
InviteMask ChannelMode = 'I' // arg
|
||||||
InviteOnly ChannelMode = 'i'
|
InviteOnly ChannelMode = 'i' // flag
|
||||||
Key ChannelMode = 'k' // arg
|
Key ChannelMode = 'k' // flag arg
|
||||||
Moderated ChannelMode = 'm'
|
Moderated ChannelMode = 'm' // flag
|
||||||
NoOutside ChannelMode = 'n'
|
NoOutside ChannelMode = 'n' // flag
|
||||||
OpOnlyTopic ChannelMode = 't'
|
OpOnlyTopic ChannelMode = 't' // flag
|
||||||
Private ChannelMode = 'p'
|
Private ChannelMode = 'p' // flag
|
||||||
Quiet ChannelMode = 'q'
|
Quiet ChannelMode = 'q' // flag
|
||||||
ReOp ChannelMode = 'r'
|
ReOp ChannelMode = 'r' // flag
|
||||||
Secret ChannelMode = 's'
|
Secret ChannelMode = 's' // flag
|
||||||
UserLimit ChannelMode = 'l' // arg
|
UserLimit ChannelMode = 'l' // flag arg
|
||||||
|
|
||||||
ChannelCreator UserChannelMode = 'O'
|
ChannelCreator UserChannelMode = 'O'
|
||||||
ChannelOperator UserChannelMode = 'o'
|
ChannelOperator UserChannelMode = 'o'
|
||||||
|
@ -343,3 +343,8 @@ func ErrUserNotInChannel(server *Server, nick string, channel *Channel) Reply {
|
|||||||
return NewNumericReply(server, ERR_USERNOTINCHANNEL,
|
return NewNumericReply(server, ERR_USERNOTINCHANNEL,
|
||||||
"%s %s :They aren't on that channel", nick, channel.name)
|
"%s %s :They aren't on that channel", nick, channel.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ErrCannotSendToChan(channel *Channel) Reply {
|
||||||
|
return NewNumericReply(channel.server, ERR_CANNOTSENDTOCHAN,
|
||||||
|
"%s :Cannot send to channel", channel.name)
|
||||||
|
}
|
||||||
|
@ -20,6 +20,10 @@ type UserMode rune
|
|||||||
// channel mode flags
|
// channel mode flags
|
||||||
type ChannelMode rune
|
type ChannelMode rune
|
||||||
|
|
||||||
|
func (mode ChannelMode) String() string {
|
||||||
|
return fmt.Sprintf("%c", mode)
|
||||||
|
}
|
||||||
|
|
||||||
// user-channel mode flags
|
// user-channel mode flags
|
||||||
type UserChannelMode rune
|
type UserChannelMode rune
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user