Update draft/rename implementation

Link to the new draft PR:
<https://github.com/ircv3/ircv3-specifications/pull/420>

Changes in the spec:

- Use standard replies instead of numerics:
  <https://github.com/ircv3/ircv3-specifications/pull/420/files#diff-70e90beef48dc9cf5d784d1e179ea822R44>
- Allow RENAME to a different case:
  <https://github.com/ircv3/ircv3-specifications/pull/420/files#diff-70e90beef48dc9cf5d784d1e179ea822R42>

This commit makes oragono send the PART-JOIN fallback even on case-only
changes. This is so that clients don't have to worry about oragono's
UTF8 casefolding. See the following comments for further info:
<https://github.com/ircv3/ircv3-specifications/pull/420#issuecomment-668770837>

Misc fixes:

- Remove unused variable,
- Add missing calls to utils.SafeErrorParam,
- Don't fill replies with the user-provided "oldName", for the same
  reason as sending the PART-JOIN fallback.
This commit is contained in:
Hubert Hirtz 2020-08-04 16:13:29 +02:00
parent daefa40b75
commit f6d5fe812f
4 changed files with 20 additions and 11 deletions

View file

@ -453,9 +453,11 @@ func (channel *Channel) NameCasefolded() string {
func (channel *Channel) Rename(name, nameCasefolded string) {
channel.stateMutex.Lock()
channel.name = name
channel.nameCasefolded = nameCasefolded
if channel.registeredFounder != "" {
channel.registeredTime = time.Now().UTC()
if channel.nameCasefolded != nameCasefolded {
channel.nameCasefolded = nameCasefolded
if channel.registeredFounder != "" {
channel.registeredTime = time.Now().UTC()
}
}
channel.stateMutex.Unlock()
}