filesharing #28
9
lib.go
9
lib.go
|
@ -599,9 +599,12 @@ func GetMessagesByContentHash(profileOnion, handle string, contentHash string) s
|
||||||
profile := application.GetPeer(profileOnion)
|
profile := application.GetPeer(profileOnion)
|
||||||
ph := utils.NewPeerHelper(profile)
|
ph := utils.NewPeerHelper(profile)
|
||||||
var err error
|
var err error
|
||||||
indexedMessages, err = ph.GetTimeline(handle).GetMessagesByHash(contentHash)
|
timeline := ph.GetTimeline(handle)
|
||||||
if err != nil {
|
if timeline != nil {
|
||||||
indexedMessages = []model.LocallyIndexedMessage{}
|
indexedMessages, err = timeline.GetMessagesByHash(contentHash)
|
||||||
|
if err != nil {
|
||||||
|
indexedMessages = []model.LocallyIndexedMessage{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes, _ := json.Marshal(indexedMessages)
|
bytes, _ := json.Marshal(indexedMessages)
|
||||||
|
|
|
@ -36,7 +36,8 @@ func (p *PeerHelper) IsServer(id string) bool {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTimeline returns a pointer to the timeline associated with the conversation handle
|
// GetTimeline returns a pointer to the timeline associated with the conversation handle or nil if the handle
|
||||||
|
// does not exist (this can happen if the conversation has been deleted)
|
||||||
func (p *PeerHelper) GetTimeline(handle string) *model.Timeline {
|
func (p *PeerHelper) GetTimeline(handle string) *model.Timeline {
|
||||||
if p.IsServer(handle) {
|
if p.IsServer(handle) {
|
||||||
// This should *never* happen
|
// This should *never* happen
|
||||||
|
@ -45,9 +46,17 @@ func (p *PeerHelper) GetTimeline(handle string) *model.Timeline {
|
||||||
}
|
}
|
||||||
// We return a pointer to the timeline to avoid copying, accessing Timeline is thread-safe
|
// We return a pointer to the timeline to avoid copying, accessing Timeline is thread-safe
|
||||||
if p.IsGroup(handle) {
|
if p.IsGroup(handle) {
|
||||||
return &p.peer.GetGroup(handle).Timeline
|
group := p.peer.GetGroup(handle)
|
||||||
|
if group == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &group.Timeline
|
||||||
}
|
}
|
||||||
return &p.peer.GetContact(handle).Timeline
|
contact := p.peer.GetContact(handle)
|
||||||
|
if contact == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &contact.Timeline
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -31,6 +31,7 @@ type GlobalSettings struct {
|
||||||
ExperimentsEnabled bool
|
ExperimentsEnabled bool
|
||||||
Experiments map[string]bool
|
Experiments map[string]bool
|
||||||
BlockUnknownConnections bool
|
BlockUnknownConnections bool
|
||||||
|
StreamerMode bool
|
||||||
StateRootPane int
|
StateRootPane int
|
||||||
FirstTime bool
|
FirstTime bool
|
||||||
UIColumnModePortrait string
|
UIColumnModePortrait string
|
||||||
|
@ -46,6 +47,7 @@ var DefaultGlobalSettings = GlobalSettings{
|
||||||
StateRootPane: 0,
|
StateRootPane: 0,
|
||||||
FirstTime: true,
|
FirstTime: true,
|
||||||
BlockUnknownConnections: false,
|
BlockUnknownConnections: false,
|
||||||
|
StreamerMode: false,
|
||||||
UIColumnModePortrait: "DualpaneMode.Single",
|
UIColumnModePortrait: "DualpaneMode.Single",
|
||||||
UIColumnModeLandscape: "DualpaneMode.CopyPortrait",
|
UIColumnModeLandscape: "DualpaneMode.CopyPortrait",
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue