imessage

package
v0.0.0-...-3bed8bd Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownNormalTapbackTarget = errors.New("unrecognized formatting of normal tapback target")
	ErrInvalidTapbackTargetPart   = errors.New("tapback target part index is invalid")
	ErrUnknownTapbackTargetType   = errors.New("unrecognized tapback target type")
)

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	PartInfo   MessagePartInfo
	Downloader *ids.AttachmentDownloader
	InlineData []byte
	FileSize   int
	FileName   string
	MimeType   string
	UTIType    string
}

type ChatDeleted

type ChatDeleted struct {
	Chat uri.ParsedURI
}

type ChatIdentifier

type ChatIdentifier struct {
	ChatGUID string `json:"chat_guid"`
	GroupID  string `json:"group_id,omitempty"`
}

type ChatInfo

type ChatInfo struct {
	JSONChatGUID string `json:"chat_guid"`
	Identifier   `json:"-"`
	DisplayName  string    `json:"title"`
	Members      []string  `json:"members"`
	NoCreateRoom bool      `json:"no_create_room"`
	GroupID      uuid.UUID `json:"group_id,omitempty"`
	Delete       bool      `json:"delete,omitempty"`
}

type Contact

type Contact struct {
	FirstName string   `json:"first_name,omitempty"`
	LastName  string   `json:"last_name,omitempty"`
	Nickname  string   `json:"nickname,omitempty"`
	Avatar    []byte   `json:"avatar,omitempty"`
	Phones    []string `json:"phones,omitempty"`
	Emails    []string `json:"emails,omitempty"`
	UserGUID  string   `json:"user_guid,omitempty"`

	PrimaryIdentifier string `json:"primary_identifier,omitempty"`
}

func (*Contact) HasName

func (contact *Contact) HasName() bool

func (*Contact) Name

func (contact *Contact) Name() string

type GroupActionType

type GroupActionType int
const (
	GroupActionAddUser    GroupActionType = 0
	GroupActionRemoveUser GroupActionType = 1

	GroupActionSetAvatar    GroupActionType = 1
	GroupActionRemoveAvatar GroupActionType = 2
)

type GroupInfoChange

type GroupInfoChange struct {
	ID                uuid.UUID
	PropertiesVersion int

	GroupID  string
	Chat     uri.ParsedURI
	Sender   uri.ParsedURI
	IsFromMe bool
	Time     time.Time

	OldName string
	NewName string

	RemoveAvatar           bool
	AvatarFileTransferGUID *string
	NewAvatar              *ids.AttachmentDownloader

	OldParticipants []uri.ParsedURI
	NewParticipants []uri.ParsedURI
}

func (*GroupInfoChange) GetIsFromMe

func (g *GroupInfoChange) GetIsFromMe() bool

func (*GroupInfoChange) GetSender

func (g *GroupInfoChange) GetSender() uri.ParsedURI

type IMessageWithSender

type IMessageWithSender interface {
	GetSender() uri.ParsedURI
	GetIsFromMe() bool
}

type Identifier

type Identifier struct {
	LocalID string
	Service string

	IsGroup bool
}

func ParseIdentifier

func ParseIdentifier(guid string) Identifier

func (Identifier) String

func (id Identifier) String() string

type ItemType

type ItemType int
const (
	ItemTypeMessage ItemType = iota
	ItemTypeMember
	ItemTypeName
	ItemTypeAvatar
)

type MarkUnread

type MarkUnread struct {
	MessageID uuid.UUID
}

type Message

type Message struct {
	GroupID  string           `json:"group_id,omitempty"`
	ID       uuid.UUID        `json:"id"`
	Time     time.Time        `json:"-"`
	Subject  string           `json:"subject"`
	Text     string           `json:"text"`
	HTML     string           `json:"html"`
	TextPart *MessagePartInfo `json:"text_part"`
	Chat     uri.ParsedURI    `json:"chat"`
	Sender   uri.ParsedURI    `json:"-"`

	EffectID string `json:"-"`

	Receiver uri.ParsedURI `json:"-"`

	Service Service `json:"service"`

	IsFromMe       bool `json:"is_from_me"`
	IsAudioMessage bool `json:"is_audio_message"`

	ThreadRoot *ParsedThreadRoot `json:"thread_originator,omitempty"`
	Tapback    *Tapback          `json:"associated_message,omitempty"`

	Attachments []*Attachment `json:"attachments,omitempty"`

	GroupName    string
	Participants []uri.ParsedURI `json:"participants,omitempty"`

	RichLink *RichLinkMetadata `json:"rich_link,omitempty"`
}

func (*Message) GetIsFromMe

func (m *Message) GetIsFromMe() bool

func (*Message) GetSender

