diff options
Diffstat (limited to 'plugins/http-files/src/upload_stream_module.vala')
-rw-r--r-- | plugins/http-files/src/upload_stream_module.vala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/http-files/src/upload_stream_module.vala b/plugins/http-files/src/upload_stream_module.vala index f4a4a428..4835f268 100644 --- a/plugins/http-files/src/upload_stream_module.vala +++ b/plugins/http-files/src/upload_stream_module.vala @@ -11,6 +11,7 @@ public class UploadStreamModule : XmppStreamModule { public static Xmpp.ModuleIdentity<UploadStreamModule> IDENTITY = new Xmpp.ModuleIdentity<UploadStreamModule>(NS_URI, "0363_http_file_upload"); public signal void feature_available(XmppStream stream, long max_file_size); + public signal void received_url(XmppStream stream, MessageStanza message); public delegate void OnUploadOk(XmppStream stream, string url_down); public delegate void OnError(XmppStream stream, string error); @@ -159,6 +160,22 @@ public class UploadStreamModule : XmppStreamModule { } } +public class ReceivedPipelineListener : StanzaListener<MessageStanza> { + + private const string[] after_actions_const = {"EXTRACT_MESSAGE_2"}; + + public override string action_group { get { return "EXTRACT_MESSAGE_2"; } } + public override string[] after_actions { get { return after_actions_const; } } + + public override async bool run(XmppStream stream, MessageStanza message) { + string? oob_url = OutOfBandData.get_url_from_message(message); + if (oob_url != null && oob_url == message.body) { + stream.get_module(UploadStreamModule.IDENTITY).received_url(stream, message); + } + return true; + } +} + public class Flag : XmppStreamFlag { public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "service_discovery"); |