refactor invitation

This commit is contained in:
yc
2026-04-11 22:05:30 +02:00
parent 1906431061
commit 793213b3fb
16 changed files with 465 additions and 436 deletions

View File

@@ -11,6 +11,8 @@ import (
"forge.redroom.link/yves/meowlib"
"forge.redroom.link/yves/meowlib/client"
invmsgs "forge.redroom.link/yves/meowlib/client/invitation/messages"
invsrv "forge.redroom.link/yves/meowlib/client/invitation/server"
"github.com/google/uuid"
"google.golang.org/protobuf/proto"
)
@@ -131,10 +133,10 @@ func ConsumeInboxFile(messageFilename string) ([]string, []string, string, error
}
// check if invitation answer (step-2 answer waiting for the initiator)
if fromServerMessage.Invitation != nil {
peer, _, _, invErr := InvitationStep3ProcessAnswer(fromServerMessage.Invitation)
peer, _, invErr := invmsgs.Step3InitiatorFinalizesInviteeAndCreatesContactCard(fromServerMessage.Invitation)
if invErr == nil && peer != nil {
// Auto-send step-3 CC to invitee's servers.
msgs, _, sendErr := InvitationStep3Message(peer.InvitationId)
msgs, sendErr := invsrv.Step3PostCard(peer.InvitationId)
if sendErr == nil {
for i, bytemsg := range msgs {
if i < len(peer.ContactPullServers) {
@@ -167,10 +169,10 @@ func ConsumeInboxFile(messageFilename string) ([]string, []string, string, error
// Handle invitation step 3: initiator's full ContactCard arriving at the invitee.
if usermsg.Invitation != nil && usermsg.Invitation.Step == 3 {
finalizedPeer, _, finalErr := InvitationStep4ProcessStep3(usermsg)
finalizedPeer, finalErr := invmsgs.Step4InviteeFinalizesInitiator(usermsg)
if finalErr == nil && finalizedPeer != nil {
// Auto-send step-4 confirmation to initiator's servers.
step4msgs, _, sendErr := InvitationStep4Message(finalizedPeer.InvitationId)
step4msgs, sendErr := invsrv.Step4PostConfirmation(finalizedPeer.InvitationId)
if sendErr == nil {
for i, bytemsg := range step4msgs {
if i < len(finalizedPeer.ContactPullServers) {