stop saving anything

This commit is contained in:
erinn 2019-01-21 13:41:47 -08:00
parent 2e908a7560
commit e19711e599
4 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,7 @@
package characters
import (
"cwtch.im/cwtch/event"
"cwtch.im/ui/go/cwutil"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
@ -26,7 +27,7 @@ func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(c
c.Trusted,
})
c.SetAttribute("name", c.Name)
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
}
cxnState, found := the.Peer.GetPeers()[contacts[i]]

View File

@ -1,6 +1,7 @@
package gothings
import (
"cwtch.im/cwtch/event"
"cwtch.im/ui/go/constants"
"cwtch.im/ui/go/cwutil"
@ -68,7 +69,7 @@ func (this *GrandCentralDispatcher) sendMessage(message string, mID uint) {
if len(this.CurrentOpenConversation()) == 32 { // SEND TO GROUP
if !the.Peer.GetGroup(this.CurrentOpenConversation()).Accepted {
the.Peer.GetGroup(this.CurrentOpenConversation()).Accepted = true
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
c := this.UIState.GetContact(this.CurrentOpenConversation())
c.Trusted = true
this.UIState.UpdateContact(c.Handle)
@ -121,7 +122,7 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
}
var name string
var exists bool
name, exists = the.Peer.GetProfile().GetCustomAttribute(tl[i].PeerID + "_name")
name, exists = the.Peer.GetProfile().GetAttribute(tl[i].PeerID + "_name")
if !exists || name == "" {
name = tl[i].PeerID[:16] + "..."
}
@ -210,7 +211,7 @@ func (this *GrandCentralDispatcher) importString(str string) {
}
the.Peer.JoinServer(group.GroupServer)
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
this.UIState.AddContact(&gobjects.Contact{
groupID,
groupID[:12],
@ -258,13 +259,13 @@ func (this *GrandCentralDispatcher) importString(str string) {
return
}
_, exists := the.Peer.GetProfile().GetCustomAttribute(name + "_onion")
_, exists := the.Peer.GetProfile().GetAttribute(name + "_onion")
if exists {
this.InvokePopup("can't re-use names :(")
return
}
_, exists = the.Peer.GetProfile().GetCustomAttribute(onion + "_name")
_, exists = the.Peer.GetProfile().GetAttribute(onion + "_name")
if exists {
this.InvokePopup("already have this contact")
return //TODO: bring them to the duplicate
@ -284,7 +285,7 @@ func (this *GrandCentralDispatcher) popup(str string) {
func (this *GrandCentralDispatcher) updateNick(nick string) {
the.Peer.GetProfile().Name = nick
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
}
func (this *GrandCentralDispatcher) createGroup(server, groupName string) {
@ -304,7 +305,7 @@ func (this *GrandCentralDispatcher) createGroup(server, groupName string) {
group := the.Peer.GetGroup(groupID)
group.SetAttribute("nick", groupName)
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
the.Peer.JoinServer(server)
group.NewMessage = make(chan model.Message)

View File

@ -1,6 +1,7 @@
package gothings
import (
"cwtch.im/cwtch/event"
"cwtch.im/cwtch/model"
"cwtch.im/ui/go/constants"
"cwtch.im/ui/go/gobjects"
@ -45,7 +46,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
if c.Trusted {
the.Peer.GetProfile().TrustPeer(c.Handle)
}
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
go the.Peer.PeerWithOnion(c.Handle)
}
@ -54,7 +55,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted)
}
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
}
func (this *InterfaceState) GetContact(handle string) *gobjects.Contact {
@ -98,7 +99,7 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
c.Badge++
this.UpdateContact(c.Handle)
}
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
}
func (this *InterfaceState) GetMessages(handle string) []*gobjects.Message {

View File

@ -2,6 +2,7 @@ package main
import (
libapp "cwtch.im/cwtch/app"
"cwtch.im/cwtch/event"
"cwtch.im/cwtch/model"
"cwtch.im/ui/go/characters"
"cwtch.im/ui/go/cwutil"
@ -126,7 +127,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
log.Errorf("couldn't create one. is your cwtch folder writable?")
os.Exit(1)
}
the.CwtchApp.SaveProfile(the.Peer)
the.CwtchApp.EventBus().Publish(event.NewEvent(event.RequestProfileSave, map[event.Field]string{}))
} else {
the.Peer = the.CwtchApp.PrimaryIdentity()
}