35 lines
868 B
Go
35 lines
868 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
|
||
|
ium.Outbound = dbm.Outbound
|
||
|
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
|
||
|
|
||
|
}
|