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

Commit

Permalink
Merge pull request #66 from signal-golang/fix_groups_and_migration
Browse files Browse the repository at this point in the history
Fix groups and migration
  • Loading branch information
nanu-c authored Oct 27, 2022
2 parents 1d1796f + 71dd89e commit 153e6c0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions crayfish/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ func copyAndCapture(w io.Writer, r io.Reader) ([]byte, error) {
if n > 0 {
d := buf[:n]
out = append(out, d...)
log.Println("[crayfish]", string(d))
// _, err := w.Write(d)
log.Debugln("[crayfish]", string(d))
if err != nil {
return out, err
}
Expand Down
3 changes: 3 additions & 0 deletions groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ func sendGroupV2Helper(hexid string, msg string, attachmentPointer *attachmentPo
var ts uint64
var err error
g := groupsV2.FindGroup(hexid)
if g == nil {
return 0, fmt.Errorf("group not found %s", hexid)
}
g.CheckJoinStatus()
if g == nil {
log.Infoln("[textsecure] sendGroupv2Helper unknown group id")
Expand Down
7 changes: 4 additions & 3 deletions groupsv2/groupsv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (g *GroupV2) UpdateGroupFromServer() error {
func GetGroupV2MembersForGroup(group string) ([]*signalservice.DecryptedMember, error) {
g := FindGroup(group)
if g == nil {
return nil, fmt.Errorf("Group not found")
return nil, fmt.Errorf("group not found")
}
err := g.UpdateGroupFromServer()
if err != nil {
Expand Down Expand Up @@ -355,9 +355,10 @@ func saveGroupV2(hexid string) error {

// loadGroup loads a group's state from a file.
func loadGroupV2(hexid string) (*GroupV2, error) {
b, err := os.ReadFile(idToPath(hexid))
path := idToPath(hexid)
b, err := os.ReadFile(path)
if err != nil {
return nil, err
return nil, fmt.Errorf("group not found %s %s", err.Error(), path)
}

group := &GroupV2{}
Expand Down
6 changes: 4 additions & 2 deletions profiles/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,15 @@ func GetProfileUUID(uuid string) (*Profile, error) {
} else {
resp, err := transport.Transport.Get(fmt.Sprintf(PROFILE_PATH, uuid))
if err != nil {
log.Errorln("[textsecure] GetProfileUuid ", err)
log.Errorln("[textsecure] GetProfileUuid fetch profile:", err)
return nil, err
}

dec := json.NewDecoder(resp.Body)
err = dec.Decode(&profile)
if err != nil {
log.Errorln("[textsecure] GetProfileUuid ", err)
log.Errorln("[textsecure] GetProfileUuid decode", err)
return nil, err
}
}
var avatarDecrypted []byte
Expand Down

0 comments on commit 153e6c0

Please sign in to comment.