Compare commits
3 Commits
4e4e3315dd
...
17acc3b8ef
Author | SHA1 | Date |
---|---|---|
erinn | 17acc3b8ef | |
erinn | 942b8b4709 | |
Sarah Jamie Lewis | 44e5c38aa6 |
|
@ -5,6 +5,7 @@ const SchemaVersion = "schemaVersion"
|
||||||
const Name = "name"
|
const Name = "name"
|
||||||
const LastRead = "last-read"
|
const LastRead = "last-read"
|
||||||
const Picture = "picture"
|
const Picture = "picture"
|
||||||
|
const DefaultProfilePicture = "defaultPicture"
|
||||||
const ShowBlocked = "show-blocked"
|
const ShowBlocked = "show-blocked"
|
||||||
const Archived = "archived"
|
const Archived = "archived"
|
||||||
|
|
||||||
|
|
10
lib.go
10
lib.go
|
@ -741,16 +741,6 @@ func ShareFile(profileOnion string, conversationID int, sharefilepath string) {
|
||||||
// FIXME: At some point we might want to allow arbitrary public files, but for now this API will assume
|
// FIXME: At some point we might want to allow arbitrary public files, but for now this API will assume
|
||||||
// there is only one, and it is the custom profile image...
|
// there is only one, and it is the custom profile image...
|
||||||
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants2.CustomProfileImageKey, fileKey)
|
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants2.CustomProfileImageKey, fileKey)
|
||||||
path, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", fileKey))
|
|
||||||
// tell the UI the the file has been "downloaded"
|
|
||||||
if exists {
|
|
||||||
eventHandler.Push(event.NewEvent(event.FileDownloaded, map[event.Field]string{
|
|
||||||
ProfileOnion: profileOnion,
|
|
||||||
event.FileKey: fileKey,
|
|
||||||
event.FilePath: path,
|
|
||||||
event.TempFile: "",
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
profile.SendMessage(conversationID, overlay)
|
profile.SendMessage(conversationID, overlay)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
type Contact struct {
|
type Contact struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Onion string `json:"onion"`
|
Onion string `json:"onion"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Picture string `json:"picture"`
|
Picture string `json:"picture"`
|
||||||
Accepted bool `json:"accepted"`
|
DefaultPicture string `json:"defaultPicture"`
|
||||||
Blocked bool `json:"blocked"`
|
Accepted bool `json:"accepted"`
|
||||||
SaveHistory string `json:"saveConversationHistory"`
|
Blocked bool `json:"blocked"`
|
||||||
Messages int `json:"numMessages"`
|
SaveHistory string `json:"saveConversationHistory"`
|
||||||
Unread int `json:"numUnread"`
|
Messages int `json:"numMessages"`
|
||||||
LastMessage string `json:"lastMsgTime"`
|
Unread int `json:"numUnread"`
|
||||||
IsGroup bool `json:"isGroup"`
|
LastMessage string `json:"lastMsgTime"`
|
||||||
GroupServer string `json:"groupServer"`
|
IsGroup bool `json:"isGroup"`
|
||||||
IsArchived bool `json:"isArchived"`
|
GroupServer string `json:"groupServer"`
|
||||||
Identifier int `json:"identifier"`
|
IsArchived bool `json:"isArchived"`
|
||||||
|
Identifier int `json:"identifier"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
online, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline)
|
online, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline)
|
||||||
// Name always exists
|
// Name always exists
|
||||||
e.Data[constants.Name], _ = profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
|
e.Data[constants.Name], _ = profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
|
||||||
|
e.Data[constants2.DefaultProfilePicture] = RandomProfileImage(onion)
|
||||||
// if a custom profile image exists then default to it.
|
// if a custom profile image exists then default to it.
|
||||||
key, exists := profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
|
key, exists := profile.GetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants.CustomProfileImageKey)
|
||||||
if !exists {
|
if !exists {
|
||||||
|
@ -221,20 +221,21 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
lastMessage, _ := profile.GetMostRecentMessages(conversationInfo.ID, 0, 0, 1)
|
lastMessage, _ := profile.GetMostRecentMessages(conversationInfo.ID, 0, 0, 1)
|
||||||
|
|
||||||
contacts = append(contacts, Contact{
|
contacts = append(contacts, Contact{
|
||||||
Name: name,
|
Name: name,
|
||||||
Identifier: conversationInfo.ID,
|
Identifier: conversationInfo.ID,
|
||||||
Onion: conversationInfo.Handle,
|
Onion: conversationInfo.Handle,
|
||||||
Status: connections.ConnectionStateName[state],
|
Status: connections.ConnectionStateName[state],
|
||||||
Picture: cpicPath,
|
Picture: cpicPath,
|
||||||
Accepted: conversationInfo.Accepted,
|
DefaultPicture: RandomProfileImage(conversationInfo.Handle),
|
||||||
Blocked: blocked,
|
Accepted: conversationInfo.Accepted,
|
||||||
SaveHistory: saveHistory,
|
Blocked: blocked,
|
||||||
Messages: count,
|
SaveHistory: saveHistory,
|
||||||
Unread: 0,
|
Messages: count,
|
||||||
LastMessage: strconv.Itoa(getLastMessageTime(lastMessage)),
|
Unread: 0,
|
||||||
IsGroup: conversationInfo.IsGroup(),
|
LastMessage: strconv.Itoa(getLastMessageTime(lastMessage)),
|
||||||
GroupServer: groupServer,
|
IsGroup: conversationInfo.IsGroup(),
|
||||||
IsArchived: isArchived == event.True,
|
GroupServer: groupServer,
|
||||||
|
IsArchived: isArchived == event.True,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,6 +357,7 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
||||||
lastMessage, _ := profile.GetMostRecentMessages(conversationID, 0, 0, 1)
|
lastMessage, _ := profile.GetMostRecentMessages(conversationID, 0, 0, 1)
|
||||||
ev.Event.Data["unread"] = strconv.Itoa(count) // if this is a new contact with messages attached then by-definition these are unread...
|
ev.Event.Data["unread"] = strconv.Itoa(count) // if this is a new contact with messages attached then by-definition these are unread...
|
||||||
ev.Event.Data[constants2.Picture] = RandomProfileImage(conversationInfo.Handle)
|
ev.Event.Data[constants2.Picture] = RandomProfileImage(conversationInfo.Handle)
|
||||||
|
ev.Event.Data[constants2.DefaultProfilePicture] = RandomProfileImage(conversationInfo.Handle)
|
||||||
ev.Event.Data["numMessages"] = strconv.Itoa(count)
|
ev.Event.Data["numMessages"] = strconv.Itoa(count)
|
||||||
ev.Event.Data["nick"] = conversationInfo.Handle
|
ev.Event.Data["nick"] = conversationInfo.Handle
|
||||||
ev.Event.Data["status"] = connections.ConnectionStateName[profile.GetPeerState(conversationInfo.Handle)]
|
ev.Event.Data["status"] = connections.ConnectionStateName[profile.GetPeerState(conversationInfo.Handle)]
|
||||||
|
|
Reference in New Issue