func (m *Message) GetSender() uri.ParsedURI

func (*Message) SenderText

func (msg *Message) SenderText() string

type MessageEdit

type MessageEdit struct {
	Sender        uri.ParsedURI
	IsFromMe      bool
	Timestamp     time.Time
	EditMessageID uuid.UUID
	EditPartIndex int
	Text          string
	EditID        uuid.UUID
	RichLink      *RichLinkMetadata
}

func (*MessageEdit) GetIsFromMe

func (m *MessageEdit) GetIsFromMe() bool

func (*MessageEdit) GetSender

func (m *MessageEdit) GetSender() uri.ParsedURI

type MessagePart

type MessagePart struct {
	PartIdx int    `xml:"message-part,attr"`
	Value   string `xml:",innerxml"`
}

type MessagePartInfo

type MessagePartInfo struct {
	PartID     int `json:"part_id"`
	StartIndex int `json:"start_idx"`
	Length     int `json:"length"`
}

type MessageUnsend

type MessageUnsend struct {
	Sender          uri.ParsedURI
	IsFromMe        bool
	Timestamp       time.Time
	UnsendMessageID uuid.UUID
	UnsendPartIndex int
	UnsendID        uuid.UUID
}

func (*MessageUnsend) GetIsFromMe

func (m *MessageUnsend) GetIsFromMe() bool

func (*MessageUnsend) GetSender

func (m *MessageUnsend) GetSender() uri.ParsedURI

type ParsedThreadRoot

type ParsedThreadRoot struct {
	MessagePartInfo
	ID uuid.UUID `json:"uuid"`
}

func ParseThreadRoot

func ParseThreadRoot(tr string) (ptr ParsedThreadRoot, err error)

func (ParsedThreadRoot) String

func (ptr ParsedThreadRoot) String() string

type ReadReceipt

type ReadReceipt struct {
	Sender   uri.ParsedURI
	IsFromMe bool
	ReadUpTo uuid.UUID
	ReadAt   time.Time
}

type RichLinkAsset

type RichLinkAsset struct {
	MimeType string               `json:"mime_type,omitempty"`
	Source   *RichLinkAssetSource `json:"source,omitempty"`
	Size     *RichLinkAssetSize   `json:"size,omitempty"`
}

type RichLinkAssetSize

type RichLinkAssetSize struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

type RichLinkAssetSource

type RichLinkAssetSource struct {
	URL  string `json:"url,omitempty"`
	Data []byte `json:"data,omitempty"`
}

type RichLinkMetadata

type RichLinkMetadata struct {
	OriginalURL  string         `json:"original_url,omitempty"`
	URL          string         `json:"url,omitempty"`
	Title        string         `json:"title,omitempty"`
	Summary      string         `json:"summary,omitempty"`
	SelectedText string         `json:"selected_text,omitempty"`
	ItemType     string         `json:"item_type,omitempty"`
	Icon         *RichLinkAsset `json:"icon,omitempty"`
	Image        *RichLinkAsset `json:"image,omitempty"`
}

type SendMessageStatus

type SendMessageStatus struct {
	GUID       uuid.UUID
	Sender     uri.ParsedURI
	Status     string
	Service    Service
	Message    string
	StatusCode string
	Timestamp  time.Time
}

type Service

type Service string
const (
	ServiceIMessage Service = "iMessage"
	ServiceSMS      Service = "SMS"
)

func (Service) String

func (s Service) String() string

type Tapback

type Tapback struct {
	TargetGUIDString string `json:"-"`

	TargetGUID uuid.UUID       `json:"target_guid"`
	TargetPart int             `json:"-"`
	PartInfo   MessagePartInfo `json:"-"`
	Remove     bool            `json:"-"`
	Type       TapbackType     `json:"type"`
}

func (*Tapback) Parse

func (tapback *Tapback) Parse() (*Tapback, error)

type TapbackType

type TapbackType int
const (
	TapbackLove TapbackType = iota + 2000
	TapbackLike
	TapbackDislike
	TapbackLaugh
	TapbackEmphasis
	TapbackQuestion

	TapbackRemoveOffset = 1000
)

func TapbackFromEmoji

func TapbackFromEmoji(emoji string) TapbackType

func (TapbackType) ActionString

func (tt TapbackType) ActionString(target string) string

func (TapbackType) Emoji

func (tt TapbackType) Emoji() string

func (TapbackType) Redacted

func (tt TapbackType) Redacted(redact bool) int

func (TapbackType) String

func (tt TapbackType) String() string

type TypingNotification

type TypingNotification struct {
	Chat   uri.ParsedURI `json:"chat_guid"`
	Typing bool          `json:"typing"`
}

Jump to

Keyboard shortcuts

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