utils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeImageDistro is a reletive path to any of the distributed images in cwtch/ui in the assets folder
	TypeImageDistro = "distro"
	// TypeImageComposition will be an face image composed of a recipe of parts like faceType, eyeType, etc
	TypeImageComposition = "composition"
)

Image types we support

View Source
const (
	Warn  = event.Field("Warn")
	Error = event.Field("Error")
	Debug = event.Field("Debug")
	Info  = event.Field("Info")
)

Logging Levels as Event Fields. Note: Unlike most event we don't cae about the *value* of the field, only the presence. If more than one of these fields is present in a single SetLoggingLevel event then the highest logging level is used. INFO < WARN < ERROR < DEBUG

View Source
const ReloadEvent = event.Field("Reload")
View Source
const (
	SetLoggingLevel = event.Type("SetLoggingLevel")
)

An event to set the logging level dynamically from the UI

Variables

This section is empty.

Functions

func ImageToString

func ImageToString(img *image) string

func NewImage

func NewImage(val, t string) *image

func RandomGroupImage

func RandomGroupImage(handle string) string

func RandomProfileImage

func RandomProfileImage(onion string) string

temporary until we do real picture selection

func StringToImage

func StringToImage(str string) (*image, error)

Types

type Contact

type Contact struct {
	Name               string                  `json:"name"`
	LocalName          string                  `json:"localname"`
	Onion              string                  `json:"onion"`
	Status             string                  `json:"status"`
	Picture            string                  `json:"picture"`
	DefaultPicture     string                  `json:"defaultPicture"`
	Accepted           bool                    `json:"accepted"`
	AccessControlList  model.AccessControlList `json:"accessControlList"`
	Blocked            bool                    `json:"blocked"`
	SaveHistory        string                  `json:"saveConversationHistory"`
	Messages           int                     `json:"numMessages"`
	Unread             int                     `json:"numUnread"`
	LastSeenMessageId  int                     `json:"lastSeenMessageId"`
	LastMessage        string                  `json:"lastMsgTime"`
	IsGroup            bool                    `json:"isGroup"`
	GroupServer        string                  `json:"groupServer"`
	IsArchived         bool                    `json:"isArchived"`
	Identifier         int                     `json:"identifier"`
	NotificationPolicy string                  `json:"notificationPolicy"`
	Attributes         map[string]string       `json:"attributes"`
}

type EventHandler

type EventHandler struct {
	// contains filtered or unexported fields
}

func NewEventHandler

func NewEventHandler() *EventHandler

func (*EventHandler) AddModule

func (eh *EventHandler) AddModule(ehi EventHandlerInterface)

func (*EventHandler) GetNextEvent

func (eh *EventHandler) GetNextEvent() string

func (*EventHandler) GetProfileImage

func (eh *EventHandler) GetProfileImage(profile peer.CwtchPeer, conversationInfo *model.Conversation, basepath string) string

func (*EventHandler) HandleApp

func (eh *EventHandler) HandleApp(application app.Application)

func (*EventHandler) Push

func (eh *EventHandler) Push(newEvent event.Event)

Push pushes an event onto the app event bus

It is also a way for libCwtch-go to publish an event for consumption by a UI before a Cwtch app has been initialized
  use: to signal an error before a cwtch app could be created

type EventHandlerInterface

type EventHandlerInterface interface {
	OnACNStatusEvent(appl app.Application, e *event.Event)
}

type EventProfileEnvelope

type EventProfileEnvelope struct {
	Event   event.Event
	Profile string
}

Jump to

Keyboard shortcuts

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