Merge branch 'master' of git.openprivacy.ca:cwtch.im/ui into ebf201902051208

This commit is contained in:
erinn 2019-02-11 13:33:20 -08:00
commit a9ffb9f47b
5 changed files with 19 additions and 4 deletions

View File

@ -27,7 +27,10 @@ func andHisBlackAndWhiteCat(incomingMessages chan gobjects.Letter) {
m := <-incomingMessages
the.Peer.PeerWithOnion(m.To)
log.Debugf("sending message!")
the.AcknowledgementIDs[m.To] = append(the.AcknowledgementIDs[m.To], m.MID)
ackID := new(the.AckId)
ackID.ID = m.MID
ackID.Ack = false
the.AcknowledgementIDs[m.To] = append(the.AcknowledgementIDs[m.To], ackID)
the.Peer.SendMessageToPeer(m.To, m.Message)
}
}

View File

@ -188,6 +188,11 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) {
messages[i].FromMe,
messages[i].Timestamp.Format(constants.TIME_FORMAT),
)
for _,id := range the.AcknowledgementIDs[messages[i].Handle] {
if int(id.ID) == messages[i].MessageID && id.Ack{
this.Acknowledged(id.ID)
}
}
}
}

View File

@ -93,7 +93,8 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
// If an ack, swallow the message and ack from the list.
acklist := the.AcknowledgementIDs[m.From]
for _,ack := range acklist {
this.parentGcd.Acknowledged(ack)
ack.Ack = true
this.parentGcd.Acknowledged(ack.ID)
}
} else {
this.messages[m.Handle] = append(this.messages[m.Handle], m)

View File

@ -8,4 +8,10 @@ import (
var CwtchApp app.Application
var Peer libPeer.CwtchPeer
var CwtchDir string
var AcknowledgementIDs map[string][]uint
type AckId struct {
ID uint
Ack bool
}
var AcknowledgementIDs map[string][]*AckId

View File

@ -33,7 +33,7 @@ func main() {
// our globals
gcd := gothings.NewGrandCentralDispatcher(nil)
gcd.UIState = gothings.NewUIState(gcd)
the.AcknowledgementIDs = make(map[string][]uint)
the.AcknowledgementIDs = make(map[string][]*the.AckId)
gcd.OutgoingMessages = make(chan gobjects.Letter, 1000)
//TODO: put theme stuff somewhere better