1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-05-14 03:23:21 +00:00

Break out tweakable things into a Config struct.

This commit is contained in:
Alex Bramley 2013-02-16 18:05:56 +00:00
parent 45d7b3317f
commit b1242aa351
4 changed files with 71 additions and 45 deletions

View file

@ -157,26 +157,26 @@ func TestPRIVMSG(t *testing.T) {
c.h_PRIVMSG(parseLine(":blah!moo@cows.com PRIVMSG #foo :test: prefix bar"))
s.nc.ExpectNothing()
c.CommandStripNick = true
c.cfg.CommandStripNick = true
c.h_PRIVMSG(parseLine(":blah!moo@cows.com PRIVMSG #foo :prefix bar"))
s.nc.Expect("PRIVMSG #foo :prefix bar")
c.h_PRIVMSG(parseLine(":blah!moo@cows.com PRIVMSG #foo :test: prefix bar"))
s.nc.Expect("PRIVMSG #foo :prefix bar")
c.CommandStripPrefix = true
c.cfg.CommandStripPrefix = true
c.h_PRIVMSG(parseLine(":blah!moo@cows.com PRIVMSG #foo :prefix bar"))
s.nc.Expect("PRIVMSG #foo :bar")
c.h_PRIVMSG(parseLine(":blah!moo@cows.com PRIVMSG #foo :test: prefix bar"))
s.nc.Expect("PRIVMSG #foo :bar")
c.CommandStripNick = false
c.cfg.CommandStripNick = false
c.h_PRIVMSG(parseLine(":blah!moo@cows.com PRIVMSG #foo :prefix bar"))
s.nc.Expect("PRIVMSG #foo :bar")
c.h_PRIVMSG(parseLine(":blah!moo@cows.com PRIVMSG #foo :test: prefix bar"))
s.nc.ExpectNothing()
// Check the various nick addressing notations that are supported.
c.CommandStripNick = true
c.cfg.CommandStripNick = true
for _, addr := range []string{":", ";", ",", ">", "-", ""} {
c.h_PRIVMSG(parseLine(fmt.Sprintf(
":blah!moo@cows.com PRIVMSG #foo :test%s prefix bar", addr)))