Skip to content

Commit

Permalink
Merge pull request #2210 from slingamn/rearrange
Browse files Browse the repository at this point in the history
tweaks to logging and NS PUSH LIST
  • Loading branch information
slingamn authored Jan 16, 2025
2 parents ab2d842 + 799e1b1 commit 2a79f64
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion irc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ func (client *Client) run(session *Session) {
if err == errInvalidUtf8 {
invalidUtf8 = true // handle as normal, including labeling
} else if err != nil {
client.server.logger.Debug("connect-ip", "read error from client", err.Error())
client.server.logger.Debug("connect-ip", session.connID, "read error from client", err.Error())
var quitMessage string
switch err {
case ircreader.ErrReadQ:
Expand Down
11 changes: 7 additions & 4 deletions irc/nickserv.go
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,9 @@ func nsClientsListHandler(service *ircService, server *Server, client *Client, p
if session.deviceID != "" {
service.Notice(rb, fmt.Sprintf(client.t("Device ID: %s"), session.deviceID))
}
if hasPrivs {
service.Notice(rb, fmt.Sprintf(client.t("Debug log ID: %s"), session.connID))
}
service.Notice(rb, fmt.Sprintf(client.t("IP address: %s"), session.ip.String()))
service.Notice(rb, fmt.Sprintf(client.t("Hostname: %s"), session.hostname))
if hasPrivs {
Expand All @@ -1339,9 +1342,6 @@ func nsClientsListHandler(service *ircService, server *Server, client *Client, p
service.Notice(rb, fmt.Sprintf(client.t("IRCv3 CAPs: %s"), capStr))
}
}
if hasPrivs {
service.Notice(rb, fmt.Sprintf(client.t("Debug log ID: %s"), session.connID))
}
}
}

Expand Down Expand Up @@ -1686,7 +1686,10 @@ func nsPushHandler(service *ircService, server *Server, client *Client, command
subscriptions := target.getPushSubscriptions()
service.Notice(rb, fmt.Sprintf(client.t("Nickname %[1]s has %[2]d push subscription(s)"), target.Nick(), len(subscriptions)))
for i, subscription := range subscriptions {
service.Notice(rb, fmt.Sprintf("%d: %s", i, subscription.Endpoint))
service.Notice(rb, fmt.Sprintf(client.t("Subscription %d:"), i+1))
service.Notice(rb, fmt.Sprintf(client.t("Endpoint: %s"), subscription.Endpoint))
service.Notice(rb, fmt.Sprintf(client.t("Last renewal: %s"), subscription.LastRefresh.Format(time.RFC1123)))
service.Notice(rb, fmt.Sprintf(client.t("Last push: %s"), subscription.LastSuccess.Format(time.RFC1123)))
}
case "DELETE":
if len(params) < 2 {
Expand Down
1 change: 0 additions & 1 deletion irc/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ func serviceRunCommand(service *ircService, server *Server, client *Client, cmd
return
}

server.logger.Debug("services", fmt.Sprintf("Client %s ran %s command %s", client.Nick(), service.Name, commandName))
if commandName == "help" {
serviceHelpHandler(service, server, client, params, rb)
} else {
Expand Down

0 comments on commit 2a79f64

Please sign in to comment.