diff options
-rw-r--r-- | cap.go | 7 | ||||
-rw-r--r-- | cmd_cap.go | 7 |
2 files changed, 12 insertions, 2 deletions
@@ -7,17 +7,22 @@ import ( var Caps = map[string]string{} var capls string +var capls302 string // Can't be in init() because Caps will be registered with init in the future // and init()s are executed by filename alphabetical order func setupCapls() { capls = "" + capls302 = "" for k, v := range Caps { capls += k + capls302 += k if v != "" { - capls += "=" + v + capls302 += "=" + v } capls += " " + capls302 += " " } capls = strings.TrimSuffix(capls, " ") + capls302 = strings.TrimSuffix(capls302, " ") } @@ -24,7 +24,12 @@ func handleClientCap(msg RMsg, client *Client) error { if client.State == ClientStatePreRegistration { client.State = ClientStateCapabilities } - err := client.Send(MakeMsg(self, "CAP", client.Nick, "LS", capls)) + var err error + if len(msg.Params) >= 2 && msg.Params[1] == "302" { + err = client.Send(MakeMsg(self, "CAP", client.Nick, "LS", capls302)) + } else { + err = client.Send(MakeMsg(self, "CAP", client.Nick, "LS", capls)) + } // TODO: Split when too long if err != nil { return err |