Merge branch 'cwtchRefactor2' of dan/ui into master
This commit is contained in:
commit
007e485e76
|
@ -1,29 +0,0 @@
|
||||||
package characters
|
|
||||||
|
|
||||||
import (
|
|
||||||
"cwtch.im/ui/go/gobjects"
|
|
||||||
"cwtch.im/ui/go/the"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GroupPoller(getContact func(string) *gobjects.Contact, updateContact func(string)) {
|
|
||||||
for {
|
|
||||||
time.Sleep(time.Second * 4)
|
|
||||||
|
|
||||||
servers := the.Peer.GetServers()
|
|
||||||
groups := the.Peer.GetGroups()
|
|
||||||
for i := range groups {
|
|
||||||
group := the.Peer.GetGroup(groups[i])
|
|
||||||
if group != nil && group.GroupID != "" {
|
|
||||||
deleted,_ := group.GetAttribute("deleted")
|
|
||||||
if deleted != "deleted" {
|
|
||||||
getContact(group.GroupID).Status = int(servers[group.GroupServer])
|
|
||||||
updateContact(group.GroupID)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Errorf("grouppoller found a group that is nil :/")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,24 +2,26 @@ package characters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/event"
|
"cwtch.im/cwtch/event"
|
||||||
|
"cwtch.im/cwtch/protocol/connections"
|
||||||
"cwtch.im/ui/go/cwutil"
|
"cwtch.im/ui/go/cwutil"
|
||||||
"cwtch.im/ui/go/gobjects"
|
"cwtch.im/ui/go/gobjects"
|
||||||
|
"cwtch.im/ui/go/gothings"
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"encoding/base32"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(string, string, string), serverStateCallback func(string, bool)) {
|
func IncomingListener(uiState *gothings.InterfaceState) {
|
||||||
q := event.NewEventQueue(1000)
|
q := event.NewEventQueue(1000)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.NewMessageFromPeer, q.EventChannel)
|
the.EventBus.Subscribe(event.NewMessageFromPeer, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.NewMessageFromGroup, q.EventChannel)
|
the.EventBus.Subscribe(event.NewMessageFromGroup, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.NewGroupInvite, q.EventChannel)
|
the.EventBus.Subscribe(event.NewGroupInvite, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.SendMessageToGroupError, q.EventChannel)
|
the.EventBus.Subscribe(event.SendMessageToGroupError, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.SendMessageToPeerError, q.EventChannel)
|
the.EventBus.Subscribe(event.SendMessageToPeerError, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.JoinServer, q.EventChannel)
|
the.EventBus.Subscribe(event.JoinServer, q.EventChannel)
|
||||||
the.CwtchApp.EventBus().Subscribe(event.FinishedFetch, q.EventChannel)
|
the.EventBus.Subscribe(event.FinishedFetch, q.EventChannel)
|
||||||
|
the.EventBus.Subscribe(event.ServerStateChange, q.EventChannel)
|
||||||
|
the.EventBus.Subscribe(event.PeerStateChange, q.EventChannel)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
e := q.Next()
|
e := q.Next()
|
||||||
|
@ -27,7 +29,7 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
|
||||||
switch e.EventType {
|
switch e.EventType {
|
||||||
case event.NewMessageFromPeer: //event.TimestampReceived, event.RemotePeer, event.Data
|
case event.NewMessageFromPeer: //event.TimestampReceived, event.RemotePeer, event.Data
|
||||||
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampReceived])
|
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampReceived])
|
||||||
callback(&gobjects.Message{
|
uiState.AddMessage(&gobjects.Message{
|
||||||
Handle: e.Data[event.RemotePeer],
|
Handle: e.Data[event.RemotePeer],
|
||||||
From: e.Data[event.RemotePeer],
|
From: e.Data[event.RemotePeer],
|
||||||
Message: e.Data[event.Data],
|
Message: e.Data[event.Data],
|
||||||
|
@ -35,8 +37,7 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
|
||||||
Timestamp: ts,
|
Timestamp: ts,
|
||||||
})
|
})
|
||||||
if the.Peer.GetContact(e.Data[event.RemotePeer]) == nil {
|
if the.Peer.GetContact(e.Data[event.RemotePeer]) == nil {
|
||||||
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(e.Data[event.RemotePeer]))
|
the.Peer.AddContact(e.Data[event.RemotePeer], e.Data[event.RemotePeer], false)
|
||||||
the.Peer.AddContact(e.Data[event.RemotePeer], e.Data[event.RemotePeer], decodedPub, false)
|
|
||||||
}
|
}
|
||||||
the.Peer.PeerWithOnion(e.Data[event.RemotePeer])
|
the.Peer.PeerWithOnion(e.Data[event.RemotePeer])
|
||||||
if e.Data[event.Data] != "ack" {
|
if e.Data[event.Data] != "ack" {
|
||||||
|
@ -56,7 +57,7 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
|
||||||
}
|
}
|
||||||
|
|
||||||
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent])
|
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent])
|
||||||
callback(&gobjects.Message{
|
uiState.AddMessage(&gobjects.Message{
|
||||||
MessageID: e.Data[event.Signature],
|
MessageID: e.Data[event.Signature],
|
||||||
Handle: e.Data[event.GroupID],
|
Handle: e.Data[event.GroupID],
|
||||||
From: e.Data[event.RemotePeer],
|
From: e.Data[event.RemotePeer],
|
||||||
|
@ -70,13 +71,42 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
|
||||||
case event.NewGroupInvite:
|
case event.NewGroupInvite:
|
||||||
log.Debugf("got a group invite!")
|
log.Debugf("got a group invite!")
|
||||||
case event.SendMessageToGroupError:
|
case event.SendMessageToGroupError:
|
||||||
groupErrorCallback(e.Data[event.GroupServer], e.Data[event.Signature], e.Data[event.Error])
|
uiState.AddSendMessageError(e.Data[event.GroupServer], e.Data[event.Signature], e.Data[event.Error])
|
||||||
case event.SendMessageToPeerError:
|
case event.SendMessageToPeerError:
|
||||||
groupErrorCallback(e.Data[event.RemotePeer], e.Data[event.Signature], e.Data[event.Error])
|
uiState.AddSendMessageError(e.Data[event.RemotePeer], e.Data[event.Signature], e.Data[event.Error])
|
||||||
case event.JoinServer:
|
case event.JoinServer:
|
||||||
serverStateCallback(e.Data[event.GroupServer], true)
|
uiState.UpdateServerStatus(e.Data[event.GroupServer], true)
|
||||||
case event.FinishedFetch:
|
case event.FinishedFetch:
|
||||||
serverStateCallback(e.Data[event.GroupServer], false)
|
uiState.UpdateServerStatus(e.Data[event.GroupServer], false)
|
||||||
|
case event.PeerStateChange:
|
||||||
|
cxnState := connections.ConnectionStateType[e.Data[event.ConnectionState]]
|
||||||
|
if contact, exists := the.Peer.GetProfile().Contacts[e.Data[event.RemotePeer]]; exists {
|
||||||
|
uiContact := uiState.GetContact(contact.Onion)
|
||||||
|
if uiContact != nil && uiContact.Status != int(cxnState) {
|
||||||
|
uiContact.Status = int(cxnState)
|
||||||
|
uiState.UpdateContact(contact.Onion)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
the.Peer.PeerWithOnion(contact.Onion)
|
||||||
|
c2 := uiState.GetContact(contact.Onion)
|
||||||
|
if c2 != nil && c2.Status != -2 {
|
||||||
|
c2.Status = -2
|
||||||
|
uiState.UpdateContact(contact.Onion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case event.ServerStateChange:
|
||||||
|
serverOnion := e.Data[event.GroupServer]
|
||||||
|
state := connections.ConnectionStateType[e.Data[event.ConnectionState]]
|
||||||
|
groups := the.Peer.GetGroups()
|
||||||
|
for _, groupID := range groups {
|
||||||
|
group := the.Peer.GetGroup(groupID)
|
||||||
|
if group != nil && group.GroupServer == serverOnion {
|
||||||
|
uiState.GetContact(group.GroupID).Status = int(state)
|
||||||
|
uiState.UpdateContact(group.GroupID)
|
||||||
|
} else {
|
||||||
|
log.Errorf("grouppoller found a group that is nil :/")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,24 @@ import (
|
||||||
"cwtch.im/cwtch/event"
|
"cwtch.im/cwtch/event"
|
||||||
"cwtch.im/ui/go/cwutil"
|
"cwtch.im/ui/go/cwutil"
|
||||||
"cwtch.im/ui/go/gobjects"
|
"cwtch.im/ui/go/gobjects"
|
||||||
|
"cwtch.im/ui/go/gothings"
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(contact *gobjects.Contact), updateContact func(string)) { // TODO: make this subscribe-able in ricochet
|
func PresencePoller(uiState *gothings.InterfaceState) {
|
||||||
time.Sleep(time.Second * 4)
|
time.Sleep(time.Second * 4)
|
||||||
for {
|
for {
|
||||||
contacts := the.Peer.GetContacts()
|
contacts := the.Peer.GetContacts()
|
||||||
for i := range contacts {
|
for i := range contacts {
|
||||||
ct := getContact(contacts[i])
|
ct := uiState.GetContact(contacts[i])
|
||||||
if ct == nil { // new contact has attempted to connect with us, treat it as an invite
|
if ct == nil { // new contact has attempted to connect with us, treat it as an invite
|
||||||
toc := the.Peer.GetContact(contacts[i])
|
toc := the.Peer.GetContact(contacts[i])
|
||||||
c, _ := the.Peer.GetProfile().GetContact(contacts[i])
|
c, _ := the.Peer.GetProfile().GetContact(contacts[i])
|
||||||
deleted, _ := c.GetAttribute("deleted")
|
deleted, _ := c.GetAttribute("deleted")
|
||||||
|
|
||||||
if deleted != "deleted" {
|
if deleted != "deleted" {
|
||||||
addContact(&gobjects.Contact{
|
uiState.AddContact(&gobjects.Contact{
|
||||||
toc.Onion,
|
toc.Onion,
|
||||||
toc.Name,
|
toc.Name,
|
||||||
cwutil.RandomProfileImage(toc.Onion),
|
cwutil.RandomProfileImage(toc.Onion),
|
||||||
|
@ -31,7 +32,7 @@ func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(c
|
||||||
false,
|
false,
|
||||||
})
|
})
|
||||||
|
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
||||||
event.RemotePeer: contacts[i],
|
event.RemotePeer: contacts[i],
|
||||||
event.Key: "name",
|
event.Key: "name",
|
||||||
event.Data: c.Name,
|
event.Data: c.Name,
|
||||||
|
@ -39,21 +40,6 @@ func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cxnState, found := the.Peer.GetPeers()[contacts[i]]
|
|
||||||
if !found {
|
|
||||||
the.Peer.PeerWithOnion(contacts[i])
|
|
||||||
c2 := getContact(contacts[i])
|
|
||||||
if c2 != nil && c2.Status != -2 {
|
|
||||||
c2.Status = -2
|
|
||||||
updateContact(contacts[i])
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
c2 := getContact(contacts[i])
|
|
||||||
if c2 != nil && c2.Status != int(cxnState) {
|
|
||||||
c2.Status = int(cxnState)
|
|
||||||
updateContact(contacts[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
time.Sleep(time.Second * 4)
|
time.Sleep(time.Second * 4)
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ func (this *GrandCentralDispatcher) saveSettings(zoom, locale string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
||||||
event.Key: "settings.zoom",
|
event.Key: "settings.zoom",
|
||||||
event.Data: zoom,
|
event.Data: zoom,
|
||||||
}))
|
}))
|
||||||
|
@ -302,7 +302,7 @@ func (this *GrandCentralDispatcher) savePeerSettings(onion, nick string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
contact.SetAttribute("nick", nick)
|
contact.SetAttribute("nick", nick)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
||||||
event.RemotePeer: onion,
|
event.RemotePeer: onion,
|
||||||
event.Key: "nick",
|
event.Key: "nick",
|
||||||
event.Data: nick,
|
event.Data: nick,
|
||||||
|
@ -346,7 +346,7 @@ func (this *GrandCentralDispatcher) saveGroupSettings(groupID, nick string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
group.SetAttribute("nick", nick)
|
group.SetAttribute("nick", nick)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
||||||
event.GroupID: groupID,
|
event.GroupID: groupID,
|
||||||
event.Key: "nick",
|
event.Key: "nick",
|
||||||
event.Data: nick,
|
event.Data: nick,
|
||||||
|
@ -443,7 +443,7 @@ func (this *GrandCentralDispatcher) popup(str string) {
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) updateNick(nick string) {
|
func (this *GrandCentralDispatcher) updateNick(nick string) {
|
||||||
the.Peer.GetProfile().Name = nick
|
the.Peer.GetProfile().Name = nick
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetProfileName, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetProfileName, map[event.Field]string{
|
||||||
event.ProfileName: nick,
|
event.ProfileName: nick,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ func (this *GrandCentralDispatcher) createGroup(server, groupName string) {
|
||||||
|
|
||||||
group := the.Peer.GetGroup(groupID)
|
group := the.Peer.GetGroup(groupID)
|
||||||
group.SetAttribute("nick", groupName)
|
group.SetAttribute("nick", groupName)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
||||||
event.GroupID: groupID,
|
event.GroupID: groupID,
|
||||||
event.Key: "nick",
|
event.Key: "nick",
|
||||||
event.Data: groupName,
|
event.Data: groupName,
|
||||||
|
@ -482,7 +482,7 @@ func (this *GrandCentralDispatcher) inviteToGroup(onion, groupID string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) leaveGroup(groupID string) {
|
func (this *GrandCentralDispatcher) leaveGroup(groupID string) {
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetGroupAttribute, map[event.Field]string{
|
||||||
event.GroupID: groupID,
|
event.GroupID: groupID,
|
||||||
event.Key: "deleted",
|
event.Key: "deleted",
|
||||||
event.Data: "deleted",
|
event.Data: "deleted",
|
||||||
|
@ -501,7 +501,7 @@ func (this *GrandCentralDispatcher) setAttribute(onion, key, value string) {
|
||||||
pp, _ := the.Peer.GetProfile().GetContact(onion)
|
pp, _ := the.Peer.GetProfile().GetContact(onion)
|
||||||
if pp != nil {
|
if pp != nil {
|
||||||
pp.SetAttribute(key, value)
|
pp.SetAttribute(key, value)
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
|
||||||
event.RemotePeer: onion,
|
event.RemotePeer: onion,
|
||||||
event.Key: key,
|
event.Key: key,
|
||||||
event.Data: value,
|
event.Data: value,
|
||||||
|
@ -513,7 +513,7 @@ func (this *GrandCentralDispatcher) setAttribute(onion, key, value string) {
|
||||||
func (this *GrandCentralDispatcher) setLocale(locale string) {
|
func (this *GrandCentralDispatcher) setLocale(locale string) {
|
||||||
this.SetLocale_helper(locale)
|
this.SetLocale_helper(locale)
|
||||||
|
|
||||||
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
the.EventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{
|
||||||
event.Key: "settings.locale",
|
event.Key: "settings.locale",
|
||||||
event.Data: locale,
|
event.Data: locale,
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -5,10 +5,8 @@ import (
|
||||||
"cwtch.im/ui/go/cwutil"
|
"cwtch.im/ui/go/cwutil"
|
||||||
"cwtch.im/ui/go/gobjects"
|
"cwtch.im/ui/go/gobjects"
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"encoding/base32"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -41,8 +39,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
||||||
this.contacts[c.Handle] = c
|
this.contacts[c.Handle] = c
|
||||||
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, false)
|
this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, false)
|
||||||
if the.Peer.GetContact(c.Handle) == nil {
|
if the.Peer.GetContact(c.Handle) == nil {
|
||||||
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(c.Handle))
|
the.Peer.AddContact(c.DisplayName, c.Handle, c.Trusted)
|
||||||
the.Peer.AddContact(c.DisplayName, c.Handle, decodedPub, c.Trusted)
|
|
||||||
go the.Peer.PeerWithOnion(c.Handle)
|
go the.Peer.PeerWithOnion(c.Handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,13 @@ package the
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/app"
|
"cwtch.im/cwtch/app"
|
||||||
|
"cwtch.im/cwtch/event"
|
||||||
libPeer "cwtch.im/cwtch/peer"
|
libPeer "cwtch.im/cwtch/peer"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||||
)
|
)
|
||||||
|
|
||||||
var CwtchApp app.Application
|
var CwtchApp app.Application
|
||||||
|
var EventBus *event.Manager
|
||||||
var ACN connectivity.ACN
|
var ACN connectivity.ACN
|
||||||
var Peer libPeer.CwtchPeer
|
var Peer libPeer.CwtchPeer
|
||||||
var CwtchDir string
|
var CwtchDir string
|
||||||
|
|
12
main.go
12
main.go
|
@ -167,10 +167,9 @@ func loadNetworkingAndFiles(gcd *gothings.GrandCentralDispatcher) {
|
||||||
|
|
||||||
// these are long-lived pollers/listeners for incoming messages and status changes
|
// these are long-lived pollers/listeners for incoming messages and status changes
|
||||||
loadCwtchData(gcd, the.ACN)
|
loadCwtchData(gcd, the.ACN)
|
||||||
go characters.IncomingListener(gcd.UIState.AddMessage, gcd.UIState.AddSendMessageError, gcd.UIState.UpdateServerStatus)
|
go characters.IncomingListener(&gcd.UIState)
|
||||||
go characters.TorStatusPoller(gcd.TorStatus, the.ACN)
|
go characters.TorStatusPoller(gcd.TorStatus, the.ACN)
|
||||||
go characters.PresencePoller(gcd.UIState.GetContact, gcd.UIState.AddContact, gcd.UIState.UpdateContact)
|
go characters.PresencePoller(&gcd.UIState)
|
||||||
go characters.GroupPoller(gcd.UIState.GetContact, gcd.UIState.UpdateContact)
|
|
||||||
|
|
||||||
// load ui preferences
|
// load ui preferences
|
||||||
gcd.RequestSettings()
|
gcd.RequestSettings()
|
||||||
|
@ -212,6 +211,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
|
||||||
} else {
|
} else {
|
||||||
the.Peer = the.CwtchApp.PrimaryIdentity()
|
the.Peer = the.CwtchApp.PrimaryIdentity()
|
||||||
}
|
}
|
||||||
|
the.EventBus = the.CwtchApp.GetEventBus(the.Peer.GetProfile().Onion)
|
||||||
|
|
||||||
gcd.UpdateMyProfile(the.Peer.GetProfile().Name, the.Peer.GetProfile().Onion, cwutil.RandomProfileImage(the.Peer.GetProfile().Onion))
|
gcd.UpdateMyProfile(the.Peer.GetProfile().Name, the.Peer.GetProfile().Onion, cwutil.RandomProfileImage(the.Peer.GetProfile().Onion))
|
||||||
the.CwtchApp.LaunchPeers()
|
the.CwtchApp.LaunchPeers()
|
||||||
|
@ -251,12 +251,6 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) {
|
||||||
Trusted: group.Accepted,
|
Trusted: group.Accepted,
|
||||||
Loading: true,
|
Loading: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Only send a join server packet if we haven't joined this server yet...
|
|
||||||
_, connecting := the.Peer.GetServers()[group.GroupServer]
|
|
||||||
if group.Accepted && !connecting {
|
|
||||||
the.Peer.JoinServer(group.GroupServer)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue