예제 #1
0
파일: client.go 프로젝트: Codesleuth/iirc
func (c clientHandler) OnReceive(l message.M) {
	if l.Command == "QUIT" {
		c.client.Send(message.Message3(
			nil,
			"ERROR",
			message.ParamsT([]string{}, "Closing Link: "+c.client.Name())))

		c.client.Channels().Each(func(ch *channel.Channel) {
			ch.Send(message.Message3(
				message.Prefix(c.client.Name(), c.client.UserName(), c.client.server.Name()),
				"QUIT",
				nil))
		})

		c.client.Close()
		return
	}

	if handler, ok := handlers[l.Command]; ok {
		handler(c.client, c.client.server, l.Args())
	}
}
예제 #2
0
파일: part.go 프로젝트: Codesleuth/iirc
func Part(nickName, userName, serverName, channel string) message.M {
	return message.Message3(
		message.Prefix(nickName, userName, serverName),
		"PART",
		message.ParamsT([]string{channel}, nickName))
}
예제 #3
0
파일: invite.go 프로젝트: Codesleuth/iirc
func Invite(nick, user, host, subject, channel string) message.M {
	return message.Message3(
		message.Prefix(nick, user, host),
		"INVITE",
		message.ParamsT([]string{subject}, channel))
}
예제 #4
0
func WhoIsIdle(host, nick string, seconds int) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_WHOISIDLE,
		message.ParamsT([]string{nick, strconv.Itoa(seconds)}, "seconds idle"))
}
예제 #5
0
파일: join.go 프로젝트: Codesleuth/iirc
func Join(nickName, userName, serverName, channelName string) message.M {
	return message.Message3(
		message.Prefix(nickName, userName, serverName),
		"JOIN",
		message.ParamsT([]string{}, channelName))
}
예제 #6
0
파일: unaway.go 프로젝트: Codesleuth/iirc
func UnAway(host string) message.M {
	return message.Message3(
		message.Prefix(host),
		"305",
		message.ParamsT([]string{}, "You are no longer marked as being away"))
}
예제 #7
0
파일: away.go 프로젝트: Codesleuth/iirc
func Away(host, nick, awayMsg string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_AWAY,
		message.ParamsT([]string{nick}, awayMsg))
}
예제 #8
0
func WhoIsUser(host, nick, user, realName string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_WHOISUSER,
		message.ParamsT([]string{nick, user, host, "*"}, realName))
}
예제 #9
0
파일: errors.go 프로젝트: Codesleuth/iirc
func err(host, code string, params []string, text string) message.M {
	return message.Message3(
		message.Prefix(host),
		code,
		message.ParamsT(params, text))
}
예제 #10
0
파일: notice.go 프로젝트: Codesleuth/iirc
func Notice(nick, user, host, subject, msg string) message.M {
	return message.Message3(
		message.Prefix(nick, user, host),
		"NOTICE",
		message.ParamsT([]string{subject}, msg))
}
예제 #11
0
func EndOfBanList(host, nick, channel string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_ENDOFBANLIST,
		message.ParamsT([]string{nick, channel}, "End of Channel Ban List"))
}
예제 #12
0
파일: topic.go 프로젝트: Codesleuth/iirc
func Topic(host, channel, topic string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_TOPIC,
		message.ParamsT([]string{channel}, topic))
}
예제 #13
0
func WhoReply(host, me, subject, user, nick, realName string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_WHOREPLY,
		message.ParamsT([]string{me, subject, user, host, host, nick, "H"}, "0 "+realName))
}
예제 #14
0
파일: now_away.go 프로젝트: Codesleuth/iirc
func NowAway(host string) message.M {
	return message.Message3(
		message.Prefix(host),
		"306",
		message.ParamsT([]string{}, "You have been marked as being away"))
}
예제 #15
0
func WhoIsServer(host, user string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_WHOISSERVER,
		message.ParamsT([]string{user, host}, ""))
}
예제 #16
0
func WhoIsOperator(host, nick string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_WHOISOPERATOR,
		message.ParamsT([]string{nick}, "is an IRC oeprator"))
}
예제 #17
0
func EndOfNames(serverName, nickName, channelName string) message.M {
	return message.Message3(
		message.Prefix(serverName),
		RPL_ENDOFNAMES,
		message.ParamsT([]string{nickName, channelName}, "End of /NAMES list."))
}
예제 #18
0
func TopicChange(nickName, userName, serverName, channel, topic string) message.M {
	return message.Message3(
		message.Prefix(nickName, userName, serverName),
		"TOPIC",
		message.ParamsT([]string{channel}, topic))
}
예제 #19
0
func WhoIsChannels(host, nick string, channels []string) message.M {
	return message.Message3(
		message.Prefix(host),
		RPL_WHOISCHANNELS,
		message.ParamsT([]string{nick}, strings.Join(channels, " ")))
}
예제 #20
0
func NameReply(serverName, nickName, channelName string, names []string) message.M {
	return message.Message3(
		message.Prefix(serverName),
		RPL_NAMREPLY,
		message.ParamsT([]string{nickName, "=", channelName}, strings.Join(names, " ")))
}
예제 #21
0
파일: privmsg.go 프로젝트: Codesleuth/iirc
func PrivMsg(nick, user, host, subject, msg string) message.M {
	return message.Message3(
		message.Prefix(nick, user, host),
		"PRIVMSG",
		message.ParamsT([]string{subject}, msg))
}