Documentation ¶
Index ¶
- Constants
- Variables
- func AddDevice(url string) error
- func AvatarImageProvider(id string, width, height int) image.Image
- func CopyAttachment(src string) (string, error)
- func DeleteGroup(hexid string) error
- func DeleteMessage(id int64) error
- func DeleteSession(ID int64) error
- func FetchAllGroups() error
- func FindQuotedMessage(quote *signalservice.DataMessage_Quote) (error, int64)
- func GetContactForTel(tel string) *textsecureContacts.Contact
- func GetContactForUUID(uuid string) *textsecureContacts.Contact
- func GroupUpdateMsg(tels []string, title string) string
- func IsEncrypted(filename string) (bool, error)
- func LoadChats() error
- func LoadGroups() error
- func LoadMessagesFromDB() error
- func MigrateMessagesFromSessionToAnotherSession(oldSession int64, newSession int64) error
- func RefreshContacts() error
- func TelToName(tel string) string
- func UpdateMessageRead(m *Message) error
- func UpdateMessageReceipt(m *Message) error
- func UpdateMessageReceiptSent(m *Message) error
- func UpdateMessageSent(m *Message) error
- func UpdateMessagesTable_v_0_7_8() error
- func UpdateSession(s *Session) error
- func UpdateSessionTable() error
- func UpdateSessionTable_v_0_7_8() error
- func UpdateSessionTable_v_0_9_0() error
- func UpdateSessionTable_v_0_9_5() error
- func UpdateTimestamps()
- type Attachment
- type Contacts
- type DataStore
- func (ds *DataStore) Convert(password string) error
- func (ds *DataStore) DBX() *sqlx.DB
- func (ds *DataStore) Decrypt(dbPath string) error
- func (ds *DataStore) DecryptDb(password string) bool
- func (ds *DataStore) Encrypt(dbFile string, password string) error
- func (ds *DataStore) EncryptDb(password string) bool
- func (ds *DataStore) ResetDb()
- func (ds *DataStore) SetupDb(password string) bool
- type GroupRecord
- type LinkedDevices
- type Message
- type MessageList
- type Session
- type Sessions
- func (s *Sessions) CreateSessionForE164(tel string, UUID string) *Session
- func (s *Sessions) CreateSessionForGroup(group *textsecure.Group) *Session
- func (s *Sessions) CreateSessionForGroupV2(group *groupsv2.GroupV2) *Session
- func (s *Sessions) CreateSessionForUUID(UUID string) *Session
- func (s *Sessions) Get(id int64) (*Session, error)
- func (s *Sessions) GetAllSessionsByE164(tel string) []*Session
- func (s *Sessions) GetByE164(tel string) *Session
- func (s *Sessions) GetByUUID(UUID string) (*Session, error)
- func (s *Sessions) GetIndex(ID int64) int
- func (s *Sessions) GetMessageList(ID int64) (error, *MessageList)
- func (s *Sessions) GetMoreMessageList(ID int64, lastID string) (error, *MessageList)
- func (s *Sessions) GetSession(i int64) *Session
- func (s *Sessions) UpdateSessionNames()
Constants ¶
const ( GroupRecordTypeGroupv1 = 0 GroupRecordTypeGroupv2 = 1 )
const ( SessionTypePrivateChat int32 = 0 SessionTypeGroupV1 int32 = 1 SessionTypeGroupV2 int32 = 2 SessionTypeGroupV2Invited int32 = 3 )
SessionTypes
Variables ¶
var ActiveSessionID int64
ActiveSessionID represents the currently opend chat
var AllGroups []*GroupRecord
var AllSessions []*Session
TODO that hasn't to be in the db controller
var Groups = map[string]*GroupRecord{}
var SessionsModel = &Sessions{ Sess: make([]*Session, 0), }
Functions ¶
func CopyAttachment ¶
CopyAttachment makes a copy of a file that is in the volatile content hub cache
func DeleteGroup ¶
DeleteGroup deletes a group from the database
func DeleteMessage ¶
func DeleteSession ¶
DeleteSession deletes a session in the database
func FetchAllGroups ¶
func FetchAllGroups() error
func FindQuotedMessage ¶ added in v0.9.0
func FindQuotedMessage(quote *signalservice.DataMessage_Quote) (error, int64)
FindQuotedMessage searches the equivalent message of DataMessage_Quote in our DB and returns the local message id
func GetContactForTel ¶
func GetContactForTel(tel string) *textsecureContacts.Contact
func GetContactForUUID ¶ added in v0.9.9
func GetContactForUUID(uuid string) *textsecureContacts.Contact
func GroupUpdateMsg ¶
func IsEncrypted ¶
IsEncrypted returns true, if the database with the given filename is encrypted, and false otherwise. If the database header cannot be read properly an error is returned.
func LoadGroups ¶ added in v0.7.5
func LoadGroups() error
func LoadMessagesFromDB ¶
func LoadMessagesFromDB() error
func MigrateMessagesFromSessionToAnotherSession ¶ added in v0.9.7
MigrateMessagesFromSessionToAnotherSession copies the messages from the old session to the new session and then deletes the oldSession
func RefreshContacts ¶
func RefreshContacts() error
func UpdateMessageRead ¶
func UpdateMessageReceipt ¶ added in v0.9.0
func UpdateMessageReceiptSent ¶ added in v0.8.3
func UpdateMessageSent ¶
func UpdateMessagesTable_v_0_7_8 ¶ added in v0.8.0
func UpdateMessagesTable_v_0_7_8() error
fix v.0.7.8 add SendingError + expireTimer
func UpdateSession ¶
UpdateSession updates a session in the database
func UpdateSessionTable ¶
func UpdateSessionTable() error
func UpdateSessionTable_v_0_7_8 ¶ added in v0.8.0
func UpdateSessionTable_v_0_7_8() error
func UpdateSessionTable_v_0_9_0 ¶ added in v0.9.0
func UpdateSessionTable_v_0_9_0() error
add support for quoted messages
func UpdateSessionTable_v_0_9_5 ¶ added in v0.9.6
func UpdateSessionTable_v_0_9_5() error
add support uuids
func UpdateTimestamps ¶
func UpdateTimestamps()
UpdateTimestamps keeps the timestamps of the last message of each session updated in human readable form.
Types ¶
type Attachment ¶ added in v0.8.0
func SaveAttachment ¶
func SaveAttachment(a *textsecure.Attachment) (Attachment, error)
type Contacts ¶
type Contacts struct { Contacts []textsecureContacts.Contact Len int }
func (*Contacts) GetContact ¶
func (c *Contacts) GetContact(i int) textsecureContacts.Contact
type DataStore ¶
var DS *DataStore
func NewDataStore ¶
type GroupRecord ¶
type GroupRecord struct { ID int64 Uuid string GroupID string Name string Members string Avatar []byte Active bool Type int JoinStatus int }
func GetGroupById ¶ added in v0.7.5
func GetGroupById(hexid string) *GroupRecord
func SaveGroup ¶
func SaveGroup(g *GroupRecord) (*GroupRecord, error)
func UpdateGroup ¶
func UpdateGroup(g *GroupRecord) (*GroupRecord, error)
type LinkedDevices ¶
type LinkedDevices struct { LinkedDevices []textsecure.DeviceInfo Len int }
var LinkedDevicesModel *LinkedDevices = &LinkedDevices{}
func RefreshDevices ¶
func RefreshDevices() (*LinkedDevices, error)
func (*LinkedDevices) DeleteDevice ¶
func (c *LinkedDevices) DeleteDevice() error
func (*LinkedDevices) GetDevice ¶
func (c *LinkedDevices) GetDevice(i int) textsecure.DeviceInfo
func (*LinkedDevices) RefreshDevices ¶
func (c *LinkedDevices) RefreshDevices() error
func (*LinkedDevices) UnlinkDevice ¶
func (c *LinkedDevices) UnlinkDevice(id int) error
type Message ¶
type Message struct { ID int64 `db:"id"` SID int64 ChatID string Source string `db:"source"` SourceUUID string `db:"srcUUID"` Message string Outgoing bool SentAt uint64 ReceivedAt uint64 HTime string CType int Attachment string IsSent bool `db:"issent"` IsRead bool `db:"isread"` Flags int ExpireTimer uint32 `db:"expireTimer"` SendingError bool `db:"sendingError"` Receipt bool `db:"receipt"` StatusMessage bool `db:"statusMessage"` QuoteID int64 `db:"quoteId"` QuotedMessage *Message }
func FindOutgoingMessage ¶ added in v0.9.0
FindOutgoingMessage returns a message that is found by it's timestamp
func GetMessageById ¶ added in v0.9.0
GetMessageById returns a message by it's ID
func SaveMessage ¶
type MessageList ¶
type Session ¶
type Session struct { ID int64 UUID string `db:"uuid"` Name string Tel string IsGroup bool `db:"isgroup"` Type int32 //describes the type of the session, wether it's a private conversation or groupv1 or groupv2 Last string Timestamp uint64 When string CType int Messages []*Message Unread int Active bool Len int Notification bool ExpireTimer uint32 `db:"expireTimer"` GroupJoinStatus int `db:"groupJoinStatus"` }
Session defines how a session looks like
func SaveSession ¶
SaveSession saves a newly created session in the database
func (*Session) Add ¶
func (s *Session) Add(text string, source string, file []Attachment, mimetype string, outgoing bool, sessionID int64) *Message
Add message to a session
func (*Session) GetMessages ¶
func (*Session) ToggleSessionNotifcation ¶
func (s *Session) ToggleSessionNotifcation()
ToggleSessionNotifcation turns on/off notification for a session
type Sessions ¶
func (*Sessions) CreateSessionForE164 ¶ added in v0.9.6
CreateSessionForE164 creates a new Session for the phone number
func (*Sessions) CreateSessionForGroup ¶ added in v0.9.6
func (s *Sessions) CreateSessionForGroup(group *textsecure.Group) *Session
CreateSessionForGroup creates a session for a group
func (*Sessions) CreateSessionForGroupV2 ¶ added in v1.0.0
CreateSessionForGroupV2 creates a session for a group
func (*Sessions) CreateSessionForUUID ¶ added in v0.9.9
func (*Sessions) GetAllSessionsByE164 ¶ added in v0.9.7
GetAllSessionsByE164 returns multiple sessions when they are duplicated
func (*Sessions) GetByE164 ¶ added in v0.9.6
GetByE164 returns the session by the telephone number and creates it if it doesn't exists
func (*Sessions) GetMessageList ¶
func (s *Sessions) GetMessageList(ID int64) (error, *MessageList)
GetMessageList returns the message list for the session id
func (*Sessions) GetMoreMessageList ¶
func (s *Sessions) GetMoreMessageList(ID int64, lastID string) (error, *MessageList)
GetMoreMessageList loads more messages from before the lastID
func (*Sessions) GetSession ¶
GetSession at a certain index
func (*Sessions) UpdateSessionNames ¶
func (s *Sessions) UpdateSessionNames()
UpdateSessionNames updates the non groups with the name from the phone book