aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/counterpart_interaction_manager.vala
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src/service/counterpart_interaction_manager.vala')
-rw-r--r--libdino/src/service/counterpart_interaction_manager.vala17
1 files changed, 5 insertions, 12 deletions
diff --git a/libdino/src/service/counterpart_interaction_manager.vala b/libdino/src/service/counterpart_interaction_manager.vala
index 221fc4d4..bfd473a2 100644
--- a/libdino/src/service/counterpart_interaction_manager.vala
+++ b/libdino/src/service/counterpart_interaction_manager.vala
@@ -5,7 +5,8 @@ using Dino.Entities;
namespace Dino {
public class CounterpartInteractionManager : StreamInteractionModule, Object {
- public const string id = "counterpart_interaction_manager";
+ public static ModuleIdentity<CounterpartInteractionManager> IDENTITY = new ModuleIdentity<CounterpartInteractionManager>("counterpart_interaction_manager");
+ public string id { get { return IDENTITY.id; } }
public signal void received_state(Account account, Jid jid, string state);
public signal void received_marker(Account account, Jid jid, Entities.Message message, string marker);
@@ -24,7 +25,7 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
private CounterpartInteractionManager(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
stream_interactor.account_added.connect(on_account_added);
- MessageManager.get_instance(stream_interactor).message_received.connect(on_message_received);
+ stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect(on_message_received);
}
public string? get_chat_state(Account account, Jid jid) {
@@ -35,14 +36,6 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
return last_read[jid];
}
- public static CounterpartInteractionManager? get_instance(StreamInteractor stream_interactor) {
- return (CounterpartInteractionManager) stream_interactor.get_module(id);
- }
-
- internal string get_id() {
- return id;
- }
-
private void on_account_added(Account account) {
stream_interactor.module_manager.get_module(account, Xep.ChatMarkers.Module.IDENTITY).marker_received.connect( (stream, jid, marker, id) => {
on_chat_marker_received(account, new Jid(jid), marker, id);
@@ -61,9 +54,9 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
}
private void on_chat_marker_received(Account account, Jid jid, string marker, string stanza_id) {
- Conversation? conversation = ConversationManager.get_instance(stream_interactor).get_conversation(jid, account);
+ Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account);
if (conversation != null) {
- Gee.List<Entities.Message>? messages = MessageManager.get_instance(stream_interactor).get_messages(conversation);
+ Gee.List<Entities.Message>? messages = stream_interactor.get_module(MessageManager.IDENTITY).get_messages(conversation);
if (messages != null) { // TODO not here
foreach (Entities.Message message in messages) {
if (message.stanza_id == stanza_id) {