xmpp-vala: Remove require-functions

This commit is contained in:
fiaxh 2017-08-12 23:27:20 +02:00
parent a59f728bdd
commit b0264b3e00
26 changed files with 2 additions and 130 deletions

View file

@ -75,8 +75,6 @@ public class UploadStreamModule : XmppStreamModule {
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
ServiceDiscovery.Module.require(stream);
stream.stream_negotiated.connect(query_availability);
}
@ -84,10 +82,6 @@ public class UploadStreamModule : XmppStreamModule {
stream.get_module(Bind.Module.IDENTITY).bound_to_resource.disconnect(query_availability);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new ChatMarkers.Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -112,8 +112,6 @@ public class StreamModule : XmppStreamModule {
}
public override void attach(XmppStream stream) {
Message.Module.require(stream);
Pubsub.Module.require(stream);
if (!Plugin.ensure_context()) return;
this.store = Plugin.get_context().create_store();

View file

@ -49,10 +49,8 @@ namespace Dino.Plugins.OpenPgp {
}
public override void attach(XmppStream stream) {
Presence.Module.require(stream);
stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.connect(on_pre_send_presence_stanza);
Message.Module.require(stream);
stream.get_module(Message.Module.IDENTITY).pre_received_message.connect(on_pre_received_message);
stream.add_flag(new Flag());
}

View file

@ -41,7 +41,6 @@ namespace Xmpp.Bind {
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
stream.received_features_node.connect(this.received_features_node);
}
@ -49,10 +48,6 @@ namespace Xmpp.Bind {
stream.received_features_node.disconnect(this.received_features_node);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module(""));
}
public override bool mandatory_outstanding(XmppStream stream) {
return !stream.has_flag(Flag.IDENTITY) || !stream.get_flag(Flag.IDENTITY).finished;
}

View file

@ -38,10 +38,6 @@ namespace Xmpp.Iq {
stream.received_iq_stanza.disconnect(on_received_iq_stanza);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Iq.Module());
}
public override bool mandatory_outstanding(XmppStream stream) { return false; }
public override bool negotiation_active(XmppStream stream) { return false; }

View file

@ -26,12 +26,7 @@ namespace Xmpp.Message {
received_message(stream, message);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Message.Module());
}
public override void attach(XmppStream stream) {
Bind.Module.require(stream);
stream.received_message_stanza.connect(received_message_stanza);
}

View file

@ -95,10 +95,6 @@ namespace Xmpp.Presence {
}
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Presence.Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
}

View file

@ -65,14 +65,8 @@ public class Module : XmppStreamModule, Iq.Handler {
public void on_iq_get(XmppStream stream, Iq.Stanza iq) { }
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, this);
Presence.Module.require(stream);
stream.get_module(Presence.Module.IDENTITY).initial_presence_sent.connect(roster_get);
stream.add_flag(new Flag());
}

View file

