add last message to peers
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-03-05 20:15:48 +01:00
parent b47ef2480c
commit f40f6520d2
2 changed files with 17 additions and 12 deletions

View File

@ -73,10 +73,17 @@ func StoreMessage(peer *Peer, usermessage *meowlib.UserMessage, filenames []stri
if err != nil { if err != nil {
return err return err
} }
_, err = statement.Exec(encData) result, err := statement.Exec(encData)
if err != nil { if err != nil {
return err return err
} }
id, err := result.LastInsertId()
if err != nil {
return err
}
ium := DbMessageToInternalUserMessage(id, dbid, dbm)
peer.LastMessage = ium
GetConfig().me.Save()
return nil return nil
} }

View File

@ -27,17 +27,15 @@ type Peer struct {
MyPullServers []string `json:"my_pull_servers,omitempty"` MyPullServers []string `json:"my_pull_servers,omitempty"`
// Peer keys and infos // Peer keys and infos
//Contact meowlib.ContactCard `json:"contact,omitempty"` // todo : remove //Contact meowlib.ContactCard `json:"contact,omitempty"` // todo : remove
ContactPublicKey string `json:"contact_public_key,omitempty"` ContactPublicKey string `json:"contact_public_key,omitempty"`
ContactLookupKey string `json:"contact_lookup_key,omitempty"` ContactLookupKey string `json:"contact_lookup_key,omitempty"`
ContactEncryption string `json:"contact_encryption,omitempty"` ContactEncryption string `json:"contact_encryption,omitempty"`
ContactPullServers []string `json:"contact_pull_servers,omitempty"` ContactPullServers []string `json:"contact_pull_servers,omitempty"`
InvitationId string `json:"invitation_id,omitempty"` InvitationId string `json:"invitation_id,omitempty"`
InvitationUrl string `json:"invitation_url,omitempty"` InvitationUrl string `json:"invitation_url,omitempty"`
InvitationMessage string `json:"invitation_message,omitempty"` InvitationMessage string `json:"invitation_message,omitempty"`
InvitationExpiry time.Time `json:"invitation_expiry,omitempty"` InvitationExpiry time.Time `json:"invitation_expiry,omitempty"`
LastMessage string `json:"last_message,omitempty"` LastMessage *InternalUserMessage `json:"last_message,omitempty"`
LastMessageDate int64 `json:"last_message_date,omitempty"`
LastMessageStatus string `json:"last_message_status,omitempty"`
// Internal management attributes // Internal management attributes
Visible bool `json:"visible,omitempty"` Visible bool `json:"visible,omitempty"`
VisiblePassword string `json:"visible_password,omitempty"` VisiblePassword string `json:"visible_password,omitempty"`