3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-11 06:29:29 +01:00
List IRCv3 CAPs in `NS CLIENTS LIST` output
This commit is contained in:
Shivaram Lingamneni 2021-03-18 04:24:45 -04:00
parent a6cf667f06
commit ab870c2ffe
2 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"time" "time"
"unsafe" "unsafe"
"github.com/oragono/oragono/irc/caps"
"github.com/oragono/oragono/irc/languages" "github.com/oragono/oragono/irc/languages"
"github.com/oragono/oragono/irc/modes" "github.com/oragono/oragono/irc/modes"
"github.com/oragono/oragono/irc/utils" "github.com/oragono/oragono/irc/utils"
@ -74,6 +75,7 @@ type SessionData struct {
deviceID string deviceID string
connInfo string connInfo string
sessionID int64 sessionID int64
caps []string
} }
func (client *Client) AllSessionData(currentSession *Session, hasPrivs bool) (data []SessionData, currentIndex int) { func (client *Client) AllSessionData(currentSession *Session, hasPrivs bool) (data []SessionData, currentIndex int) {
@ -102,6 +104,7 @@ func (client *Client) AllSessionData(currentSession *Session, hasPrivs bool) (da
if hasPrivs { if hasPrivs {
data[i].connInfo = utils.DescribeConn(session.socket.conn.UnderlyingConn().Conn) data[i].connInfo = utils.DescribeConn(session.socket.conn.UnderlyingConn().Conn)
} }
data[i].caps = session.capabilities.Strings(caps.Cap302, nil, 300)
} }
return return
} }

View File

@ -1140,6 +1140,11 @@ func nsClientsListHandler(service *ircService, server *Server, client *Client, p
if session.certfp != "" { if session.certfp != "" {
service.Notice(rb, fmt.Sprintf(client.t("Certfp: %s"), session.certfp)) service.Notice(rb, fmt.Sprintf(client.t("Certfp: %s"), session.certfp))
} }
for _, capStr := range session.caps {
if capStr != "" {
service.Notice(rb, fmt.Sprintf(client.t("IRCv3 CAPs: %s"), capStr))
}
}
} }
} }