diff options
Diffstat (limited to 'xmpp-vala')
-rw-r--r-- | xmpp-vala/src/core/xmpp_stream.vala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala index 18256119..38b4abb4 100644 --- a/xmpp-vala/src/core/xmpp_stream.vala +++ b/xmpp-vala/src/core/xmpp_stream.vala @@ -129,9 +129,7 @@ public class XmppStream { public T? get_module<T>(ModuleIdentity<T>? identity) { if (identity == null) return null; foreach (var module in modules) { - if (module.get_ns() == identity.ns && module.get_id() == identity.id) { - return module; - } + if (identity.matches(module)) return identity.cast(module); } return null; } @@ -244,6 +242,10 @@ public class ModuleIdentity<T> : Object { public T? cast(XmppStreamModule module) { return (T?) module; } + + public bool matches(XmppStreamModule module) { + return module.get_ns() == ns && module.get_id() == id; + } } public abstract class XmppStreamModule : Object { |