cwtch/app/app.go

45 lines
788 B
Go
Raw Normal View History

2018-04-30 21:47:21 +00:00
package app
import (
"git.mascherari.press/cwtch/model"
"git.mascherari.press/cwtch/peer"
)
type Application struct {
Peer *peer.CwtchPeer
}
func (app *Application) NewProfile(name string, filename string) error {
profile := peer.NewCwtchPeer(name)
app.Peer = profile
return profile.Save(filename)
}
func (app *Application) SetProfile(filename string) error {
profile,err := peer.LoadCwtchPeer(filename)
app.Peer = profile
if err == nil {
app.Peer.Listen()
}
return err
}
func (app *Application) PeerRequest(onion string) {
app.Peer.PeerWithOnion(onion)
}
func (app *Application) SendMessageToPeer(onion string) {
}
func (app *Application) GetPeers() []model.PublicProfile {
return nil
}
func (app *Application) GetNewMessages() []model.Message {
return nil
}