Identity Messageservers count errors

This commit is contained in:
ycc 2022-11-30 21:35:38 +01:00
parent 8bde6802de
commit 3066d48b3e

View File

@ -42,7 +42,12 @@ func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerI
peer.Name = ContactName
peer.InvitationId = uuid.New().String()
if id.MessageServers.Servers == nil {
return nil, errors.New("no servers defined in your identity")
return nil, errors.New("no message servers defined in your identity")
}
for _, i := range MessageServerIdxs {
if i > len(id.MessageServers.Servers)-1 {
return nil, errors.New("requested server out of range of defined message servers")
}
}
for _, i := range MessageServerIdxs {
srv := id.MessageServers.Servers[i].ServerData