]> Cypherpunks.ru repositories - goircd.git/commitdiff
Remove port from /whois output.
authorThomas Habets <thomas@habets.se>
Mon, 9 Jun 2014 14:03:11 +0000 (16:03 +0200)
committerThomas Habets <thomas@habets.se>
Mon, 9 Jun 2014 14:03:11 +0000 (16:03 +0200)
daemon.go

index 1f979ce6ea4f7c4dd295c5f4924b8ab477bdd845..d8cc3b8bc2729d87af875dc7ea30ffd06b389c7b 100644 (file)
--- a/daemon.go
+++ b/daemon.go
@@ -21,6 +21,7 @@ import (
        "fmt"
        "io/ioutil"
        "log"
+       "net"
        "regexp"
        "sort"
        "strings"
@@ -98,7 +99,13 @@ func (daemon *Daemon) SendWhois(client *Client, nicknames []string) {
                                continue
                        }
                        found = true
-                       client.ReplyNicknamed("311", c.nickname, c.username, c.conn.RemoteAddr().String(), "*", c.realname)
+                       h := c.conn.RemoteAddr().String()
+                       h, _, err := net.SplitHostPort(h)
+                       if err != nil {
+                               log.Printf("Can't parse RemoteAddr %q: %v", h, err)
+                               h = "Unknown"
+                       }
+                       client.ReplyNicknamed("311", c.nickname, c.username, h, "*", c.realname)
                        client.ReplyNicknamed("312", c.nickname, daemon.hostname, daemon.hostname)
                        subscriptions := []string{}
                        for _, room := range daemon.rooms {