Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
update protobufs
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Aug 19, 2022
1 parent 090c079 commit f07256c
Show file tree
Hide file tree
Showing 19 changed files with 5,586 additions and 3,270 deletions.
3 changes: 3 additions & 0 deletions contacts/contacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type Contact struct {
Archived bool
Certificate []byte
Registered bool
About string
AboutEmoji string
}

func (c *Contact) GetProfileKey() []byte {
Expand Down Expand Up @@ -95,6 +97,7 @@ func WriteContacts(filename string, contacts []Contact) error {

// WriteContactsToPath saves a list of contacts to a file at the standard location
func WriteContactsToPath() error {
log.Debugln("[textsecure] write contacts to path ", filePath)
c := contactsToYaml()
b, err := yaml.Marshal(c)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/signal-golang/textsecure
go 1.15

require (
github.com/agl/gcmsiv v0.0.0-20190418185415-e8dcd2f151dc
github.com/go-redis/redis v6.15.7+incompatible
github.com/go-yaml/yaml v2.1.0+incompatible
github.com/golang/protobuf v1.4.3
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/agl/gcmsiv v0.0.0-20190418185415-e8dcd2f151dc h1:MB338WDPuyQ8qXRiSRK2NVTv0EmLYsHXZAevEiQO1+c=
github.com/agl/gcmsiv v0.0.0-20190418185415-e8dcd2f151dc/go.mod h1:5joDAvk82M2Cx1X8mAL5Orvhy5lfW4BjrTCW65wbvRo=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand All @@ -8,6 +10,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-redis/redis v6.15.7+incompatible h1:3skhDh95XQMpnqeqNftPkQD9jL9e5e36z/1SUm6dy1U=
github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
Expand Down
36 changes: 0 additions & 36 deletions groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,42 +174,6 @@ var GroupUpdateFlag uint32 = 1
// GroupLeaveFlag signals that this message is a group leave message
var GroupLeaveFlag uint32 = 2

// handleGroups is the main entry point for handling the group metadata on messages.
func handleGroups(src string, dm *signalservice.DataMessage) (*Group, error) {
gr := dm.GetGroup()
if gr == nil {
return nil, nil
}
hexid := idToHex(gr.GetId())
log.Debugln("[textsecure] handle group", hexid, gr.GetType())
switch gr.GetType() {
case signalservice.GroupContext_UPDATE:
if err := updateGroup(gr); err != nil {
return nil, err
}
groups[hexid].Flags = GroupUpdateFlag
case signalservice.GroupContext_DELIVER:
eGr, ok := groups[hexid]
setupGroups()
if !ok || len(eGr.Members) == 0 || hexid == eGr.Name {
log.Debugln("[textsecure] request update group", hexid)
g, _ := newPartlyGroup(gr.GetId())
g.Members = []string{src}
RequestGroupInfo(g)
setupGroups()
return nil, UnknownGroupIDError{hexid}
}
groups[hexid].Flags = 0
case signalservice.GroupContext_QUIT:
if err := quitGroup(src, hexid); err != nil {
return nil, err
}
groups[hexid].Flags = GroupLeaveFlag
}

return groups[hexid], nil
}

// handleGroups is the main entry point for handling the group metadata on messages.
func handleGroupsV2(src string, dm *signalservice.DataMessage) (*groupsv2.GroupV2, error) {
gr := dm.GetGroupV2()
Expand Down
6 changes: 0 additions & 6 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ func handleDataMessage(src string, srcUUID string, timestamp uint64, dm *signals
return err
}
log.Debugln("[textsecure] handleDataMessage", timestamp, *dm.Timestamp, dm.GetExpireTimer())
gr, err := handleGroups(src, dm)
if err != nil {
return err
}
gr2, err := groupsv2.HandleGroupsV2(src, dm)
if err != nil {
return err
Expand All @@ -97,15 +93,13 @@ func handleDataMessage(src string, srcUUID string, timestamp uint64, dm *signals
sourceUUID: srcUUID,
message: dm.GetBody(),
attachments: atts,
group: gr,
groupV2: gr2,
flags: flags,
expireTimer: dm.GetExpireTimer(),
profileKey: dm.GetProfileKey(),
timestamp: *dm.Timestamp,
quote: dm.GetQuote(),
contact: dm.GetContact(),
preview: dm.GetPreview(),
sticker: dm.GetSticker(),
reaction: dm.GetReaction(),
// requiredProtocolVersion: dm.GetRequiredProtocolVersion(),
Expand Down
1 change: 0 additions & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Message struct {
timestamp uint64
quote *signalservice.DataMessage_Quote
contact []*signalservice.DataMessage_Contact
preview []*signalservice.DataMessage_Preview
sticker *signalservice.DataMessage_Sticker
requiredProtocolVersion uint32
isViewOnce bool
Expand Down
Loading

0 comments on commit f07256c

Please sign in to comment.