Compare commits
No commits in common. "88545e33086e3de3358d44ec7d4c74107c2f4fcf" and "327f695a40c851e2029da4cec7a07f1bafddad46" have entirely different histories.
88545e3308
...
327f695a40
@ -56,17 +56,17 @@ 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();
|
final from = JID.fromString(presence.from!).toBare().toString();
|
||||||
final lastHash = _lastHash[from];
|
final lastHash = _lastHash[from];
|
||||||
if (lastHash != hash) {
|
if (lastHash != hash) {
|
||||||
_lastHash[from.toString()] = hash;
|
_lastHash[from] = hash;
|
||||||
final vcardResult = await requestVCard(from);
|
final vcardResult = await requestVCard(from);
|
||||||
|
|
||||||
if (vcardResult.isType<VCard>()) {
|
if (vcardResult.isType<VCard>()) {
|
||||||
final binval = vcardResult.get<VCard>().photo?.binval;
|
final binval = vcardResult.get<VCard>().photo?.binval;
|
||||||
if (binval != null) {
|
if (binval != null) {
|
||||||
getAttributes().sendEvent(
|
getAttributes().sendEvent(
|
||||||
VCardAvatarUpdatedEvent(from, binval, hash),
|
VCardAvatarUpdatedEvent(JID.fromString(from), binval, hash),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.warning('No avatar data found');
|
logger.warning('No avatar data found');
|
||||||
@ -98,11 +98,11 @@ class VCardManager extends XmppManagerBase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Result<VCardError, VCard>> requestVCard(JID jid) async {
|
Future<Result<VCardError, VCard>> requestVCard(String jid) async {
|
||||||
final result = (await getAttributes().sendStanza(
|
final result = (await getAttributes().sendStanza(
|
||||||
StanzaDetails(
|
StanzaDetails(
|
||||||
Stanza.iq(
|
Stanza.iq(
|
||||||
to: jid.toString(),
|
to: jid,
|
||||||
type: 'get',
|
type: 'get',
|
||||||
children: [
|
children: [
|
||||||
XMLNode.xmlns(
|
XMLNode.xmlns(
|
||||||
|
@ -151,17 +151,14 @@ class SFSManager extends XmppManagerBase {
|
|||||||
// TODO(Unknown): Consider all sources?
|
// TODO(Unknown): Consider all sources?
|
||||||
final source = data.sources.first;
|
final source = data.sources.first;
|
||||||
OOBData? oob;
|
OOBData? oob;
|
||||||
MessageBodyData? body;
|
|
||||||
if (source is StatelessFileSharingUrlSource && data.includeOOBFallback) {
|
if (source is StatelessFileSharingUrlSource && data.includeOOBFallback) {
|
||||||
// SFS recommends OOB as a fallback
|
// SFS recommends OOB as a fallback
|
||||||
oob = OOBData(source.url, null);
|
oob = OOBData(source.url, null);
|
||||||
body = MessageBodyData(source.url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
data.toXML(),
|
data.toXML(),
|
||||||
if (oob != null) oob.toXML(),
|
if (oob != null) oob.toXML(),
|
||||||
if (body != null) body.toXML(),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user