Browse Source

Merge pull request #1662 from slingamn/relay_nuh_followup.2

fix #1661
tags/v2.7.0-rc1
Shivaram Lingamneni 2 years ago
parent
commit
351eb8ad27
No account linked to committer's email address
2 changed files with 12 additions and 7 deletions
  1. 9
    4
      irc/handlers.go
  2. 3
    3
      irc/hostserv.go

+ 9
- 4
irc/handlers.go View File

@@ -2658,13 +2658,19 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
2658 2658
 		return false
2659 2659
 	}
2660 2660
 
2661
+	details := client.Details()
2661 2662
 	// #1647: we need to publish a full NUH. send ~u (or the configured alternative)
2662 2663
 	// as the user/ident, and send the relayer's hostname as the hostname:
2663 2664
 	ident := config.Server.CoerceIdent
2664 2665
 	if ident == "" {
2665 2666
 		ident = "~u"
2666 2667
 	}
2667
-	hostname := client.Hostname()
2668
+	// #1661: if the bot has its own account, use the account cloak,
2669
+	// otherwise fall back to the hostname (which may be IP-derived)
2670
+	hostname := details.hostname
2671
+	if details.accountName != "" {
2672
+		hostname = config.Server.Cloaks.ComputeAccountCloak(details.accountName)
2673
+	}
2668 2674
 	nuh := fmt.Sprintf("%s!%s@%s", nick, ident, hostname)
2669 2675
 
2670 2676
 	channel.AddHistoryItem(history.Item{
@@ -2675,9 +2681,8 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
2675 2681
 
2676 2682
 	// 3 possibilities for tags:
2677 2683
 	// no tags, the relaymsg tag only, or the relaymsg tag together with all client-only tags
2678
-	cnick := client.Nick()
2679 2684
 	relayTag := map[string]string{
2680
-		caps.RelaymsgTagName: cnick,
2685
+		caps.RelaymsgTagName: details.nick,
2681 2686
 	}
2682 2687
 	clientOnlyTags := msg.ClientOnlyTags()
2683 2688
 	var fullTags map[string]string
@@ -2685,7 +2690,7 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
2685 2690
 		fullTags = relayTag
2686 2691
 	} else {
2687 2692
 		fullTags = make(map[string]string, 1+len(clientOnlyTags))
2688
-		fullTags[caps.RelaymsgTagName] = cnick
2693
+		fullTags[caps.RelaymsgTagName] = details.nick
2689 2694
 		for t, v := range clientOnlyTags {
2690 2695
 			fullTags[t] = v
2691 2696
 		}

+ 3
- 3
irc/hostserv.go View File

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

Loading…
Cancel
Save