diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 233a3513..8fbf5aa1 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -52,11 +52,12 @@ type GrandCentralDispatcher struct { _ func(str string) `signal:"InvokePopup"` _ func(zoom, locale string) `signal:"SupplySettings"` _ func(groupID, name, server, invitation string, accepted bool, addrbooknames, addrbookaddrs []string) `signal:"SupplyGroupSettings"` - _ func(onion, nick string) `signal:"SupplyPeerSettings"` + _ func(onion, nick string, blocked bool) `signal:"SupplyPeerSettings"` // signals emitted from the ui (written in go, below) _ func(message string, mid string) `signal:"sendMessage,auto"` _ func(onion string) `signal:"blockPeer,auto"` + _ func(onion string) `signal:"unblockPeer,auto"` _ func(onion string) `signal:"loadMessagesPane,auto"` _ func(signal string) `signal:"broadcast,auto"` // convenience relay signal _ func(str string) `signal:"importString,auto"` @@ -285,18 +286,18 @@ func (this *GrandCentralDispatcher) requestPeerSettings() { contact := the.Peer.GetContact(this.CurrentOpenConversation()) if contact == nil { log.Errorf("error: requested settings for unknown contact %v?", this.CurrentOpenConversation()) - this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation()) + this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation(), false) return } name, exists := contact.GetAttribute("nick") if !exists { log.Errorf("error: couldn't find contact %v", this.CurrentOpenConversation()) - this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation()) + this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation(), contact.Blocked) return } - this.SupplyPeerSettings(contact.Onion, name) + this.SupplyPeerSettings(contact.Onion, name, contact.Blocked) } func (this *GrandCentralDispatcher) savePeerSettings(onion, nick string) { @@ -492,6 +493,16 @@ func (this *GrandCentralDispatcher) blockPeer(onion string) { this.UIState.UpdateContact(onion) } +func (this *GrandCentralDispatcher) unblockPeer(onion string) { + err := the.Peer.UnblockPeer(onion) + if err != nil { + this.InvokePopup("Error Unblocking Peer: " + err.Error()) + } + the.Peer.PeerWithOnion(onion) + this.UIState.UpdateContact(onion) +} + + func (this *GrandCentralDispatcher) inviteToGroup(onion, groupID string) { err := the.Peer.InviteOnionToGroup(onion, groupID) if err != nil { diff --git a/go/gothings/uistate.go b/go/gothings/uistate.go index d4c803c9..d2977884 100644 --- a/go/gothings/uistate.go +++ b/go/gothings/uistate.go @@ -177,6 +177,12 @@ func (this *InterfaceState) UpdateContact(handle string) { c.Blocked = contact.Blocked this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Blocked, c.Loading) } + } else { + cif, found := this.contacts.Load(handle) + if found { + c := cif.(*gobjects.Contact) + this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Blocked, c.Loading) + } } } diff --git a/i18n/translation_de.ts b/i18n/translation_de.ts index 6de5c10c..84bb3bb6 100644 --- a/i18n/translation_de.ts +++ b/i18n/translation_de.ts @@ -255,7 +255,12 @@ - + + unblock-btn + + + + delete-btn löschen diff --git a/i18n/translation_en.qm b/i18n/translation_en.qm index 59f64a74..b38f9584 100644 Binary files a/i18n/translation_en.qm and b/i18n/translation_en.qm differ diff --git a/i18n/translation_en.ts b/i18n/translation_en.ts index 38547850..83e884c7 100644 --- a/i18n/translation_en.ts +++ b/i18n/translation_en.ts @@ -255,7 +255,12 @@ Block Peer - + + unblock-btn + Unblock Peer + + + delete-btn Delete diff --git a/i18n/translation_fr.ts b/i18n/translation_fr.ts index 38d59aa3..8b493ee5 100644 --- a/i18n/translation_fr.ts +++ b/i18n/translation_fr.ts @@ -255,7 +255,12 @@ - + + unblock-btn + + + + delete-btn Effacer diff --git a/i18n/translation_pt.ts b/i18n/translation_pt.ts index db0542ef..b73d4ac6 100644 --- a/i18n/translation_pt.ts +++ b/i18n/translation_pt.ts @@ -255,7 +255,12 @@ - + + unblock-btn + + + + delete-btn Deletar diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index cdb2afdf..1e1f3cd8 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -92,7 +92,7 @@ ColumnLayout { } } - onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) { + onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) { if (gcd.currentOpenConversation == _handle) { if (_loading == true) { newposttitle.enabled = false diff --git a/qml/overlays/ChatOverlay.qml b/qml/overlays/ChatOverlay.qml index 9f0fa148..bdf44afa 100644 --- a/qml/overlays/ChatOverlay.qml +++ b/qml/overlays/ChatOverlay.qml @@ -110,7 +110,7 @@ ColumnLayout { messagesListView.positionViewAtEnd() } - onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) { + onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) { if (gcd.currentOpenConversation == _handle) { // Group is Synced OR p2p is Authenticated if ( (_handle.length == 32 && _status == 4) || _status == 3) { diff --git a/qml/overlays/ListOverlay.qml b/qml/overlays/ListOverlay.qml index 1142f0ca..5304ac28 100644 --- a/qml/overlays/ListOverlay.qml +++ b/qml/overlays/ListOverlay.qml @@ -96,7 +96,7 @@ ColumnLayout { } } - onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) { + onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) { if (gcd.currentOpenConversation == _handle) { if (_loading == true) { newposttitle.enabled = false diff --git a/qml/panes/PeerSettingsPane.qml b/qml/panes/PeerSettingsPane.qml index b2e37023..3fa3c419 100644 --- a/qml/panes/PeerSettingsPane.qml +++ b/qml/panes/PeerSettingsPane.qml @@ -12,7 +12,7 @@ import "../styles" ColumnLayout { // peerSettingsPane id: root anchors.fill: parent - + property bool blocked StackToolbar { id: toolbar @@ -82,10 +82,15 @@ ColumnLayout { // peerSettingsPane SimpleButton { icon: "solid/hand-paper" - text: qsTr("block-btn") + text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn") onClicked: { - gcd.blockPeer(txtOnion.text) + if (root.blocked) { + gcd.unblockPeer(txtOnion.text) + } else { + gcd.blockPeer(txtOnion.text) + } + root.blocked = !root.blocked } } @@ -106,10 +111,11 @@ ColumnLayout { // peerSettingsPane Connections { target: gcd - onSupplyPeerSettings: function(onion, nick) { + onSupplyPeerSettings: function(onion, nick, blocked) { toolbar.text = nick txtOnion.text = onion txtDisplayName.text = nick + root.blocked = blocked } } } \ No newline at end of file diff --git a/qml/widgets/ContactList.qml b/qml/widgets/ContactList.qml index 3ba74972..8390d986 100644 --- a/qml/widgets/ContactList.qml +++ b/qml/widgets/ContactList.qml @@ -56,9 +56,9 @@ ColumnLayout { "_badge": badge, "_status": status, "_trusted": trusted, + "_blocked": blocked, "_deleted": false, "_loading": loading, - "_blocked": blocked }) }