This commit is contained in:
parent
13cfda928d
commit
54b932e9c1
@ -58,6 +58,14 @@ func (id *Identity) CreateFolder() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (id *Identity) Wipe() error {
|
||||||
|
err := os.RemoveAll(filepath.Join(GetConfig().StoragePath, id.Uuid))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Creates an invitation for a peer, returns the newly created peer including infos to provide a ContactCard
|
// Creates an invitation for a peer, returns the newly created peer including infos to provide a ContactCard
|
||||||
func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerUids []string, InvitationMessage string) (*Peer, error) {
|
func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerUids []string, InvitationMessage string) (*Peer, error) {
|
||||||
var peer Peer
|
var peer Peer
|
||||||
|
@ -43,7 +43,7 @@ func (r *RedisRouter) Route(msg *meowlib.ToServerMessage) (*meowlib.FromServerMe
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
// user message
|
// user message => store
|
||||||
if len(msg.Messages) > 0 {
|
if len(msg.Messages) > 0 {
|
||||||
// update messages counter
|
// update messages counter
|
||||||
err := r.Client.Incr("statistics:messages:usermessages").Err()
|
err := r.Client.Incr("statistics:messages:usermessages").Err()
|
||||||
@ -62,6 +62,7 @@ func (r *RedisRouter) Route(msg *meowlib.ToServerMessage) (*meowlib.FromServerMe
|
|||||||
}
|
}
|
||||||
// check for messages
|
// check for messages
|
||||||
if len(msg.PullRequest) > 0 {
|
if len(msg.PullRequest) > 0 {
|
||||||
|
//dataFound := false
|
||||||
// update messages counter
|
// update messages counter
|
||||||
err := r.Client.Incr("statistics:messages:messagelookups").Err()
|
err := r.Client.Incr("statistics:messages:messagelookups").Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -96,13 +97,15 @@ func (r *RedisRouter) Route(msg *meowlib.ToServerMessage) (*meowlib.FromServerMe
|
|||||||
if msgcnt == 0 {
|
if msgcnt == 0 {
|
||||||
// get invitation answer
|
// get invitation answer
|
||||||
var answer meowlib.Invitation
|
var answer meowlib.Invitation
|
||||||
storedAanswer, err := r.GetAnswerToInvitation(rq.LookupKey)
|
storedAnswer, err := r.GetAnswerToInvitation(rq.LookupKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := proto.Unmarshal(storedAanswer, &answer)
|
err := proto.Unmarshal(storedAnswer, &answer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
from_server.Invitation.Payload = []byte("invitation answer corrupted")
|
from_server.Invitation.Payload = []byte("invitation answer corrupted")
|
||||||
}
|
}
|
||||||
from_server.Invitation = &answer
|
from_server.Invitation = &answer
|
||||||
|
// exit loop if invitation found, cannot store several in a message
|
||||||
|
break
|
||||||
}
|
}
|
||||||
// add invitation answer to the response
|
// add invitation answer to the response
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user