importer

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: Unlicense Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GChat

type GChat struct {
	// MyEmail identifies the current user for is_from_me detection.
	// If empty, no messages are marked as from me.
	MyEmail string
	// ConversationName overrides the conversation name (useful when group_info.json isn't available).
	ConversationName string
}

GChat imports Google Chat Takeout messages from a single messages.json file.

func (*GChat) Import

func (g *GChat) Import(store *db.Store, source io.Reader) (*ImportResult, error)

type IMessage

type IMessage struct {
	// DBPath is the path to chat.db. Defaults to ~/Library/Messages/chat.db.
	DBPath string
	// MyName is the display name for outgoing messages (default "Me").
	MyName string
}

IMessage imports messages from the macOS Messages chat.db. Requires Full Disk Access to read ~/Library/Messages/chat.db.

func (*IMessage) ImportFromDB

func (im *IMessage) ImportFromDB(store *db.Store) (*ImportResult, error)

ImportFromDB reads the iMessage database and imports all messages.

type ImportResult

type ImportResult struct {
	ConversationsCreated int
	MessagesImported     int
	MessagesDuplicate    int
	Errors               []string
}

ImportResult summarizes what happened during an import.

func ImportGChatDirectory

func ImportGChatDirectory(store *db.Store, baseDir, myEmail string) (*ImportResult, error)

ImportGChatDirectory imports all conversation directories from a Google Chat Takeout export. baseDir should be the "Google Chat/Groups/" directory containing subdirectories.

type Importer

type Importer interface {
	Import(store *db.Store, source io.Reader) (*ImportResult, error)
}

Importer reads messages from an external source and stores them.

type MediaRepairResult

type MediaRepairResult struct {
	MessagesRepaired int
	MessagesSkipped  int
}

type SignalDesktop

type SignalDesktop struct {
	// SupportDir overrides the default Signal Desktop support directory.
	SupportDir string
	// MyName is the local display name for outgoing messages.
	MyName string
	// MyAddress is the account identifier (usually phone number) to use for outgoing messages.
	MyAddress string
	// SinceMS limits the import to messages at or after this Unix millisecond timestamp.
	// When zero, the importer auto-detects the latest imported Signal timestamp and only imports newer rows.
	// Negative means force a full import.
	SinceMS int64
}

SignalDesktop imports historical messages from Signal Desktop's local archive.

func (*SignalDesktop) ImportFromDB

func (s *SignalDesktop) ImportFromDB(store *db.Store) (*ImportResult, error)

type WhatsApp

type WhatsApp struct {
	// MyName identifies the current user for is_from_me detection.
	MyName string
	// ConversationName overrides the auto-detected conversation name.
	ConversationName string
}

WhatsApp imports messages from a WhatsApp text export file.

func (*WhatsApp) Import

func (w *WhatsApp) Import(store *db.Store, source io.Reader) (*ImportResult, error)

type WhatsAppNative

type WhatsAppNative struct {
	// DBPath overrides the default ChatStorage.sqlite location.
	DBPath string
	// MyName is the display name for outgoing messages (default "Me").
	MyName string
	// SinceMS limits import to messages after this Unix millisecond timestamp.
	// When zero, imports everything.
	SinceMS int64
}

WhatsAppNative imports messages by reading the macOS WhatsApp Desktop database directly. This is more robust than the text-export importer because:

  • No separate bridge process to maintain
  • WhatsApp Desktop handles its own connection
  • Always has the latest messages (if the desktop app is synced)
  • Incremental: only imports messages newer than the last sync

func (*WhatsAppNative) ImportFromDB

func (w *WhatsAppNative) ImportFromDB(store *db.Store) (*ImportResult, error)

ImportFromDB reads the WhatsApp Desktop database and imports all messages. When SinceMS is 0, it auto-detects the latest imported WhatsApp timestamp from the store and only imports newer messages (incremental sync).

func (*WhatsAppNative) RepairLegacyMediaPlaceholders

func (w *WhatsAppNative) RepairLegacyMediaPlaceholders(store *db.Store) (*MediaRepairResult, error)

Jump to

Keyboard shortcuts

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