aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/service/content_item_store.vala3
-rw-r--r--libdino/src/service/database.vala12
-rw-r--r--libdino/src/service/file_manager.vala10
3 files changed, 14 insertions, 11 deletions
diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala
index 39bdfdde..83ba1da0 100644
--- a/libdino/src/service/content_item_store.vala
+++ b/libdino/src/service/content_item_store.vala
@@ -126,10 +126,9 @@ public class ContentItemStore : StreamInteractionModule, Object {
}
}
- private void insert_file_transfer(FileTransfer file_transfer) {
+ private void insert_file_transfer(FileTransfer file_transfer, Conversation conversation) {
FileItem item = new FileItem(file_transfer, -1);
if (!discard(item)) {
- Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(file_transfer.counterpart, file_transfer.account);
item.id = db.add_content_item(conversation, file_transfer.time, file_transfer.local_time, 2, file_transfer.id);
if (collection_conversations.has_key(conversation)) {
diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala
index 4d8f0bd6..8475cc1b 100644
--- a/libdino/src/service/database.vala
+++ b/libdino/src/service/database.vala
@@ -239,11 +239,15 @@ public class Database : Qlite.Database {
message.body not in (select info from file_transfer where info not null) and
message.id not in (select info from file_transfer where info not null)
union
- select conversation.id, file_transfer.time, file_transfer.local_time, 2, file_transfer.id
- from file_transfer join conversation on
+ select conversation.id, message.time, message.local_time, 2, file_transfer.id
+ from file_transfer
+ join message on
+ file_transfer.info=message.id
+ join conversation on
file_transfer.account_id=conversation.account_id and
- file_transfer.counterpart_id=conversation.jid_id
- order by message.local_time, message.time""");
+ file_transfer.counterpart_id=conversation.jid_id and
+ message.type=conversation.type+1 and
+ (message.counterpart_resource=conversation.resource or message.type != 3)""");
}
}
diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala
index 18f1735d..340205af 100644
--- a/libdino/src/service/file_manager.vala
+++ b/libdino/src/service/file_manager.vala
@@ -11,7 +11,7 @@ public class FileManager : StreamInteractionModule, Object {
public string id { get { return IDENTITY.id; } }
public signal void upload_available(Account account);
- public signal void received_file(FileTransfer file_transfer);
+ public signal void received_file(FileTransfer file_transfer, Conversation conversation);
private StreamInteractor stream_interactor;
private Database db;
@@ -68,7 +68,7 @@ public class FileManager : StreamInteractionModule, Object {
file_sender.send_file(conversation, file_transfer);
}
}
- received_file(file_transfer);
+ received_file(file_transfer, conversation);
}
public bool is_upload_available(Conversation conversation) {
@@ -134,7 +134,7 @@ public class FileManager : StreamInteractionModule, Object {
outgoing_processors.add(processor);
}
- private void handle_incomming_file(FileTransfer file_transfer) {
+ private void handle_incomming_file(FileTransfer file_transfer, Conversation conversation) {
foreach (IncommingFileProcessor processor in incomming_processors) {
if (processor.can_process(file_transfer)) {
processor.process(file_transfer);
@@ -148,7 +148,7 @@ public class FileManager : StreamInteractionModule, Object {
} catch (Error e) { }
file_transfer.persist(db);
- received_file(file_transfer);
+ received_file(file_transfer, conversation);
}
private void save_file(FileTransfer file_transfer) {
@@ -169,7 +169,7 @@ public class FileManager : StreamInteractionModule, Object {
}
public interface FileProvider : Object {
- public signal void file_incoming(FileTransfer file_transfer);
+ public signal void file_incoming(FileTransfer file_transfer, Conversation conversation);
}
public interface FileSender : Object {