Documentation ¶
Index ¶
- Variables
- func CmdAway(s Server, u *User, msg *irc.Message) error
- func CmdInvite(s Server, u *User, msg *irc.Message) error
- func CmdIson(s Server, u *User, msg *irc.Message) error
- func CmdJoin(s Server, u *User, msg *irc.Message) error
- func CmdKick(s Server, u *User, msg *irc.Message) error
- func CmdList(s Server, u *User, msg *irc.Message) error
- func CmdLusers(s Server, u *User, msg *irc.Message) error
- func CmdMode(s Server, u *User, msg *irc.Message) error
- func CmdMotd(s Server, u *User, _ *irc.Message) error
- func CmdNames(s Server, u *User, msg *irc.Message) error
- func CmdNick(s Server, u *User, msg *irc.Message) error
- func CmdPart(s Server, u *User, msg *irc.Message) error
- func CmdPing(s Server, u *User, msg *irc.Message) error
- func CmdPrivMsg(s Server, u *User, msg *irc.Message) error
- func CmdQuit(s Server, u *User, msg *irc.Message) error
- func CmdTopic(s Server, u *User, msg *irc.Message) error
- func CmdWho(s Server, u *User, msg *irc.Message) error
- func CmdWhois(s Server, u *User, msg *irc.Message) error
- func ID(s string) string
- func IsDebugLevel() bool
- func SetLogLevel(level string)
- func SetLogger(l *logrus.Entry)
- type Channel
- type Command
- type CommandHandler
- type Commands
- type Conn
- type Handler
- type MmCfg
- type MmCredentials
- type MmInfo
- type Prefixer
- type Server
- type ServerConfig
- type SlackInfo
- type User
- func (u *User) Channels() []Channel
- func (u *User) Close() error
- func (user *User) Decode() (*irc.Message, error)
- func (user *User) Encode(msgs ...*irc.Message) (err error)
- func (u *User) ID() string
- func (u *User) MsgSpoofUser(rcvuser string, msg string)
- func (u *User) MsgUser(toUser *User, msg string)
- func (u *User) NumChannels() int
- func (u *User) Prefix() *irc.Prefix
- func (u *User) String() string
- func (u *User) VisibleTo() []*User
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHandshakeFailed = errors.New("handshake failed")
View Source
var ErrUnknownCommand = errors.New("unknown command")
The error returned when an invalid command is issued.
View Source
var LogLevel string
Functions ¶
func CmdPrivMsg ¶
CmdPrivMsg is a handler for the /PRIVMSG command.
func IsDebugLevel ¶
func IsDebugLevel() bool
func SetLogLevel ¶
func SetLogLevel(level string)
Types ¶
type Channel ¶
type Channel interface { Prefixer // ID is a normalized unique identifier for the channel ID() string // Created returns the time when the Channel was created. Created() time.Time // Names returns a sorted slice of Nicks in the channel Names() []string // Users returns a slice of Users in the channel. Users() []*User // HasUser returns whether a User is in the channel. HasUser(*User) bool // Invite prompts the User to join the Channel on behalf of Prefixer. Invite(from Prefixer, u *User) error // SendNamesResponse sends a User messages indicating the current members of the Channel. SendNamesResponse(u *User) error // Join introduces the User to the channel (handler for JOIN). Join(u *User) error // Part removes the User from the channel (handler for PART). Part(u *User, text string) // Message transmits a message from a User to the channel (handler for PRIVMSG). Message(u *User, text string) // Service returns the service that set the channel Service() string // Topic sets the topic of the channel (handler for TOPIC). Topic(from Prefixer, text string) // GetTopic gets the topic of the channel GetTopic() string // Unlink will disassociate the Channel from its Server. Unlink() // Len returns the number of Users in the channel. Len() int // String returns the name of the channel String() string // Spoof message SpoofMessage(from string, text string) // Spoof notice SpoofNotice(from string, text string) }
Channel is a representation of a room in our server
type CommandHandler ¶
type CommandHandler interface {
// contains filtered or unexported methods
}
type Commands ¶
func DefaultCommands ¶
func DefaultCommands() Commands
type Conn ¶
type Conn interface { Close() error Encode(*irc.Message) error Decode() (*irc.Message, error) // ResolveHost returns the resolved host of the RemoteAddr ResolveHost() string }
Conn abstracts the encoding/decoding and sending/receiving when speaking IRC.
type Handler ¶
type Handler struct { // Command is the IRC command that Call handles. Command string // Handler is a function that takes the server, user who sent the message, and a message to perform some command. Call func(s Server, u *User, msg *irc.Message) error // MinParams is the minimum number of params required on the message. MinParams int // LoggedIn is true when authenticated (logged in) against mattermost LoggedIn bool }
Handler is a container for an irc.Message handler.
type MmCredentials ¶
type MmInfo ¶
type MmInfo struct { MmGhostUser bool Srv Server Credentials *MmCredentials Cfg *MmCfg // contains filtered or unexported fields }
type Server ¶
type Server interface { Prefixer // Name of the server (usually hostname). Name() string // Motd is the Message of the Day for the server. Motd() []string // Connect starts the handshake for a new user, blocks until it's completed or failed with an error. Connect(*User) error // Quit removes the user from all the channels and disconnects. Quit(*User, string) // HasUser returns an existing User with a given Nick. HasUser(string) (*User, bool) // RenameUser changes the Nick of a User if the new name is available. // Returns whether the rename was was successful. RenameUser(*User, string) bool // Channel gets or creates a new channel with the given name and Id. Channel(string) Channel // HasChannel returns an existing Channel with a given name. HasChannel(string) (Channel, bool) // UnlinkChannel removes the channel from the server's storage if it // exists. Once removed, the server is free to create a fresh channel with // the same ID. The server is not responsible for evicting members of an // unlinked channel. UnlinkChannel(Channel) Add(u *User) bool Handle(u *User) Logout(u *User) ChannelCount() int UserCount() int EncodeMessage(u *User, cmd string, params []string, trailing string) error }
type ServerConfig ¶
type ServerConfig struct { // Name is used as the prefix for the server. Name string // Version string of the server (default: go-irckit). Version string // Motd is the message of the day for the server, list of message lines where each line should be max 80 chars. Motd []string // InviteOnly prevents regular users from joining and making new channels. InviteOnly bool // MaxNickLen is the maximum length for a NICK value (default: 32) MaxNickLen int // DiscardEmpty setting will start a goroutine to discard empty channels. DiscardEmpty bool // NewChannel overrides the constructor for a new Channel in a given Server and Name. NewChannel func(s Server, channelId string, name string, service string) Channel // Commands is the handler registry to use (default: DefaultCommands()) Commands Commands }
ServerConfig produces a Server setup with configuration options.
func (ServerConfig) Server ¶
func (c ServerConfig) Server() Server
type User ¶
type User struct { Conn sync.RWMutex Nick string // From NICK command User string // From USER command Real string // From USER command Pass []string // From PASS command Host string Roles string DisplayName string MmInfo SlackInfo // contains filtered or unexported fields }
func NewUserNet ¶
NewUserNet creates a *User from a net.Conn connection.
func (*User) MsgSpoofUser ¶
func (*User) NumChannels ¶
Click to show internal directories.
Click to hide internal directories.