Download:
child 49:5ca76c8726c5
parent 47:e923d8296d25
48:7c2bcef09311
Anton Shestakov <engored@ya.ru>, Sat, 08 Mar 2014 21:55:29 +0900
Add possibility to use rps_nickserv's api with a Pid.

1 файлов изменено, 9 вставок(+), 3 удалений(-) [+]
src/rps_nickserv.erl file | annotate | diff | comparison | revisions
--- a/src/rps_nickserv.erl Sat Mar 08 18:39:51 2014 +0900
+++ b/src/rps_nickserv.erl Sat Mar 08 21:55:29 2014 +0900
@@ -1,7 +1,7 @@
-module(rps_nickserv).
-behaviour(gen_server).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
--export([start_link/0, nick/2, whois/1]).
+-export([start_link/0, nick/2, nick/3, whois/1, whois/2]).
start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
@@ -29,7 +29,13 @@
code_change(_OldVersion, State, _Extra) -> {ok, State}.
nick(Who, Nickname) ->
- gen_server:call(?MODULE, {nick, Who, Nickname}).
+ nick(?MODULE, Who, Nickname).
+
+nick(Pid, Who, Nickname) ->
+ gen_server:call(Pid, {nick, Who, Nickname}).
whois(Who) ->
- gen_server:call(?MODULE, {whois, Who}).
+ whois(?MODULE, Who).
+
+whois(Pid, Who) ->
+ gen_server:call(Pid, {whois, Who}).