Skip to content

Commit 45ad701

Browse files
committed
Advertize informational capability soju.im/account-required
1 parent f6abaf1 commit 45ad701

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/irc/handler.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ defmodule M51.IrcConn.Handler do
8585
"userhost-in-names" => {:userhost_in_names, nil}
8686
}
8787

88+
@informative_capabilities %{
89+
# https://git.sr.ht/~emersion/soju/tree/master/item/doc/ext/account-required.md
90+
"soju.im/account-required" => {nil, nil}
91+
}
92+
93+
@capabilities_ls Map.merge(@capabilities, @informative_capabilities)
94+
8895
@valid_batch_types ["draft/multiline"]
8996

9097
@doc """
@@ -322,7 +329,7 @@ defmodule M51.IrcConn.Handler do
322329

323330
{"CAP", ["LS", "302"]} ->
324331
caps =
325-
@capabilities
332+
@capabilities_ls
326333
|> Map.to_list()
327334
|> Enum.sort_by(fn {k, _v} -> k end)
328335
|> Enum.map(fn {k, {_, v}} ->
@@ -338,7 +345,7 @@ defmodule M51.IrcConn.Handler do
338345

339346
{"CAP", ["LS" | _]} ->
340347
caps =
341-
@capabilities
348+
@capabilities_ls
342349
|> Map.to_list()
343350
|> Enum.sort_by(fn {k, {_, _v}} -> k end)
344351
|> Enum.map(fn {k, _v} -> k end)

test/irc/handler_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ defmodule M51.IrcConn.HandlerTest do
1818
use ExUnit.Case, async: false
1919
doctest M51.IrcConn.Handler
2020

21-
@cap_ls_302 ":server. CAP * LS :account-tag batch draft/account-registration=before-connect draft/channel-rename draft/chathistory draft/multiline=max-bytes=8192 echo-message extended-join labeled-response message-tags sasl=PLAIN server-time userhost-in-names\r\n"
22-
@cap_ls ":server. CAP * LS :account-tag batch draft/account-registration draft/channel-rename draft/chathistory draft/multiline echo-message extended-join labeled-response message-tags sasl server-time userhost-in-names\r\n"
21+
@cap_ls_302 ":server. CAP * LS :account-tag batch draft/account-registration=before-connect draft/channel-rename draft/chathistory draft/multiline=max-bytes=8192 echo-message extended-join labeled-response message-tags sasl=PLAIN server-time soju.im/account-required userhost-in-names\r\n"
22+
@cap_ls ":server. CAP * LS :account-tag batch draft/account-registration draft/channel-rename draft/chathistory draft/multiline echo-message extended-join labeled-response message-tags sasl server-time soju.im/account-required userhost-in-names\r\n"
2323
@isupport "CASEMAPPING=rfc3454 CLIENTTAGDENY=*,-draft/react,-draft/reply CHANLIMIT= CHANTYPES=#! CHATHISTORY=1000 MAXTARGETS=1 MSGREFTYPES=msgid PREFIX= TARGMAX=JOIN:1,PART:1 UTF8ONLY :are supported by this server\r\n"
2424

2525
setup do

0 commit comments

Comments
 (0)