Documentation ¶
Index ¶
- Constants
- Variables
- func EnrichNewPeer(handle string, ph *PeerHelper, ev *EventProfileEnvelope) error
- func GetPicturePath(pic *image) string
- func ImageToString(img *image) string
- func InitGlobalSettingsFile(directory string, password string) error
- func NewImage(val, t string) *image
- func RandomGroupImage(handle string) string
- func RandomProfileImage(onion string) string
- func StringToImage(str string) (*image, error)
- func WriteGlobalSettings(globalSettings GlobalSettings)
- type Contact
- type EventHandler
- type EventProfileEnvelope
- type GlobalSettings
- type PeerHelper
- func (p *PeerHelper) CountUnread(messages []model.Message, lastRead time.Time) int
- func (p *PeerHelper) GetNick(id string) string
- func (p *PeerHelper) GetProfilePic(id string) string
- func (p *PeerHelper) GetTimeline(handle string) *model.Timeline
- func (p *PeerHelper) GetWithSetDefault(id string, key string, defaultVal string) string
- func (p *PeerHelper) InitLastReadTime(id string) time.Time
- func (p *PeerHelper) IsGroup(id string) bool
- func (p *PeerHelper) IsPeer(id string) bool
- func (p *PeerHelper) IsServer(id string) bool
Constants ¶
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
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
const ( CwtchStarted = event.Type("CwtchStarted") CwtchStartError = event.Type("CwtchStartError") UpdateGlobalSettings = event.Type("UpdateGlobalSettings") )
const GlobalSettingsFilename = "ui.globals"
const (
SetLoggingLevel = event.Type("SetLoggingLevel")
)
An event to set the logging level dynamically from the UI
Variables ¶
var DefaultGlobalSettings = GlobalSettings{ Locale: "en", Theme: "dark", PreviousPid: -1, ExperimentsEnabled: false, Experiments: make(map[string]bool), StateRootPane: 0, FirstTime: true, BlockUnknownConnections: false, StreamerMode: false, UIColumnModePortrait: "DualpaneMode.Single", UIColumnModeLandscape: "DualpaneMode.CopyPortrait", }
var GlobalSettingsFile v1.FileStore
Functions ¶
func EnrichNewPeer ¶
func EnrichNewPeer(handle string, ph *PeerHelper, ev *EventProfileEnvelope) error
EnrichNewPeer populates required data for use by frontend
uiManager.AddContact(onion) (handle string, displayName string, image string, badge int, status int, authorization string, loading bool, lastMsgTime int)
func GetPicturePath ¶
func GetPicturePath(pic *image) string
func ImageToString ¶
func ImageToString(img *image) string
func InitGlobalSettingsFile ¶
func RandomGroupImage ¶
func RandomProfileImage ¶
temporary until we do real picture selection
func StringToImage ¶
func WriteGlobalSettings ¶
func WriteGlobalSettings(globalSettings GlobalSettings)
Types ¶
type Contact ¶
type Contact struct { Name string `json:"name"` Onion string `json:"onion"` Status string `json:"status"` Picture string `json:"picture"` Authorization string `json:"authorization"` SaveHistory string `json:"saveConversationHistory"` Messages int `json:"numMessages"` Unread int `json:"numUnread"` LastMessage string `json:"lastMsgTime"` IsGroup bool `json:"isGroup"` GroupServer string `json:"groupServer"` IsArchived bool `json:"isArchived"` }
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewEventHandler ¶
func NewEventHandler() *EventHandler
func (*EventHandler) GetNextEvent ¶
func (eh *EventHandler) GetNextEvent() string
func (*EventHandler) HandleApp ¶
func (eh *EventHandler) HandleApp(application app.Application)
func (*EventHandler) PublishAppEvent ¶
func (eh *EventHandler) PublishAppEvent(event event.Event)
PublishAppEvent is a way for libCwtch-go to publish an event for consumption by a UI before a Cwtch app has been initialized
Main use: to signal an error before a cwtch app could be created
func (*EventHandler) Push ¶
func (eh *EventHandler) Push(newEvent event.Event)
type EventProfileEnvelope ¶
type GlobalSettings ¶
type GlobalSettings struct { Locale string Theme string PreviousPid int64 ExperimentsEnabled bool Experiments map[string]bool BlockUnknownConnections bool StreamerMode bool StateRootPane int FirstTime bool UIColumnModePortrait string UIColumnModeLandscape string }
func ReadGlobalSettings ¶
func ReadGlobalSettings() *GlobalSettings
type PeerHelper ¶
type PeerHelper struct {
// contains filtered or unexported fields
}
func NewPeerHelper ¶
func NewPeerHelper(profile peer.CwtchPeer) *PeerHelper
func (*PeerHelper) CountUnread ¶
func (*PeerHelper) GetNick ¶
func (p *PeerHelper) GetNick(id string) string
func (*PeerHelper) GetProfilePic ¶
func (p *PeerHelper) GetProfilePic(id string) string
GetProfilePic returns a string path to an image to display for hte given peer/group id
func (*PeerHelper) GetTimeline ¶
func (p *PeerHelper) GetTimeline(handle string) *model.Timeline
GetTimeline returns a pointer to the timeline associated with the conversation handle or nil if the handle does not exist (this can happen if the conversation has been deleted)
func (*PeerHelper) GetWithSetDefault ¶
func (p *PeerHelper) GetWithSetDefault(id string, key string, defaultVal string) string
func (*PeerHelper) InitLastReadTime ¶
func (p *PeerHelper) InitLastReadTime(id string) time.Time
InitLastReadTime checks and gets the Attributable's LastRead time or sets it to now
func (*PeerHelper) IsGroup ¶
func (p *PeerHelper) IsGroup(id string) bool
func (*PeerHelper) IsPeer ¶
func (p *PeerHelper) IsPeer(id string) bool
func (*PeerHelper) IsServer ¶
func (p *PeerHelper) IsServer(id string) bool
Check if the id is associated with a contact with a KeyTypeServerOnion attribute (which indicates that this is a server, not a regular contact or a group