Explorar el Código

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.
tags/v2.8.0-rc1
Alex Jaspersen hace 3 años
padre
commit
1d832ee1bc
Se han modificado 2 ficheros con 11 adiciones y 0 borrados
  1. 4
    0
      irc/accounts.go
  2. 7
    0
      irc/nickserv.go

+ 4
- 0
irc/accounts.go Ver fichero

@@ -1259,6 +1259,9 @@ func (am *AccountManager) deserializeRawAccount(raw rawClientAccount, cfName str
1259 1259
 		return
1260 1260
 	}
1261 1261
 	result.AdditionalNicks = unmarshalReservedNicks(raw.AdditionalNicks)
1262
+	if strings.HasPrefix(raw.Callback, "mailto:") {
1263
+		result.Email = strings.TrimPrefix(raw.Callback, "mailto:")
1264
+	}
1262 1265
 	result.Verified = raw.Verified
1263 1266
 	if raw.VHost != "" {
1264 1267
 		e := json.Unmarshal([]byte(raw.VHost), &result.VHost)
@@ -2032,6 +2035,7 @@ type ClientAccount struct {
2032 2035
 	Name            string
2033 2036
 	NameCasefolded  string
2034 2037
 	RegisteredAt    time.Time
2038
+	Email           string
2035 2039
 	Credentials     AccountCredentials
2036 2040
 	Verified        bool
2037 2041
 	Suspended       *AccountSuspension

+ 7
- 0
irc/nickserv.go Ver fichero

@@ -813,6 +813,13 @@ func nsInfoHandler(service *ircService, server *Server, client *Client, command
813 813
 	service.Notice(rb, fmt.Sprintf(client.t("Account: %s"), account.Name))
814 814
 	registeredAt := account.RegisteredAt.Format(time.RFC1123)
815 815
 	service.Notice(rb, fmt.Sprintf(client.t("Registered at: %s"), registeredAt))
816
+
817
+	if account.Name == client.AccountName() || client.HasRoleCapabs("accreg") {
818
+		if account.Email != "" {
819
+			service.Notice(rb, fmt.Sprintf(client.t("Email address: %s"), account.Email))
820
+		}
821
+	}
822
+
816 823
 	// TODO nicer formatting for this
817 824
 	for _, nick := range account.AdditionalNicks {
818 825
 		service.Notice(rb, fmt.Sprintf(client.t("Additional grouped nick: %s"), nick))

Loading…
Cancelar
Guardar