3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 11:12:44 +01:00

Merge pull request #1677 from ajaspers/email

Show email in NS INFO when user has permission.
This commit is contained in:
Shivaram Lingamneni 2021-06-13 00:49:33 -04:00 committed by GitHub
commit 5d4a12f008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -1259,6 +1259,9 @@ func (am *AccountManager) deserializeRawAccount(raw rawClientAccount, cfName str
return
}
result.AdditionalNicks = unmarshalReservedNicks(raw.AdditionalNicks)
if strings.HasPrefix(raw.Callback, "mailto:") {
result.Email = strings.TrimPrefix(raw.Callback, "mailto:")
}
result.Verified = raw.Verified
if raw.VHost != "" {
e := json.Unmarshal([]byte(raw.VHost), &result.VHost)
@ -2032,6 +2035,7 @@ type ClientAccount struct {
Name string
NameCasefolded string
RegisteredAt time.Time
Email string
Credentials AccountCredentials
Verified bool
Suspended *AccountSuspension

View File

@ -813,6 +813,13 @@ func nsInfoHandler(service *ircService, server *Server, client *Client, command
service.Notice(rb, fmt.Sprintf(client.t("Account: %s"), account.Name))
registeredAt := account.RegisteredAt.Format(time.RFC1123)
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
for _, nick := range account.AdditionalNicks {
service.Notice(rb, fmt.Sprintf(client.t("Additional grouped nick: %s"), nick))