forked from cwtch.im/cwtch
Update APIs, Formatting
This commit is contained in:
parent
41b3e20aff
commit
d66beb95e5
|
@ -37,10 +37,10 @@ func TestContactRetryQueue(t *testing.T) {
|
|||
setup := false
|
||||
for !setup {
|
||||
if _, exists := cr.connections.Load(testOnion); exists {
|
||||
if _, exists := cr.authorizedPeers.Load(testOnion); exists {
|
||||
t.Logf("authorized")
|
||||
setup = true
|
||||
}
|
||||
if _, exists := cr.authorizedPeers.Load(testOnion); exists {
|
||||
t.Logf("authorized")
|
||||
setup = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -718,17 +718,8 @@ func (cp *cwtchPeer) UpdateConversationAccessControlList(id int, acl model.Acces
|
|||
return cp.storage.SetConversationACL(id, acl)
|
||||
}
|
||||
|
||||
// EnhancedGetConversationAccessControlList serialzies the access control list associated with the conversation
|
||||
func (cp *cwtchPeer) EnhancedGetConversationAccessControlList(id int) (string, error) {
|
||||
ci, err := cp.GetConversationInfo(id)
|
||||
if err == nil {
|
||||
return string(ci.ACL.Serialize()), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
// UpdateConversationAccessControlListJSON wraps UpdateConversationAccessControlList and allows updating via a serialized JSON struct
|
||||
func (cp *cwtchPeer) UpdateConversationAccessControlListJSON(id int, json string) error {
|
||||
// EnhancedUpdateConversationAccessControlList wraps UpdateConversationAccessControlList and allows updating via a serialized JSON struct
|
||||
func (cp *cwtchPeer) EnhancedUpdateConversationAccessControlList(id int, json string) error {
|
||||
_, err := cp.GetConversationInfo(id)
|
||||
if err == nil {
|
||||
acl, err := model.DeserializeAccessControlList([]byte(json))
|
||||
|
@ -740,6 +731,24 @@ func (cp *cwtchPeer) UpdateConversationAccessControlListJSON(id int, json string
|
|||
return err
|
||||
}
|
||||
|
||||
// GetConversationAccessControlList returns the access control list associated with the conversation
|
||||
func (cp *cwtchPeer) GetConversationAccessControlList(id int) (model.AccessControlList, error) {
|
||||
ci, err := cp.GetConversationInfo(id)
|
||||
if err == nil {
|
||||
return ci.ACL, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// EnhancedGetConversationAccessControlList serialzies the access control list associated with the conversation
|
||||
func (cp *cwtchPeer) EnhancedGetConversationAccessControlList(id int) (string, error) {
|
||||
ci, err := cp.GetConversationInfo(id)
|
||||
if err == nil {
|
||||
return string(ci.ACL.Serialize()), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
// AcceptConversation looks up a conversation by `handle` and sets the Accepted status to `true`
|
||||
// This will cause Cwtch to auto connect to this conversation on start up
|
||||
func (cp *cwtchPeer) AcceptConversation(id int) error {
|
||||
|
|
|
@ -123,8 +123,10 @@ type CwtchPeer interface {
|
|||
|
||||
// API-level management of conversation access control
|
||||
UpdateConversationAccessControlList(id int, acl model.AccessControlList) error
|
||||
EnhancedUpdateConversationAccessControlList(conversation int, acjson string) error
|
||||
|
||||
GetConversationAccessControlList(conversation int) (model.AccessControlList, error)
|
||||
EnhancedGetConversationAccessControlList(conversation int) (string, error)
|
||||
UpdateConversationAccessControlListJSON(conversation int, acjson string) error
|
||||
|
||||
// Convieniance Functions for ACL Management
|
||||
AcceptConversation(conversation int) error
|
||||
|
|
Loading…
Reference in New Issue