mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
Enable chanmode +r, fix bug with registering channels
This commit is contained in:
parent
317a804644
commit
0046025d60
@ -425,6 +425,9 @@ func (channel *Channel) CanSpeak(client *Client) bool {
|
|||||||
if channel.flags[Moderated] && !channel.clientIsAtLeastNoMutex(client, Voice) {
|
if channel.flags[Moderated] && !channel.clientIsAtLeastNoMutex(client, Voice) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if channel.flags[RegisteredOnly] && client.account == &NoAccount {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
account := client.account
|
account := client.account
|
||||||
if account == nil {
|
if account == &NoAccount {
|
||||||
client.ChanServNotice("You must be logged in to register a channel")
|
client.ChanServNotice("You must be logged in to register a channel")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
22
irc/help.go
22
irc/help.go
@ -21,25 +21,18 @@ var (
|
|||||||
|
|
||||||
Oragono supports the following channel modes:
|
Oragono supports the following channel modes:
|
||||||
|
|
||||||
= Type A - list modes =
|
+b | Client masks that are banned from the channel (e.g. *!*@127.0.0.1)
|
||||||
|
|
||||||
+b | Client masks that are banned from the channel.
|
|
||||||
+e | Client masks that are exempted from bans.
|
+e | Client masks that are exempted from bans.
|
||||||
+I | Client masks that are exempted from the invite-only flag.
|
+I | Client masks that are exempted from the invite-only flag.
|
||||||
|
|
||||||
= Type C - setting modes with a parameter =
|
|
||||||
|
|
||||||
+l | Client join limit for the channel.
|
|
||||||
+k | Key required when joining the channel.
|
|
||||||
|
|
||||||
= Type D - flag modes =
|
|
||||||
|
|
||||||
+i | Invite-only mode, only invited clients can join the channel.
|
+i | Invite-only mode, only invited clients can join the channel.
|
||||||
|
+k | Key required when joining the channel.
|
||||||
|
+l | Client join limit for the channel.
|
||||||
+m | Moderated mode, only privileged clients can talk on the channel.
|
+m | Moderated mode, only privileged clients can talk on the channel.
|
||||||
+n | No-outside-messages mode, only users that are on the channel can send
|
+n | No-outside-messages mode, only users that are on the channel can send
|
||||||
| messages to it.
|
| messages to it.
|
||||||
+t | Only channel opers can modify the topic.
|
+r | Only registered users can talk in the channel.
|
||||||
+s | Secret mode, channel won't show up in /LIST or whois replies.
|
+s | Secret mode, channel won't show up in /LIST or whois replies.
|
||||||
|
+t | Only channel opers can modify the topic.
|
||||||
|
|
||||||
= Prefixes =
|
= Prefixes =
|
||||||
|
|
||||||
@ -210,7 +203,7 @@ command is processed by that server.`,
|
|||||||
text: `MODE <target> [<modestring> [<mode arguments>...]]
|
text: `MODE <target> [<modestring> [<mode arguments>...]]
|
||||||
|
|
||||||
Sets and removes modes from the given target. For more specific information on
|
Sets and removes modes from the given target. For more specific information on
|
||||||
mode characters, see the help for "cmode" and "umode".`,
|
mode characters, see the help for "modes".`,
|
||||||
},
|
},
|
||||||
"monitor": {
|
"monitor": {
|
||||||
text: `MONITOR <subcmd>
|
text: `MONITOR <subcmd>
|
||||||
@ -417,6 +410,9 @@ Returns historical information on the last user with the given nickname.`,
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Informational
|
// Informational
|
||||||
|
"modes": {
|
||||||
|
text: cmodeHelpText + "\n\n" + umodeHelpText,
|
||||||
|
},
|
||||||
"cmode": {
|
"cmode": {
|
||||||
text: cmodeHelpText,
|
text: cmodeHelpText,
|
||||||
},
|
},
|
||||||
|
@ -122,6 +122,7 @@ const (
|
|||||||
Moderated Mode = 'm' // flag
|
Moderated Mode = 'm' // flag
|
||||||
NoOutside Mode = 'n' // flag
|
NoOutside Mode = 'n' // flag
|
||||||
OpOnlyTopic Mode = 't' // flag
|
OpOnlyTopic Mode = 't' // flag
|
||||||
|
RegisteredOnly Mode = 'r' // flag
|
||||||
Secret Mode = 's' // flag
|
Secret Mode = 's' // flag
|
||||||
UserLimit Mode = 'l' // flag arg
|
UserLimit Mode = 'l' // flag arg
|
||||||
)
|
)
|
||||||
@ -455,7 +456,7 @@ func ApplyChannelModeChanges(channel *Channel, client *Client, isSamode bool, ch
|
|||||||
}
|
}
|
||||||
applied = append(applied, change)
|
applied = append(applied, change)
|
||||||
|
|
||||||
case InviteOnly, Moderated, NoOutside, OpOnlyTopic, Secret, ChanRoleplaying:
|
case InviteOnly, Moderated, NoOutside, OpOnlyTopic, RegisteredOnly, Secret, ChanRoleplaying:
|
||||||
switch change.op {
|
switch change.op {
|
||||||
case Add:
|
case Add:
|
||||||
if channel.flags[change.mode] {
|
if channel.flags[change.mode] {
|
||||||
|
@ -952,6 +952,10 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
|
|||||||
client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, "No such channel")
|
client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, "No such channel")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if !channel.CanSpeak(client) {
|
||||||
|
client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
|
||||||
|
continue
|
||||||
|
}
|
||||||
msgid := server.generateMessageID()
|
msgid := server.generateMessageID()
|
||||||
channel.SplitPrivMsg(msgid, lowestPrefix, clientOnlyTags, client, splitMsg)
|
channel.SplitPrivMsg(msgid, lowestPrefix, clientOnlyTags, client, splitMsg)
|
||||||
} else {
|
} else {
|
||||||
@ -1017,6 +1021,10 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, "No such channel")
|
client.Send(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, "No such channel")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if !channel.CanSpeak(client) {
|
||||||
|
client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
|
||||||
|
continue
|
||||||
|
}
|
||||||
msgid := server.generateMessageID()
|
msgid := server.generateMessageID()
|
||||||
|
|
||||||
channel.TagMsg(msgid, lowestPrefix, clientOnlyTags, client)
|
channel.TagMsg(msgid, lowestPrefix, clientOnlyTags, client)
|
||||||
@ -1610,6 +1618,10 @@ func noticeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
// errors silently ignored with NOTICE as per RFC
|
// errors silently ignored with NOTICE as per RFC
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if !channel.CanSpeak(client) {
|
||||||
|
// errors silently ignored with NOTICE as per RFC
|
||||||
|
continue
|
||||||
|
}
|
||||||
msgid := server.generateMessageID()
|
msgid := server.generateMessageID()
|
||||||
channel.SplitNotice(msgid, lowestPrefix, clientOnlyTags, client, splitMsg)
|
channel.SplitNotice(msgid, lowestPrefix, clientOnlyTags, client, splitMsg)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user