summaryrefslogtreecommitdiff
path: root/lib/irc/user_track.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irc/user_track.ex')
-rw-r--r--lib/irc/user_track.ex16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/irc/user_track.ex b/lib/irc/user_track.ex
index 08b5160..5e1c3a3 100644
--- a/lib/irc/user_track.ex
+++ b/lib/irc/user_track.ex
@@ -17,6 +17,18 @@ defmodule IRC.UserTrack do
op(fn(ets) -> :ets.insert(ets, tuple) end)
end
+ def clear_network(network) do
+ op(fn(ets) ->
+ spec = [
+ {{:_, :"$1", :_, :_, :_, :_, :_, :_, :_, :_, :_},
+ [
+ {:==, :"$1", {:const, network}}
+ ], [:"$_"]}
+ ]
+ :ets.match_delete(ets, spec)
+ end)
+ end
+
def op(fun) do
GenServer.call(__MODULE__, {:op, fun})
end
@@ -97,6 +109,10 @@ defmodule IRC.UserTrack do
end
end
+ def clear_network(network) do
+ Storage.clear_network(network)
+ end
+
def merge_account(old_id, new_id) do
#iex(15)> :ets.fun2ms(fn(obj = {_, net, acct, _, _, _, _, _, _}) when net == network and acct == account -> obj end)