status #15
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module git.openprivacy.ca/cwtch.im/cwtch-autobindings
|
|||
go 1.19
|
||||
|
||||
require (
|
||||
cwtch.im/cwtch v0.19.3
|
||||
cwtch.im/cwtch v0.19.5
|
||||
git.openprivacy.ca/cwtch.im/server v1.4.5
|
||||
git.openprivacy.ca/openprivacy/connectivity v1.8.6
|
||||
git.openprivacy.ca/openprivacy/log v1.0.3
|
||||
|
|
6
go.sum
6
go.sum
|
@ -1,8 +1,6 @@
|
|||
cwtch.im/cwtch v0.18.0/go.mod h1:StheazFFY7PKqBbEyDVLhzWW6WOat41zV0ckC240c5Y=
|
||||
cwtch.im/cwtch v0.19.2 h1:H7DrSKQ9J7aNkKQkdyGGWckEV+dPKbL5PMRq0GoAn6I=
|
||||
cwtch.im/cwtch v0.19.2/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||
cwtch.im/cwtch v0.19.3 h1:LRcJFgSw5LwUlOOcVtDC5mRb9NsuXUwNloGo5zNZb9A=
|
||||
cwtch.im/cwtch v0.19.3/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||
cwtch.im/cwtch v0.19.5 h1:SBie1Ucalxte//3QzWK2h3DSZCDqPyu+gJa8vmEPopg=
|
||||
cwtch.im/cwtch v0.19.5/go.mod h1:h8S7EgEM+8pE1k+XLB5jAFdIPlOzwoXEY0GH5mQye5A=
|
||||
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
|
||||
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||
|
|
|
@ -288,10 +288,18 @@ func SetProfileAttribute(profileOnion string, key string, value string) {
|
|||
if profile != nil {
|
||||
zone, key := attr.ParseZone(key)
|
||||
|
||||
// TODO We only allow public.profile.key to be set for now.
|
||||
// TODO We only allow certain public.profile.key to be set for now.
|
||||
// All other scopes and zones need to be added explicitly or handled by Cwtch.
|
||||
if zone == attr.ProfileZone && key == constants.Name {
|
||||
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name, value)
|
||||
} else if zone == attr.ProfileZone && key == constants.ProfileAttribute1 {
|
||||
|
||||
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.ProfileAttribute1, value)
|
||||
} else if zone == attr.ProfileZone && key == constants.ProfileAttribute2 {
|
||||
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.ProfileAttribute2, value)
|
||||
} else if zone == attr.ProfileZone && key == constants.ProfileAttribute3 {
|
||||
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.ProfileAttribute3, value)
|
||||
} else if zone == attr.ProfileZone && key == constants.ProfileStatus {
|
||||
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.ProfileStatus, value)
|
||||
} else if zone == attr.ProfileZone && key == constants.PeerAutostart {
|
||||
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants.PeerAutostart, value)
|
||||
} else {
|
||||
|
|
|
@ -388,9 +388,6 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
|||
ev.Event.Data["Nick"], exists = ci.GetAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
|
||||
if !exists {
|
||||
ev.Event.Data["Nick"] = ev.Event.Data["RemotePeer"]
|
||||
// If we dont have a name val for a peer, but they have sent us a message, we might be approved now, re-ask
|
||||
profile.SendScopedZonedGetValToContact(ci.ID, attr.PublicScope, attr.ProfileZone, constants.Name)
|
||||
profile.SendScopedZonedGetValToContact(ci.ID, attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,15 +512,6 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
|||
return ""
|
||||
}
|
||||
contactStateCache[ev.Event.Data[event.RemotePeer]] = cxnState
|
||||
|
||||
if contact != nil {
|
||||
// No enrichment needed
|
||||
if cxnState == connections.AUTHENTICATED {
|
||||
// if known and authed, get vars
|
||||
profile.SendScopedZonedGetValToContact(contact.ID, attr.PublicScope, attr.ProfileZone, constants.Name)
|
||||
profile.SendScopedZonedGetValToContact(contact.ID, attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
|
||||
}
|
||||
}
|
||||
case event.ServerStateChange:
|
||||
cxnState := connections.ConnectionStateToType()[ev.Event.Data[event.ConnectionState]]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
could be a switch statement wrapped in one
if zone == attr.ProfileZone
?