Reject Group Invite should delete group invite from storage
This commit is contained in:
parent
d70e3609f3
commit
e119958db1
|
@ -57,6 +57,7 @@ const (
|
||||||
|
|
||||||
// GroupID
|
// GroupID
|
||||||
AcceptGroupInvite = Type("AcceptGroupInvite")
|
AcceptGroupInvite = Type("AcceptGroupInvite")
|
||||||
|
RejectGroupInvite = Type("RejectGroupInvite")
|
||||||
|
|
||||||
SendMessageToGroup = Type("SendMessagetoGroup")
|
SendMessageToGroup = Type("SendMessagetoGroup")
|
||||||
|
|
||||||
|
|
|
@ -563,6 +563,7 @@ func (cp *cwtchPeer) RejectInvite(groupID string) {
|
||||||
cp.mutex.Lock()
|
cp.mutex.Lock()
|
||||||
defer cp.mutex.Unlock()
|
defer cp.mutex.Unlock()
|
||||||
cp.Profile.RejectInvite(groupID)
|
cp.Profile.RejectInvite(groupID)
|
||||||
|
cp.eventBus.Publish(event.NewEvent(event.RejectGroupInvite, map[event.Field]string{event.GroupID: groupID}))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen makes the peer open a listening port to accept incoming connections (and be detactably online)
|
// Listen makes the peer open a listening port to accept incoming connections (and be detactably online)
|
||||||
|
|
|
@ -75,6 +75,7 @@ func (ps *ProfileStoreV1) initProfileWriterStore() {
|
||||||
ps.eventManager.Subscribe(event.SetPeerAttribute, ps.queue)
|
ps.eventManager.Subscribe(event.SetPeerAttribute, ps.queue)
|
||||||
ps.eventManager.Subscribe(event.SetGroupAttribute, ps.queue)
|
ps.eventManager.Subscribe(event.SetGroupAttribute, ps.queue)
|
||||||
ps.eventManager.Subscribe(event.AcceptGroupInvite, ps.queue)
|
ps.eventManager.Subscribe(event.AcceptGroupInvite, ps.queue)
|
||||||
|
ps.eventManager.Subscribe(event.RejectGroupInvite, ps.queue)
|
||||||
ps.eventManager.Subscribe(event.NewGroupInvite, ps.queue)
|
ps.eventManager.Subscribe(event.NewGroupInvite, ps.queue)
|
||||||
ps.eventManager.Subscribe(event.NewMessageFromGroup, ps.queue)
|
ps.eventManager.Subscribe(event.NewMessageFromGroup, ps.queue)
|
||||||
ps.eventManager.Subscribe(event.SendMessageToPeer, ps.queue)
|
ps.eventManager.Subscribe(event.SendMessageToPeer, ps.queue)
|
||||||
|
@ -373,6 +374,9 @@ func (ps *ProfileStoreV1) eventHandler() {
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("error accepting group invite")
|
log.Errorf("error accepting group invite")
|
||||||
}
|
}
|
||||||
|
case event.RejectGroupInvite:
|
||||||
|
ps.profile.RejectInvite(ev.Data[event.GroupID])
|
||||||
|
ps.save()
|
||||||
case event.NewGroupInvite:
|
case event.NewGroupInvite:
|
||||||
gid, _, err := ps.profile.ProcessInvite(ev.Data[event.GroupInvite], ev.Data[event.RemotePeer])
|
gid, _, err := ps.profile.ProcessInvite(ev.Data[event.GroupInvite], ev.Data[event.RemotePeer])
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
Loading…
Reference in New Issue