aboutsummaryrefslogtreecommitdiff
path: root/libdino
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-03-09 13:37:11 +0100
committerfiaxh <git@lightrise.org>2020-03-09 13:37:11 +0100
commit4a08c8061dcdf865ccde2f5f8ee71f167f3d4d92 (patch)
tree12e0f07b6e2dd376780eedab648a5d855d2e658e /libdino
parentefc085dc11d678aba3e1c9a5da3a127557777b78 (diff)
downloaddino-4a08c8061dcdf865ccde2f5f8ee71f167f3d4d92.tar.gz
dino-4a08c8061dcdf865ccde2f5f8ee71f167f3d4d92.zip
Fix messages to self being duplicated
fixes #591
Diffstat (limited to 'libdino')
-rw-r--r--libdino/src/service/message_processor.vala16
1 files changed, 12 insertions, 4 deletions
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala
index 04518e72..fd719eda 100644
--- a/libdino/src/service/message_processor.vala
+++ b/libdino/src/service/message_processor.vala
@@ -451,10 +451,18 @@ public class MessageProcessor : StreamInteractionModule, Object {
.with(db.message.stanza_id, "=", message.stanza_id)
.with(db.message.counterpart_id, "=", db.get_jid_id(message.counterpart))
.with(db.message.account_id, "=", account.id);
- if (message.counterpart.resourcepart != null) {
- builder.with(db.message.counterpart_resource, "=", message.counterpart.resourcepart);
- } else {
- builder.with_null(db.message.counterpart_resource);
+ if (message.direction == Message.DIRECTION_RECEIVED) {
+ if (message.counterpart.resourcepart != null) {
+ builder.with(db.message.counterpart_resource, "=", message.counterpart.resourcepart);
+ } else {
+ builder.with_null(db.message.counterpart_resource);
+ }
+ } else if (message.direction == Message.DIRECTION_SENT) {
+ if (message.ourpart.resourcepart != null) {
+ builder.with(db.message.our_resource, "=", message.ourpart.resourcepart);
+ } else {
+ builder.with_null(db.message.our_resource);
+ }
}
RowOption row_opt = builder.single().row();
bool duplicate = row_opt.is_present();