Code cleanup: Remove left-over usages of mam_earliest_synced

This commit is contained in:
fiaxh 2023-04-23 11:48:29 +02:00
parent 2b9a0ccf7e
commit 10315a245d
3 changed files with 1 additions and 29 deletions

View file

@ -18,7 +18,6 @@ public class Account : Object {
public string? alias { get; set; } public string? alias { get; set; }
public bool enabled { get; set; default = false; } public bool enabled { get; set; default = false; }
public string? roster_version { get; set; } public string? roster_version { get; set; }
public DateTime mam_earliest_synced { get; set; default=new DateTime.from_unix_utc(0); }
private Database? db; private Database? db;
@ -50,7 +49,6 @@ public class Account : Object {
alias = row[db.account.alias]; alias = row[db.account.alias];
enabled = row[db.account.enabled]; enabled = row[db.account.enabled];
roster_version = row[db.account.roster_version]; roster_version = row[db.account.roster_version];
mam_earliest_synced = new DateTime.from_unix_utc(row[db.account.mam_earliest_synced]);
notify.connect(on_update); notify.connect(on_update);
} }
@ -66,7 +64,6 @@ public class Account : Object {
.value(db.account.alias, alias) .value(db.account.alias, alias)
.value(db.account.enabled, enabled) .value(db.account.enabled, enabled)
.value(db.account.roster_version, roster_version) .value(db.account.roster_version, roster_version)
.value(db.account.mam_earliest_synced, (long)mam_earliest_synced.to_unix())
.perform(); .perform();
notify.connect(on_update); notify.connect(on_update);
@ -106,8 +103,6 @@ public class Account : Object {
update.set(db.account.enabled, enabled); break; update.set(db.account.enabled, enabled); break;
case "roster-version": case "roster-version":
update.set(db.account.roster_version, roster_version); break; update.set(db.account.roster_version, roster_version); break;
case "mam-earliest-synced":
update.set(db.account.mam_earliest_synced, (long)mam_earliest_synced.to_unix()); break;
} }
update.perform(); update.perform();
} }

View file

@ -17,6 +17,7 @@ public class Database : Qlite.Database {
public Column<string> alias = new Column.Text("alias"); public Column<string> alias = new Column.Text("alias");
public Column<bool> enabled = new Column.BoolInt("enabled"); public Column<bool> enabled = new Column.BoolInt("enabled");
public Column<string> roster_version = new Column.Text("roster_version") { min_version=2 }; public Column<string> roster_version = new Column.Text("roster_version") { min_version=2 };
// no longer used. all usages already removed. remove db column at some point.
public Column<long> mam_earliest_synced = new Column.Long("mam_earliest_synced") { min_version=4 }; public Column<long> mam_earliest_synced = new Column.Long("mam_earliest_synced") { min_version=4 };
internal AccountTable(Database db) { internal AccountTable(Database db) {

View file

@ -38,7 +38,6 @@ public class MessageProcessor : StreamInteractionModule, Object {
received_pipeline.connect(new FilterMessageListener()); received_pipeline.connect(new FilterMessageListener());
received_pipeline.connect(new StoreMessageListener(this, stream_interactor)); received_pipeline.connect(new StoreMessageListener(this, stream_interactor));
received_pipeline.connect(new StoreContentItemListener(stream_interactor)); received_pipeline.connect(new StoreContentItemListener(stream_interactor));
received_pipeline.connect(new MamMessageListener(stream_interactor));
stream_interactor.account_added.connect(on_account_added); stream_interactor.account_added.connect(on_account_added);
@ -365,29 +364,6 @@ public class MessageProcessor : StreamInteractionModule, Object {
} }
} }
private class MamMessageListener : MessageListener {
public string[] after_actions_const = new string[]{ "DEDUPLICATE" };
public override string action_group { get { return "MAM_NODE"; } }
public override string[] after_actions { get { return after_actions_const; } }
private StreamInteractor stream_interactor;
public MamMessageListener(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
}
public override async bool run(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) {
bool is_mam_message = Xmpp.MessageArchiveManagement.MessageFlag.get_flag(stanza) != null;
XmppStream? stream = stream_interactor.get_stream(conversation.account);
Xmpp.MessageArchiveManagement.Flag mam_flag = Xmpp.MessageArchiveManagement.Flag.get_flag(stream);
if (is_mam_message || (mam_flag != null && mam_flag.cought_up == true)) {
conversation.account.mam_earliest_synced = message.local_time;
}
return false;
}
}
public Entities.Message create_out_message(string text, Conversation conversation) { public Entities.Message create_out_message(string text, Conversation conversation) {
Entities.Message message = new Entities.Message(text); Entities.Message message = new Entities.Message(text);
message.type_ = Util.get_message_type_for_conversation(conversation); message.type_ = Util.get_message_type_for_conversation(conversation);