Add hidden
column to content_item table
This commit is contained in:
parent
ecb18afdb5
commit
0e41fb3294
|
@ -26,8 +26,7 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
this.stream_interactor = stream_interactor;
|
this.stream_interactor = stream_interactor;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
|
|
||||||
stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(on_new_message);
|
stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect((message, conversation) => insert_message(message, conversation));
|
||||||
stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(on_new_message);
|
|
||||||
stream_interactor.get_module(FileManager.IDENTITY).received_file.connect(insert_file_transfer);
|
stream_interactor.get_module(FileManager.IDENTITY).received_file.connect(insert_file_transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +42,8 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
Gee.TreeSet<ContentItem> items = new Gee.TreeSet<ContentItem>(ContentItem.compare);
|
Gee.TreeSet<ContentItem> items = new Gee.TreeSet<ContentItem>(ContentItem.compare);
|
||||||
|
|
||||||
foreach (var row in select) {
|
foreach (var row in select) {
|
||||||
int provider = row[db.content.content_type];
|
int provider = row[db.content_item.content_type];
|
||||||
int foreign_id = row[db.content.foreign_id];
|
int foreign_id = row[db.content_item.foreign_id];
|
||||||
switch (provider) {
|
switch (provider) {
|
||||||
case 1:
|
case 1:
|
||||||
RowOption row_option = db.message.select().with(db.message.id, "=", foreign_id).row();
|
RowOption row_option = db.message.select().with(db.message.id, "=", foreign_id).row();
|
||||||
|
@ -53,15 +52,15 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
message = new Message.from_row(db, row_option.inner);
|
message = new Message.from_row(db, row_option.inner);
|
||||||
}
|
}
|
||||||
items.add(new MessageItem(message, conversation, row[db.content.id]));
|
items.add(new MessageItem(message, conversation, row[db.content_item.id]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
RowOption row_option = db.file_transfer.select().with(db.file_transfer.id, "=", foreign_id).row();
|
RowOption row_option = db.file_transfer.select().with(db.file_transfer.id, "=", foreign_id).row();
|
||||||
if (row_option.is_present()) {
|
if (row_option.is_present()) {
|
||||||
string storage_dir = stream_interactor.get_module(FileManager.IDENTITY).get_storage_dir();
|
string storage_dir = FileManager.get_storage_dir();
|
||||||
FileTransfer file_transfer = new FileTransfer.from_row(db, row_option.inner, storage_dir);
|
FileTransfer file_transfer = new FileTransfer.from_row(db, row_option.inner, storage_dir);
|
||||||
items.add(new FileItem(file_transfer, row[db.content.id]));
|
items.add(new FileItem(file_transfer, row[db.content_item.id]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -74,11 +73,22 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContentItem? get_item(Conversation conversation, int type, int foreign_id) {
|
||||||
|
QueryBuilder select = db.content_item.select()
|
||||||
|
.with(db.content_item.content_type, "=", type)
|
||||||
|
.with(db.content_item.foreign_id, "=", foreign_id);
|
||||||
|
|
||||||
|
Gee.List<ContentItem> item = get_items_from_query(select, conversation);
|
||||||
|
|
||||||
|
return item.size > 0 ? item[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
public Gee.List<ContentItem> get_latest(Conversation conversation, int count) {
|
public Gee.List<ContentItem> get_latest(Conversation conversation, int count) {
|
||||||
QueryBuilder select = db.content.select()
|
QueryBuilder select = db.content_item.select()
|
||||||
.with(db.content.conversation_id, "=", conversation.id)
|
.with(db.content_item.conversation_id, "=", conversation.id)
|
||||||
.order_by(db.content.local_time, "DESC")
|
.with(db.content_item.hide, "=", false)
|
||||||
.order_by(db.content.time, "DESC")
|
.order_by(db.content_item.local_time, "DESC")
|
||||||
|
.order_by(db.content_item.time, "DESC")
|
||||||
.limit(count);
|
.limit(count);
|
||||||
|
|
||||||
return get_items_from_query(select, conversation);
|
return get_items_from_query(select, conversation);
|
||||||
|
@ -87,11 +97,12 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
public Gee.List<ContentItem> get_before(Conversation conversation, ContentItem item, int count) {
|
public Gee.List<ContentItem> get_before(Conversation conversation, ContentItem item, int count) {
|
||||||
long local_time = (long) item.sort_time.to_unix();
|
long local_time = (long) item.sort_time.to_unix();
|
||||||
long time = (long) item.display_time.to_unix();
|
long time = (long) item.display_time.to_unix();
|
||||||
QueryBuilder select = db.content.select()
|
QueryBuilder select = db.content_item.select()
|
||||||
.where(@"local_time < ? OR (local_time = ? AND time < ?) OR (local_time = ? AND time = ? AND id < ?)", { local_time.to_string(), local_time.to_string(), time.to_string(), local_time.to_string(), time.to_string(), item.id.to_string() })
|
.where(@"local_time < ? OR (local_time = ? AND time < ?) OR (local_time = ? AND time = ? AND id < ?)", { local_time.to_string(), local_time.to_string(), time.to_string(), local_time.to_string(), time.to_string(), item.id.to_string() })
|
||||||
.with(db.content.conversation_id, "=", conversation.id)
|
.with(db.content_item.conversation_id, "=", conversation.id)
|
||||||
.order_by(db.content.local_time, "DESC")
|
.with(db.content_item.hide, "=", false)
|
||||||
.order_by(db.content.time, "DESC")
|
.order_by(db.content_item.local_time, "DESC")
|
||||||
|
.order_by(db.content_item.time, "DESC")
|
||||||
.limit(count);
|
.limit(count);
|
||||||
|
|
||||||
return get_items_from_query(select, conversation);
|
return get_items_from_query(select, conversation);
|
||||||
|
@ -100,11 +111,12 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
public Gee.List<ContentItem> get_after(Conversation conversation, ContentItem item, int count) {
|
public Gee.List<ContentItem> get_after(Conversation conversation, ContentItem item, int count) {
|
||||||
long local_time = (long) item.sort_time.to_unix();
|
long local_time = (long) item.sort_time.to_unix();
|
||||||
long time = (long) item.display_time.to_unix();
|
long time = (long) item.display_time.to_unix();
|
||||||
QueryBuilder select = db.content.select()
|
QueryBuilder select = db.content_item.select()
|
||||||
.where(@"local_time > ? OR (local_time = ? AND time > ?) OR (local_time = ? AND time = ? AND id > ?)", { local_time.to_string(), local_time.to_string(), time.to_string(), local_time.to_string(), time.to_string(), item.id.to_string() })
|
.where(@"local_time > ? OR (local_time = ? AND time > ?) OR (local_time = ? AND time = ? AND id > ?)", { local_time.to_string(), local_time.to_string(), time.to_string(), local_time.to_string(), time.to_string(), item.id.to_string() })
|
||||||
.with(db.content.conversation_id, "=", conversation.id)
|
.with(db.content_item.conversation_id, "=", conversation.id)
|
||||||
.order_by(db.content.local_time, "ASC")
|
.with(db.content_item.hide, "=", false)
|
||||||
.order_by(db.content.time, "ASC")
|
.order_by(db.content_item.local_time, "ASC")
|
||||||
|
.order_by(db.content_item.time, "ASC")
|
||||||
.limit(count);
|
.limit(count);
|
||||||
|
|
||||||
return get_items_from_query(select, conversation);
|
return get_items_from_query(select, conversation);
|
||||||
|
@ -114,11 +126,10 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
filters.add(content_filter);
|
filters.add(content_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void on_new_message(Message message, Conversation conversation) {
|
public void insert_message(Message message, Conversation conversation, bool hide = false) {
|
||||||
MessageItem item = new MessageItem(message, conversation, -1);
|
MessageItem item = new MessageItem(message, conversation, -1);
|
||||||
|
item.id = db.add_content_item(conversation, message.time, message.local_time, 1, message.id, hide);
|
||||||
if (!discard(item)) {
|
if (!discard(item)) {
|
||||||
item.id = db.add_content_item(conversation, message.time, message.local_time, 1, message.id);
|
|
||||||
|
|
||||||
if (collection_conversations.has_key(conversation)) {
|
if (collection_conversations.has_key(conversation)) {
|
||||||
collection_conversations.get(conversation).insert_item(item);
|
collection_conversations.get(conversation).insert_item(item);
|
||||||
}
|
}
|
||||||
|
@ -129,7 +140,7 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
private void insert_file_transfer(FileTransfer file_transfer, Conversation conversation) {
|
private void insert_file_transfer(FileTransfer file_transfer, Conversation conversation) {
|
||||||
FileItem item = new FileItem(file_transfer, -1);
|
FileItem item = new FileItem(file_transfer, -1);
|
||||||
if (!discard(item)) {
|
if (!discard(item)) {
|
||||||
item.id = db.add_content_item(conversation, file_transfer.time, file_transfer.local_time, 2, file_transfer.id);
|
item.id = db.add_content_item(conversation, file_transfer.time, file_transfer.local_time, 2, file_transfer.id, false);
|
||||||
|
|
||||||
if (collection_conversations.has_key(conversation)) {
|
if (collection_conversations.has_key(conversation)) {
|
||||||
collection_conversations.get(conversation).insert_item(item);
|
collection_conversations.get(conversation).insert_item(item);
|
||||||
|
@ -138,6 +149,13 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void set_item_hide(ContentItem content_item, bool hide) {
|
||||||
|
db.content_item.update()
|
||||||
|
.with(db.content_item.id, "=", content_item.id)
|
||||||
|
.set(db.content_item.hide, hide)
|
||||||
|
.perform();
|
||||||
|
}
|
||||||
|
|
||||||
private bool discard(ContentItem content_item) {
|
private bool discard(ContentItem content_item) {
|
||||||
foreach (ContentFilter filter in filters) {
|
foreach (ContentFilter filter in filters) {
|
||||||
if (filter.discard(content_item)) {
|
if (filter.discard(content_item)) {
|
||||||
|
@ -167,12 +185,12 @@ public abstract class ContentItem : Object {
|
||||||
public Encryption? encryption { get; set; default=null; }
|
public Encryption? encryption { get; set; default=null; }
|
||||||
public Entities.Message.Marked? mark { get; set; default=null; }
|
public Entities.Message.Marked? mark { get; set; default=null; }
|
||||||
|
|
||||||
public ContentItem(int id, string ty, Jid jid, DateTime sort_time, double seccondary_sort_indicator, DateTime display_time, Encryption encryption, Entities.Message.Marked mark) {
|
public ContentItem(int id, string ty, Jid jid, DateTime sort_time, DateTime display_time, Encryption encryption, Entities.Message.Marked mark) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type_ = ty;
|
this.type_ = ty;
|
||||||
this.jid = jid;
|
this.jid = jid;
|
||||||
this.sort_time = sort_time;
|
this.sort_time = sort_time;
|
||||||
this.seccondary_sort_indicator = seccondary_sort_indicator;
|
this.seccondary_sort_indicator = id;
|
||||||
this.display_time = display_time;
|
this.display_time = display_time;
|
||||||
this.encryption = encryption;
|
this.encryption = encryption;
|
||||||
this.mark = mark;
|
this.mark = mark;
|
||||||
|
@ -197,7 +215,7 @@ public class MessageItem : ContentItem {
|
||||||
public Conversation conversation;
|
public Conversation conversation;
|
||||||
|
|
||||||
public MessageItem(Message message, Conversation conversation, int id) {
|
public MessageItem(Message message, Conversation conversation, int id) {
|
||||||
base(id, TYPE, message.from, message.local_time, message.id + 0.0845, message.time, message.encryption, message.marked);
|
base(id, TYPE, message.from, message.local_time, message.time, message.encryption, message.marked);
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
|
|
||||||
|
@ -218,7 +236,7 @@ public class FileItem : ContentItem {
|
||||||
|
|
||||||
public FileItem(FileTransfer file_transfer, int id) {
|
public FileItem(FileTransfer file_transfer, int id) {
|
||||||
Jid jid = file_transfer.direction == FileTransfer.DIRECTION_SENT ? file_transfer.account.bare_jid.with_resource(file_transfer.account.resourcepart) : file_transfer.counterpart;
|
Jid jid = file_transfer.direction == FileTransfer.DIRECTION_SENT ? file_transfer.account.bare_jid.with_resource(file_transfer.account.resourcepart) : file_transfer.counterpart;
|
||||||
base(id, TYPE, jid, file_transfer.local_time, file_transfer.id + 0.0845, file_transfer.time, file_transfer.encryption, file_to_message_state(file_transfer.state));
|
base(id, TYPE, jid, file_transfer.local_time, file_transfer.time, file_transfer.encryption, file_to_message_state(file_transfer.state));
|
||||||
|
|
||||||
this.file_transfer = file_transfer;
|
this.file_transfer = file_transfer;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ using Dino.Entities;
|
||||||
namespace Dino {
|
namespace Dino {
|
||||||
|
|
||||||
public class Database : Qlite.Database {
|
public class Database : Qlite.Database {
|
||||||
private const int VERSION = 8;
|
private const int VERSION = 9;
|
||||||
|
|
||||||
public class AccountTable : Table {
|
public class AccountTable : Table {
|
||||||
public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true };
|
public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true };
|
||||||
|
@ -34,17 +34,19 @@ public class Database : Qlite.Database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ContentTable : Table {
|
public class ContentItemTable : Table {
|
||||||
public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true };
|
public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true };
|
||||||
public Column<int> conversation_id = new Column.Integer("conversation_id") { not_null = true };
|
public Column<int> conversation_id = new Column.Integer("conversation_id") { not_null = true };
|
||||||
public Column<long> time = new Column.Long("time") { not_null = true };
|
public Column<long> time = new Column.Long("time") { not_null = true };
|
||||||
public Column<long> local_time = new Column.Long("local_time") { not_null = true };
|
public Column<long> local_time = new Column.Long("local_time") { not_null = true };
|
||||||
public Column<int> content_type = new Column.Integer("content_type") { not_null = true };
|
public Column<int> content_type = new Column.Integer("content_type") { not_null = true };
|
||||||
public Column<int> foreign_id = new Column.Integer("foreign_id") { not_null = true };
|
public Column<int> foreign_id = new Column.Integer("foreign_id") { not_null = true };
|
||||||
|
public Column<bool> hide = new Column.BoolInt("hide") { default = "0", not_null = true, min_version = 9 };
|
||||||
|
|
||||||
internal ContentTable(Database db) {
|
internal ContentItemTable(Database db) {
|
||||||
base(db, "content_item");
|
base(db, "content_item");
|
||||||
init({id, conversation_id, time, local_time, content_type, foreign_id});
|
init({id, conversation_id, time, local_time, content_type, foreign_id, hide});
|
||||||
|
index("contentitem_localtime_counterpart_idx", {local_time, conversation_id});
|
||||||
unique({content_type, foreign_id}, "IGNORE");
|
unique({content_type, foreign_id}, "IGNORE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +191,7 @@ public class Database : Qlite.Database {
|
||||||
|
|
||||||
public AccountTable account { get; private set; }
|
public AccountTable account { get; private set; }
|
||||||
public JidTable jid { get; private set; }
|
public JidTable jid { get; private set; }
|
||||||
public ContentTable content { get; private set; }
|
public ContentItemTable content_item { get; private set; }
|
||||||
public MessageTable message { get; private set; }
|
public MessageTable message { get; private set; }
|
||||||
public RealJidTable real_jid { get; private set; }
|
public RealJidTable real_jid { get; private set; }
|
||||||
public FileTransferTable file_transfer { get; private set; }
|
public FileTransferTable file_transfer { get; private set; }
|
||||||
|
@ -207,7 +209,7 @@ public class Database : Qlite.Database {
|
||||||
base(fileName, VERSION);
|
base(fileName, VERSION);
|
||||||
account = new AccountTable(this);
|
account = new AccountTable(this);
|
||||||
jid = new JidTable(this);
|
jid = new JidTable(this);
|
||||||
content = new ContentTable(this);
|
content_item = new ContentItemTable(this);
|
||||||
message = new MessageTable(this);
|
message = new MessageTable(this);
|
||||||
real_jid = new RealJidTable(this);
|
real_jid = new RealJidTable(this);
|
||||||
file_transfer = new FileTransferTable(this);
|
file_transfer = new FileTransferTable(this);
|
||||||
|
@ -216,7 +218,7 @@ public class Database : Qlite.Database {
|
||||||
entity_feature = new EntityFeatureTable(this);
|
entity_feature = new EntityFeatureTable(this);
|
||||||
roster = new RosterTable(this);
|
roster = new RosterTable(this);
|
||||||
settings = new SettingsTable(this);
|
settings = new SettingsTable(this);
|
||||||
init({ account, jid, content, message, real_jid, file_transfer, conversation, avatar, entity_feature, roster, settings });
|
init({ account, jid, content_item, message, real_jid, file_transfer, conversation, avatar, entity_feature, roster, settings });
|
||||||
try {
|
try {
|
||||||
exec("PRAGMA synchronous=0");
|
exec("PRAGMA synchronous=0");
|
||||||
} catch (Error e) { }
|
} catch (Error e) { }
|
||||||
|
@ -226,10 +228,11 @@ public class Database : Qlite.Database {
|
||||||
// new table columns are added, outdated columns are still present
|
// new table columns are added, outdated columns are still present
|
||||||
if (oldVersion < 7) {
|
if (oldVersion < 7) {
|
||||||
message.fts_rebuild();
|
message.fts_rebuild();
|
||||||
} else if (oldVersion < 8) {
|
}
|
||||||
|
if (oldVersion < 8) {
|
||||||
exec("""
|
exec("""
|
||||||
insert into content_item (conversation_id, time, local_time, content_type, foreign_id)
|
insert into content_item (conversation_id, time, local_time, content_type, foreign_id, hide)
|
||||||
select conversation.id, message.time, message.local_time, 1, message.id
|
select conversation.id, message.time, message.local_time, 1, message.id, 0
|
||||||
from message join conversation on
|
from message join conversation on
|
||||||
message.account_id=conversation.account_id and
|
message.account_id=conversation.account_id and
|
||||||
message.counterpart_id=conversation.jid_id and
|
message.counterpart_id=conversation.jid_id and
|
||||||
|
@ -239,7 +242,7 @@ public class Database : Qlite.Database {
|
||||||
message.body not in (select info from file_transfer where info not null) and
|
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)
|
message.id not in (select info from file_transfer where info not null)
|
||||||
union
|
union
|
||||||
select conversation.id, message.time, message.local_time, 2, file_transfer.id
|
select conversation.id, message.time, message.local_time, 2, file_transfer.id, 0
|
||||||
from file_transfer
|
from file_transfer
|
||||||
join message on
|
join message on
|
||||||
file_transfer.info=message.id
|
file_transfer.info=message.id
|
||||||
|
@ -249,6 +252,19 @@ public class Database : Qlite.Database {
|
||||||
message.type=conversation.type+1 and
|
message.type=conversation.type+1 and
|
||||||
(message.counterpart_resource=conversation.resource or message.type != 3)""");
|
(message.counterpart_resource=conversation.resource or message.type != 3)""");
|
||||||
}
|
}
|
||||||
|
if (oldVersion < 9) {
|
||||||
|
exec("""
|
||||||
|
insert into content_item (conversation_id, time, local_time, content_type, foreign_id, hide)
|
||||||
|
select conversation.id, message.time, message.local_time, 1, message.id, 1
|
||||||
|
from message join conversation on
|
||||||
|
message.account_id=conversation.account_id and
|
||||||
|
message.counterpart_id=conversation.jid_id and
|
||||||
|
message.type=conversation.type+1 and
|
||||||
|
(message.counterpart_resource=conversation.resource or message.type != 3)
|
||||||
|
where
|
||||||
|
message.body in (select info from file_transfer where info not null) or
|
||||||
|
message.id in (select info from file_transfer where info not null)""");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Account> get_accounts() {
|
public ArrayList<Account> get_accounts() {
|
||||||
|
@ -275,13 +291,14 @@ public class Database : Qlite.Database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int add_content_item(Conversation conversation, DateTime time, DateTime local_time, int content_type, int foreign_id) {
|
public int add_content_item(Conversation conversation, DateTime time, DateTime local_time, int content_type, int foreign_id, bool hide) {
|
||||||
return (int) content.insert()
|
return (int) content_item.insert()
|
||||||
.value(content.conversation_id, conversation.id)
|
.value(content_item.conversation_id, conversation.id)
|
||||||
.value(content.local_time, (long) local_time.to_unix())
|
.value(content_item.local_time, (long) local_time.to_unix())
|
||||||
.value(content.time, (long) time.to_unix())
|
.value(content_item.time, (long) time.to_unix())
|
||||||
.value(content.content_type, content_type)
|
.value(content_item.content_type, content_type)
|
||||||
.value(content.foreign_id, foreign_id)
|
.value(content_item.foreign_id, foreign_id)
|
||||||
|
.value(content_item.hide, hide)
|
||||||
.perform();
|
.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class MessageStorage : StreamInteractionModule, Object {
|
||||||
message.persist(db);
|
message.persist(db);
|
||||||
init_conversation(conversation);
|
init_conversation(conversation);
|
||||||
messages[conversation].add(message);
|
messages[conversation].add(message);
|
||||||
|
stream_interactor.get_module(ContentItemStore.IDENTITY).insert_message(message, conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gee.List<Message> get_messages(Conversation conversation, int count = 50) {
|
public Gee.List<Message> get_messages(Conversation conversation, int count = 50) {
|
||||||
|
|
|
@ -63,8 +63,8 @@ public class SearchProcessor : StreamInteractionModule, Object {
|
||||||
.outer_join_with(db.real_jid, db.real_jid.message_id, db.message.id)
|
.outer_join_with(db.real_jid, db.real_jid.message_id, db.message.id)
|
||||||
.with(db.account.enabled, "=", true);
|
.with(db.account.enabled, "=", true);
|
||||||
if (join_content) {
|
if (join_content) {
|
||||||
rows.join_on(db.content, "message.id=content_item.foreign_id AND content_item.content_type=1")
|
rows.join_on(db.content_item, "message.id=content_item.foreign_id AND content_item.content_type=1")
|
||||||
.with(db.content.content_type, "=", 1);
|
.with(db.content_item.content_type, "=", 1);
|
||||||
}
|
}
|
||||||
if (with != null) {
|
if (with != null) {
|
||||||
if (with.index_of("/") > 0) {
|
if (with.index_of("/") > 0) {
|
||||||
|
@ -233,7 +233,7 @@ public class SearchProcessor : StreamInteractionModule, Object {
|
||||||
foreach (Row row in rows) {
|
foreach (Row row in rows) {
|
||||||
Message message = new Message.from_row(db, row);
|
Message message = new Message.from_row(db, row);
|
||||||
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_for_message(message);
|
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_for_message(message);
|
||||||
ret.add(new MessageItem(message, conversation, row[db.content.id]));
|
ret.add(new MessageItem(message, conversation, row[db.content_item.id]));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ public class FileProvider : Dino.FileProvider, Object {
|
||||||
|
|
||||||
private class ReceivedMessageListener : MessageListener {
|
private class ReceivedMessageListener : MessageListener {
|
||||||
|
|
||||||
public string[] after_actions_const = new string[]{ };
|
public string[] after_actions_const = new string[]{ "STORE" };
|
||||||
public override string action_group { get { return "DECRYPT"; } }
|
public override string action_group { get { return ""; } }
|
||||||
public override string[] after_actions { get { return after_actions_const; } }
|
public override string[] after_actions { get { return after_actions_const; } }
|
||||||
|
|
||||||
private FileProvider outer;
|
private FileProvider outer;
|
||||||
|
@ -91,6 +91,12 @@ public class FileProvider : Dino.FileProvider, Object {
|
||||||
file_transfer.provider = 0;
|
file_transfer.provider = 0;
|
||||||
file_transfer.info = message.id.to_string();
|
file_transfer.info = message.id.to_string();
|
||||||
file_incoming(file_transfer, conversation);
|
file_incoming(file_transfer, conversation);
|
||||||
|
|
||||||
|
ContentItem? content_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item(conversation, 1, message.id);
|
||||||
|
if (content_item != null) {
|
||||||
|
stream_interactor.get_module(ContentItemStore.IDENTITY).set_item_hide(content_item, true);
|
||||||
|
}
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
Idle.add((owned)callback);
|
Idle.add((owned)callback);
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,6 +40,11 @@ public class Manager : StreamInteractionModule, FileSender, Object {
|
||||||
message.encryption = Encryption.NONE;
|
message.encryption = Encryption.NONE;
|
||||||
stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(message, conversation);
|
stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(message, conversation);
|
||||||
file_transfer.info = message.id.to_string();
|
file_transfer.info = message.id.to_string();
|
||||||
|
|
||||||
|
ContentItem? content_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item(conversation, 1, message.id);
|
||||||
|
if (content_item != null) {
|
||||||
|
stream_interactor.get_module(ContentItemStore.IDENTITY).set_item_hide(content_item, true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(stream, error_str) => {
|
(stream, error_str) => {
|
||||||
print(@"Failed getting upload url + $error_str\n");
|
print(@"Failed getting upload url + $error_str\n");
|
||||||
|
|
Loading…
Reference in a new issue