Files
moxxy/lib/xmpp/xeps/xep_0352.dart

45 lines
1.0 KiB
Dart

import "package:moxxyv2/xmpp/managers/base.dart";
import "package:moxxyv2/xmpp/managers/namespaces.dart";
import "package:moxxyv2/xmpp/stringxml.dart";
import "package:moxxyv2/xmpp/namespaces.dart";
class CSIActiveNonza extends XMLNode {
CSIActiveNonza() : super(
tag: "active",
attributes: {
"xmlns": csiXmlns
}
);
}
class CSIInactiveNonza extends XMLNode {
CSIInactiveNonza() : super(
tag: "inactive",
attributes: {
"xmlns": csiXmlns
}
);
}
// TODO: Remember the CSI state in case we resume a stream
class CSIManager extends XmppManagerBase {
@override
String getId() => csiManager;
/// Tells the server to top optimizing traffic
void setActive() {
final attrs = getAttributes();
if (attrs.isStreamFeatureSupported(csiXmlns)) {
attrs.sendNonza(CSIActiveNonza());
}
}
/// Tells the server to optimize traffic following XEP-0352
void setInactive() {
final attrs = getAttributes();
if (attrs.isStreamFeatureSupported(csiXmlns)) {
attrs.sendNonza(CSIInactiveNonza());
}
}
}