Make "@" and "/" indicate client name and network, respectively
This allows both kinds "<username>@<client>/<network>" and "<username>/<network>@<client>".
This commit is contained in:
parent
8e6eb18d09
commit
73ee7d237f
@ -37,6 +37,9 @@ soju supports two connection modes:
|
||||
a channel, you need to use the suffix too: _/join #channel/network_. Same
|
||||
applies to messages sent to users.
|
||||
|
||||
For per-client history to work, clients need to indicate their name. This can
|
||||
be done by adding a "@<client>" suffix to the username.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
*-h, -help*
|
||||
|
@ -540,10 +540,18 @@ func unmarshalUsername(rawUsername string) (username, client, network string) {
|
||||
username = rawUsername[:i]
|
||||
}
|
||||
if j >= 0 {
|
||||
network = rawUsername[j+1:]
|
||||
if rawUsername[j] == '@' {
|
||||
client = rawUsername[j+1:]
|
||||
} else {
|
||||
network = rawUsername[j+1:]
|
||||
}
|
||||
}
|
||||
if i >= 0 && j >= 0 && i < j {
|
||||
client = rawUsername[i+1 : j]
|
||||
if rawUsername[i] == '@' {
|
||||
client = rawUsername[i+1 : j]
|
||||
} else {
|
||||
network = rawUsername[i+1 : j]
|
||||
}
|
||||
}
|
||||
|
||||
return username, client, network
|
||||
|
Loading…
Reference in New Issue
Block a user