fix(xep): Do not automatically request vCards
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
5bd2466c54
commit
814f99436b
@ -22,6 +22,7 @@
|
||||
- *BREAKING*: Rename `UserAvatarManager`'s `getUserAvatar` to `getUserAvatarData`. It now also requires the id of the avatar to fetch
|
||||
- *BREAKING*: `UserAvatarManager`'s `getAvatarId` with `getLatestMetadata`.
|
||||
- The `PubSubManager` now supports PubSub's `max_items` in `getItems`.
|
||||
- *BREAKING*: `vCardManager`'s `VCardAvatarUpdatedEvent` no longer automatically requests the newest VCard avatar.
|
||||
|
||||
## 0.3.1
|
||||
|
||||
|
@ -184,16 +184,12 @@ class UserAvatarUpdatedEvent extends XmppEvent {
|
||||
class VCardAvatarUpdatedEvent extends XmppEvent {
|
||||
VCardAvatarUpdatedEvent(
|
||||
this.jid,
|
||||
this.base64,
|
||||
this.hash,
|
||||
);
|
||||
|
||||
/// The JID of the entity that updated their avatar.
|
||||
final JID jid;
|
||||
|
||||
/// The base64-encoded avatar data.
|
||||
final String base64;
|
||||
|
||||
/// The SHA-1 hash of the avatar.
|
||||
final String hash;
|
||||
}
|
||||
|
@ -129,7 +129,8 @@ class MUCManager extends XmppManagerBase {
|
||||
);
|
||||
return Result(roomInformation);
|
||||
} catch (e) {
|
||||
return Result(InvalidDiscoInfoResponse);
|
||||
logger.warning('Invalid disco information: $e');
|
||||
return Result(InvalidDiscoInfoResponse());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,26 +56,13 @@ class VCardManager extends XmppManagerBase {
|
||||
final x = presence.firstTag('x', xmlns: vCardTempUpdate)!;
|
||||
final hash = x.firstTag('photo')!.innerText();
|
||||
|
||||
final from = JID.fromString(presence.from!).toBare();
|
||||
final lastHash = _lastHash[from];
|
||||
if (lastHash != hash) {
|
||||
_lastHash[from.toString()] = hash;
|
||||
final vcardResult = await requestVCard(from);
|
||||
|
||||
if (vcardResult.isType<VCard>()) {
|
||||
final binval = vcardResult.get<VCard>().photo?.binval;
|
||||
if (binval != null) {
|
||||
getAttributes().sendEvent(
|
||||
VCardAvatarUpdatedEvent(from, binval, hash),
|
||||
);
|
||||
} else {
|
||||
logger.warning('No avatar data found');
|
||||
}
|
||||
} else {
|
||||
logger.warning('Failed to retrieve vCard for $from');
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(Unknown): Use the presence manager interface.
|
||||
getAttributes().sendEvent(
|
||||
VCardAvatarUpdatedEvent(
|
||||
JID.fromString(presence.from!),
|
||||
hash,
|
||||
),
|
||||
);
|
||||
return state..done = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user