mirror of
https://github.com/gissleh/irc.git
synced 2026-09-29 00:05:34 +00:00
fix query messages' echoes not being put in right target.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1361,8 +1361,9 @@ func (client *Client) handleEvent(event *Event) {
|
||||
// Target the message
|
||||
target := Target(client.status)
|
||||
targetName := event.Arg(0)
|
||||
|
||||
if targetName == client.nick {
|
||||
queryTarget := client.Target("query", targetName)
|
||||
queryTarget := client.Target("query", event.Nick)
|
||||
if queryTarget == nil {
|
||||
query := &Query{
|
||||
id: client.id,
|
||||
|
||||
@@ -243,6 +243,30 @@ func TestClient(t *testing.T) {
|
||||
}},
|
||||
{Client: "INVALIDCOMMAND stuff and things"},
|
||||
{Server: ":testserver.example.com 421 Test768 INVALIDCOMMAND :Unknown command"},
|
||||
{Callback: func() error {
|
||||
client.Say("SevenAsterisks", "hi!")
|
||||
return nil
|
||||
}},
|
||||
{Client: "PRIVMSG SevenAsterisks :hi!"},
|
||||
{Server: ":Test768!~Tester@127.0.0.1 PRIVMSG SevenAsterisks :hi!"},
|
||||
{Callback: func() error {
|
||||
event := logger.Last("packet", "PRIVMSG")
|
||||
if event == nil {
|
||||
return errors.New("did not find last query message")
|
||||
}
|
||||
if event.QueryTarget() == nil {
|
||||
return errors.New("event lacks query target")
|
||||
}
|
||||
if event.QueryTarget().Name() != "SevenAsterisks" {
|
||||
return errors.New("incorrect query target")
|
||||
}
|
||||
|
||||
return nil
|
||||
}},
|
||||
{Callback: func() error {
|
||||
client.EmitInput("/invalidcommand stuff and things", nil)
|
||||
return nil
|
||||
}},
|
||||
{Callback: func() error {
|
||||
channel := client.Channel("#Test")
|
||||
if channel == nil {
|
||||
|
||||
Reference in New Issue
Block a user