use the TR39 skeleton algorithm to prevent confusables (#178)

This commit is contained in:
Shivaram Lingamneni 2019-01-30 18:59:49 -05:00
parent a11486d699
commit b9b2553a2f
9 changed files with 271 additions and 76 deletions

View file

@ -108,6 +108,15 @@ func (client *Client) Realname() string {
return client.realname
}
// uniqueIdentifiers returns the strings for which the server enforces per-client
// uniqueness/ownership; no two clients can have colliding casefolded nicks or
// skeletons.
func (client *Client) uniqueIdentifiers() (nickCasefolded string, skeleton string) {
client.stateMutex.RLock()
defer client.stateMutex.RUnlock()
return client.nickCasefolded, client.skeleton
}
func (client *Client) ResumeToken() string {
client.stateMutex.RLock()
defer client.stateMutex.RUnlock()
@ -120,12 +129,6 @@ func (client *Client) Oper() *Oper {
return client.oper
}
func (client *Client) SetOper(oper *Oper) {
client.stateMutex.Lock()
defer client.stateMutex.Unlock()
client.oper = oper
}
func (client *Client) Registered() bool {
client.stateMutex.RLock()
defer client.stateMutex.RUnlock()