aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/contact_details/muc_config_form_provider.vala17
-rw-r--r--main/src/ui/manage_accounts/add_account_dialog.vala2
-rw-r--r--main/src/ui/util/data_forms.vala2
3 files changed, 16 insertions, 5 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);
}
}
diff --git a/main/src/ui/manage_accounts/add_account_dialog.vala b/main/src/ui/manage_accounts/add_account_dialog.vala
index 0ad8b72d..5dd6621b 100644
--- a/main/src/ui/manage_accounts/add_account_dialog.vala
+++ b/main/src/ui/manage_accounts/add_account_dialog.vala
@@ -302,7 +302,7 @@ public class AddAccountDialog : Gtk.Dialog {
register_form_continue.grab_focus();
} else if (form.fields.size > 0) {
foreach (Xep.DataForms.DataForm.Field field in form.fields) {
- Widget? field_widget = Util.get_data_form_fild_widget(field);
+ Widget? field_widget = Util.get_data_form_field_widget(field);
if (field.label != null && field.label != "" && field_widget != null) {
form_box.add(new Label(field.label) { xalign=0, margin_top=7, visible=true });
form_box.add(field_widget);
diff --git a/main/src/ui/util/data_forms.vala b/main/src/ui/util/data_forms.vala
index 11308462..c3449a86 100644
--- a/main/src/ui/util/data_forms.vala
+++ b/main/src/ui/util/data_forms.vala
@@ -6,7 +6,7 @@ using Xmpp.Xep;
namespace Dino.Ui.Util {
-public static Widget? get_data_form_fild_widget(DataForms.DataForm.Field field) {
+public static Widget? get_data_form_field_widget(DataForms.DataForm.Field field) {
if (field.type_ == null) return null;
switch (field.type_) {
case DataForms.DataForm.Type.BOOLEAN: