This commit is contained in:
@@ -129,9 +129,20 @@ func ConsumeInboxFile(messageFilename string) ([]string, []string, string, error
|
||||
if err != nil {
|
||||
return nil, nil, "ReadMessage: Unmarshal FromServerMessage", err
|
||||
}
|
||||
// check if invitation answer
|
||||
// check if invitation answer (step-2 answer waiting for the initiator)
|
||||
if fromServerMessage.Invitation != nil {
|
||||
invitationGetAnswerReadResponse(fromServerMessage.Invitation)
|
||||
peer, _, _, invErr := InvitationStep3ProcessAnswer(fromServerMessage.Invitation)
|
||||
if invErr == nil && peer != nil {
|
||||
// Auto-send step-3 CC to invitee's servers.
|
||||
msgs, _, sendErr := InvitationStep3Message(peer.InvitationId)
|
||||
if sendErr == nil {
|
||||
for i, bytemsg := range msgs {
|
||||
if i < len(peer.ContactPullServers) {
|
||||
meowlib.HttpPostMessage(peer.ContactPullServers[i], bytemsg, client.GetConfig().HttpTimeOut)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Chat messages
|
||||
if len(fromServerMessage.Chat) > 0 {
|
||||
@@ -142,12 +153,41 @@ func ConsumeInboxFile(messageFilename string) ([]string, []string, string, error
|
||||
if peer == nil {
|
||||
return nil, nil, "ReadMessage: GetFromMyLookupKey", errors.New("no visible peer for that message")
|
||||
}
|
||||
// Unpack the message
|
||||
usermsg, err := peer.ProcessInboundUserMessage(packedUserMessage)
|
||||
// Unpack the message — step-3 messages arrive before the initiator's identity
|
||||
// key is known, so skip signature verification for pending peers.
|
||||
var usermsg *meowlib.UserMessage
|
||||
if peer.InvitationPending() {
|
||||
usermsg, err = peer.ProcessInboundStep3UserMessage(packedUserMessage)
|
||||
} else {
|
||||
usermsg, err = peer.ProcessInboundUserMessage(packedUserMessage)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, "ReadMessage: ProcessInboundUserMessage", err
|
||||
}
|
||||
|
||||
// Handle invitation step 3: initiator's full ContactCard arriving at the invitee.
|
||||
if usermsg.Invitation != nil && usermsg.Invitation.Step == 3 {
|
||||
finalizedPeer, _, finalErr := InvitationStep4ProcessStep3(usermsg)
|
||||
if finalErr == nil && finalizedPeer != nil {
|
||||
// Auto-send step-4 confirmation to initiator's servers.
|
||||
step4msgs, _, sendErr := InvitationStep4Message(finalizedPeer.InvitationId)
|
||||
if sendErr == nil {
|
||||
for i, bytemsg := range step4msgs {
|
||||
if i < len(finalizedPeer.ContactPullServers) {
|
||||
meowlib.HttpPostMessage(finalizedPeer.ContactPullServers[i], bytemsg, client.GetConfig().HttpTimeOut)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// Handle invitation step 4: invitee's confirmation arriving at the initiator.
|
||||
if usermsg.Invitation != nil && usermsg.Invitation.Step == 4 {
|
||||
// Contact is fully active — nothing more to do on the initiator side.
|
||||
continue
|
||||
}
|
||||
|
||||
// Check for received or processed already filled => it's an ack for one of our sent messages
|
||||
if len(usermsg.Data) == 0 && usermsg.Status != nil && usermsg.Status.Uuid != "" &&
|
||||
(usermsg.Status.Received != 0 || usermsg.Status.Processed != 0) {
|
||||
|
||||
Reference in New Issue
Block a user