aboutsummaryrefslogtreecommitdiff
path: root/client/src/entity/message.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-10 19:53:24 +0100
committerfiaxh <git@mx.ax.lt>2017-03-10 19:53:24 +0100
commit24b55d83a1f9e21b028c8d5ac9778e75565f417d (patch)
tree195b0f332e32d08e1a18fc3d8a5a6725c5ed11d7 /client/src/entity/message.vala
parent4c48c5c16d5f5b010c2e5dfb1affcb59f937510c (diff)
parent29ca70a6d534e1cd79963718c793ae740318cff1 (diff)
downloaddino-24b55d83a1f9e21b028c8d5ac9778e75565f417d.tar.gz
dino-24b55d83a1f9e21b028c8d5ac9778e75565f417d.zip
Merge branch 'master' of github.com:dino/dino
Diffstat (limited to 'client/src/entity/message.vala')
-rw-r--r--client/src/entity/message.vala91
1 files changed, 0 insertions, 91 deletions
diff --git a/client/src/entity/message.vala b/client/src/entity/message.vala
deleted file mode 100644
index 65d05bdf..00000000
--- a/client/src/entity/message.vala
+++ /dev/null
@@ -1,91 +0,0 @@
-using Gee;
-
-using Xmpp;
-
-public class Dino.Entities.Message : Object {
-
- public const bool DIRECTION_SENT = true;
- public const bool DIRECTION_RECEIVED = false;
-
- public enum Marked {
- NONE,
- RECEIVED,
- READ,
- ACKNOWLEDGED,
- UNSENT,
- WONTSEND
- }
-
- public enum Encryption {
- NONE,
- PGP
- }
-
- public enum Type {
- ERROR,
- CHAT,
- GROUPCHAT,
- HEADLINE,
- NORMAL
- }
-
- public int? id { get; set; }
- public Account account { get; set; }
- public Jid? counterpart { get; set; }
- public Jid? ourpart { get; set; }
- public Jid? from {
- get { return direction == DIRECTION_SENT ? account.bare_jid : counterpart; }
- }
- public Jid? to {
- get { return direction == DIRECTION_SENT ? counterpart : account.bare_jid; }
- }
- public bool direction { get; set; }
- public string? real_jid { get; set; }
- public Type type_ { get; set; }
- public string? body { get; set; }
- public string? stanza_id { get; set; }
- public DateTime? time { get; set; }
- public DateTime? local_time { get; set; }
- public Encryption encryption { get; set; default = Encryption.NONE; }
- public Marked marked { get; set; default = Marked.NONE; }
- public Xmpp.Message.Stanza stanza { get; set; }
-
- public void set_type_string(string type) {
- switch (type) {
- case Xmpp.Message.Stanza.TYPE_CHAT:
- type_ = Type.CHAT; break;
- case Xmpp.Message.Stanza.TYPE_GROUPCHAT:
- type_ = Type.GROUPCHAT; break;
- default:
- type_ = Type.NORMAL; break;
- }
- }
-
- public new string get_type_string() {
- switch (type_) {
- case Type.CHAT:
- return Xmpp.Message.Stanza.TYPE_CHAT;
- case Type.GROUPCHAT:
- return Xmpp.Message.Stanza.TYPE_GROUPCHAT;
- default:
- return Xmpp.Message.Stanza.TYPE_NORMAL;
- }
- }
-
- public bool equals(Message? m) {
- if (m == null) return false;
- return equals_func(this, m);
- }
-
- public static bool equals_func(Message m1, Message m2) {
- if (m1.stanza_id == m2.stanza_id &&
- m1.body == m2.body) {
- return true;
- }
- return false;
- }
-
- public static uint hash_func(Message message) {
- return message.body.hash();
- }
-}