Closes #1
This using `msg` instead of `target` in the JoinCallback(Ex) seems to work correctly
This commit is contained in:
parent
d363768965
commit
820f2b96a2
4
irc.go
4
irc.go
@ -274,9 +274,9 @@ func (c *Connection) parseMessage(line string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "join":
|
case "join":
|
||||||
c.addNick(target, GetNick(from))
|
c.addNick(msg, GetNick(from))
|
||||||
if c.JoinCallback != nil {
|
if c.JoinCallback != nil {
|
||||||
c.JoinCallback(from, target)
|
c.JoinCallback(from, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.JoinCallbackEx != nil {
|
if c.JoinCallbackEx != nil {
|
||||||
|
30
irc_test.go
30
irc_test.go
@ -37,6 +37,36 @@ func TestJoinChannel(t *testing.T) {
|
|||||||
con.SendQuit("go-irc: Test Join Channel")
|
con.SendQuit("go-irc: Test Join Channel")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestJoinCallback(t *testing.T) {
|
||||||
|
con := NewConnection("irc.ouch.chat:6667", "irc-go", "irc-go", nil, []string{channel})
|
||||||
|
i := 0
|
||||||
|
con.JoinCallback = func(from, target string) {
|
||||||
|
i++
|
||||||
|
for _, x := range con.userList[channel] {
|
||||||
|
con.SendPrivmsg(channel, x)
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == 3 {
|
||||||
|
con.SendQuit("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
go con.Run()
|
||||||
|
|
||||||
|
time.Sleep(10 * time.Second)
|
||||||
|
|
||||||
|
t1 := NewConnection("irc.ouch.chat:6667", "abc", "abc", nil, []string{channel})
|
||||||
|
t2 := NewConnection("irc.ouch.chat:6667", "def", "def", nil, []string{channel})
|
||||||
|
|
||||||
|
go t1.Run()
|
||||||
|
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
|
||||||
|
go t2.Run()
|
||||||
|
|
||||||
|
time.Sleep(10 * time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
func TestLusers(t *testing.T) {
|
func TestLusers(t *testing.T) {
|
||||||
con := NewConnection("irc.ouch.chat:6667", "irc-go", "irc-go", nil, []string{channel})
|
con := NewConnection("irc.ouch.chat:6667", "irc-go", "irc-go", nil, []string{channel})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user