Skip to content

Commit

Permalink
Send PONG with prefixes
Browse files Browse the repository at this point in the history
Closes GH-33.

Co-authored-by: Val Lorentz <progval+git@progval.net>
  • Loading branch information
jlu5 and progval committed Oct 1, 2022
1 parent d89f0e3 commit 008e18f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/irc/handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,10 @@ defmodule M51.IrcConn.Handler do
send_numeric.("410", ["CAP", "Missing CAP subcommand"])

{"PING", [cookie]} ->
send.(%M51.Irc.Command{command: "PONG", params: [cookie]})
send.(%M51.Irc.Command{source: "server.", command: "PONG", params: [cookie]})

{"PING", [_, cookie | _]} ->
send.(%M51.Irc.Command{command: "PONG", params: [cookie]})
send.(%M51.Irc.Command{source: "server.", command: "PONG", params: [cookie]})

{"PING", []} ->
send_needmoreparams.()
Expand Down
10 changes: 5 additions & 5 deletions test/irc/handler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ defmodule M51.IrcConn.HandlerTest do
assert_welcome("foo:bar")

send(handler, cmd("PING sync2"))
assert_line("PONG :sync2\r\n")
assert_line(":server. PONG :sync2\r\n")

assert M51.IrcConn.State.nick(state) == "foo:bar"
assert M51.IrcConn.State.gecos(state) == "My GECOS"
Expand Down Expand Up @@ -419,7 +419,7 @@ defmodule M51.IrcConn.HandlerTest do
do_connection_registration(handler)

send(handler, cmd("@label=abcd PING sync1"))
assert_line("@label=abcd PONG :sync1\r\n")
assert_line("@label=abcd :server. PONG :sync1\r\n")
end

test "joining a room", %{handler: handler} do
Expand All @@ -435,7 +435,7 @@ defmodule M51.IrcConn.HandlerTest do
send(handler, cmd("TAGMSG #"))

send(handler, cmd("PING sync1"))
assert_line("PONG :sync1\r\n")
assert_line(":server. PONG :sync1\r\n")
end

test "sending privmsg", %{handler: handler} do
Expand Down Expand Up @@ -690,7 +690,7 @@ defmodule M51.IrcConn.HandlerTest do

# No reply because the room is not synced (and never will be)
send(handler, cmd("PING sync1"))
assert_line("PONG :sync1\r\n")
assert_line(":server. PONG :sync1\r\n")

send(handler, cmd("@label=l2 WHO #existing_room:example.org"))

Expand Down Expand Up @@ -719,7 +719,7 @@ defmodule M51.IrcConn.HandlerTest do

# No reply because the room is not synced (and never will be)
send(handler, cmd("PING sync1"))
assert_line("PONG :sync1\r\n")
assert_line(":server. PONG :sync1\r\n")

send(handler, cmd("WHO #existing_room:example.org"))

Expand Down

0 comments on commit 008e18f

Please sign in to comment.