Documentation ¶
Index ¶
- Variables
- type ChannelTopic
- type Command
- type Config
- type Join
- type Messagable
- type Message
- type Nick
- type NumericCommand
- type NumericReply
- func ErrNeedMoreParams(command string) *NumericReply
- func ErrUnknownCommand(command string) *NumericReply
- func MOTDAsNumerics(motd string) []*NumericReply
- func NamelistAsNumerics(users []User, channelName string) []*NumericReply
- func WholistAsNumerics(users []User, channelName, serverName string) []*NumericReply
- type Part
- type Pong
- type Privmsg
- type Server
- type ServerMessage
- type ServerStateProvider
- type Topic
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrMalformedIRCMessage = errors.New("malformed IRC message")
ErrMalformedIRCMessage represents the error returned when parsing an incoming IRC line fails due to invalid message syntax
Functions ¶
This section is empty.
Types ¶
type ChannelTopic ¶
ChannelTopic represents a channel's set topic and metadata
type Config ¶
Config holds configurable parameters for the IRC server
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
SetDefaults overwrites config entries with their default values
type Messagable ¶
type Messagable interface {
ToMessage() *Message
}
Messagable is a type that can be converted to an IRC message
func ParseMessage ¶
func ParseMessage(m *Message) (Messagable, error)
ParseMessage parses an IRC Message into a higher-level IRC type
type Message ¶
Message corresponds to an IRC message
func StringToMessage ¶
StringToMessage takes a string with a line of input and returns a Message corresponding to the line
type NumericCommand ¶
type NumericCommand int
NumericCommand represents a numbered server reply
const ( RPL_WELCOME NumericCommand = 001 RPL_YOURHOST NumericCommand = 002 RPL_CREATED NumericCommand = 003 RPL_ISUPPORT NumericCommand = 005 RPL_CHANNELMODEIS NumericCommand = 324 RPL_CREATIONTIME NumericCommand = 329 RPL_TOPIC NumericCommand = 332 RPL_TOPIC_WHOTIME NumericCommand = 333 RPL_WHOREPLY NumericCommand = 352 RPL_ENDOFWHO NumericCommand = 315 RPL_NAMREPLY NumericCommand = 353 RPL_ENDOFNAMES NumericCommand = 366 RPL_MOTD NumericCommand = 372 RPL_MOTDSTART NumericCommand = 375 RPL_ENDOFMOTD NumericCommand = 376 ERR_UNKNOWNCOMMAND NumericCommand = 421 ERR_NEEDMOREPARAMS NumericCommand = 461 )
nolint: golint noinspection GoSnakeCaseUsage
type NumericReply ¶
type NumericReply struct { Code NumericCommand Params []string ServerName string Target string }
A NumericReply is a numbered reply generated by the server
func ErrNeedMoreParams ¶
func ErrNeedMoreParams(command string) *NumericReply
ErrNeedMoreParams is the numeric reply to a command that requires more params
func ErrUnknownCommand ¶
func ErrUnknownCommand(command string) *NumericReply
ErrUnknownCommand is the numeric reply to an unknown or invalid command
func MOTDAsNumerics ¶
func MOTDAsNumerics(motd string) []*NumericReply
MOTDAsNumerics formats a MOTD into a series of numeric replies
func NamelistAsNumerics ¶
func NamelistAsNumerics(users []User, channelName string) []*NumericReply
NamelistAsNumerics formats a list of Users into a series of NAMES replies
func WholistAsNumerics ¶
func WholistAsNumerics(users []User, channelName, serverName string) []*NumericReply
WholistAsNumerics formats a list of Users into a series of WHO replies
func (*NumericReply) Error ¶
func (n *NumericReply) Error() string
func (*NumericReply) String ¶
func (n *NumericReply) String() string
func (*NumericReply) ToMessage ¶
func (n *NumericReply) ToMessage() *Message
ToMessage turns a NumericReply into a message
type Privmsg ¶
Privmsg represents a line in an IRC conversation
func (*Privmsg) IsFromSelf ¶
IsFromSelf returns whether the private message originated from self
func (*Privmsg) IsTargetChannel ¶
IsTargetChannel returns whether the target for this PrivMsg is a channel
func (*Privmsg) IsValidTarget ¶
IsValidTarget returns whether the private message target is legal or not
type Server ¶
Server represents the IRC server listener for bridging IRC clients to Slack and fanning out Slack events as necessary
func NewServer ¶
func NewServer(config *Config, stopChan <-chan interface{}, stateProvider ServerStateProvider) *Server
NewServer creates a new IRC server
func (*Server) HandleChannelJoined ¶ added in v0.1.4
HandleChannelJoined handles a Slack-initiated channel membership change event. This special signalling is necessary due to the extra data (NAMES/topic) which needs to be sent by the IRC server on join.
func (*Server) HandleConnectBurst ¶
HandleConnectBurst handles the initial burst of data from a freshly established Slack connection.
Sets the IRC user info for the gateway user and informs clients.
func (*Server) HandleOutgoingMessageRouting ¶
HandleOutgoingMessageRouting handles fanning out IRC messages generated from Slack events
type ServerMessage ¶
type ServerMessage struct {
// contains filtered or unexported fields
}
ServerMessage is a message from a client to the server, indexed by the remote address of the connection
type ServerStateProvider ¶
type ServerStateProvider interface { GetChannelUsers(channelName string) []User GetChannelTopic(channelName string) ChannelTopic GetChannelCTime(channelName string) time.Time GetChannelPrivate(channelName string) bool GetJoinedChannels() []string SendPrivmsg(privMsg *Privmsg) GetUserFromNick(nick string) User }
ServerStateProvider contains methods used by the IRC server to answer client queries about channels and their members.
type User ¶
User represents a user identified by a nick and an ident
func ParseUserString ¶
ParseUserString pares a string into an IRC User