Documentation
¶
Index ¶
- Constants
- type Channels
- func (c *Channels) Buffer() termui.Buffer
- func (c *Channels) ClearNewMessageIndicator()
- func (c *Channels) GetChannels(svc *service.SlackService)
- func (c *Channels) GetHeight() int
- func (c *Channels) MoveCursorBottom()
- func (c *Channels) MoveCursorDown()
- func (c *Channels) MoveCursorTop()
- func (c *Channels) MoveCursorUp()
- func (c *Channels) ScrollDown()
- func (c *Channels) ScrollUp()
- func (c *Channels) Search(term string)
- func (c *Channels) SetNotification(svc *service.SlackService, channelID string)
- func (c *Channels) SetPresence(svc *service.SlackService, userID string, presence string)
- func (c *Channels) SetPresenceForIMChannels(svc *service.SlackService)
- func (c *Channels) SetReadMark(svc *service.SlackService)
- func (c *Channels) SetSelectedChannel(index int)
- func (c *Channels) SetWidth(w int)
- func (c *Channels) SetX(x int)
- func (c *Channels) SetY(y int)
- type Chat
- func (c *Chat) AddMessage(message string)
- func (c *Chat) Buffer() termui.Buffer
- func (c *Chat) ClearMessages()
- func (c *Chat) GetHeight() int
- func (c *Chat) GetMessages(svc *service.SlackService, channel interface{})
- func (c *Chat) Help(cfg *config.Config)
- func (c *Chat) ScrollDown()
- func (c *Chat) ScrollUp()
- func (c *Chat) SetBorderLabel(channel service.Channel)
- func (c *Chat) SetWidth(w int)
- func (c *Chat) SetX(x int)
- func (c *Chat) SetY(y int)
- type Input
- func (i *Input) Backspace()
- func (i *Input) Buffer() termui.Buffer
- func (i *Input) Clear()
- func (i *Input) Delete()
- func (i *Input) GetHeight() int
- func (i *Input) GetText() string
- func (i *Input) Insert(key rune)
- func (i *Input) IsEmpty() bool
- func (i *Input) MoveCursorLeft()
- func (i *Input) MoveCursorRight()
- func (i *Input) SendMessage(svc *service.SlackService, channel string, message string)
- func (i *Input) SetWidth(w int)
- func (i *Input) SetX(x int)
- func (i *Input) SetY(y int)
- type Mode
Constants ¶
const ( IconOnline = "●" IconOffline = "○" IconChannel = "#" IconGroup = "☰" IconIM = "●" IconNotification = "🞷" PresenceAway = "away" PresenceActive = "active" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channels ¶
type Channels struct { List *termui.List SelectedChannel int // index of which channel is selected from the List Offset int // from what offset are channels rendered CursorPosition int // the y position of the 'cursor' }
Channels is the definition of a Channels component
func CreateChannels ¶
func CreateChannels(svc *service.SlackService, inputHeight int) *Channels
CreateChannels is the constructor for the Channels component
func (*Channels) ClearNewMessageIndicator ¶
func (c *Channels) ClearNewMessageIndicator()
ClearNewMessageIndicator will remove the notification icon in front of a channel that received a new message. This will happen as one will move up or down the cursor for Channels
func (*Channels) GetChannels ¶
func (c *Channels) GetChannels(svc *service.SlackService)
GetChannels will get all available channels from the SlackService
func (*Channels) MoveCursorBottom ¶
func (c *Channels) MoveCursorBottom()
MoveCursorBottom will move the cursor to the bottom of the channels
func (*Channels) MoveCursorDown ¶
func (c *Channels) MoveCursorDown()
MoveCursorDown will increase the SelectedChannel by 1
func (*Channels) MoveCursorTop ¶
func (c *Channels) MoveCursorTop()
MoveCursorTop will move the cursor to the top of the channels
func (*Channels) MoveCursorUp ¶
func (c *Channels) MoveCursorUp()
MoveCursorUp will decrease the SelectedChannel by 1
func (*Channels) ScrollDown ¶
func (c *Channels) ScrollDown()
ScrollDown enables us to scroll through the channel list when it overflows
func (*Channels) ScrollUp ¶
func (c *Channels) ScrollUp()
ScrollUp enables us to scroll through the channel list when it overflows
func (*Channels) Search ¶ added in v0.2.2
Search will search through the channels to find a channel, when a match has been found the selected channel will then be the channel that has been found
func (*Channels) SetNotification ¶ added in v0.2.2
func (c *Channels) SetNotification(svc *service.SlackService, channelID string)
SetNotification will be called when a new message arrives and will render an notification icon in front of the channel name
func (*Channels) SetPresence ¶ added in v0.2.2
func (c *Channels) SetPresence(svc *service.SlackService, userID string, presence string)
SetPresence will set the correct icon for a IM Channel
func (*Channels) SetPresenceForIMChannels ¶ added in v0.2.2
func (c *Channels) SetPresenceForIMChannels(svc *service.SlackService)
SetPresenceForIMChannels this will set the correct icon for IM channels for when they're online of away
func (*Channels) SetReadMark ¶ added in v0.2.0
func (c *Channels) SetReadMark(svc *service.SlackService)
SetReadMark will send the ReadMark event on the service
func (*Channels) SetSelectedChannel ¶
SetSelectedChannel sets the SelectedChannel given the index
type Chat ¶
Chat is the definition of a Chat component
func CreateChat ¶
func CreateChat(svc *service.SlackService, inputHeight int, selectedSlackChannel interface{}, selectedChannel service.Channel) *Chat
CreateChat is the constructor for the Chat struct
func (*Chat) AddMessage ¶
AddMessage adds a single message to List.Items
func (*Chat) GetMessages ¶
func (c *Chat) GetMessages(svc *service.SlackService, channel interface{})
GetMessages will get an array of strings for a specific channel which will contain messages in turn all these messages will be added to List.Items
func (*Chat) ScrollDown ¶
func (c *Chat) ScrollDown()
ScrollDown will render the chat messages based on the Offset of the Chat pane.
Offset is 0 when scrolled down. (we loop backwards over the array, so we start with rendering last item in the list at the maximum y of the Chat pane). Increasing the Offset will thus result in substracting the offset from the len(Chat.List.Items).
func (*Chat) ScrollUp ¶
func (c *Chat) ScrollUp()
ScrollUp will render the chat messages based on the Offset of the Chat pane.
Offset is 0 when scrolled down. (we loop backwards over the array, so we start with rendering last item in the list at the maximum y of the Chat pane). Increasing the Offset will thus result in substracting the offset from the len(Chat.List.Items).
func (*Chat) SetBorderLabel ¶
SetBorderLabel will set Label of the Chat pane to the specified string
type Input ¶
Input is the definition of an Input component
func (*Input) Backspace ¶
func (i *Input) Backspace()
Backspace will remove a character in front of the CursorPosition
func (*Input) Clear ¶
func (i *Input) Clear()
Clear will empty the input and move the cursor to the start position
func (*Input) Delete ¶
func (i *Input) Delete()
Delete will remove a character at the CursorPosition
func (*Input) MoveCursorLeft ¶
func (i *Input) MoveCursorLeft()
MoveCursorLeft will decrease the current CursorPosition with 1
func (*Input) MoveCursorRight ¶
func (i *Input) MoveCursorRight()
MoveCursorRight will increase the current CursorPosition with 1
func (*Input) SendMessage ¶
func (i *Input) SendMessage(svc *service.SlackService, channel string, message string)
SendMessage send the input text through the SlackService