smsbackuprestore

package
v0.0.0-...-b88c27a Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package smsbackuprestore implements a Timeliner data source for the Android SMS Backup & Restore app by SyncTech: https://synctech.com.au/sms-backup-restore/

Index

Constants

View Source
const (
	DataSourceName = "SMS Backup & Restore"
	DataSourceID   = "smsbackuprestore"
)

Data source name and ID.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Text    string `xml:",chardata"`
	Address string `xml:"address,attr"`
	Type    int    `xml:"type,attr"` // 151 = recipient, 137 = sender
	Charset string `xml:"charset,attr"`
}

Address is a sender or recipient of the MMS.

type Addresses

type Addresses struct {
	Text string    `xml:",chardata"`
	Addr []Address `xml:"addr"`
}

Addresses is the addresses the MMS was sent to.

type Client

type Client struct {
	// DefaultRegion is the region to assume for phone
	// numbers that do not have an explicit country
	// calling code. This value should be the ISO
	// 3166-1 alpha-2 standard region code.
	DefaultRegion string
	// contains filtered or unexported fields
}

Client implements the timeliner.Client interface.

func (*Client) ListItems

func (c *Client) ListItems(ctx context.Context, itemChan chan<- *timeliner.ItemGraph, opt timeliner.ListingOptions) error

ListItems lists items from the data source.

type CommonSMSandMMSFields

type CommonSMSandMMSFields struct {
	Text         string `xml:",chardata"`
	Address      string `xml:"address,attr"`
	Date         int64  `xml:"date,attr"` // unix timestamp in milliseconds
	Read         int    `xml:"read,attr"`
	Locked       int    `xml:"locked,attr"`
	DateSent     int64  `xml:"date_sent,attr"` // unix timestamp in (SMS: milliseconds, MMS: seconds)
	SubID        int    `xml:"sub_id,attr"`
	ReadableDate string `xml:"readable_date,attr"` // format: "Oct 20, 2017 12:35:30 PM"
	ContactName  string `xml:"contact_name,attr"`  // might be "(Unknown)"
}

CommonSMSandMMSFields are the fields that both SMS and MMS share in common.

type MMS

type MMS struct {
	CommonSMSandMMSFields
	Rr         string    `xml:"rr,attr"`
	Sub        string    `xml:"sub,attr"`
	CtT        string    `xml:"ct_t,attr"`
	ReadStatus string    `xml:"read_status,attr"`
	Seen       string    `xml:"seen,attr"`
	MsgBox     string    `xml:"msg_box,attr"`
	SubCs      string    `xml:"sub_cs,attr"`
	RespSt     string    `xml:"resp_st,attr"`
	RetrSt     string    `xml:"retr_st,attr"`
	DTm        string    `xml:"d_tm,attr"`
	TextOnly   string    `xml:"text_only,attr"`
	Exp        string    `xml:"exp,attr"`
	MID        string    `xml:"m_id,attr"`
	St         string    `xml:"st,attr"`
	RetrTxtCs  string    `xml:"retr_txt_cs,attr"`
	RetrTxt    string    `xml:"retr_txt,attr"`
	Creator    string    `xml:"creator,attr"`
	MSize      string    `xml:"m_size,attr"`
	RptA       string    `xml:"rpt_a,attr"`
	CtCls      string    `xml:"ct_cls,attr"`
	Pri        string    `xml:"pri,attr"`
	TrID       string    `xml:"tr_id,attr"`
	RespTxt    string    `xml:"resp_txt,attr"`
	CtL        string    `xml:"ct_l,attr"`
	MCls       string    `xml:"m_cls,attr"`
	DRpt       string    `xml:"d_rpt,attr"`
	V          string    `xml:"v,attr"`
	MType      string    `xml:"m_type,attr"`
	Parts      Parts     `xml:"parts"`
	Addrs      Addresses `xml:"addrs"`
	// contains filtered or unexported fields
}

MMS represents a multimedia message.

func (MMS) Class

func (m MMS) Class() timeliner.ItemClass

Class returns the class Message.

func (MMS) DataFileHash

func (m MMS) DataFileHash() []byte

DataFileHash returns nil.

func (MMS) DataFileMIMEType

func (m MMS) DataFileMIMEType() *string

DataFileMIMEType returns the MIME type, if any.

func (MMS) DataFileName

