Fix user presence
This commit is contained in:
parent
3ab8921388
commit
7b2cbcfa23
@ -14,6 +14,7 @@ const (
|
||||
IconChannel = "#"
|
||||
IconGroup = "☰"
|
||||
IconIM = "●"
|
||||
IconMpIM = "●" // TODO
|
||||
IconNotification = "*"
|
||||
|
||||
PresenceAway = "away"
|
||||
@ -56,6 +57,8 @@ func (c ChannelItem) ToString() string {
|
||||
icon = IconChannel
|
||||
case ChannelTypeGroup:
|
||||
icon = IconGroup
|
||||
case ChannelTypeMpIM:
|
||||
icon = IconMpIM
|
||||
case ChannelTypeIM:
|
||||
switch c.Presence {
|
||||
case PresenceActive:
|
||||
|
@ -527,6 +527,7 @@ func createNotifyMessage(ctx *context.AppContext, ev *slack.MessageEvent) {
|
||||
notifyTimer.Stop()
|
||||
}
|
||||
|
||||
// Only actually notify when time expires
|
||||
notifyTimer = time.NewTimer(time.Second * 2)
|
||||
<-notifyTimer.C
|
||||
|
||||
@ -543,7 +544,6 @@ func createNotifyMessage(ctx *context.AppContext, ev *slack.MessageEvent) {
|
||||
message = fmt.Sprintf("Message received from: %s", channel.Name)
|
||||
}
|
||||
|
||||
// Only actually notify when time expires
|
||||
ctx.Notify.Push("slack-term", message, "", notificator.UR_NORMAL)
|
||||
}()
|
||||
}
|
||||
|
@ -16,12 +16,6 @@ import (
|
||||
"github.com/erroneousboat/slack-term/config"
|
||||
)
|
||||
|
||||
const (
|
||||
ChannelTypeChannel = "channel"
|
||||
ChannelTypeGroup = "group"
|
||||
ChannelTypeIM = "im"
|
||||
)
|
||||
|
||||
type SlackService struct {
|
||||
Config *config.Config
|
||||
Client *slack.Client
|
||||
@ -164,8 +158,10 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
|
||||
|
||||
chanName = name
|
||||
chanType = components.ChannelTypeIM
|
||||
|
||||
// TODO: way to speed this up? see SetPresenceChannels
|
||||
presence, _ = s.GetUserPresence(chn.ID)
|
||||
// TODO: err
|
||||
presence, _ = s.GetUserPresence(chn.User)
|
||||
}
|
||||
|
||||
chans = append(
|
||||
|
Loading…
Reference in New Issue
Block a user