aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/contact_details
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-12-16 01:34:28 +0100
committerfiaxh <git@lightrise.org>2019-12-16 01:41:04 +0100
commit890b91ce4d968f838b46686295883500eba55c78 (patch)
tree62983c8fb2fe49e0cbab66cef944121e1f074ef3 /main/src/ui/contact_details
parent21c01dcdcb3ba7f7d5c6fcd18c5fd2117f050e5e (diff)
downloaddino-890b91ce4d968f838b46686295883500eba55c78.tar.gz
dino-890b91ce4d968f838b46686295883500eba55c78.zip
Only send new room config if something was changed
fixes #675
Diffstat (limited to 'main/src/ui/contact_details')
-rw-r--r--main/src/ui/contact_details/muc_config_form_provider.vala17
1 files changed, 14 insertions, 3 deletions
diff --git a/main/src/ui/contact_details/muc_config_form_provider.vala b/main/src/ui/contact_details/muc_config_form_provider.vala
index a088bd97..2b1bb6d9 100644
--- a/main/src/ui/contact_details/muc_config_form_provider.vala
+++ b/main/src/ui/contact_details/muc_config_form_provider.vala
@@ -19,12 +19,23 @@ public class MucConfigFormProvider : Plugins.ContactDetailsProvider, Object {
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
Xmpp.XmppStream? stream = stream_interactor.get_stream(conversation.account);
if (stream == null) return;
- stream_interactor.get_module(MucManager.IDENTITY).get_config_form(conversation.account, conversation.counterpart, (jid, data_form) => {
- contact_details.save.connect(() => { data_form.submit(); });
+
+ stream_interactor.get_module(MucManager.IDENTITY).get_config_form.begin(conversation.account, conversation.counterpart, (_, res) => {
+ DataForms.DataForm? data_form = stream_interactor.get_module(MucManager.IDENTITY).get_config_form.end(res);
+ if (data_form == null) return;
+
for (int i = 0; i < data_form.fields.size; i++) {
DataForms.DataForm.Field field = data_form.fields[i];
add_field(field, contact_details);
}
+
+ string config_backup = data_form.stanza_node.to_string();
+ contact_details.save.connect(() => {
+ // Only send the config form if something was changed
+ if (config_backup != data_form.stanza_node.to_string()) {
+ stream_interactor.get_module(MucManager.IDENTITY).set_config_form(conversation.account, conversation.counterpart, data_form);
+ }
+ });
});
}
}
@@ -74,7 +85,7 @@ public class MucConfigFormProvider : Plugins.ContactDetailsProvider, Object {
}
}
- Widget? widget = Util.get_data_form_fild_widget(field);
+ Widget? widget = Util.get_data_form_field_widget(field);
if (widget != null) contact_details.add(_("Room Configuration"), label, desc, widget);
}
}