2012-12-09 07:54:58 +01:00
|
|
|
package irc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2012-12-09 21:51:50 +01:00
|
|
|
"strings"
|
2012-12-09 07:54:58 +01:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2014-02-09 02:43:59 +01:00
|
|
|
func joinedLen(names []string) int {
|
|
|
|
var l = len(names) - 1 // " " between names
|
|
|
|
for _, name := range names {
|
|
|
|
l += len(name)
|
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
|
|
|
|
2013-05-12 03:28:18 +02:00
|
|
|
type BaseReply struct {
|
2012-12-09 07:54:58 +01:00
|
|
|
source Identifier
|
|
|
|
message string
|
|
|
|
}
|
|
|
|
|
2013-05-12 03:28:18 +02:00
|
|
|
func (reply *BaseReply) Source() Identifier {
|
|
|
|
return reply.source
|
2012-12-13 08:27:17 +01:00
|
|
|
}
|
|
|
|
|
2013-05-12 03:28:18 +02:00
|
|
|
type StringReply struct {
|
2013-06-03 07:07:50 +02:00
|
|
|
*BaseReply
|
2013-05-12 03:28:18 +02:00
|
|
|
code string
|
2013-05-11 23:43:06 +02:00
|
|
|
}
|
|
|
|
|
2013-05-12 03:28:18 +02:00
|
|
|
func NewStringReply(source Identifier, code string,
|
|
|
|
format string, args ...interface{}) *StringReply {
|
|
|
|
message := fmt.Sprintf(format, args...)
|
|
|
|
fullMessage := fmt.Sprintf(":%s %s %s", source.Id(), code, message)
|
2013-05-12 20:20:55 +02:00
|
|
|
return &StringReply{
|
2014-02-11 23:32:17 +01:00
|
|
|
BaseReply: &BaseReply{
|
|
|
|
source: source,
|
|
|
|
message: fullMessage,
|
|
|
|
},
|
|
|
|
code: code,
|
2013-05-12 20:20:55 +02:00
|
|
|
}
|
2013-05-12 03:28:18 +02:00
|
|
|
}
|
|
|
|
|
2014-02-12 00:00:19 +01:00
|
|
|
func (reply *StringReply) Format(client *Client) []string {
|
|
|
|
return []string{reply.message}
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2013-05-12 03:28:18 +02:00
|
|
|
func (reply *StringReply) String() string {
|
|
|
|
return fmt.Sprintf("Reply(source=%s, code=%s, message=%s)",
|
|
|
|
reply.source, reply.code, reply.message)
|
2012-12-17 04:13:53 +01:00
|
|
|
}
|
|
|
|
|
2012-12-13 08:27:17 +01:00
|
|
|
type NumericReply struct {
|
2013-06-03 07:07:50 +02:00
|
|
|
*BaseReply
|
2013-05-12 03:28:18 +02:00
|
|
|
code int
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2013-05-12 20:20:55 +02:00
|
|
|
func NewNumericReply(source Identifier, code int, format string,
|
|
|
|
args ...interface{}) *NumericReply {
|
|
|
|
return &NumericReply{
|
2013-06-03 07:07:50 +02:00
|
|
|
BaseReply: &BaseReply{source, fmt.Sprintf(format, args...)},
|
2013-05-12 20:20:55 +02:00
|
|
|
code: code,
|
|
|
|
}
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2014-02-12 00:00:19 +01:00
|
|
|
func (reply *NumericReply) Format(client *Client) []string {
|
|
|
|
return []string{reply.FormatString(client)}
|
2013-06-03 07:07:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (reply *NumericReply) FormatString(client *Client) string {
|
2013-05-12 03:28:18 +02:00
|
|
|
return fmt.Sprintf(":%s %03d %s %s", reply.Source().Id(), reply.code,
|
|
|
|
client.Nick(), reply.message)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (reply *NumericReply) String() string {
|
|
|
|
return fmt.Sprintf("Reply(source=%s, code=%d, message=%s)",
|
|
|
|
reply.source, reply.code, reply.message)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2013-06-03 07:07:50 +02:00
|
|
|
// names reply
|
|
|
|
|
|
|
|
type NamesReply struct {
|
|
|
|
*BaseReply
|
|
|
|
channel *Channel
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewNamesReply(channel *Channel) Reply {
|
|
|
|
return &NamesReply{
|
|
|
|
BaseReply: &BaseReply{
|
|
|
|
source: channel,
|
|
|
|
},
|
2014-02-05 04:28:24 +01:00
|
|
|
channel: channel,
|
2013-06-03 07:07:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-12 00:00:19 +01:00
|
|
|
func (reply *NamesReply) Format(client *Client) []string {
|
|
|
|
lines := make([]string, 0)
|
2013-06-03 07:07:50 +02:00
|
|
|
base := RplNamReply(reply.channel, []string{})
|
|
|
|
baseLen := len(base.FormatString(client))
|
|
|
|
tooLong := func(names []string) bool {
|
|
|
|
return (baseLen + joinedLen(names)) > MAX_REPLY_LEN
|
|
|
|
}
|
2014-02-08 22:18:11 +01:00
|
|
|
from, to := 0, 1
|
2013-06-03 07:07:50 +02:00
|
|
|
nicks := reply.channel.Nicks()
|
2014-02-08 22:18:11 +01:00
|
|
|
for to < len(nicks) {
|
|
|
|
if (from < (to - 1)) && tooLong(nicks[from:to]) {
|
2014-02-12 00:00:19 +01:00
|
|
|
lines = append(lines, RplNamReply(reply.channel, nicks[from:to-1]).Format(client)...)
|
2014-02-08 22:18:11 +01:00
|
|
|
from, to = to-1, to
|
|
|
|
} else {
|
|
|
|
to += 1
|
2013-06-03 07:07:50 +02:00
|
|
|
}
|
|
|
|
}
|
2014-02-08 22:18:11 +01:00
|
|
|
if from < len(nicks) {
|
2014-02-12 00:00:19 +01:00
|
|
|
lines = append(lines, RplNamReply(reply.channel, nicks[from:]).Format(client)...)
|
2013-06-03 07:07:50 +02:00
|
|
|
}
|
2014-02-12 00:00:19 +01:00
|
|
|
lines = append(lines, RplEndOfNames(reply.channel).Format(client)...)
|
|
|
|
return lines
|
2013-06-03 07:07:50 +02:00
|
|
|
}
|
|
|
|
|
2014-02-08 22:18:11 +01:00
|
|
|
func (reply *NamesReply) String() string {
|
|
|
|
return fmt.Sprintf("NamesReply(channel=%s, names=%s)",
|
|
|
|
reply.channel, reply.channel.Nicks())
|
|
|
|
}
|
|
|
|
|
2012-12-13 08:33:09 +01:00
|
|
|
// messaging replies
|
2012-12-09 07:54:58 +01:00
|
|
|
|
2012-12-15 23:34:20 +01:00
|
|
|
func RplPrivMsg(source Identifier, target Identifier, message string) Reply {
|
2013-05-12 03:28:18 +02:00
|
|
|
return NewStringReply(source, RPL_PRIVMSG, "%s :%s", target.Nick(), message)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2013-05-12 20:20:55 +02:00
|
|
|
func RplNick(source Identifier, newNick string) Reply {
|
|
|
|
return NewStringReply(source, RPL_NICK, newNick)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 02:53:06 +01:00
|
|
|
func RplJoin(client *Client, channel *Channel) Reply {
|
2014-02-05 04:28:24 +01:00
|
|
|
return NewStringReply(client, RPL_JOIN, channel.name)
|
2012-12-13 08:27:17 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 02:53:06 +01:00
|
|
|
func RplPart(client *Client, channel *Channel, message string) Reply {
|
2014-02-05 04:28:24 +01:00
|
|
|
return NewStringReply(client, RPL_PART, "%s :%s", channel.name, message)
|
2012-12-13 08:27:17 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 21:13:09 +01:00
|
|
|
func RplPing(server *Server, target Identifier) Reply {
|
|
|
|
return NewStringReply(server, RPL_PING, target.Nick())
|
|
|
|
}
|
|
|
|
|
2014-02-09 02:10:04 +01:00
|
|
|
func RplPong(server *Server, client *Client) Reply {
|
|
|
|
return NewStringReply(server, RPL_PONG, client.Nick())
|
2012-12-13 08:27:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func RplQuit(client *Client, message string) Reply {
|
2013-05-12 03:28:18 +02:00
|
|
|
return NewStringReply(client, RPL_QUIT, ":%s", message)
|
2012-12-09 22:47:02 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 02:10:04 +01:00
|
|
|
func RplError(server *Server, target Identifier) Reply {
|
|
|
|
return NewStringReply(server, RPL_ERROR, target.Nick())
|
|
|
|
}
|
|
|
|
|
2012-12-13 08:33:09 +01:00
|
|
|
func RplInviteMsg(channel *Channel, inviter *Client) Reply {
|
2013-05-12 03:28:18 +02:00
|
|
|
return NewStringReply(inviter, RPL_INVITE, channel.name)
|
2012-12-13 08:33:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// numeric replies
|
2012-12-09 07:54:58 +01:00
|
|
|
|
|
|
|
func RplWelcome(source Identifier, client *Client) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(source, RPL_WELCOME,
|
2012-12-15 23:34:20 +01:00
|
|
|
"Welcome to the Internet Relay Network %s", client.Id())
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2013-06-03 07:07:50 +02:00
|
|
|
func RplYourHost(server *Server) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(server, RPL_YOURHOST,
|
2013-05-11 22:55:01 +02:00
|
|
|
"Your host is %s, running version %s", server.name, VERSION)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func RplCreated(server *Server) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(server, RPL_CREATED,
|
2012-12-15 23:34:20 +01:00
|
|
|
"This server was created %s", server.ctime.Format(time.RFC1123))
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func RplMyInfo(server *Server) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(server, RPL_MYINFO,
|
2014-02-09 08:15:05 +01:00
|
|
|
"%s %s aiOorsw abeIikmntpqrsl", server.name, VERSION)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func RplUModeIs(server *Server, client *Client) Reply {
|
2014-02-09 17:53:06 +01:00
|
|
|
return NewNumericReply(server, RPL_UMODEIS, client.ModeString())
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2012-12-13 08:27:17 +01:00
|
|
|
func RplNoTopic(channel *Channel) Reply {
|
2012-12-15 23:34:20 +01:00
|
|
|
return NewNumericReply(channel.server, RPL_NOTOPIC,
|
|
|
|
"%s :No topic is set", channel.name)
|
2012-12-10 00:20:21 +01:00
|
|
|
}
|
|
|
|
|
2012-12-13 08:27:17 +01:00
|
|
|
func RplTopic(channel *Channel) Reply {
|
2012-12-13 08:34:32 +01:00
|
|
|
return NewNumericReply(channel.server, RPL_TOPIC,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :%s", channel.name, channel.topic)
|
2012-12-10 00:20:21 +01:00
|
|
|
}
|
|
|
|
|
2012-12-13 08:27:17 +01:00
|
|
|
func RplInvitingMsg(channel *Channel, invitee *Client) Reply {
|
|
|
|
return NewNumericReply(channel.server, RPL_INVITING,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s %s", channel.name, invitee.Nick())
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2013-06-03 07:07:50 +02:00
|
|
|
func RplNamReply(channel *Channel, names []string) *NumericReply {
|
|
|
|
return NewNumericReply(channel.server, RPL_NAMREPLY, "= %s :%s",
|
|
|
|
channel.name, strings.Join(names, " "))
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2014-02-08 22:18:11 +01:00
|
|
|
func RplEndOfNames(channel *Channel) Reply {
|
|
|
|
return NewNumericReply(channel, RPL_ENDOFNAMES,
|
|
|
|
"%s :End of NAMES list", channel.name)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 19:07:40 +01:00
|
|
|
// :You are now an IRC operator
|
2012-12-10 05:24:53 +01:00
|
|
|
func RplYoureOper(server *Server) Reply {
|
2014-02-09 19:07:40 +01:00
|
|
|
return NewNumericReply(server, RPL_YOUREOPER, ":You are now an IRC operator")
|
2012-12-10 05:24:53 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 02:43:59 +01:00
|
|
|
func RplWhoisUser(server *Server, client *Client) Reply {
|
|
|
|
return NewNumericReply(server, RPL_WHOISUSER, "%s %s %s * :%s",
|
|
|
|
client.nick, client.username, client.hostname, client.realname)
|
|
|
|
}
|
|
|
|
|
|
|
|
func RplEndOfWhois(server *Server) Reply {
|
|
|
|
return NewNumericReply(server, RPL_ENDOFWHOIS, ":End of WHOIS list")
|
|
|
|
}
|
|
|
|
|
2014-02-09 07:06:10 +01:00
|
|
|
func RplChannelModeIs(channel *Channel) Reply {
|
|
|
|
return NewNumericReply(channel.server, RPL_CHANNELMODEIS, "%s %s",
|
2014-02-09 03:14:39 +01:00
|
|
|
channel.name, channel.ModeString())
|
|
|
|
}
|
|
|
|
|
2014-02-09 03:49:52 +01:00
|
|
|
// <channel> <user> <host> <server> <nick> ( "H" / "G" ) ["*"] [ ( "@" / "+" ) ]
|
|
|
|
// :<hopcount> <real name>
|
|
|
|
func RplWhoReply(server *Server, channel *Channel, client *Client) Reply {
|
2014-02-11 18:09:16 +01:00
|
|
|
channelName := "*"
|
|
|
|
if channel != nil {
|
|
|
|
channelName = channel.name
|
|
|
|
}
|
2014-02-09 03:49:52 +01:00
|
|
|
return NewNumericReply(server, RPL_WHOREPLY, "%s %s %s %s %s H :0 %s",
|
2014-02-11 18:09:16 +01:00
|
|
|
channelName, client.username, client.hostname, server.name, client.nick,
|
2014-02-09 03:49:52 +01:00
|
|
|
client.realname)
|
|
|
|
}
|
|
|
|
|
|
|
|
// <name> :End of WHO list
|
|
|
|
func RplEndOfWho(server *Server, name string) Reply {
|
|
|
|
return NewNumericReply(server, RPL_ENDOFWHO, "%s :End of WHO list", name)
|
|
|
|
}
|
|
|
|
|
2014-02-09 07:06:10 +01:00
|
|
|
func RplBanList(channel *Channel, ban UserMask) Reply {
|
|
|
|
return NewNumericReply(channel.server, RPL_BANLIST, "%s %s", channel.name, ban)
|
|
|
|
}
|
|
|
|
|
|
|
|
func RplEndOfBanList(channel *Channel) Reply {
|
2014-02-12 00:44:58 +01:00
|
|
|
return NewNumericReply(channel.server, RPL_ENDOFBANLIST,
|
|
|
|
"%s :End of channel ban list", channel.name)
|
|
|
|
}
|
|
|
|
|
|
|
|
func RplNowAway(server *Server) Reply {
|
|
|
|
return NewNumericReply(server, RPL_NOWAWAY,
|
|
|
|
":You have been marked as being away")
|
|
|
|
}
|
|
|
|
|
|
|
|
func RplUnAway(server *Server) Reply {
|
|
|
|
return NewNumericReply(server, RPL_UNAWAY,
|
|
|
|
":You are no longer marked as being away")
|
|
|
|
}
|
|
|
|
|
|
|
|
func RplAway(server *Server, client *Client) Reply {
|
|
|
|
return NewNumericReply(server, RPL_AWAY,
|
|
|
|
"%s :%s", client.nick, client.awayMessage)
|
2014-02-09 07:06:10 +01:00
|
|
|
}
|
|
|
|
|
2014-02-12 00:58:54 +01:00
|
|
|
func RplIsOn(server *Server, nicks []string) Reply {
|
|
|
|
return NewNumericReply(server, RPL_ISON,
|
|
|
|
":%s", strings.Join(nicks, " "))
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2012-12-13 08:33:09 +01:00
|
|
|
// errors (also numeric)
|
2014-02-12 00:58:54 +01:00
|
|
|
//
|
2012-12-09 07:54:58 +01:00
|
|
|
|
|
|
|
func ErrAlreadyRegistered(source Identifier) Reply {
|
2012-12-15 23:34:20 +01:00
|
|
|
return NewNumericReply(source, ERR_ALREADYREGISTRED,
|
|
|
|
":You may not reregister")
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrNickNameInUse(source Identifier, nick string) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(source, ERR_NICKNAMEINUSE,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :Nickname is already in use", nick)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrUnknownCommand(source Identifier, command string) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(source, ERR_UNKNOWNCOMMAND,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :Unknown command", command)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrUsersDontMatch(source Identifier) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(source, ERR_USERSDONTMATCH,
|
2012-12-09 22:47:02 +01:00
|
|
|
":Cannot change mode for other users")
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrNeedMoreParams(source Identifier, command string) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(source, ERR_NEEDMOREPARAMS,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :Not enough parameters", command)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 03:14:39 +01:00
|
|
|
func ErrNoSuchChannel(server *Server, channel string) Reply {
|
|
|
|
return NewNumericReply(server, ERR_NOSUCHCHANNEL,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :No such channel", channel)
|
2012-12-09 22:47:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrUserOnChannel(channel *Channel, member *Client) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(channel.server, ERR_USERONCHANNEL,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s %s :is already on channel", member.nick, channel.name)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrNotOnChannel(channel *Channel) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(channel.server, ERR_NOTONCHANNEL,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :You're not on that channel", channel.name)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrInviteOnlyChannel(channel *Channel) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(channel.server, ERR_INVITEONLYCHAN,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :Cannot join channel (+i)", channel.name)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrBadChannelKey(channel *Channel) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(channel.server, ERR_BADCHANNELKEY,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :Cannot join channel (+k)", channel.name)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ErrNoSuchNick(source Identifier, nick string) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(source, ERR_NOSUCHNICK,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :No such nick/channel", nick)
|
2012-12-09 07:54:58 +01:00
|
|
|
}
|
2012-12-10 05:24:53 +01:00
|
|
|
|
|
|
|
func ErrPasswdMismatch(server *Server) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(server, ERR_PASSWDMISMATCH, ":Password incorrect")
|
2012-12-10 05:24:53 +01:00
|
|
|
}
|
2012-12-12 08:04:03 +01:00
|
|
|
|
|
|
|
func ErrNoChanModes(channel *Channel) Reply {
|
2012-12-13 08:27:17 +01:00
|
|
|
return NewNumericReply(channel.server, ERR_NOCHANMODES,
|
2012-12-15 23:34:20 +01:00
|
|
|
"%s :Channel doesn't support modes", channel.name)
|
|
|
|
}
|
|
|
|
|
|
|
|
func ErrNoPrivileges(server *Server) Reply {
|
|
|
|
return NewNumericReply(server, ERR_NOPRIVILEGES, ":Permission Denied")
|
|
|
|
}
|
|
|
|
|
|
|
|
func ErrRestricted(server *Server) Reply {
|
|
|
|
return NewNumericReply(server, ERR_RESTRICTED, ":Your connection is restricted!")
|
2012-12-12 08:04:03 +01:00
|
|
|
}
|
2014-02-09 02:43:59 +01:00
|
|
|
|
|
|
|
func ErrNoSuchServer(server *Server, target string) Reply {
|
|
|
|
return NewNumericReply(server, ERR_NOSUCHSERVER, "%s :No such server", target)
|
|
|
|
}
|
2014-02-09 03:14:39 +01:00
|
|
|
|
|
|
|
func ErrUserNotInChannel(server *Server, nick string, channel *Channel) Reply {
|
|
|
|
return NewNumericReply(server, ERR_USERNOTINCHANNEL,
|
|
|
|
"%s %s :They aren't on that channel", nick, channel.name)
|
|
|
|
}
|
2014-02-09 08:33:56 +01:00
|
|
|
|
|
|
|
func ErrCannotSendToChan(channel *Channel) Reply {
|
|
|
|
return NewNumericReply(channel.server, ERR_CANNOTSENDTOCHAN,
|
|
|
|
"%s :Cannot send to channel", channel.name)
|
|
|
|
}
|
2014-02-10 04:59:59 +01:00
|
|
|
|
|
|
|
// <channel> :You're not channel operator
|
|
|
|
func ErrChanOPrivIsNeeded(channel *Channel) Reply {
|
|
|
|
return NewNumericReply(channel.server, ERR_CHANOPRIVSNEEDED,
|
|
|
|
"%s :You're not channel operator", channel.name)
|
|
|
|
}
|
2014-02-12 00:33:02 +01:00
|
|
|
|
|
|
|
func ErrNoMOTD(server *Server) Reply {
|
|
|
|
return NewNumericReply(server, ERR_NOMOTD, ":MOTD File is missing")
|
|
|
|
}
|