aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdino/src/service/muc_manager.vala37
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala15
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks.vala1
-rw-r--r--xmpp-vala/src/module/xep/0048_conference.vala3
4 files changed, 25 insertions, 31 deletions
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index 018f78b3..a51204c3 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -9,8 +9,6 @@ public class MucManager : StreamInteractionModule, Object {
public static ModuleIdentity<MucManager> IDENTITY = new ModuleIdentity<MucManager>("muc_manager");
public string id { get { return IDENTITY.id; } }
- public signal void joined(Account account, Jid jid, string nick);
- public signal void enter_error(Account account, Jid jid, Xep.Muc.MucEnterError error);
public signal void left(Account account, Jid jid);
public signal void subject_set(Account account, Jid jid, string? subject);
public signal void room_name_set(Account account, Jid jid, string? room_name);
@@ -49,7 +47,23 @@ public class MucManager : StreamInteractionModule, Object {
if (last_message != null) history_since = last_message.time;
}
- return yield stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid, nick_, password, history_since);
+ Muc.JoinResult? res = yield stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid, nick_, password, history_since);
+
+ if (res.nick != null) {
+ // Join completed
+ enter_errors.unset(jid);
+ set_autojoin(account, stream, jid, nick, password);
+ stream_interactor.get_module(MessageProcessor.IDENTITY).send_unsent_messages(account, jid);
+
+ Conversation joined_conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.GROUPCHAT);
+ joined_conversation.nickname = nick;
+ stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
+ } else if (res.muc_error != null) {
+ // Join failed
+ enter_errors[jid] = res.muc_error;
+ }
+
+ return res;
}
public void part(Account account, Jid jid) {
@@ -264,13 +278,6 @@ 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) => {
- 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;
- enter_error(account, jid, error);
- });
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).self_removed_from_room.connect( (stream, jid, code) => {
left(account, jid);
});
@@ -317,16 +324,6 @@ public class MucManager : StreamInteractionModule, Object {
}
}
- private void on_room_entred(Account account, XmppStream stream, Jid jid, string nick) {
- enter_errors.unset(jid);
- set_autojoin(account, 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) {
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index ec10d500..aef10f9f 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -70,8 +70,6 @@ public class Module : XmppStreamModule {
public signal void room_name_set(XmppStream stream, Jid jid, string? room_name);
public signal void invite_received(XmppStream stream, Jid room_jid, Jid from_jid, string? password, string? reason);
- public signal void room_entered(XmppStream stream, Jid jid, string nick);
- public signal void room_enter_error(XmppStream stream, Jid jid, MucEnterError? error); // TODO "?" shoudln't be necessary (vala bug), remove someday
public signal void self_removed_from_room(XmppStream stream, Jid jid, StatusCode code);
public signal void removed_from_room(XmppStream stream, Jid jid, StatusCode? code);
@@ -226,12 +224,6 @@ public class Module : XmppStreamModule {
if (stream.get_module(ServiceDiscovery.Module.IDENTITY) != null) {
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
}
-
- room_entered.connect((stream, jid, nick) => {
- query_affiliation(stream, jid, "member", null);
- query_affiliation(stream, jid, "admin", null);
- query_affiliation(stream, jid, "owner", null);
- });
}
public override void detach(XmppStream stream) {
@@ -300,7 +292,6 @@ public class Module : XmppStreamModule {
break;
}
if (error != MucEnterError.NONE) {
- room_enter_error(stream, bare_jid, error);
flag.enter_futures[bare_jid].set_value(new JoinResult() {muc_error=error});
} else {
flag.enter_futures[bare_jid].set_value(new JoinResult() {stanza_error=error_stanza.condition});
@@ -319,7 +310,11 @@ public class Module : XmppStreamModule {
if (status_codes.contains(StatusCode.SELF_PRESENCE)) {
Jid bare_jid = presence.from.bare_jid;
if (flag.get_enter_id(bare_jid) != null) {
- room_entered(stream, bare_jid, presence.from.resourcepart);
+
+ query_affiliation(stream, bare_jid, "member", null);
+ query_affiliation(stream, bare_jid, "admin", null);
+ query_affiliation(stream, bare_jid, "owner", null);
+
flag.finish_muc_enter(bare_jid, presence.from.resourcepart);
flag.enter_futures[bare_jid].set_value(new JoinResult() {nick=presence.from.resourcepart});
}
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks.vala b/xmpp-vala/src/module/xep/0048_bookmarks.vala
index 8454d711..2fd38bea 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks.vala
@@ -42,6 +42,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
conference_node.put_node(new StanzaNode.build("nick", NS_URI)
.put_node(new StanzaNode.text(conference.nick)));
}
+ // TODO (?) Bookmarks 2 currently don't define a password
storage_node.put_node(conference_node);
}
}
diff --git a/xmpp-vala/src/module/xep/0048_conference.vala b/xmpp-vala/src/module/xep/0048_conference.vala
index fdc26152..b61de1c0 100644
--- a/xmpp-vala/src/module/xep/0048_conference.vala
+++ b/xmpp-vala/src/module/xep/0048_conference.vala
@@ -71,9 +71,10 @@ public class Bookmarks1Conference : Conference {
return;
}
if (password_node == null) {
- password_node = new StanzaNode.build(NODE_PASSWORD);
+ password_node = new StanzaNode.build(NODE_PASSWORD, NS_URI);
stanza_node.put_node(password_node);
}
+ password_node.sub_nodes.clear();
password_node.put_node(new StanzaNode.text(value));
}
}