forked from cwtch.im/cwtch
add storage eventbus calls
This commit is contained in:
parent
2db7385ce0
commit
ad7cddaacf
|
@ -67,7 +67,11 @@ func (app *application) CreatePeer(name string, password string) (peer.CwtchPeer
|
|||
profileStore, err := storage.NewProfileStore(app.eventBus, path.Join(app.directory, "profiles", randomFileName), password)
|
||||
profileStore.Init(name)
|
||||
p := peer.NewCwtchPeer(name)
|
||||
app.eventBus.Publish(event.NewEvent(event.SetProfileName, map[event.Field]string{event.ProfileName: name}))
|
||||
|
||||
app.eventBus.Publish(event.NewEvent(event.SetProfileName, map[event.Field]string{
|
||||
event.ProfileName: name,
|
||||
}))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -25,9 +25,32 @@ const (
|
|||
SendMessageToPeer = Type("SendMessageToPeer")
|
||||
NewMessageFromPeer = Type("NewMessageFromPeer")
|
||||
|
||||
// REQUESTS TO STORAGE ENGINE
|
||||
|
||||
// change the .Name attribute of a profile (careful - this is not a custom attribute. it is used in the underlying protocol during handshakes!)
|
||||
// attributes:
|
||||
// ProfileName [eg "erinn"]
|
||||
SetProfileName = Type("SetProfileName")
|
||||
|
||||
RequestProfileSave = Type("RequestProfileSave")
|
||||
// request to store a profile-wide attribute (good for e.g. per-profile settings like theme prefs)
|
||||
// attributes:
|
||||
// Key [eg "fontcolor"]
|
||||
// Data [eg "red"]
|
||||
SetAttribute = Type("SetAttribute")
|
||||
|
||||
// request to store a per-contact attribute (e.g. display names for a peer)
|
||||
// attributes:
|
||||
// RemotePeer [eg ""]
|
||||
// Key [eg "nick"]
|
||||
// Data [eg "erinn"]
|
||||
SetPeerAttribute = Type("SetPeerAttribute")
|
||||
|
||||
// request to store a per-cwtch-group attribute (e.g. display name for a group)
|
||||
// attributes:
|
||||
// GroupID [eg ""]
|
||||
// Key [eg "nick"]
|
||||
// Data [eg "open privacy board"]
|
||||
SetGroupAttribute = Type("SetGroupAttribute")
|
||||
)
|
||||
|
||||
// Field defines common event attributes
|
||||
|
@ -49,6 +72,7 @@ const (
|
|||
|
||||
ProfileName = Field("ProfileName")
|
||||
|
||||
Key = Field("Key")
|
||||
Data = Field("Data")
|
||||
|
||||
Error = Field("Error")
|
||||
|
|
Loading…
Reference in New Issue