Merge branch 'master' into stateful
the build was successful
Details
the build was successful
Details
This commit is contained in:
commit
09079dd224
100
go/ui/gcd.go
100
go/ui/gcd.go
|
@ -121,8 +121,8 @@ type GrandCentralDispatcher struct {
|
||||||
_ func(onion string, auth string) `signal:"setPeerAuthorization,auto"`
|
_ func(onion string, auth string) `signal:"setPeerAuthorization,auto"`
|
||||||
_ func(onion string) `signal:"loadMessagesPane,auto"`
|
_ func(onion string) `signal:"loadMessagesPane,auto"`
|
||||||
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
|
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
|
||||||
_ func(str string) `signal:"importString,auto"`
|
|
||||||
_ func(name, address string) `signal:"addPeer,auto"`
|
_ func(name, address string) `signal:"addPeer,auto"`
|
||||||
|
_ func(address string) `signal:"addGroup,auto"`
|
||||||
_ func(str string) `signal:"createContact,auto"`
|
_ func(str string) `signal:"createContact,auto"`
|
||||||
_ func(str string) `signal:"popup,auto"`
|
_ func(str string) `signal:"popup,auto"`
|
||||||
_ func(server, groupName string) `signal:"createGroup,auto"`
|
_ func(server, groupName string) `signal:"createGroup,auto"`
|
||||||
|
@ -416,6 +416,12 @@ func (this *GrandCentralDispatcher) requestServerSettings(groupID string) {
|
||||||
|
|
||||||
serverInfo := the.Peer.GetContact(group.GroupServer)
|
serverInfo := the.Peer.GetContact(group.GroupServer)
|
||||||
|
|
||||||
|
if serverInfo == nil {
|
||||||
|
// This should never happen...there is a bug....
|
||||||
|
log.Errorf("No server info found for ", group.GroupServer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
key_types := []model.KeyType{model.KeyTypeServerOnion, model.KeyTypeTokenOnion, model.KeyTypePrivacyPass}
|
key_types := []model.KeyType{model.KeyTypeServerOnion, model.KeyTypeTokenOnion, model.KeyTypePrivacyPass}
|
||||||
var keyNames []string
|
var keyNames []string
|
||||||
var keys []string
|
var keys []string
|
||||||
|
@ -518,6 +524,25 @@ func (this *GrandCentralDispatcher) createContact(onion string) {
|
||||||
the.Peer.PeerWithOnion(onion)
|
the.Peer.PeerWithOnion(onion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *GrandCentralDispatcher) addGroup(address string) {
|
||||||
|
log.Debugf("importing group: %s\n", address)
|
||||||
|
address = strings.TrimSpace(address)
|
||||||
|
|
||||||
|
if gf, err := groups.ExperimentGate(this.GlobalSettings.Experiments); err == nil {
|
||||||
|
if gf.ValidPrefix(address) {
|
||||||
|
err = gf.HandleImportString(address)
|
||||||
|
if err == nil {
|
||||||
|
// TODO: We need a better way of signaling the success of "invisible" actions like adding server bundles
|
||||||
|
this.InvokePopup("successfully imported")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.InvokePopup("failed import: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// drop through to peer import strings
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) addPeer(name, address string) {
|
func (this *GrandCentralDispatcher) addPeer(name, address string) {
|
||||||
|
|
||||||
log.Debugf("importing peer: %s\n", address)
|
log.Debugf("importing peer: %s\n", address)
|
||||||
|
@ -529,8 +554,6 @@ func (this *GrandCentralDispatcher) addPeer(name, address string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
name = strings.TrimSpace(name)
|
|
||||||
|
|
||||||
_, err := base32.StdEncoding.DecodeString(strings.ToUpper(address[:56]))
|
_, err := base32.StdEncoding.DecodeString(strings.ToUpper(address[:56]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugln(err)
|
log.Debugln(err)
|
||||||
|
@ -553,77 +576,6 @@ func (this *GrandCentralDispatcher) addPeer(name, address string) {
|
||||||
this.GetUiManager(this.selectedProfile()).AddContact(address)
|
this.GetUiManager(this.selectedProfile()).AddContact(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated TODO: delete when gcd.addGroup is implemented from this
|
|
||||||
func (this *GrandCentralDispatcher) importString(str string) {
|
|
||||||
if len(str) < 5 {
|
|
||||||
log.Debugf("ignoring short string")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if gf, err := groups.ExperimentGate(this.GlobalSettings.Experiments); err == nil {
|
|
||||||
if gf.ValidPrefix(str) {
|
|
||||||
err = gf.HandleImportString(str)
|
|
||||||
if err == nil {
|
|
||||||
// TODO: We need a better way of signaling the success of "invisible" actions like adding server bundles
|
|
||||||
this.InvokePopup("successfully imported")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.InvokePopup("failed import: " + err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// drop through to peer import strings
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Debugf("importing: %s\n", str)
|
|
||||||
onion := str
|
|
||||||
name := onion
|
|
||||||
str = strings.TrimSpace(str)
|
|
||||||
|
|
||||||
if strings.Contains(str, " ") { // usually people prepend spaces and we don't want it going into the name (use ~ for that)
|
|
||||||
parts := strings.Split(strings.TrimSpace(str), " ")
|
|
||||||
str = parts[len(parts)-1]
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(str, "~") {
|
|
||||||
parts := strings.Split(str, "~")
|
|
||||||
onion = parts[len(parts)-1]
|
|
||||||
name = strings.Join(parts[:len(parts)-1], " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(onion) != 56 {
|
|
||||||
this.InvokePopup("invalid format")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
name = strings.TrimSpace(name)
|
|
||||||
if name == "" {
|
|
||||||
this.InvokePopup("empty name")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(name) > 32 {
|
|
||||||
name = name[:32] //TODO: better strategy for long names?
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion[:56]))
|
|
||||||
if err != nil {
|
|
||||||
log.Debugln(err)
|
|
||||||
this.InvokePopup("bad format. missing handlers?")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
checkc := the.Peer.GetContact(onion)
|
|
||||||
if checkc != nil {
|
|
||||||
this.InvokePopup("already have this contact")
|
|
||||||
return //TODO: bring them to the duplicate
|
|
||||||
} else {
|
|
||||||
the.Peer.AddContact(name, onion, model.AuthApproved)
|
|
||||||
the.Peer.PeerWithOnion(onion)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.GetUiManager(this.selectedProfile()).AddContact(onion)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) popup(str string) {
|
func (this *GrandCentralDispatcher) popup(str string) {
|
||||||
this.InvokePopup(str)
|
this.InvokePopup(str)
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,18 +183,6 @@ Rectangle {
|
||||||
placeholderText: qsTr("group-addr")
|
placeholderText: qsTr("group-addr")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Opaque.UnderlineTextField {
|
|
||||||
visible: gcd.experimentsEnabled && Utils.checkMap(gcd.experiments, "tapir-groups-experiment")
|
|
||||||
id: groupNameJoin
|
|
||||||
|
|
||||||
backgroundColor: Theme.backgroundPaneColor
|
|
||||||
width: parent.width - (40*gcd.themeScale)
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
|
|
||||||
//: Name
|
|
||||||
placeholderText: qsTr("group-name")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -218,7 +206,10 @@ Rectangle {
|
||||||
if (tabBar.currentIndex == 0) {
|
if (tabBar.currentIndex == 0) {
|
||||||
gcd.addPeer(peerName.text, peerAddr.text)
|
gcd.addPeer(peerName.text, peerAddr.text)
|
||||||
theStack.currentIndex = theStack.emptyPane
|
theStack.currentIndex = theStack.emptyPane
|
||||||
} // Else Group stuff
|
} else if (tabBar.currentIndex == 2) {
|
||||||
|
gcd.addGroup(groupAddr.text)
|
||||||
|
theStack.currentIndex = theStack.emptyPane
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ ColumnLayout {
|
||||||
StackLayout {
|
StackLayout {
|
||||||
id: overlayStack
|
id: overlayStack
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
width: parent.width
|
||||||
|
|
||||||
|
|
||||||
implicitHeight: height
|
implicitHeight: height
|
||||||
|
|
Reference in New Issue