mirror of
https://github.com/ergochat/ergo.git
synced 2025-01-11 04:32:39 +01:00
Show email in NS INFO when user has permission.
Users logged into an account can see their own email. Opers with the accreg capability can see all users.
This commit is contained in:
parent
36703580fc
commit
1d832ee1bc
@ -1259,6 +1259,9 @@ func (am *AccountManager) deserializeRawAccount(raw rawClientAccount, cfName str
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result.AdditionalNicks = unmarshalReservedNicks(raw.AdditionalNicks)
|
result.AdditionalNicks = unmarshalReservedNicks(raw.AdditionalNicks)
|
||||||
|
if strings.HasPrefix(raw.Callback, "mailto:") {
|
||||||
|
result.Email = strings.TrimPrefix(raw.Callback, "mailto:")
|
||||||
|
}
|
||||||
result.Verified = raw.Verified
|
result.Verified = raw.Verified
|
||||||
if raw.VHost != "" {
|
if raw.VHost != "" {
|
||||||
e := json.Unmarshal([]byte(raw.VHost), &result.VHost)
|
e := json.Unmarshal([]byte(raw.VHost), &result.VHost)
|
||||||
@ -2032,6 +2035,7 @@ type ClientAccount struct {
|
|||||||
Name string
|
Name string
|
||||||
NameCasefolded string
|
NameCasefolded string
|
||||||
RegisteredAt time.Time
|
RegisteredAt time.Time
|
||||||
|
Email string
|
||||||
Credentials AccountCredentials
|
Credentials AccountCredentials
|
||||||
Verified bool
|
Verified bool
|
||||||
Suspended *AccountSuspension
|
Suspended *AccountSuspension
|
||||||
|
@ -813,6 +813,13 @@ func nsInfoHandler(service *ircService, server *Server, client *Client, command
|
|||||||
service.Notice(rb, fmt.Sprintf(client.t("Account: %s"), account.Name))
|
service.Notice(rb, fmt.Sprintf(client.t("Account: %s"), account.Name))
|
||||||
registeredAt := account.RegisteredAt.Format(time.RFC1123)
|
registeredAt := account.RegisteredAt.Format(time.RFC1123)
|
||||||
service.Notice(rb, fmt.Sprintf(client.t("Registered at: %s"), registeredAt))
|
service.Notice(rb, fmt.Sprintf(client.t("Registered at: %s"), registeredAt))
|
||||||
|
|
||||||
|
if account.Name == client.AccountName() || client.HasRoleCapabs("accreg") {
|
||||||
|
if account.Email != "" {
|
||||||
|
service.Notice(rb, fmt.Sprintf(client.t("Email address: %s"), account.Email))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO nicer formatting for this
|
// TODO nicer formatting for this
|
||||||
for _, nick := range account.AdditionalNicks {
|
for _, nick := range account.AdditionalNicks {
|
||||||
service.Notice(rb, fmt.Sprintf(client.t("Additional grouped nick: %s"), nick))
|
service.Notice(rb, fmt.Sprintf(client.t("Additional grouped nick: %s"), nick))
|
||||||
|
Loading…
Reference in New Issue
Block a user