aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/conversation_manager.vala6
-rw-r--r--libdino/src/service/muc_manager.vala15
2 files changed, 11 insertions, 10 deletions
diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala
index f6e3553d..c72500b4 100644
--- a/libdino/src/service/conversation_manager.vala
+++ b/libdino/src/service/conversation_manager.vala
@@ -26,7 +26,6 @@ public class ConversationManager : StreamInteractionModule, Object {
this.stream_interactor = stream_interactor;
stream_interactor.add_module(this);
stream_interactor.account_added.connect(on_account_added);
- stream_interactor.get_module(MucManager.IDENTITY).joined.connect(on_groupchat_joined);
stream_interactor.get_module(MessageProcessor.IDENTITY).received_pipeline.connect(new MessageListener(stream_interactor));
stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(handle_new_message);
}
@@ -155,11 +154,6 @@ public class ConversationManager : StreamInteractionModule, Object {
start_conversation(conversation);
}
- private void on_groupchat_joined(Account account, Jid jid, string nick) {
- Conversation conversation = create_conversation(jid, account, Conversation.Type.GROUPCHAT);
- start_conversation(conversation);
- }
-
private void add_conversation(Conversation conversation) {
conversations[conversation.account][conversation.counterpart] = conversation;
if (conversation.active) {
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index f224a8ec..696f304c 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -208,10 +208,7 @@ public class MucManager : StreamInteractionModule, Object {
private void on_account_added(Account account) {
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_entered.connect( (stream, jid, nick) => {
- enter_errors.unset(jid);
- set_autojoin(stream, jid, nick, null); // TODO password
- joined(account, jid, nick);
- stream_interactor.get_module(MessageProcessor.IDENTITY).send_unsent_messages(account, jid);
+ on_room_entred(account, stream, jid, nick);
});
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_enter_error.connect( (stream, jid, error) => {
enter_errors[jid] = error;
@@ -243,6 +240,16 @@ public class MucManager : StreamInteractionModule, Object {
});
}
+ private void on_room_entred(Account account, XmppStream stream, Jid jid, string nick) {
+ enter_errors.unset(jid);
+ set_autojoin(stream, jid, nick, null); // TODO password
+ joined(account, jid, nick);
+ stream_interactor.get_module(MessageProcessor.IDENTITY).send_unsent_messages(account, jid);
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.GROUPCHAT);
+ stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
+ conversation.nickname = nick;
+ }
+
private void join_all_active(Account account) {
Gee.List<Conversation> conversations = stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations(account);
foreach (Conversation conversation in conversations) {