neiam
/oh-my-ex-oh-ircd
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
Credo: drop Connection's write-only oper_name, keeping State under 32 fields
59413a3 · Gabe Morell · 2026-11-04 20:40
Files changed
modified
lib/oh_my_ex_oh_ircd/irc/connection.ex
+5
−6
@@ -81,7 +81,6 @@ defmodule OhMyExOhIrcd.IRC.Connection do
| 81 | 81 | # IRC operator status — set by successful OPER, cleared when |
| 82 | 82 | # the user-mode `-o` is set (not implemented yet). |
| 83 | 83 | operator?: false, |
| 84 | − oper_name: nil, | |
| 85 | 84 | # `+w` user-mode: receive WALLOPS broadcasts. |
| 86 | 85 | wallops?: false, |
| 87 | 86 | # The client's QUIT reason, kept for the disconnect sighting. |
@@ -1007,7 +1006,7 @@ defmodule OhMyExOhIrcd.IRC.Connection do
| 1007 | 1006 | state |
| 1008 | 1007 | |
| 1009 | 1008 | account_is_oper?(state.account) -> |
| 1010 | − grant_oper(socket, state, "user:" <> state.account.email) | |
| 1009 | + grant_oper(socket, state) | |
| 1011 | 1010 | |
| 1012 | 1011 | true -> |
| 1013 | 1012 | send_numeric(socket, state, "464", [ |
@@ -1036,14 +1035,14 @@ defmodule OhMyExOhIrcd.IRC.Connection do
| 1036 | 1035 | state |
| 1037 | 1036 | |
| 1038 | 1037 | account_is_oper?(state.account) -> |
| 1039 | − grant_oper(socket, state, "user:" <> state.account.email) | |
| 1038 | + grant_oper(socket, state) | |
| 1040 | 1039 | |
| 1041 | 1040 | true -> |
| 1042 | 1041 | user_at_host = "#{state.user || state.nick}@#{state.real_host}" |
| 1043 | 1042 | |
| 1044 | 1043 | case OhMyExOhIrcd.IRC.Opers.verify(name, password, user_at_host) do |
| 1045 | 1044 | :ok -> |
| 1046 | − grant_oper(socket, state, name) | |
| 1045 | + grant_oper(socket, state) | |
| 1047 | 1046 | |
| 1048 | 1047 | {:error, :bad_host} -> |
| 1049 | 1048 | send_numeric(socket, state, "491", [state.nick, "No O-lines for your host"]) |
@@ -2471,11 +2470,11 @@ defmodule OhMyExOhIrcd.IRC.Connection do
| 2471 | 2470 | Regex.match?(~r/\A#{pattern}\z/i, string) |
| 2472 | 2471 | end |
| 2473 | 2472 | |
| 2474 | − defp grant_oper(socket, state, oper_name) do | |
| 2473 | + defp grant_oper(socket, state) do | |
| 2475 | 2474 | send_numeric(socket, state, "381", [state.nick, "You are now an IRC operator"]) |
| 2476 | 2475 | send_msg(socket, Message.build("MODE", [state.nick, "+o"], state.nick)) |
| 2477 | 2476 | OhMyExOhIrcd.IRC.Broadcast.subscribe_opers() |
| 2478 | − %{state | operator?: true, oper_name: oper_name} | |
| 2477 | + %{state | operator?: true} | |
| 2479 | 2478 | end |
| 2480 | 2479 | |
| 2481 | 2480 | # Re-read the `is_oper` flag from the DB rather than trusting the |
Parents: 18212a4