|
@@ -39,7 +39,8 @@ const (
|
39
|
39
|
keyAccountChannels = "account.channels %s" // channels registered to the account
|
40
|
40
|
keyAccountJoinedChannels = "account.joinedto %s" // channels a persistent client has joined
|
41
|
41
|
keyAccountLastSeen = "account.lastseen %s"
|
42
|
|
- keyAccountModes = "account.modes %s" // user modes for the always-on client as a string
|
|
42
|
+ keyAccountModes = "account.modes %s" // user modes for the always-on client as a string
|
|
43
|
+ keyAccountRealname = "account.realname %s" // client realname stored as string
|
43
|
44
|
|
44
|
45
|
keyVHostQueueAcctToId = "vhostQueue %s"
|
45
|
46
|
vhostRequestIdx = "vhostQueue"
|
|
@@ -127,7 +128,13 @@ func (am *AccountManager) createAlwaysOnClients(config *Config) {
|
127
|
128
|
account, err := am.LoadAccount(accountName)
|
128
|
129
|
if err == nil && account.Verified &&
|
129
|
130
|
persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, account.Settings.AlwaysOn) {
|
130
|
|
- am.server.AddAlwaysOnClient(account, am.loadChannels(accountName), am.loadLastSeen(accountName), am.loadModes(accountName))
|
|
131
|
+ am.server.AddAlwaysOnClient(
|
|
132
|
+ account,
|
|
133
|
+ am.loadChannels(accountName),
|
|
134
|
+ am.loadLastSeen(accountName),
|
|
135
|
+ am.loadModes(accountName),
|
|
136
|
+ am.loadRealname(accountName),
|
|
137
|
+ )
|
131
|
138
|
}
|
132
|
139
|
}
|
133
|
140
|
}
|
|
@@ -650,6 +657,30 @@ func (am *AccountManager) loadLastSeen(account string) (lastSeen map[string]time
|
650
|
657
|
return
|
651
|
658
|
}
|
652
|
659
|
|
|
660
|
+func (am *AccountManager) saveRealname(account string, realname string) {
|
|
661
|
+ key := fmt.Sprintf(keyAccountRealname, account)
|
|
662
|
+ am.server.store.Update(func(tx *buntdb.Tx) error {
|
|
663
|
+ if realname != "" {
|
|
664
|
+ tx.Set(key, realname, nil)
|
|
665
|
+ } else {
|
|
666
|
+ tx.Delete(key)
|
|
667
|
+ }
|
|
668
|
+ return nil
|
|
669
|
+ })
|
|
670
|
+}
|
|
671
|
+
|
|
672
|
+func (am *AccountManager) loadRealname(account string) (realname string) {
|
|
673
|
+ key := fmt.Sprintf(keyAccountRealname, account)
|
|
674
|
+ am.server.store.Update(func(tx *buntdb.Tx) error {
|
|
675
|
+ realname, _ = tx.Get(key)
|
|
676
|
+ return nil
|
|
677
|
+ })
|
|
678
|
+ if realname == "" {
|
|
679
|
+ return ""
|
|
680
|
+ }
|
|
681
|
+ return
|
|
682
|
+}
|
|
683
|
+
|
653
|
684
|
func (am *AccountManager) addRemoveCertfp(account, certfp string, add bool, hasPrivs bool) (err error) {
|
654
|
685
|
certfp, err = utils.NormalizeCertfp(certfp)
|
655
|
686
|
if err != nil {
|
|
@@ -874,6 +905,9 @@ func (am *AccountManager) Verify(client *Client, account string, code string) er
|
874
|
905
|
am.server.RandomlyRename(currentClient)
|
875
|
906
|
}
|
876
|
907
|
}
|
|
908
|
+ if client.AlwaysOn() {
|
|
909
|
+ client.markDirty(IncludeRealname)
|
|
910
|
+ }
|
877
|
911
|
return nil
|
878
|
912
|
}
|
879
|
913
|
|