diff options
author | Marvin W <git@larma.de> | 2018-01-12 21:03:09 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2018-01-28 00:38:47 +0100 |
commit | 782ae4c049e2b6fab13d7453cbb0e74610e7d200 (patch) | |
tree | 1b4cd0a1689cee0c2e2cac2ae9a5fb8ebbe63621 /libdino/src/entity/message.vala | |
parent | d46d071e57e599e8cfb1780597cbecb36881c4d8 (diff) | |
download | dino-782ae4c049e2b6fab13d7453cbb0e74610e7d200.tar.gz dino-782ae4c049e2b6fab13d7453cbb0e74610e7d200.zip |
Move Jid class to xmpp-vala, partially refactor namespace
Diffstat (limited to 'libdino/src/entity/message.vala')
-rw-r--r-- | libdino/src/entity/message.vala | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala index 27bd08d8..6e34e458 100644 --- a/libdino/src/entity/message.vala +++ b/libdino/src/entity/message.vala @@ -1,4 +1,5 @@ using Gee; +using Xmpp; namespace Dino.Entities { @@ -51,7 +52,7 @@ public class Message : Object { marked_ = value; } } - public Xmpp.Message.Stanza stanza { get; set; } + public Xmpp.MessageStanza stanza { get; set; } private Database? db; @@ -67,15 +68,15 @@ public class Message : Object { stanza_id = row[db.message.stanza_id]; type_ = (Message.Type) row[db.message.type_]; - string counterpart_jid = db.get_jid_by_id(row[db.message.counterpart_id]); + counterpart = Jid.parse(db.get_jid_by_id(row[db.message.counterpart_id])); string counterpart_resource = row[db.message.counterpart_resource]; - counterpart = counterpart_resource != null ? new Jid.with_resource(counterpart_jid, counterpart_resource) : new Jid(counterpart_jid); + if (counterpart_resource != null) counterpart = counterpart.with_resource(counterpart_resource); string our_resource = row[db.message.our_resource]; if (type_ == Type.GROUPCHAT && our_resource != null) { - ourpart = new Jid.with_resource(counterpart_jid, our_resource); + ourpart = counterpart.with_resource(our_resource); } else if (our_resource != null) { - ourpart = new Jid.with_resource(account.bare_jid.to_string(), our_resource); + ourpart = account.bare_jid.with_resource(our_resource); } else { ourpart = account.bare_jid; } @@ -121,9 +122,9 @@ public class Message : Object { public void set_type_string(string type) { switch (type) { - case Xmpp.Message.Stanza.TYPE_CHAT: + case Xmpp.MessageStanza.TYPE_CHAT: type_ = Type.CHAT; break; - case Xmpp.Message.Stanza.TYPE_GROUPCHAT: + case Xmpp.MessageStanza.TYPE_GROUPCHAT: type_ = Type.GROUPCHAT; break; } } @@ -131,11 +132,11 @@ public class Message : Object { public new string get_type_string() { switch (type_) { case Type.CHAT: - return Xmpp.Message.Stanza.TYPE_CHAT; + return Xmpp.MessageStanza.TYPE_CHAT; case Type.GROUPCHAT: - return Xmpp.Message.Stanza.TYPE_GROUPCHAT; + return Xmpp.MessageStanza.TYPE_GROUPCHAT; default: - return Xmpp.Message.Stanza.TYPE_NORMAL; + return Xmpp.MessageStanza.TYPE_NORMAL; } } |