This commit is contained in:
@ -224,6 +224,25 @@ func GetMessagesHistory(peer *Peer, inAppMsgCount int, lastDbId int, wantMore in
|
||||
return messages, nil
|
||||
}
|
||||
|
||||
// make an image from the files content (loads the first image, or build a more complex view)
|
||||
func MessagePreview(msg *InternalUserMessage, password string) ([]byte, error) {
|
||||
// get the hidden file name
|
||||
if len(msg.FilePaths) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
// get the hidden file
|
||||
encData, err := os.ReadFile(msg.FilePaths[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// decrypt the file
|
||||
data, err := meowlib.SymDecrypt(password, encData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func getMessageCount(dbid string) (int, error) {
|
||||
db, _ := sql.Open("sqlite3", filepath.Join(GetConfig().StoragePath, GetConfig().GetIdentity().Uuid, dbid+GetConfig().DbSuffix)) // Open the created SQLite File
|
||||
defer db.Close()
|
||||
|
Reference in New Issue
Block a user