MCPcopy
hub / github.com/tinode/chat / parsePublic

Function parsePublic

tinode-db/gendb.go:434–455  ·  view source on GitHub ↗

{"fn": "Alice Johnson", "photo": "alice-128.jpg"}

(public *theCard, path string)

Source from the content-addressed store, hash-verified

432
433// {"fn": "Alice Johnson", "photo": "alice-128.jpg"}
434func parsePublic(public *theCard, path string) *card {
435 var photo *photoStruct
436 var err error
437
438 if public.Fn == "" && public.Photo == "" {
439 return nil
440 }
441
442 if fname := public.Photo; fname != "" {
443 photo = &photoStruct{Type: public.Type}
444 dir, _ := filepath.Split(fname)
445 if dir == "" {
446 dir = path
447 }
448 photo.Data, err = os.ReadFile(filepath.Join(dir, fname))
449 if err != nil {
450 log.Fatal(err)
451 }
452 }
453
454 return &card{Fn: public.Fn, Photo: photo}
455}

Callers 1

genDbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…