Selaa lähdekoodia

restore transition mechanism

tags/v2.2.0-rc1
Shivaram Lingamneni 3 vuotta sitten
vanhempi
commit
77184c1625
2 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 5
    0
      irc/client_lookup_set.go
  2. 7
    0
      irc/getters.go

+ 5
- 0
irc/client_lookup_set.go Näytä tiedosto

@@ -122,6 +122,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
122 122
 	accountName := client.accountName
123 123
 	settings := client.accountSettings
124 124
 	registered := client.registered
125
+	realname := client.realname
125 126
 	client.stateMutex.RUnlock()
126 127
 
127 128
 	// recompute always-on status, because client.alwaysOn is not set for unregistered clients
@@ -224,6 +225,10 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
224 225
 			client.server.stats.AddRegistered(invisible, operator)
225 226
 		}
226 227
 		session.autoreplayMissedSince = lastSeen
228
+		// TODO: transition mechanism for #1065, clean this up eventually:
229
+		if currentClient.Realname() == "" {
230
+			currentClient.SetRealname(realname)
231
+		}
227 232
 		// successful reattach!
228 233
 		return newNick, nil, back
229 234
 	} else if currentClient == client && currentClient.Nick() == newNick {

+ 7
- 0
irc/getters.go Näytä tiedosto

@@ -430,6 +430,13 @@ func (client *Client) UpdateActive(session *Session) {
430 430
 	session.lastActive = now
431 431
 }
432 432
 
433
+func (client *Client) Realname() string {
434
+	client.stateMutex.RLock()
435
+	result := client.realname
436
+	client.stateMutex.RUnlock()
437
+	return result
438
+}
439
+
433 440
 func (channel *Channel) Name() string {
434 441
 	channel.stateMutex.RLock()
435 442
 	defer channel.stateMutex.RUnlock()

Loading…
Peruuta
Tallenna