meowlib/client/dbmessage.go
ycc 0c0aa6e807
Some checks failed
continuous-integration/drone/push Build is failing
try to avoid protobuf omitted
2024-03-02 10:45:05 +01:00

39 lines
916 B
Go

package client
import (
"forge.redroom.link/yves/meowlib"
)
func DbMessageToInternalUserMessage(id int64, dbFile string, dbm *meowlib.DbMessage) *InternalUserMessage {
var ium InternalUserMessage
ium.Dbid = id
ium.Dbfile = dbFile
if dbm.Outbound {
ium.Outbound = true
} else {
ium.Outbound = false
}
ium.Message = string(dbm.Data)
ium.ConversationStatus = dbm.Status
ium.Contact = dbm.Contact
ium.CurrentLocation = dbm.CurrentLocation
ium.Messagetype = dbm.Type
ium.Appdata = dbm.Appdata
ium.FilePaths = dbm.FilePaths
return &ium
}
func UserMessageToDbMessage(outbound bool, um *meowlib.UserMessage, filepaths []string) *meowlib.DbMessage {
var dbm meowlib.DbMessage
dbm.Outbound = outbound
dbm.Type = um.Type
dbm.Data = um.Data
dbm.Appdata = um.Appdata
dbm.Contact = um.Contact
dbm.CurrentLocation = um.CurrentLocation
dbm.Status = um.Status
dbm.FilePaths = filepaths
return &dbm
}