Skip to content

Commit 97b277e

Browse files
committed
Add a dot in the placeholder IRC origin
Some clients may assume it is a nick otherwise. > Servers SHOULD pick a name which contains a dot character (".", 0x2E). > This can help clients disambiguate between server names and nicknames > in a message source. -- https://modern.ircdocs.horse/#servers Though we are probably confusing enough to clients, because of dots in actual nicks: > They SHOULD NOT contain any dot character ('.', 0x2E). -- https://modern.ircdocs.horse/#clients
1 parent 768e149 commit 97b277e

File tree

5 files changed

+164
-164
lines changed

5 files changed

+164
-164
lines changed

lib/irc/handler.ex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ defmodule M51.IrcConn.Handler do
295295
end
296296

297297
send.(%M51.Irc.Command{
298-
source: "server",
298+
source: "server.",
299299
command: numeric,
300300
params: [first_param | params]
301301
})
@@ -333,7 +333,7 @@ defmodule M51.IrcConn.Handler do
333333
end)
334334
|> Enum.join(" ")
335335

336-
send.(%M51.Irc.Command{source: "server", command: "CAP", params: ["*", "LS", caps]})
336+
send.(%M51.Irc.Command{source: "server.", command: "CAP", params: ["*", "LS", caps]})
337337
:got_cap_ls
338338

339339
{"CAP", ["LS" | _]} ->
@@ -344,12 +344,12 @@ defmodule M51.IrcConn.Handler do
344344
|> Enum.map(fn {k, _v} -> k end)
345345
|> Enum.join(" ")
346346

347-
send.(%M51.Irc.Command{source: "server", command: "CAP", params: ["*", "LS", caps]})
347+
send.(%M51.Irc.Command{source: "server.", command: "CAP", params: ["*", "LS", caps]})
348348
:got_cap_ls
349349

350350
{"CAP", ["LIST" | _]} ->
351351
# TODO: return sasl when relevant
352-
send.(%M51.Irc.Command{source: "server", command: "CAP", params: ["*", "LIST"]})
352+
send.(%M51.Irc.Command{source: "server.", command: "CAP", params: ["*", "LIST"]})
353353
nil
354354

355355
{"CAP", ["REQ", caps | _]} ->
@@ -366,11 +366,11 @@ defmodule M51.IrcConn.Handler do
366366
all_caps_known = Enum.all?(cap_atoms, fn atom -> atom != nil end)
367367

368368
if all_caps_known do
369-
send.(%M51.Irc.Command{source: "server", command: "CAP", params: ["*", "ACK", caps]})
369+
send.(%M51.Irc.Command{source: "server.", command: "CAP", params: ["*", "ACK", caps]})
370370
state = M51.IrcConn.Supervisor.state(sup_pid)
371371
M51.IrcConn.State.add_capabilities(state, cap_atoms)
372372
else
373-
send.(%M51.Irc.Command{source: "server", command: "CAP", params: ["*", "NAK", caps]})
373+
send.(%M51.Irc.Command{source: "server.", command: "CAP", params: ["*", "NAK", caps]})
374374
end
375375

376376
nil
@@ -558,7 +558,7 @@ defmodule M51.IrcConn.Handler do
558558
nick = M51.IrcConn.State.nick(state)
559559

560560
send_numeric = fn numeric, params ->
561-
send.(%M51.Irc.Command{source: "server", command: numeric, params: [nick | params]})
561+
send.(%M51.Irc.Command{source: "server.", command: numeric, params: [nick | params]})
562562
end
563563

564564
# RPL_WELCOME
@@ -591,7 +591,7 @@ defmodule M51.IrcConn.Handler do
591591
send = make_send_function(command, sup_pid)
592592

593593
send_numeric = fn numeric, params ->
594-
send.(%M51.Irc.Command{source: "server", command: numeric, params: [nick | params]})
594+
send.(%M51.Irc.Command{source: "server.", command: numeric, params: [nick | params]})
595595
end
596596

597597
# This function is only called if the nick matches the user_id, and the
@@ -688,7 +688,7 @@ defmodule M51.IrcConn.Handler do
688688

