Documentation ¶
Index ¶
- Variables
- func ConfigPath() string
- func ConversationFolder() string
- func FindConfigFolder() string
- func FindDataFolder() string
- func LogPath() string
- type Attachment
- type Config
- type Contact
- type ContactList
- func (cl ContactList) AllNames() []string
- func (cl ContactList) FindContact(pattern string) *Contact
- func (cl ContactList) List() []*Contact
- func (cl ContactList) SortedByIndex() []*Contact
- func (cl ContactList) SortedByName() []*Contact
- func (cl ContactList) SortedByNumber() []*Contact
- func (cl ContactList) StringSlice() []string
- type ConvInfo
- type Conversation
- func (c *Conversation) AddAttachment(path string) error
- func (c *Conversation) AddMessage(message *Message)
- func (c *Conversation) CaughtUp()
- func (c *Conversation) ClearAttachments()
- func (c *Conversation) ClearStaged()
- func (c *Conversation) ClearStagedMessage()
- func (c *Conversation) Filter(pattern string) string
- func (c *Conversation) HasStagedData() bool
- func (c *Conversation) HasStagedMessage() bool
- func (c *Conversation) LastMessage() *Message
- func (c *Conversation) Load(path string, cfg *Config) error
- func (c *Conversation) NumAttachments() int
- func (c *Conversation) Save() error
- func (c *Conversation) SaveAs(path string) error
- func (c *Conversation) String() string
- type Message
- type PhoneNumber
- type Siggo
- func (s *Siggo) Config() Config
- func (s *Siggo) Contacts() ContactList
- func (s *Siggo) Conversations() map[*Contact]*Conversation
- func (s *Siggo) Quit()
- func (s *Siggo) Receive() error
- func (s *Siggo) ReceiveForever()
- func (s *Siggo) SaveConversations()
- func (s *Siggo) Send(msg string, contact *Contact) error
- type SignalAPI
Constants ¶
This section is empty.
Variables ¶
var DeliveryStatus map[bool]string = map[bool]string{ // contains filtered or unexported fields }
var ReadStatus map[bool]string = map[bool]string{ // contains filtered or unexported fields }
Functions ¶
func ConversationFolder ¶
func ConversationFolder() string
ConversationFolder returns the folder where conversations are saved
func FindConfigFolder ¶
func FindConfigFolder() string
FindConfigFolder returns $XDG_CONFIG_HOME/siggo/ if it exists, otherwise returns $HOME/.config/siggo/
func FindDataFolder ¶
func FindDataFolder() string
FindDataFolder returns $XDG_DATA_HOME if it exists, otherwise returns $HOME/.local/share/siggo/
Types ¶
type Attachment ¶
type Attachment struct { ContentType string `json:"contentType"` Filename string `json:"filename"` ID string `json:"id"` Size int `json:"size"` Timestamp int64 `json:"timestamp"` FromSelf bool `json:"from_self"` }
Attachment is any file sent or received. Received attachments are left in the usual `signal-cli` location for now. It seems to automatically delete old attachments, so we may want to come up with a way to keep our own copy somewhere in the siggo data folder.
func ConvertAttachments ¶
func ConvertAttachments(wire []*signal.Attachment, timestamp int64, fromSelf bool) []*Attachment
ConvertAttachments converts signal's wire attachments into our model's attachments
func NewAttachmentFromWire ¶
func NewAttachmentFromWire(wire *signal.Attachment, timestamp int64, fromSelf bool) *Attachment
NewAttachmentFromWire creates a new siggo attachment from a signal.Attachment
func (*Attachment) Path ¶
func (a *Attachment) Path() (string, error)
Path returns the full path to an attachment file
func (*Attachment) String ¶
func (a *Attachment) String() string
String returns the string representation of the attachment
type Config ¶
type Config struct { UserNumber string `yaml:"user_number"` UserName string `yaml:"user_name"` // SaveMessages enables message saving. You will still load any (previously) saved messages // at startup. SaveMessages bool `yaml:"save_messages"` // Attempt to send desktop notifications DesktopNotifications bool `yaml:"desktop_notifications"` DesktopNotificationsShowMessage bool `yaml:"desktop_notifications_show_message"` DesktopNotificationsShowAvatar bool `yaml:"desktop_notifications_show_avatar"` // Terminal bell TerminalBellNotifications bool `yaml:"terminal_bell_notifications"` // doesn't do anything yet MaxConversationLength int `yaml:"max_coversation_length"` HidePanelTitles bool `yaml:"hide_panel_titles"` HidePhoneNumbers bool `yaml:"hide_phone_numbers"` ContactColors map[string]string `yaml:"contact_colors"` ContactAliases map[string]string `yaml:"contact_aliases"` // No rotation provided, use at your own risk! LogFilePath string `yaml:"log_file"` }
Config includes both siggo and UI config
func DefaultConfig ¶
func DefaultConfig() *Config
func GetConfig ¶
GetConfig returns the current configuration from the default config location, creates a new one if it isn't there
func LoadConfig ¶
LoadConfig loads the config located @ `path`
func NewConfigFile ¶
NewConfigFile makes a new config file at `path` and returns the default config.
type Contact ¶
type Contact struct { Number PhoneNumber Name string Index int // contains filtered or unexported fields }
func (*Contact) Avatar ¶
Avatar returns the path to the contact's avatar, if it can find it, otherwise ""
type ContactList ¶
type ContactList map[PhoneNumber]*Contact
func (ContactList) AllNames ¶
func (cl ContactList) AllNames() []string
AllNames returns a slice of all aliases and names in the entire contact list
func (ContactList) FindContact ¶
func (cl ContactList) FindContact(pattern string) *Contact
FindContact searches the contact list for the first contact whose name matches the supplied pattern. Returns nil if no match is found.
func (ContactList) List ¶
func (cl ContactList) List() []*Contact
List returns a list of contacts (in random order)
func (ContactList) SortedByIndex ¶
func (cl ContactList) SortedByIndex() []*Contact
SortedByIndex returns a slice of contacts sorted by index provided by signal-cli
func (ContactList) SortedByName ¶
func (cl ContactList) SortedByName() []*Contact
SortedByName returns a slice of contacts sorted alphabetically
func (ContactList) SortedByNumber ¶
func (cl ContactList) SortedByNumber() []*Contact
SortedByNumber returns a slice of contacts sorted by phone number Idk why anyone would ever want to use this but here it is.
func (ContactList) StringSlice ¶
func (cl ContactList) StringSlice() []string
StringSlice returns the contact list as a string slice
type ConvInfo ¶
type ConvInfo map[*Contact]*Conversation
type Conversation ¶
type Conversation struct { Contact *Contact // can be a group! Messages map[int64]*Message MessageOrder []int64 HasNewMessage bool StagedMessage string // contains filtered or unexported fields }
Coversation is a contact or group and its associated messages
func NewConversation ¶
func NewConversation(contact *Contact) *Conversation
func (*Conversation) AddAttachment ¶
func (c *Conversation) AddAttachment(path string) error
StageAttachment attaches a file to be sent in the next message
func (*Conversation) AddMessage ¶
func (c *Conversation) AddMessage(message *Message)
AddMessage appends a message to the conversation
func (*Conversation) CaughtUp ¶
func (c *Conversation) CaughtUp()
CaughtUp iterates back through the messages of the conversation marking the un-read ones as read. We call this after we switch to this conversation.
func (*Conversation) ClearAttachments ¶
func (c *Conversation) ClearAttachments()
ClearAttachments removes any staged attachments
func (*Conversation) ClearStaged ¶
func (c *Conversation) ClearStaged()
ClearStaged clears any staged message or attachment
func (*Conversation) ClearStagedMessage ¶
func (c *Conversation) ClearStagedMessage()
ClearStagedMessage removes any staged attachments
func (*Conversation) Filter ¶
func (c *Conversation) Filter(pattern string) string
Filter redners the conversation, but filters out any messages that don't have a regex match TODO: eliminate code duplication with String()
func (*Conversation) HasStagedData ¶
func (c *Conversation) HasStagedData() bool
HasStagedData returns whether the conversation has a staged message or attachment
func (*Conversation) HasStagedMessage ¶
func (c *Conversation) HasStagedMessage() bool
HasStagedMessage returns whether the conversation has a staged message
func (*Conversation) LastMessage ¶
func (c *Conversation) LastMessage() *Message
LastMessage returns the most recent message. Can be nil.
func (*Conversation) Load ¶
func (c *Conversation) Load(path string, cfg *Config) error
Load will load a conversation saved @ `path` TODO: load only the last N messages based on config HERE IS WHERE THE COLOR THE LOADED MESSAGES
func (*Conversation) NumAttachments ¶
func (c *Conversation) NumAttachments() int
NumAttachments returns the number of staged attachments
func (*Conversation) Save ¶
func (c *Conversation) Save() error
Save writes the conversation to the default location only if it has new data
func (*Conversation) SaveAs ¶
func (c *Conversation) SaveAs(path string) error
SaveAs writes the conversation to `path`.
func (*Conversation) String ¶
func (c *Conversation) String() string
String renders the conversation to a single string
type Message ¶
type Message struct { Content string `json:"content"` Timestamp int64 `json:"timestamp"` IsDelivered bool `json:"is_delivered"` IsRead bool `json:"is_read"` FromSelf bool `json:"from_self"` Attachments []*Attachment `json:"attachments"` From string `json:from"` FromContact *Contact `json:from_contact"` }
func (*Message) AddAttachments ¶
AddAttachments currently only is used to track attachments we sent to other people, so that they show up in the GUI.
type Siggo ¶
type Siggo struct { NewInfo func(*Conversation) ErrorEvent func(error) // contains filtered or unexported fields }
func (*Siggo) Contacts ¶
func (s *Siggo) Contacts() ContactList
Contacts returns the current contact list
func (*Siggo) Conversations ¶
func (s *Siggo) Conversations() map[*Contact]*Conversation
Conversations returns the current converstation book
func (*Siggo) ReceiveForever ¶
func (s *Siggo) ReceiveForever()
ReceiveForever waits until initialzation is complete, then starts the daemon.
func (*Siggo) SaveConversations ¶
func (s *Siggo) SaveConversations()
SaveConversations saves all conversations to disk
type SignalAPI ¶
type SignalAPI interface { Send(string, string) (int64, error) SendDbus(string, string, ...string) (int64, error) SendGroupDbus(string, string, ...string) (int64, error) Receive() error RequestGroupInfo() ([]signal.SignalGroupInfo, error) ReceiveForever() Close() OnReceived(signal.ReceivedCallback) OnReceipt(signal.ReceiptCallback) OnSent(signal.SentCallback) OnError(signal.ErrorCallback) }