@ -16,7 +16,6 @@ public class VersioningModule : XmppStreamModule {
}
public override void attach(XmppStream stream) {
Module.require(stream);
stream.get_module(Module.IDENTITY).pre_get_roster.connect(on_pre_get_roster);
stream.get_module(Module.IDENTITY).received_roster.connect(on_received_roster);
stream.get_module(Module.IDENTITY).item_updated.connect(on_item_updated);

View file

@ -88,10 +88,6 @@ namespace Xmpp.PlainSasl {
}
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stderr.printf("PlainSaslModule required but not attached!\n");
}
private static uchar[] get_plain_bytes(string name_s, string password_s) {
var name = name_s.to_utf8();
var password = password_s.to_utf8();

View file

@ -8,7 +8,6 @@ public class Module : XmppStreamNegotiationModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "session");
public override void attach(XmppStream stream) {
Bind.Module.require(stream);
stream.get_module(Bind.Module.IDENTITY).bound_to_resource.connect(on_bound_resource);
}
@ -16,10 +15,6 @@ public class Module : XmppStreamNegotiationModule {
stream.get_module(Bind.Module.IDENTITY).bound_to_resource.disconnect(on_bound_resource);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override bool mandatory_outstanding(XmppStream stream) { return false; }
public override bool negotiation_active(XmppStream stream) {

View file

@ -71,7 +71,6 @@ public class Module : XmppStreamModule, Iq.Handler {
public void on_iq_set(XmppStream stream, Iq.Stanza iq) { }
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI_INFO, this);
stream.add_flag(new Flag());
add_feature(stream, NS_URI_INFO);

View file

@ -162,9 +162,7 @@ public class Module : XmppStreamModule {
public override void attach(XmppStream stream) {
stream.add_flag(new Muc.Flag());
Message.Module.require(stream);
stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
Presence.Module.require(stream);
stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
stream.get_module(Presence.Module.IDENTITY).received_available.connect(on_received_available);
stream.get_module(Presence.Module.IDENTITY).received_unavailable.connect(on_received_unavailable);
@ -186,11 +184,6 @@ public class Module : XmppStreamModule {
stream.get_module(Presence.Module.IDENTITY).received_unavailable.disconnect(on_received_unavailable);
}
public static void require(XmppStream stream) {
Presence.Module.require(stream);
if (stream.get_module(IDENTITY) == null) stream.add_module(new Muc.Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -70,10 +70,6 @@ public class Module : XmppStreamModule {
public override void detach(XmppStream stream) { }
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -26,16 +26,10 @@ namespace Xmpp.Xep.PrivateXmlStorage {
});
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
}
public override void attach(XmppStream stream) { }
public override void detach(XmppStream stream) { }
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new PrivateXmlStorage.Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
}

View file

@ -16,8 +16,6 @@ public class Module : XmppStreamModule {
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
Presence.Module.require(stream);
stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
}
@ -25,10 +23,6 @@ public class Module : XmppStreamModule {
stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stderr.printf("VCardModule required but not attached!\n"); ;
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -41,9 +41,6 @@ namespace Xmpp.Xep.Pubsub {
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
Message.Module.require(stream);
ServiceDiscovery.Module.require(stream);
stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
}
@ -51,10 +48,6 @@ namespace Xmpp.Xep.Pubsub {
stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -34,7 +34,6 @@ namespace Xmpp.Xep.UserAvatars {
}
public override void attach(XmppStream stream) {
Pubsub.Module.require(stream);
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI_METADATA, on_pupsub_event);
}
@ -51,10 +50,6 @@ namespace Xmpp.Xep.UserAvatars {
}
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stderr.printf("UserAvatarsModule required but not attached!\n");
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -30,7 +30,6 @@ public class Module : XmppStreamModule {
}
public override void attach(XmppStream stream) {
ServiceDiscovery.Module.require(stream);
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
stream.get_module(Message.Module.IDENTITY).pre_send_message.connect(on_pre_send_message);
stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
@ -41,10 +40,6 @@ public class Module : XmppStreamModule {
stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module()); ;
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -23,8 +23,6 @@ namespace Xmpp.Xep.EntityCapabilities {
}
public override void attach(XmppStream stream) {
ServiceDiscovery.Module.require(stream);
Presence.Module.require(stream);
stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.connect(on_pre_send_presence_stanza);
stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
@ -35,10 +33,6 @@ namespace Xmpp.Xep.EntityCapabilities {
stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stderr.printf("EntityCapabilitiesModule required but not attached!\n");
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -20,9 +20,6 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
}
public override void attach(XmppStream stream) {
ServiceDiscovery.Module.require(stream);
Message.Module.require(stream);
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
stream.get_module(Message.Module.IDENTITY).received_message.connect(received_message);
stream.get_module(Message.Module.IDENTITY).pre_send_message.connect(pre_send_message);
@ -33,10 +30,6 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
stream.get_module(Message.Module.IDENTITY).pre_send_message.disconnect(pre_send_message);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -16,16 +16,11 @@ namespace Xmpp.Xep.Ping {
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, new IqHandlerImpl());
}
public override void detach(XmppStream stream) { }
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -28,10 +28,6 @@ namespace Xmpp.Xep.DelayedDelivery {
public override void detach(XmppStream stream) { }
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -17,11 +17,6 @@ namespace Xmpp.Xep.MessageCarbons {
}
public override void attach(XmppStream stream) {
Bind.Module.require(stream);
Iq.Module.require(stream);
Message.Module.require(stream);
ServiceDiscovery.Module.require(stream);
stream.stream_negotiated.connect(enable);
stream.get_module(Message.Module.IDENTITY).pre_received_message.connect(pre_received_message);
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
@ -32,10 +27,6 @@ namespace Xmpp.Xep.MessageCarbons {
stream.get_module(Message.Module.IDENTITY).pre_received_message.disconnect(pre_received_message);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -30,10 +30,6 @@ public class Module : XmppStreamModule {
}
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
Message.Module.require(stream);
ServiceDiscovery.Module.require(stream);
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
stream.get_module(Message.Module.IDENTITY).pre_send_message.connect(on_pre_send_message);
stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
@ -44,10 +40,6 @@ public class Module : XmppStreamModule {
stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
}
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }

View file

@ -13,10 +13,6 @@ public class Module : XmppStreamNegotiationModule {
public override void detach(XmppStream stream) { }
public static void require(XmppStream stream) {
if (stream.get_module(IDENTITY) == null) stream.add_module(new Module());
}
public override bool mandatory_outstanding(XmppStream stream) { return false; }
public override bool negotiation_active(XmppStream stream) { return false; }
public override string get_ns() { return IDENTITY.ns; }