signald

package
v0.0.0-...-97a6747 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Username   string
	DeviceID   int
	Filename   string
	Registered bool
	HasKeys    bool `json:"has_keys"`
	Subscribed bool
}

Account represents a user account registered to signald

type DataMessage

type DataMessage struct {
	Timestamp        float64
	Message          string
	ExpiresInSeconds float64
	GroupInfo        IncomingGroupInfo
}

DataMessage is the main component of incoming text messages

type Group

type Group struct {
	GroupID  string
	Members  []string
	Name     string
	AvatarID int
}

Group represents a group in signal

type IncomingGroupInfo

type IncomingGroupInfo struct {
	GroupID string
	Type    string
}

IncomingGroupInfo is information about a particular group

type JsonAttachment

type JsonAttachment struct {
	Filename  string `json:"filename"`
	Caption   string `json:"caption"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	VoiceNote bool   `json:"voiceNote"`
	Preview   bool   `json:"preview"`
}

type Request

type Request struct {
	Type                string           `json:"type"`
	ID                  string           `json:"id,omitempty"`
	Username            string           `json:"username,omitempty"`
	MessageBody         string           `json:"messageBody,omitempty"`
	RecipientAddress    v1.JsonAddress   `json:"recipientAddress,omitempty"`
	RecipientGroupID    string           `json:"recipientGroupId,omitempty"`
	Voice               bool             `json:"voice,omitempty"`
	Code                string           `json:"code,omitempty"`
	DeviceName          string           `json:"deviceName,omitempty"`
	AttachmentFilenames []string         `json:"attachmentFilenames,omitempty"`
	URI                 string           `json:"uri,omitempty"`
	Attachments         []JsonAttachment `json:"attachments,omitempty"`
	GroupName           string           `json:"groupName,omitempty"`
	Members             []string         `json:"members,omitempty"`
	Avatar              string           `json:"avatar,omitempty"`
}

Request represents a message sent to signald

type Response

type Response struct {
	ID   string
	Data ResponseData
	Type string
}

Response is a response to a request to signald, or a new inbound message

type ResponseData

type ResponseData struct {
	Groups          []Group
	Accounts        []Account
	URI             string
	DataMessage     DataMessage
	Message         string
	Username        string
	Source          v1.JsonAddress
	SourceDevice    int
	Type            string
	IsReceipt       bool
	Timestamp       float64
	ServerTimestamp float64
}

ResponseData is where most of the data in the response is stored.

type Signald

type Signald struct {
	SocketPath string
	// contains filtered or unexported fields
}

Signald is a connection to a signald instance.

func (*Signald) Connect

func (s *Signald) Connect() error

Connect connects to the signad socket

func (*Signald) Listen

func (s *Signald) Listen(c chan Response) error

Listen listens for events from signald

func (*Signald) SendRequest

func (s *Signald) SendRequest(request Request) error

SendRequest sends a request to signald. Mostly used interally.

Directories

Path Synopsis
client-protocol
v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL