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*: Rename `UserAvatarManager`'s `getUserAvatar` to `getUserAvatarData`. It now also requires the id of the avatar to fetch
|
||||||
- *BREAKING*: `UserAvatarManager`'s `getAvatarId` with `getLatestMetadata`.
|
- *BREAKING*: `UserAvatarManager`'s `getAvatarId` with `getLatestMetadata`.
|
||||||
- The `PubSubManager` now supports PubSub's `max_items` in `getItems`.
|
- 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
|
## 0.3.1
|
||||||
|
|
||||||
|
@ -184,16 +184,12 @@ class UserAvatarUpdatedEvent extends XmppEvent {
|
|||||||
class VCardAvatarUpdatedEvent extends XmppEvent {
|
class VCardAvatarUpdatedEvent extends XmppEvent {
|
||||||
VCardAvatarUpdatedEvent(
|
VCardAvatarUpdatedEvent(
|
||||||
this.jid,
|
this.jid,
|
||||||
this.base64,
|
|
||||||
this.hash,
|
this.hash,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// The JID of the entity that updated their avatar.
|
/// The JID of the entity that updated their avatar.
|
||||||
final JID jid;
|
final JID jid;
|
||||||
|
|
||||||
/// The base64-encoded avatar data.
|
|
||||||
final String base64;
|
|
||||||
|
|
||||||
/// The SHA-1 hash of the avatar.
|
/// The SHA-1 hash of the avatar.
|
||||||
final String hash;
|
final String hash;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,8 @@ class MUCManager extends XmppManagerBase {
|
|||||||
);
|
);
|
||||||
return Result(roomInformation);
|
return Result(roomInformation);
|
||||||
} catch (e) {
|
} 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 x = presence.firstTag('x', xmlns: vCardTempUpdate)!;
|
||||||
final hash = x.firstTag('photo')!.innerText();
|
final hash = x.firstTag('photo')!.innerText();
|
||||||
|
|
||||||
final from = JID.fromString(presence.from!).toBare();
|
// TODO(Unknown): Use the presence manager interface.
|
||||||
final lastHash = _lastHash[from];
|
getAttributes().sendEvent(
|
||||||
if (lastHash != hash) {
|
VCardAvatarUpdatedEvent(
|
||||||
_lastHash[from.toString()] = hash;
|
JID.fromString(presence.from!),
|
||||||
final vcardResult = await requestVCard(from);
|
hash,
|
||||||
|
),
|
||||||
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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return state..done = true;
|
return state..done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user