From 782ae4c049e2b6fab13d7453cbb0e74610e7d200 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Fri, 12 Jan 2018 21:03:09 +0100 Subject: Move Jid class to xmpp-vala, partially refactor namespace --- xmpp-vala/src/module/message/module.vala | 20 ++++++++++---------- xmpp-vala/src/module/message/stanza.vala | 10 ++++------ 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'xmpp-vala/src/module/message') diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala index afa3f005..cfb1d750 100644 --- a/xmpp-vala/src/module/message/module.vala +++ b/xmpp-vala/src/module/message/module.vala @@ -1,27 +1,27 @@ using Gee; -using Xmpp.Core; -namespace Xmpp.Message { + +namespace Xmpp { private const string NS_URI = "jabber:client"; - public class Module : XmppStreamModule { - public static ModuleIdentity IDENTITY = new ModuleIdentity(NS_URI, "message_module"); + public class MessageModule : XmppStreamModule { + public static ModuleIdentity IDENTITY = new ModuleIdentity(NS_URI, "message_module"); - public StanzaListenerHolder received_pipeline = new StanzaListenerHolder(); - public StanzaListenerHolder send_pipeline = new StanzaListenerHolder(); + public StanzaListenerHolder received_pipeline = new StanzaListenerHolder(); + public StanzaListenerHolder send_pipeline = new StanzaListenerHolder(); - public signal void pre_received_message(XmppStream stream, Message.Stanza message); - public signal void received_message(XmppStream stream, Message.Stanza message); + public signal void pre_received_message(XmppStream stream, MessageStanza message); + public signal void received_message(XmppStream stream, MessageStanza message); - public void send_message(XmppStream stream, Message.Stanza message) { + public void send_message(XmppStream stream, MessageStanza message) { send_pipeline.run.begin(stream, message, (obj, res) => { stream.write(message.stanza); }); } public async void received_message_stanza_async(XmppStream stream, StanzaNode node) { - Message.Stanza message = new Message.Stanza.from_stanza(node, stream.get_flag(Bind.Flag.IDENTITY).my_jid); + MessageStanza message = new MessageStanza.from_stanza(node, stream.get_flag(Bind.Flag.IDENTITY).my_jid); yield received_pipeline.run(stream, message); received_message(stream, message); } diff --git a/xmpp-vala/src/module/message/stanza.vala b/xmpp-vala/src/module/message/stanza.vala index 2b60c517..640f2796 100644 --- a/xmpp-vala/src/module/message/stanza.vala +++ b/xmpp-vala/src/module/message/stanza.vala @@ -1,10 +1,8 @@ using Gee; -using Xmpp.Core; +namespace Xmpp { -namespace Xmpp.Message { - -public class Stanza : Xmpp.Stanza { +public class MessageStanza : Xmpp.Stanza { public const string NODE_BODY = "body"; public const string NODE_SUBJECT = "subject"; public const string NODE_THREAD = "thread"; @@ -40,12 +38,12 @@ public class Stanza : Xmpp.Stanza { set { base.type_ = value; } } - public Stanza(string? id = null) { + public MessageStanza(string? id = null) { base.outgoing(new StanzaNode.build("message")); stanza.set_attribute(ATTRIBUTE_ID, id ?? random_uuid()); } - public Stanza.from_stanza(StanzaNode stanza_node, string my_jid) { + public MessageStanza.from_stanza(StanzaNode stanza_node, Jid my_jid) { base.incoming(stanza_node, my_jid); } -- cgit v1.2.3-70-g09d2