Beispiel #1
0
func PingHandler(s *irc.Encoder, m *irc.Message) {
	s.Encode(&irc.Message{
		Command:  irc.PONG,
		Params:   m.Params,
		Trailing: m.Trailing,
	})
}
Beispiel #2
0
func addChannel(f []string, s *irc.Encoder, name string) []string {
	f = append(f, name)
	s.Encode(&irc.Message{
		Command: irc.JOIN,
		Params:  []string{"#" + name},
	})
	return f
}
Beispiel #3
0
func removeChannel(f []string, s *irc.Encoder, name string) []string {
	var index int
	for i, v := range f {
		if v == name {
			index = i
		}
	}
	f = append(f[:index], f[index+1:]...)

	s.Encode(&irc.Message{
		Command: irc.PART,
		Params:  []string{"#" + name},
	})
	return f
}
Beispiel #4
0
func send(encoder *irc.Encoder, msg *irc.Message) error {
	logSend(msg)
	return encoder.Encode(msg)
}