mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 03:49:27 +01:00
modes: Remove channel.Persist mode
It's broken anyways, and we'll be replacing it with our custom channel ownership stuff later.
This commit is contained in:
parent
7b50f64d7e
commit
06028e0117
@ -12,13 +12,14 @@ Improved compatibility, more features, etc.
|
||||
### Security
|
||||
|
||||
### Added
|
||||
* Add integrated help.
|
||||
* Added integrated help.
|
||||
* Support for IRCv3 capability [`account-notify`](http://ircv3.net/specs/extensions/account-notify-3.1.html)
|
||||
|
||||
### Changed
|
||||
* Casemapping changed from custom unicode mapping to preliminary [rfc7700](https://github.com/ircv3/ircv3-specifications/pull/272) mapping.
|
||||
|
||||
### Removed
|
||||
* Removed channel persistence with the `+P` mode (not too useful as currently implemented, to be replaced later).
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -22,7 +22,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). For the purpo
|
||||
* IRC operators
|
||||
* ident lookups for usernames
|
||||
* passwords stored in [bcrypt][go-crypto] format
|
||||
* channels that persist between restarts (+P)
|
||||
* client accounts and SASL
|
||||
* IRCv3 support
|
||||
|
||||
|
@ -220,7 +220,7 @@ func (channel *Channel) Join(client *Client, key string) {
|
||||
|
||||
client.channels.Add(channel)
|
||||
channel.members.Add(client)
|
||||
if !channel.flags[Persistent] && (len(channel.members) == 1) {
|
||||
if len(channel.members) == 1 {
|
||||
channel.createdTime = time.Now()
|
||||
channel.members[client][ChannelFounder] = true
|
||||
channel.members[client][ChannelOperator] = true
|
||||
@ -284,8 +284,6 @@ func (channel *Channel) SetTopic(client *Client, topic string) {
|
||||
for member := range channel.members {
|
||||
member.Send(nil, client.nickMaskString, "TOPIC", channel.name, channel.topic)
|
||||
}
|
||||
|
||||
channel.Persist()
|
||||
}
|
||||
|
||||
func (channel *Channel) CanSpeak(client *Client) bool {
|
||||
@ -424,34 +422,6 @@ func (channel *Channel) applyModeMask(client *Client, mode ChannelMode, op ModeO
|
||||
return false
|
||||
}
|
||||
|
||||
func (channel *Channel) Persist() (err error) {
|
||||
return
|
||||
|
||||
//TODO(dan): Fix persistence
|
||||
/*
|
||||
if channel.flags[Persistent] {
|
||||
//TODO(dan): Save topicSetBy/topicSetTime and createdTime
|
||||
_, err = channel.server.db.Exec(`
|
||||
INSERT OR REPLACE INTO channel
|
||||
(name, flags, key, topic, user_limit, ban_list, except_list,
|
||||
invite_list)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
channel.name.String(), channel.flags.String(), channel.key,
|
||||
channel.topic, channel.userLimit, channel.lists[BanMask].String(),
|
||||
channel.lists[ExceptMask].String(), channel.lists[InviteMask].String())
|
||||
} else {
|
||||
_, err = channel.server.db.Exec(`
|
||||
DELETE FROM channel WHERE name = ?`, channel.name.String())
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
Log.error.Println("Channel.Persist:", channel, err)
|
||||
}
|
||||
|
||||
return
|
||||
*/
|
||||
}
|
||||
|
||||
func (channel *Channel) Notice(client *Client, message string) {
|
||||
if !channel.CanSpeak(client) {
|
||||
client.Send(nil, client.server.name, ERR_CANNOTSENDTOCHAN, channel.name, "Cannot send to channel")
|
||||
@ -469,7 +439,7 @@ func (channel *Channel) Quit(client *Client) {
|
||||
channel.members.Remove(client)
|
||||
client.channels.Remove(channel)
|
||||
|
||||
if !channel.flags[Persistent] && channel.IsEmpty() {
|
||||
if channel.IsEmpty() {
|
||||
channel.server.channels.Remove(channel)
|
||||
}
|
||||
}
|
||||
@ -511,7 +481,6 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client) {
|
||||
|
||||
if channel.flags[InviteOnly] {
|
||||
channel.lists[InviteMask].Add(invitee.UserHost())
|
||||
channel.Persist()
|
||||
}
|
||||
|
||||
//TODO(dan): should inviter.server.name here be inviter.nickMaskString ?
|
||||
|
@ -170,7 +170,6 @@ const (
|
||||
Moderated ChannelMode = 'm' // flag
|
||||
NoOutside ChannelMode = 'n' // flag
|
||||
OpOnlyTopic ChannelMode = 't' // flag
|
||||
Persistent ChannelMode = 'P' // flag
|
||||
Secret ChannelMode = 's' // flag
|
||||
UserLimit ChannelMode = 'l' // flag arg
|
||||
)
|
||||
@ -178,7 +177,7 @@ const (
|
||||
var (
|
||||
SupportedChannelModes = ChannelModes{
|
||||
BanMask, ExceptMask, InviteMask, InviteOnly, Key, NoOutside,
|
||||
OpOnlyTopic, Persistent, Secret, UserLimit,
|
||||
OpOnlyTopic, Secret, UserLimit,
|
||||
}
|
||||
// supportedChannelModesString acts as a cache for when we introduce users
|
||||
supportedChannelModesString = SupportedChannelModes.String()
|
||||
@ -429,7 +428,7 @@ func cmodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
}
|
||||
applied = append(applied, change)
|
||||
|
||||
case InviteOnly, Moderated, NoOutside, OpOnlyTopic, Persistent, Secret:
|
||||
case InviteOnly, Moderated, NoOutside, OpOnlyTopic, Secret:
|
||||
switch change.op {
|
||||
case Add:
|
||||
if channel.flags[change.mode] {
|
||||
|
@ -154,8 +154,6 @@ func NewServer(config *Config) *Server {
|
||||
server.password = config.Server.PasswordBytes()
|
||||
}
|
||||
|
||||
server.loadChannels()
|
||||
|
||||
for _, addr := range config.Server.Listen {
|
||||
server.listen(addr, config.TLSListeners())
|
||||
}
|
||||
@ -175,7 +173,7 @@ func NewServer(config *Config) *Server {
|
||||
server.isupport = NewISupportList()
|
||||
server.isupport.Add("AWAYLEN", strconv.Itoa(server.limits.AwayLen))
|
||||
server.isupport.Add("CASEMAPPING", "rfc7700")
|
||||
server.isupport.Add("CHANMODES", strings.Join([]string{ChannelModes{BanMask, ExceptMask, InviteMask}.String(), "", ChannelModes{UserLimit, Key}.String(), ChannelModes{InviteOnly, Moderated, NoOutside, OpOnlyTopic, Persistent, Secret}.String()}, ","))
|
||||
server.isupport.Add("CHANMODES", strings.Join([]string{ChannelModes{BanMask, ExceptMask, InviteMask}.String(), "", ChannelModes{UserLimit, Key}.String(), ChannelModes{InviteOnly, Moderated, NoOutside, OpOnlyTopic, Secret}.String()}, ","))
|
||||
server.isupport.Add("CHANNELLEN", strconv.Itoa(config.Limits.ChannelLen))
|
||||
server.isupport.Add("CHANTYPES", "#")
|
||||
server.isupport.Add("EXCEPTS", "")
|
||||
@ -217,41 +215,6 @@ func loadChannelList(channel *Channel, list string, maskMode ChannelMode) {
|
||||
channel.lists[maskMode].AddAll(strings.Split(list, " "))
|
||||
}
|
||||
|
||||
func (server *Server) loadChannels() {
|
||||
//TODO(dan): Fix channel persistence
|
||||
/*
|
||||
rows, err := server.db.Query(`
|
||||
SELECT name, flags, key, topic, user_limit, ban_list, except_list,
|
||||
invite_list
|
||||
FROM channel`)
|
||||
if err != nil {
|
||||
log.Fatal("error loading channels: ", err)
|
||||
}
|
||||
for rows.Next() {
|
||||
var name, flags, key, topic string
|
||||
var userLimit uint64
|
||||
var banList, exceptList, inviteList string
|
||||
err = rows.Scan(&name, &flags, &key, &topic, &userLimit, &banList,
|
||||
&exceptList, &inviteList)
|
||||
if err != nil {
|
||||
log.Println("Server.loadChannels:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
channel := NewChannel(server, NewName(name), false)
|
||||
for _, flag := range flags {
|
||||
channel.flags[ChannelMode(flag)] = true
|
||||
}
|
||||
channel.key = key
|
||||
channel.topic = topic
|
||||
channel.userLimit = userLimit
|
||||
loadChannelList(channel, banList, BanMask)
|
||||
loadChannelList(channel, exceptList, ExceptMask)
|
||||
loadChannelList(channel, inviteList, InviteMask)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
func (server *Server) Shutdown() {
|
||||
//TODO(dan): Make sure we disallow new nicks
|
||||
for _, client := range server.clients.byNick {
|
||||
|
Loading…
Reference in New Issue
Block a user