Documentation ¶
Index ¶
- Constants
- Variables
- func AddDevice(url string) error
- func CopyAttachment(src string) (string, error)
- func DeleteGroup(hexid string) error
- func DeleteMessage(id int64) error
- func FindQuotedMessage(quote *signalservice.DataMessage_Quote) (error, int64)
- func GetContactForTel(tel string) *textsecureContacts.Contact
- func GetContactForUUID(uuid string) *textsecureContacts.Contact
- func GetUnreadMessageCounterForSession(id int64) (int64, error)
- func GroupUpdateMsg(tels []string, title string) string
- func IsEncrypted(filename string) (bool, error)
- func LoadGroups() error
- func Migrate() 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 UpdateSessionTable_v_0_9_0() error
- func UpdateSessionTable_v_0_9_5() error
- 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 GroupV2
- func (g *GroupV2) AddGroupMembers(members []*signalservice.DecryptedMember) error
- func (g *GroupV2) AddMember(recipient *Recipient) error
- func (g *GroupV2) Delete() error
- func (g *GroupV2) DeleteGroupMembers(members [][]byte) error
- func (g *GroupV2) DeleteMember(recipient *Recipient) error
- func (g *GroupV2) DeleteMembers() error
- func (g *GroupV2) GetGroupMembers() ([]GroupV2Member, error)
- func (g *GroupV2) GetGroupMembersAsRecipients() ([]*Recipient, error)
- func (g *GroupV2) IsMember(recipient *Recipient) bool
- func (g *GroupV2) UpdateGroup() error
- func (g *GroupV2) UpdateGroupAction(action *signalservice.DecryptedGroupChange) error
- func (g *GroupV2) UpdateGroupMembers(members []GroupV2Member) error
- type GroupV2Member
- type GroupV2s
- type LinkedDevices
- type Message
- type MessageList
- type Recipient
- type Recipients
- func (r *Recipients) CreateRecipient(recipient *Recipient) (*Recipient, error)
- func (r *Recipients) CreateRecipientWithoutProfileUpdate(recipient *Recipient) (*Recipient, error)
- func (r *Recipients) GetOrCreateRecipient(uuid string) *Recipient
- func (r *Recipients) GetOrCreateRecipientForContact(contact *contacts.Contact) *Recipient
- func (*Recipients) GetRecipientByE164(e164 string) *Recipient
- func (*Recipients) GetRecipientById(id int64) *Recipient
- func (*Recipients) GetRecipientByUUID(uuid string) *Recipient
- type Session
- type SessionV2
- type SessionV2Name
- type Sessions
- type SessionsV2
- func (s *SessionsV2) CreateSession(session *SessionV2) (*SessionV2, error)
- func (s *SessionsV2) CreateSessionForDirectMessageRecipient(recipient int64) (*SessionV2, error)
- func (s *SessionsV2) CreateSessionForGroupV1(group string) (*SessionV2, error)
- func (s *SessionsV2) CreateSessionForGroupV2(groupID string) (*SessionV2, error)
- func (*SessionsV2) DeleteAllSessions() error
- func (*SessionsV2) DeleteSession(session *SessionV2) error
- func (*SessionsV2) GetAllSessions() ([]*SessionV2, error)
- func (s *SessionsV2) GetMoreMessageList(ID int64, sentAt uint64) (*MessageList, error)
- func (s *SessionsV2) GetOrCreateSessionForDirectMessageRecipient(recipient int64) (*SessionV2, error)
- func (s *SessionsV2) GetOrCreateSessionForGroupV2ID(group string) (*SessionV2, error)
- func (*SessionsV2) GetSessionByDirectMessageRecipientID(recipient int64) (*SessionV2, error)
- func (*SessionsV2) GetSessionByGroupV1ID(group string) (*SessionV2, error)
- func (*SessionsV2) GetSessionByGroupV2ID(group string) (*SessionV2, error)
- func (*SessionsV2) GetSessionByID(id int64) (*SessionV2, error)
- func (s *SessionsV2) GetSessionNames() ([]SessionV2Name, error)
- func (*SessionsV2) SaveSession(session *SessionV2) (*SessionV2, error)
- func (s *SessionsV2) UpdateAllUnreadCountersForSessions() error
- func (*SessionsV2) UpdateUnreadCounterForSession(session *SessionV2) error
Constants ¶
const ( GroupRecordTypeGroupv1 = 0 GroupRecordTypeGroupv2 = 1 )
const ( SessionTypePrivateChat int32 = 0 SessionTypeGroupV1 int32 = 1 SessionTypeGroupV2 int32 = 2 SessionTypeGroupV2Invited int32 = 3 )
SessionTypes
const TIME_FORMAT = "2006-01-02 15:04:05 -0700 MST"
Variables ¶
var ( GroupJoinStatusJoined = 0 GroupJoinStatusInvited = 1 GroupJoinStatusDeleted = 2 )
var ActiveSessionID int64
ActiveSessionID represents the currently opend chat
var AllGroups []*GroupRecord
var (
GroupRecipientsID = -1
)
var GroupV2sModel = GroupV2s{ Groups: []GroupV2{}, }
var Groups = map[string]*GroupRecord{}
var RecipientsModel = &Recipients{ Recipients: make([]*Recipient, 0), }
var SessionsV2Model = &SessionsV2{ Sess: make([]*SessionV2, 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 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 GetUnreadMessageCounterForSession ¶ added in v1.6.0
GetUnreadMessageCounterForSession returns an int for the unread messages for a session
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 RefreshContacts ¶
func RefreshContacts() error
func UpdateMessageRead ¶
func UpdateMessageReceipt ¶ added in v0.9.0
func UpdateMessageReceiptSent ¶ added in v0.8.3
func UpdateMessageSent ¶
func UpdateSessionTable_v_0_9_0 ¶ added in v0.9.0
func UpdateSessionTable_v_0_9_0() error
UpdateSessionTable_v_0_9_0 adds support for quoted messages
func UpdateSessionTable_v_0_9_5 ¶ added in v0.9.6
func UpdateSessionTable_v_0_9_5() error
UpdateSessionTable_v_0_9_5 adds support uuids
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 ¶
func NewStorage ¶
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)
type GroupV2 ¶ added in v1.6.0
type GroupV2 struct { Id string `json:"id" db:"id"` Name string `json:"name" db:"name"` MasterKey string `json:"master_key" db:"master_key"` Revision int `json:"revision" db:"revision"` InviteLinkPassword string `json:"invite_link_password" db:"invite_link_password"` AccessRequiredForAttributes int `json:"access_required_for_attributes" db:"access_required_for_attributes"` AccessRequiredForMembers int `json:"access_required_for_members" db:"access_required_for_members"` JoinStatus int `json:"join_status" db:"join_status"` }
GroupV2 is a group, groupsv1 are deprecated
func (*GroupV2) AddGroupMembers ¶ added in v1.6.0
func (g *GroupV2) AddGroupMembers(members []*signalservice.DecryptedMember) error
func (*GroupV2) AddMember ¶ added in v1.6.0
AddMember adds a new member to a group for this recipient
func (*GroupV2) DeleteGroupMembers ¶ added in v1.6.0
func (*GroupV2) DeleteMember ¶ added in v1.6.0
DeleteMember deletes a member from a group
func (*GroupV2) DeleteMembers ¶ added in v1.6.0
DeleteMembers deletes all members of a group
func (*GroupV2) GetGroupMembers ¶ added in v1.6.0
func (g *GroupV2) GetGroupMembers() ([]GroupV2Member, error)
GetGroupMembers returns all members of a group
func (*GroupV2) GetGroupMembersAsRecipients ¶ added in v1.6.0
GetGroupMembersAsRecipients returns the recipient records for all group members
func (*GroupV2) IsMember ¶ added in v1.6.0
IsMember returns true if the user is a member of the group
func (*GroupV2) UpdateGroup ¶ added in v1.6.0
UpdateGroup updates a group
func (*GroupV2) UpdateGroupAction ¶ added in v1.6.0
func (g *GroupV2) UpdateGroupAction(action *signalservice.DecryptedGroupChange) error
UpdateGroupAction updates a group with a new action
func (*GroupV2) UpdateGroupMembers ¶ added in v1.6.0
func (g *GroupV2) UpdateGroupMembers(members []GroupV2Member) error
UpdateGroupMembers updates all group members
type GroupV2Member ¶ added in v1.6.0
type GroupV2Member struct { Id int `json:"id" db:"id"` GroupV2Id string `json:"group_v2_id" db:"group_v2_id"` RecipientId int `json:"recipient_id" db:"recipient_id"` MemberSince string `json:"member_since" db:"member_since"` JoinedAtRevision int `json:"joined_at_revision" db:"joined_at_revision"` Role int `json:"role" db:"role"` }
GroupV2Member represents a group member
type GroupV2s ¶ added in v1.6.0
type GroupV2s struct {
Groups []GroupV2 `json:"groups"`
}
func (GroupV2s) GetGroupById ¶ added in v1.6.0
GetGroupById returns a group by id
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 GetLastMessagesForAllSessions ¶ added in v1.6.0
func GetMessageById ¶ added in v0.9.0
GetMessageById returns a message by it's ID
func SaveMessage ¶
type MessageList ¶
type Recipient ¶ added in v1.6.0
type Recipient struct { Id int64 `db:"id"` E164 string `db:"e164"` UUID string `db:"uuid"` Username string `db:"username"` Email string `db:"email"` IsBlocked bool `db:"is_blocked"` ProfileKey []byte `db:"profile_key"` ProfileKeyCredential []byte `db:"profile_key_credential"` ProfileGivenName string `db:"profile_given_name"` ProfileFamilyName string `db:"profile_family_name"` ProfileJoinedName string `db:"profile_joined_name"` SignalProfileAvatar string `db:"signal_profile_avatar"` ProfileSharingEnabled bool `db:"profile_sharing_enabled"` LastProfileFetch string `db:"last_profile_fetch"` UnidentifiedAccessMode bool `db:"unidentified_access_mode"` StorageServiceId []byte `db:"storage_service_id"` StorageProto []byte `db:"storage_proto"` Capabilities int `db:"capabilities"` LastSessionReset string `db:"last_session_reset"` About string `db:"about"` AboutEmoji string `db:"about_emoji"` }
func (*Recipient) SaveRecipient ¶ added in v1.6.0
SaveRecipient saves a recipient
func (*Recipient) UpdateProfile ¶ added in v1.6.0
UpdateProfile updates a recipient's profile
type Recipients ¶ added in v1.6.0
type Recipients struct {
Recipients []*Recipient `db:"recipients"`
}
func (*Recipients) CreateRecipient ¶ added in v1.6.0
func (r *Recipients) CreateRecipient(recipient *Recipient) (*Recipient, error)
CreateRecipient creates a recipient
func (*Recipients) CreateRecipientWithoutProfileUpdate ¶ added in v1.6.0
func (r *Recipients) CreateRecipientWithoutProfileUpdate(recipient *Recipient) (*Recipient, error)
CreateRecipientWithoutProfileUpdate is only used in the v1.6.0 migration because we migrate before we initialize the signal server
func (*Recipients) GetOrCreateRecipient ¶ added in v1.6.0
func (r *Recipients) GetOrCreateRecipient(uuid string) *Recipient
GetOrCreateRecipient returns a recipient by uuid or creates a new one
func (*Recipients) GetOrCreateRecipientForContact ¶ added in v1.6.0
func (r *Recipients) GetOrCreateRecipientForContact(contact *contacts.Contact) *Recipient
GetOrCreateRecipientForContact returns a recipient for a contact
func (*Recipients) GetRecipientByE164 ¶ added in v1.6.0
func (*Recipients) GetRecipientByE164(e164 string) *Recipient
GetRecipientByE164 returns a recipient by e164
func (*Recipients) GetRecipientById ¶ added in v1.6.0
func (*Recipients) GetRecipientById(id int64) *Recipient
GetRecipientById returns a recipient by id
func (*Recipients) GetRecipientByUUID ¶ added in v1.6.0
func (*Recipients) GetRecipientByUUID(uuid string) *Recipient
GetRecipientByUUID returns a recipient by uuid
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 is Deprecated: use store.SessionsV2Model instead It used to define how a session looks like
type SessionV2 ¶ added in v1.6.0
type SessionV2 struct { ID int64 `db:"id"` DirectMessageRecipientID int64 `db:"directMessageRecipientId"` ExpireTimer int64 `db:"expireTimer"` IsArchived bool `db:"isArchived"` IsBlocked bool `db:"isBlocked"` IsPinned bool `db:"isPinned"` IsSilenced bool `db:"isSilenced"` IsMuted bool `db:"isMuted"` Draft string `db:"draft"` GroupV2ID string `db:"groupV2Id"` GroupV1ID string `db:"groupV1Id"` UnreadCounter int64 `db:"unreadCounter"` }
func (*SessionV2) GetMessageList ¶ added in v1.6.0
GetMessageList returns a list of messages for a session
func (*SessionV2) NotificationsToggle ¶ added in v1.6.0
NotificationsToggle toggles the notifications for a session
type SessionV2Name ¶ added in v1.6.0
type SessionsV2 ¶ added in v1.6.0
type SessionsV2 struct {
Sess []*SessionV2
}
func (*SessionsV2) CreateSession ¶ added in v1.6.0
func (s *SessionsV2) CreateSession(session *SessionV2) (*SessionV2, error)
CreateSession inserts this session into the database
func (*SessionsV2) CreateSessionForDirectMessageRecipient ¶ added in v1.6.0
func (s *SessionsV2) CreateSessionForDirectMessageRecipient(recipient int64) (*SessionV2, error)
CreateSessionForDirectMessageRecipient creates a session for a direct message (one to one)
func (*SessionsV2) CreateSessionForGroupV1 ¶ added in v1.6.0
func (s *SessionsV2) CreateSessionForGroupV1(group string) (*SessionV2, error)
CreateSessionForGroupV1 creates a session for a group v1
func (*SessionsV2) CreateSessionForGroupV2 ¶ added in v1.6.0
func (s *SessionsV2) CreateSessionForGroupV2(groupID string) (*SessionV2, error)
CreateSessionForGroupV2 creates a session for a group v2
func (*SessionsV2) DeleteAllSessions ¶ added in v1.6.0
func (*SessionsV2) DeleteAllSessions() error
DeleteAllSessions deletes all sessions
func (*SessionsV2) DeleteSession ¶ added in v1.6.0
func (*SessionsV2) DeleteSession(session *SessionV2) error
DeleteSession deletes a session
func (*SessionsV2) GetAllSessions ¶ added in v1.6.0
func (*SessionsV2) GetAllSessions() ([]*SessionV2, error)
GetAllSessions returns all sessions
func (*SessionsV2) GetMoreMessageList ¶ added in v1.6.0
func (s *SessionsV2) GetMoreMessageList(ID int64, sentAt uint64) (*MessageList, error)
GetMoreMessageList loads more messages from before the timestamp sentAt
func (*SessionsV2) GetOrCreateSessionForDirectMessageRecipient ¶ added in v1.6.0
func (s *SessionsV2) GetOrCreateSessionForDirectMessageRecipient(recipient int64) (*SessionV2, error)
GetOrCreateSessionForDirectMessageRecipient returns a session for a direct message (one to one)
func (*SessionsV2) GetOrCreateSessionForGroupV2ID ¶ added in v1.6.0
func (s *SessionsV2) GetOrCreateSessionForGroupV2ID(group string) (*SessionV2, error)
GetOrCreateSessionForGroupV2ID returns a session for a group v2 id
func (*SessionsV2) GetSessionByDirectMessageRecipientID ¶ added in v1.6.0
func (*SessionsV2) GetSessionByDirectMessageRecipientID(recipient int64) (*SessionV2, error)
GetSessionByDirectMessageRecipientID returns a session by direct message recipient id
func (*SessionsV2) GetSessionByGroupV1ID ¶ added in v1.6.0
func (*SessionsV2) GetSessionByGroupV1ID(group string) (*SessionV2, error)
GetSessionByGroupV1ID returns a session by group v1 id
func (*SessionsV2) GetSessionByGroupV2ID ¶ added in v1.6.0
func (*SessionsV2) GetSessionByGroupV2ID(group string) (*SessionV2, error)
GetSessionByGroupV2ID returns a session by group v2 id
func (*SessionsV2) GetSessionByID ¶ added in v1.6.0
func (*SessionsV2) GetSessionByID(id int64) (*SessionV2, error)
GetSessionByID returns a session by id
func (*SessionsV2) GetSessionNames ¶ added in v1.6.0
func (s *SessionsV2) GetSessionNames() ([]SessionV2Name, error)
GetSessionNames returns all session names
func (*SessionsV2) SaveSession ¶ added in v1.6.0
func (*SessionsV2) SaveSession(session *SessionV2) (*SessionV2, error)
SaveSession saves a session to the database
func (*SessionsV2) UpdateAllUnreadCountersForSessions ¶ added in v1.6.0
func (s *SessionsV2) UpdateAllUnreadCountersForSessions() error
UpdateAllUnreadCountersForSessions updates all unread counters for all sessions
func (*SessionsV2) UpdateUnreadCounterForSession ¶ added in v1.6.0
func (*SessionsV2) UpdateUnreadCounterForSession(session *SessionV2) error
UpdateUnreadCounterForSession updates the unread counter for a session