func (m MMS) DataFileName() *string

DataFileName returns the name of the file, if any.

func (MMS) DataFileReader

func (m MMS) DataFileReader() (io.ReadCloser, error)

DataFileReader returns the data file reader, if any.

func (MMS) DataText

func (m MMS) DataText() (*string, error)

DataText returns the text of the multimedia message, if any.

func (MMS) ID

func (m MMS) ID() string

ID returns a unique ID by concatenating the date of the message with its TRID.

func (MMS) Location

func (m MMS) Location() (*timeliner.Location, error)

Location returns nil.

func (MMS) Metadata

func (m MMS) Metadata() (*timeliner.Metadata, error)

Metadata returns nil.

func (MMS) Owner

func (m MMS) Owner() (number *string, name *string)

Owner returns the name and number of the sender, if available. The export format does not give us the contacts' names, however.

func (MMS) Timestamp

func (m MMS) Timestamp() time.Time

Timestamp returns the message's date.

type Part

type Part struct {
	Text        string `xml:",chardata"`
	Seq         int    `xml:"seq,attr"`
	ContentType string `xml:"ct,attr"`
	Name        string `xml:"name,attr"`
	Charset     string `xml:"chset,attr"`
	Cd          string `xml:"cd,attr"`
	Fn          string `xml:"fn,attr"`
	Cid         string `xml:"cid,attr"`
	Filename    string `xml:"cl,attr"`
	CttS        string `xml:"ctt_s,attr"`
	CttT        string `xml:"ctt_t,attr"`
	AttrText    string `xml:"text,attr"`
	Data        string `xml:"data,attr"`
}

Part is a part of an MMS.

type Parts

type Parts struct {
	Text string `xml:",chardata"`
	Part []Part `xml:"part"`
}

Parts is the parts of an MMS.

type SMS

type SMS struct {
	CommonSMSandMMSFields
	Protocol      int    `xml:"protocol,attr"`
	Type          int    `xml:"type,attr"` // 1 = received, 2 = sent
	Subject       string `xml:"subject,attr"`
	Body          string `xml:"body,attr"`
	Toa           string `xml:"toa,attr"`
	ScToa         string `xml:"sc_toa,attr"`
	ServiceCenter string `xml:"service_center,attr"`
	Status        int    `xml:"status,attr"`
	// contains filtered or unexported fields
}

SMS represents a simple text message.

func (SMS) Class

func (s SMS) Class() timeliner.ItemClass

Class returns class Message.

func (SMS) DataFileHash

func (s SMS) DataFileHash() []byte

DataFileHash returns nil.

func (SMS) DataFileMIMEType

func (s SMS) DataFileMIMEType() *string

DataFileMIMEType returns nil.

func (SMS) DataFileName

func (s SMS) DataFileName() *string

DataFileName returns nil.

func (SMS) DataFileReader

func (s SMS) DataFileReader() (io.ReadCloser, error)

DataFileReader returns nil.

func (SMS) DataText

func (s SMS) DataText() (*string, error)

DataText returns the text of the message.

func (SMS) ID

func (s SMS) ID() string

ID returns a unique ID for this text message. Because text messages do not have IDs, an ID is constructed by concatenating the millisecond timestamp of the message with a fast hash of the message body.

func (SMS) Location

func (s SMS) Location() (*timeliner.Location, error)

Location returns nil.

func (SMS) Metadata

func (s SMS) Metadata() (*timeliner.Metadata, error)

Metadata returns nil.

func (SMS) Owner

func (s SMS) Owner() (number *string, name *string)

Owner returns the sender's phone number and name, if available.

func (SMS) Timestamp

func (s SMS) Timestamp() time.Time

Timestamp returns the message's date.

type Smses

type Smses struct {
	XMLName    xml.Name `xml:"smses"`
	Text       string   `xml:",chardata"`
	Count      int      `xml:"count,attr"`
	BackupSet  string   `xml:"backup_set,attr"`  // UUID
	BackupDate int64    `xml:"backup_date,attr"` // unix timestamp in milliseconds
	SMS        []SMS    `xml:"sms"`
	MMS        []MMS    `xml:"mms"`
}

Smses was generated 2019-07-10 using an export from SMS Backup & Restore v10.05.602 (previous versions have a bug with emoji encodings).

Jump to

Keyboard shortcuts

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