Download:
child 48:7c2bcef09311
parent 46:1514111fb94a
47:e923d8296d25
Anton Shestakov <engored@ya.ru>, Sat, 08 Mar 2014 18:39:51 +0900
Return pid if no nickserv can't find nickname.

1 файлов изменено, 5 вставок(+), 1 удалений(-) [+]
src/rps_nickserv.erl file | annotate | diff | comparison | revisions
--- a/src/rps_nickserv.erl Sat Mar 08 15:37:47 2014 +0900
+++ b/src/rps_nickserv.erl Sat Mar 08 18:39:51 2014 +0900
@@ -14,7 +14,11 @@
{reply, ok, dict:store(Who, Nickname, Nicknames)};
handle_call({whois, Who}, _From, Nicknames) ->
- {reply, dict:fetch(Who, Nicknames), Nicknames}.
+ N = case dict:find(Who, Nicknames) of
+ {ok, Nickname} -> Nickname;
+ error -> Who
+ end,
+ {reply, N, Nicknames}.
handle_cast(_Msg, State) -> {noreply, State}.