diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 099e947..0ce4cc8 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -120,6 +120,7 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) { this.ClearMessages() this.SetCurrentOpenConversation(handle) c := this.UIState.GetContact(handle) + c.Badge = 0 this.UIState.UpdateContact(handle) diff --git a/go/gothings/uistate.go b/go/gothings/uistate.go index 52e6f6d..547524f 100644 --- a/go/gothings/uistate.go +++ b/go/gothings/uistate.go @@ -2,6 +2,7 @@ package gothings import ( "cwtch.im/ui/go/constants" + "cwtch.im/ui/go/cwutil" "cwtch.im/ui/go/gobjects" "cwtch.im/ui/go/the" "encoding/base32" @@ -50,6 +51,22 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) { } func (this *InterfaceState) GetContact(handle string) *gobjects.Contact { + if _, found := this.contacts[handle]; !found { + c := &gobjects.Contact{ + handle, + handle, + cwutil.RandomProfileImage(handle), + "", + 1, + 0, + false, + } + + this.contacts[handle] = c + this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted) + go the.Peer.PeerWithOnion(c.Handle) + } + return this.contacts[handle] } @@ -57,21 +74,16 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) { _, found := this.contacts[m.Handle] if !found { this.AddContact(&gobjects.Contact{ - m.DisplayName, - m.Image, m.Handle, + m.Handle, + cwutil.RandomProfileImage(m.Handle), "", - 1, + 0, 0, false, }) } - c := the.Peer.GetContact(m.Handle) - if c == nil { - - } - _, found = this.messages[m.Handle] if !found { this.messages[m.Handle] = make([]*gobjects.Message, 0) diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index e1e89e5..06a37fc 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -57,7 +57,7 @@ ColumnLayout { target: gcd onClearMessages: function() { - //jsonModel4.clear() + jsonModel4.clear() } onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts) { @@ -173,10 +173,6 @@ ColumnLayout { } focus: true - onCurrentItemChanged: console.log(model.get(bulletinView.currentIndex).title + ' selected') - - - ListModel { id: jsonModel4 } diff --git a/qml/overlays/ChatOverlay.qml b/qml/overlays/ChatOverlay.qml index 3f813f4..24130e2 100644 --- a/qml/overlays/ChatOverlay.qml +++ b/qml/overlays/ChatOverlay.qml @@ -102,6 +102,9 @@ ColumnLayout { Flickable { id: flkMessage + anchors.fill: parent//this does nothing! bug in qt + Layout.minimumWidth: parent.width + Layout.maximumWidth: parent.width Layout.minimumHeight: rectMessage.height Layout.maximumHeight: rectMessage.height contentWidth: txtMessage.width @@ -120,6 +123,7 @@ ColumnLayout { padding: 6 wrapMode: TextEdit.Wrap textFormat: Text.RichText + width: rectMessage.width property bool skipOneUpdate: false