feat(contacts): PROFILE_COSMETIC_UPDATE on friends mesh
Friends receive profile cosmetics gossip via broadcastProfileCosmetic and profile-cosmetic events for platform peer cache updates. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -312,6 +312,12 @@ class PearcordContacts extends EventEmitter {
|
|||||||
return this._lastSelfPresence
|
return this._lastSelfPresence
|
||||||
}
|
}
|
||||||
|
|
||||||
|
broadcastProfileCosmetic (payload) {
|
||||||
|
if (!payload?.userId || !this._meshJoined) return null
|
||||||
|
broadcastContactsGossip(this, RPC.PROFILE_COSMETIC_UPDATE, payload)
|
||||||
|
return payload
|
||||||
|
}
|
||||||
|
|
||||||
getFriendPresenceMap () {
|
getFriendPresenceMap () {
|
||||||
const out = {}
|
const out = {}
|
||||||
for (const [uid, row] of this._friendPresence) {
|
for (const [uid, row] of this._friendPresence) {
|
||||||
@@ -325,6 +331,10 @@ class PearcordContacts extends EventEmitter {
|
|||||||
this.ingestFriendPresence(payload)
|
this.ingestFriendPresence(payload)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (method === RPC.PROFILE_COSMETIC_UPDATE) {
|
||||||
|
this.emit('profile-cosmetic', payload)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (method === RPC.CONTACT_REQUEST) {
|
if (method === RPC.CONTACT_REQUEST) {
|
||||||
this.ingestRequest(payload).catch(() => {})
|
this.ingestRequest(payload).catch(() => {})
|
||||||
} else if (method === RPC.CONTACT_ACCEPT) {
|
} else if (method === RPC.CONTACT_ACCEPT) {
|
||||||
@@ -342,6 +352,10 @@ class PearcordContacts extends EventEmitter {
|
|||||||
|
|
||||||
async simulateGossip (method, payload) {
|
async simulateGossip (method, payload) {
|
||||||
if (method === RPC.PRESENCE_UPDATE) return this.ingestFriendPresence(payload)
|
if (method === RPC.PRESENCE_UPDATE) return this.ingestFriendPresence(payload)
|
||||||
|
if (method === RPC.PROFILE_COSMETIC_UPDATE) {
|
||||||
|
this.emit('profile-cosmetic', payload)
|
||||||
|
return payload
|
||||||
|
}
|
||||||
if (method === RPC.CONTACT_REQUEST) return this.ingestRequest(payload)
|
if (method === RPC.CONTACT_REQUEST) return this.ingestRequest(payload)
|
||||||
if (method === RPC.CONTACT_ACCEPT) return this.ingestAccept(payload)
|
if (method === RPC.CONTACT_ACCEPT) return this.ingestAccept(payload)
|
||||||
if (method === RPC.CONTACT_DECLINE) return this.ingestDecline(payload)
|
if (method === RPC.CONTACT_DECLINE) return this.ingestDecline(payload)
|
||||||
|
|||||||
Reference in New Issue
Block a user