689689
send.(%M51.Irc.Command{
690690
tags: tags,
691-
source: "server",
691+
source: "server.",
692692
command: "400",
693693
params: [
694694
nick || "*",
@@ -716,7 +716,7 @@ defmodule M51.IrcConn.Handler do
716716
_ -> nick
717717
end
718718

719-
%M51.Irc.Command{source: "server", command: numeric, params: [first_param | params]}
719+
%M51.Irc.Command{source: "server.", command: numeric, params: [first_param | params]}
720720
end
721721

722722
send_numeric = fn numeric, params ->
@@ -741,7 +741,7 @@ defmodule M51.IrcConn.Handler do
741741
nil
742742

743743
{"CAP", ["LIST" | _]} ->
744-
send.(%M51.Irc.Command{source: "server", command: "CAP", params: ["*", "LIST", "sasl"]})
744+
send.(%M51.Irc.Command{source: "server.", command: "CAP", params: ["*", "LIST", "sasl"]})
745745

746746
{"CAP", [subcommand | _]} ->
747747
# ERR_INVALIDCAPCMD
@@ -1199,7 +1199,7 @@ defmodule M51.IrcConn.Handler do
11991199

12001200
{:error, error} ->
12011201
send.(%M51.Irc.Command{
1202-
source: "server",
1202+
source: "server.",
12031203
command: "NOTICE",
12041204
params: [channel, "Error while sending message: " <> Kernel.inspect(error)]
12051205
})

lib/matrix_client/poller.ex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ defmodule M51.MatrixClient.Poller do
145145
nick = M51.IrcConn.State.nick(irc_state)
146146

147147
write.(%M51.Irc.Command{
148-
source: "server",
148+
source: "server.",
149149
command: "NOTICE",
150150
params: [
151151
nick,
@@ -266,7 +266,7 @@ defmodule M51.MatrixClient.Poller do
266266
send = make_send_function(sup_pid, event, write)
267267

268268
send.(%M51.Irc.Command{
269-
source: "server",
269+
source: "server.",
270270
command: "NOTICE",
271271
params: [
272272
channel,
@@ -677,7 +677,7 @@ defmodule M51.MatrixClient.Poller do
677677

678678
_ ->
679679
send.(%M51.Irc.Command{
680-
source: "server",
680+
source: "server.",
681681
command: "NOTICE",
682682
params: [
683683
channel,
@@ -750,7 +750,7 @@ defmodule M51.MatrixClient.Poller do
750750
sender = String.replace_prefix(sender, "@", "")
751751

752752
send.(%M51.Irc.Command{
753-
source: "server",
753+
source: "server.",
754754
command: "NOTICE",
755755
params: [channel, "#{sender} sent an encrypted message"]
756756
})
@@ -869,7 +869,7 @@ defmodule M51.MatrixClient.Poller do
869869
case event do
870870
%{"type" => event_type} when is_binary(event_type) ->
871871
send.(%M51.Irc.Command{
872-
source: "server",
872+
source: "server.",
873873
command: "NOTICE",
874874
params: [
875875
channel,
@@ -879,7 +879,7 @@ defmodule M51.MatrixClient.Poller do
879879

880880
_ ->
881881
send.(%M51.Irc.Command{
882-
source: "server",
882+
source: "server.",
883883
command: "NOTICE",
884884
params: [
885885
channel,
@@ -981,7 +981,7 @@ defmodule M51.MatrixClient.Poller do
981981

982982
source =
983983
case canonical_alias_sender do
984-
nil -> "server"
984+
nil -> "server."
985985
_ -> nick2nuh(canonical_alias_sender)
986986
end
987987

@@ -1016,7 +1016,7 @@ defmodule M51.MatrixClient.Poller do
10161016
send = make_send_function(sup_pid, event, write)
10171017

10181018
make_numeric = fn numeric, params ->
1019-
%M51.Irc.Command{source: "server", command: numeric, params: [nick | params]}
1019+
%M51.Irc.Command{source: "server.", command: numeric, params: [nick | params]}
10201020
end
10211021

10221022
send_numeric = fn numeric, params ->
@@ -1109,7 +1109,7 @@ defmodule M51.MatrixClient.Poller do
11091109

11101110
# Announce the rename in the new room
11111111
send.(%M51.Irc.Command{
1112-
source: "server",
1112+
source: "server.",
11131113
command: "NOTICE",
11141114
params: [
11151115
new_canonical_alias,

lib/matrix_client/sender.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ defmodule M51.MatrixClient.Sender do
8888
channel = M51.MatrixClient.State.room_irc_channel(state, room_id)
8989

9090
send.(%M51.Irc.Command{
91-
source: "server",
91+
source: "server.",
9292
command: "NOTICE",
9393
params: [channel, "Error while sending message: " <> Kernel.inspect(reason)]
9494
})

0 commit comments

Comments
 (0)