Documentation ¶
Overview ¶
Package signalMessenger provides a dbus interface to talk to the signal-cli from https://github.com/AsamK/signal-cli.
Using DBus should be preferred as it guarantees fixed formating and type definitions. Furthermore, more processes can use the signal-cli simultaneously when using the DBus implementation. Systembus or Sessionbus are both possible to choose from during the creation. Message handling and other events are managed through the Event interface.
Copyright 2021 Lukas Gallandi. All rights reserved. Use of this source code is governed by a license that can be found in the LICENSE file.
Index ¶
- type Connection
- func (conn *Connection) Close()
- func (conn *Connection) SendMessage(target, message string, attachments []string) (int64, error)
- func (conn *Connection) SendMessageASync(target, message string, attachments []string) error
- func (conn *Connection) SetEventHandler(eventHandler Event) (err error)
- func (conn *Connection) SetLogger(logger *logrus.Entry) (err error)
- type Event
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is the main struct which stores necessary information and is used for controlling and using the signalMessenger.
func New ¶
func New(useSystembus bool, eventHandler Event) (conn *Connection, err error)
New creates a new connection object and starts the necessary routines. If no event handling is desired, nil can be used safely.
func (*Connection) Close ¶
func (conn *Connection) Close()
Close closes the connection to the DBus and stopes all running routines.
func (*Connection) SendMessage ¶
func (conn *Connection) SendMessage(target, message string, attachments []string) (int64, error)
SendMessage sends a new message to the target with possible attachments. This function waits for the message timestamp. The timestamp of the message given by signal-cli will be returned.
func (*Connection) SendMessageASync ¶
func (conn *Connection) SendMessageASync(target, message string, attachments []string) error
SendMessageASync sends a new message to the target but does not care about the returning messageTimestamp.
func (*Connection) SetEventHandler ¶
func (conn *Connection) SetEventHandler(eventHandler Event) (err error)
SetEventHandler sets a new eventHandler for the connection.