3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

Merge pull request #1662 from slingamn/relay_nuh_followup.2

fix #1661
This commit is contained in:
Shivaram Lingamneni 2021-05-27 11:54:36 -04:00 committed by GitHub
commit 351eb8ad27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -2658,13 +2658,19 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
return false
}
details := client.Details()
// #1647: we need to publish a full NUH. send ~u (or the configured alternative)
// as the user/ident, and send the relayer's hostname as the hostname:
ident := config.Server.CoerceIdent
if ident == "" {
ident = "~u"
}
hostname := client.Hostname()
// #1661: if the bot has its own account, use the account cloak,
// otherwise fall back to the hostname (which may be IP-derived)
hostname := details.hostname
if details.accountName != "" {
hostname = config.Server.Cloaks.ComputeAccountCloak(details.accountName)
}
nuh := fmt.Sprintf("%s!%s@%s", nick, ident, hostname)
channel.AddHistoryItem(history.Item{
@ -2675,9 +2681,8 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
// 3 possibilities for tags:
// no tags, the relaymsg tag only, or the relaymsg tag together with all client-only tags
cnick := client.Nick()
relayTag := map[string]string{
caps.RelaymsgTagName: cnick,
caps.RelaymsgTagName: details.nick,
}
clientOnlyTags := msg.ClientOnlyTags()
var fullTags map[string]string
@ -2685,7 +2690,7 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
fullTags = relayTag
} else {
fullTags = make(map[string]string, 1+len(clientOnlyTags))
fullTags[caps.RelaymsgTagName] = cnick
fullTags[caps.RelaymsgTagName] = details.nick
for t, v := range clientOnlyTags {
fullTags[t] = v
}

View File

@ -53,9 +53,9 @@ OFF disables your vhost, if you have one approved.`,
handler: hsStatusHandler,
help: `Syntax: $bSTATUS [user]$b
STATUS displays your current vhost, if any, and the status of your most recent
request for a new one. A server operator can view someone else's status.`,
helpShort: `$bSTATUS$b shows your vhost and request status.`,
STATUS displays your current vhost, if any, and whether it is enabled or
disabled. A server operator can view someone else's status.`,
helpShort: `$bSTATUS$b shows your vhost status.`,
enabled: hostservEnabled,
},
"set": {