aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdino/src/service/database.vala14
-rw-r--r--main/data/chat_input.ui16
-rw-r--r--xmpp-vala/src/module/message/stanza.vala7
-rw-r--r--xmpp-vala/src/module/presence/stanza.vala4
-rw-r--r--xmpp-vala/src/module/stanza.vala2
5 files changed, 28 insertions, 15 deletions
diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala
index 953fa0b1..29c6f3ee 100644
--- a/libdino/src/service/database.vala
+++ b/libdino/src/service/database.vala
@@ -282,15 +282,19 @@ public class Database : Qlite.Database {
public bool contains_message(Message query_message, Account account) {
int jid_id = get_jid_id(query_message.counterpart);
- return message.select()
+ QueryBuilder builder = message.select()
.with(message.account_id, "=", account.id)
- .with(message.stanza_id, "=", query_message.stanza_id)
.with(message.counterpart_id, "=", jid_id)
.with(message.counterpart_resource, "=", query_message.counterpart.resourcepart)
.with(message.body, "=", query_message.body)
.with(message.time, "<", (long) query_message.time.add_minutes(1).to_unix())
- .with(message.time, ">", (long) query_message.time.add_minutes(-1).to_unix())
- .count() > 0;
+ .with(message.time, ">", (long) query_message.time.add_minutes(-1).to_unix());
+ if (query_message.stanza_id != null) {
+ builder.with(message.stanza_id, "=", query_message.stanza_id);
+ } else {
+ builder.with_null(message.stanza_id);
+ }
+ return builder.count() > 0;
}
public bool contains_message_by_stanza_id(string stanza_id, Account account) {
@@ -347,8 +351,6 @@ public class Database : Qlite.Database {
.value(conversation.active, new_conversation.active);
if (new_conversation.last_active != null) {
insert.value(conversation.last_active, (long) new_conversation.last_active.to_unix());
- } else {
- insert.value_null(conversation.last_active);
}
new_conversation.id = (int) insert.perform();
new_conversation.notify.connect(on_conversation_update);
diff --git a/main/data/chat_input.ui b/main/data/chat_input.ui
index 18583d07..455286ab 100644
--- a/main/data/chat_input.ui
+++ b/main/data/chat_input.ui
@@ -11,12 +11,16 @@
<property name="max_content_height">300</property>
<property name="propagate_natural_height">True</property>
<child>
- <object class="GtkTextView" id="text_input">
- <property name="wrap-mode">GTK_WRAP_WORD_CHAR</property>
- <property name="border-width">5</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="visible">True</property>
+ <object class="GtkFrame">
+ <child>
+ <object class="GtkTextView" id="text_input">
+ <property name="wrap-mode">GTK_WRAP_WORD_CHAR</property>
+ <property name="border-width">5</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/xmpp-vala/src/module/message/stanza.vala b/xmpp-vala/src/module/message/stanza.vala
index 8a9064a5..2b60c517 100644
--- a/xmpp-vala/src/module/message/stanza.vala
+++ b/xmpp-vala/src/module/message/stanza.vala
@@ -33,6 +33,13 @@ public class Stanza : Xmpp.Stanza {
}
}
+ public override string? type_ {
+ get {
+ return base.type_ ?? TYPE_NORMAL;
+ }
+ set { base.type_ = value; }
+ }
+
public Stanza(string? id = null) {
base.outgoing(new StanzaNode.build("message"));
stanza.set_attribute(ATTRIBUTE_ID, id ?? random_uuid());
diff --git a/xmpp-vala/src/module/presence/stanza.vala b/xmpp-vala/src/module/presence/stanza.vala
index 9ad8f791..0926555e 100644
--- a/xmpp-vala/src/module/presence/stanza.vala
+++ b/xmpp-vala/src/module/presence/stanza.vala
@@ -73,9 +73,9 @@ public class Stanza : Xmpp.Stanza {
}
}
- public override string type_ {
+ public override string? type_ {
get {
- return base.type_ != null ? base.type_ : TYPE_AVAILABLE;
+ return base.type_ ?? TYPE_AVAILABLE;
}
set { base.type_ = value; }
}
diff --git a/xmpp-vala/src/module/stanza.vala b/xmpp-vala/src/module/stanza.vala
index f6af9623..85cbadb7 100644
--- a/xmpp-vala/src/module/stanza.vala
+++ b/xmpp-vala/src/module/stanza.vala
@@ -43,7 +43,7 @@ namespace Xmpp {
set { stanza.set_attribute(ATTRIBUTE_TO, value); }
}
- public virtual string type_ {
+ public virtual string? type_ {
get { return stanza.get_attribute(ATTRIBUTE_TYPE); }
set { stanza.set_attribute(ATTRIBUTE_TYPE, value); }
}