forked from cwtch.im/ui
Merge branch 'master' of git.openprivacy.ca:cwtch.im/ui into ebf201902051208
This commit is contained in:
commit
a9ffb9f47b
|
@ -27,7 +27,10 @@ func andHisBlackAndWhiteCat(incomingMessages chan gobjects.Letter) {
|
||||||
m := <-incomingMessages
|
m := <-incomingMessages
|
||||||
the.Peer.PeerWithOnion(m.To)
|
the.Peer.PeerWithOnion(m.To)
|
||||||
log.Debugf("sending message!")
|
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)
|
the.Peer.SendMessageToPeer(m.To, m.Message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,11 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) {
|
||||||
messages[i].FromMe,
|
messages[i].FromMe,
|
||||||
messages[i].Timestamp.Format(constants.TIME_FORMAT),
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,8 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
||||||
// If an ack, swallow the message and ack from the list.
|
// If an ack, swallow the message and ack from the list.
|
||||||
acklist := the.AcknowledgementIDs[m.From]
|
acklist := the.AcknowledgementIDs[m.From]
|
||||||
for _,ack := range acklist {
|
for _,ack := range acklist {
|
||||||
this.parentGcd.Acknowledged(ack)
|
ack.Ack = true
|
||||||
|
this.parentGcd.Acknowledged(ack.ID)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.messages[m.Handle] = append(this.messages[m.Handle], m)
|
this.messages[m.Handle] = append(this.messages[m.Handle], m)
|
||||||
|
|
|
@ -8,4 +8,10 @@ import (
|
||||||
var CwtchApp app.Application
|
var CwtchApp app.Application
|
||||||
var Peer libPeer.CwtchPeer
|
var Peer libPeer.CwtchPeer
|
||||||
var CwtchDir string
|
var CwtchDir string
|
||||||
var AcknowledgementIDs map[string][]uint
|
|
||||||
|
type AckId struct {
|
||||||
|
ID uint
|
||||||
|
Ack bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var AcknowledgementIDs map[string][]*AckId
|
||||||
|
|
2
main.go
2
main.go
|
@ -33,7 +33,7 @@ func main() {
|
||||||
// our globals
|
// our globals
|
||||||
gcd := gothings.NewGrandCentralDispatcher(nil)
|
gcd := gothings.NewGrandCentralDispatcher(nil)
|
||||||
gcd.UIState = gothings.NewUIState(gcd)
|
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)
|
gcd.OutgoingMessages = make(chan gobjects.Letter, 1000)
|
||||||
|
|
||||||
//TODO: put theme stuff somewhere better
|
//TODO: put theme stuff somewhere better
|
||||||
|
|
Loading…
Reference in New Issue