From 1b80d77d869dff4d8e4ebebb0b58fbe69f447562 Mon Sep 17 00:00:00 2001 From: Fabian Sauter Date: Mon, 2 Sep 2019 10:09:23 +0200 Subject: [PATCH] Added #67 conversion to lower case --- .../Dialogs/AddChatDialogDataTemplate.cs | 3 ++ .../Dialogs/AddMucDialogDataTemplate.cs | 34 +++++++++++-------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddChatDialogDataTemplate.cs b/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddChatDialogDataTemplate.cs index 793fbc801..0b002fc77 100644 --- a/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddChatDialogDataTemplate.cs +++ b/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddChatDialogDataTemplate.cs @@ -94,6 +94,9 @@ public AddChatDialogDataTemplate() #region --Set-, Get- Methods-- private void SetChatBareJidProperty(string value) { + // Make sure we only allow lower case JIDs: + value = value?.ToLowerInvariant(); + if (SetProperty(ref _ChatBareJid, value, nameof(ChatBareJid))) { if (Client is null || string.IsNullOrEmpty(value)) diff --git a/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddMucDialogDataTemplate.cs b/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddMucDialogDataTemplate.cs index d99882279..29312ba4c 100644 --- a/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddMucDialogDataTemplate.cs +++ b/UWPX_UI_Context/Classes/DataTemplates/Dialogs/AddMucDialogDataTemplate.cs @@ -46,7 +46,7 @@ public string Nickname public string RoomBareJid { get => _RoomBareJid; - set => SetProperty(ref _RoomBareJid, value); + set => SetRoomBareJidProperty(value); } private string _Password; @@ -89,16 +89,13 @@ public AddMucDialogDataTemplate() #endregion //--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ #region --Set-, Get- Methods-- + private void SetRoomBareJidProperty(string value) + { + // Make sure we only allow lower case JIDs: + value = value?.ToLowerInvariant(); + SetProperty(ref _RoomBareJid, value, nameof(RoomBareJid)); + } - - #endregion - //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ - #region --Misc Methods (Public)-- - - - #endregion - - #region --Misc Methods (Private)-- private void SetIsRoomBareJidValidProperty(bool value) { if (SetProperty(ref _IsRoomBareJidValid, value, nameof(IsRoomBareJidValid))) @@ -115,11 +112,6 @@ private void SetIsNicknameValidProperty(bool value) } } - private void UpdateIsInputValid() - { - IsInputValid = IsRoomBareJidValid && IsNicknameValid; - } - private void SetNicknameProperty(string value) { if (SetProperty(ref _Nickname, value, nameof(Nickname))) @@ -135,6 +127,18 @@ private void SetClientProperty(XMPPClient value) Nickname = value.getXMPPAccount().user.localPart; } } + #endregion + //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ + #region --Misc Methods (Public)-- + + + #endregion + + #region --Misc Methods (Private)-- + private void UpdateIsInputValid() + { + IsInputValid = IsRoomBareJidValid && IsNicknameValid; + } #endregion