Permalink
Browse files

Add API to change NICK for a bot

  • Loading branch information...
mazenharake committed May 5, 2011
1 parent dc6e6c1 commit c3e7d394466d9e8f41a78cfc33b95613386f2dca
Showing with 10 additions and 0 deletions.
  1. +3 −0 src/eirc.erl
  2. +7 −0 src/eirc_cl.erl
View
@@ -96,6 +96,9 @@ notice(Client, Nick, Msg) ->
ctcp(Client, Nick, Msg) ->
eirc_cl:msg(Client, ctcp, Nick, Msg).
+nick(Client, NewNick) ->
+ eirc_cl:nick(Client, NewNick).
+
cmd(Client, RawCmd) ->
eirc_cl:cmd(Client, RawCmd).
View
@@ -54,6 +54,9 @@ logon(Client, Pass, Nick, User, Name) ->
msg(Client, Type, Nick, Msg) ->
gen_server:call(Client, {msg, Type, Nick, Msg}, infinity).
+nick(Client, NewNick) ->
+ gen_server:call(Client, {nick, NewNick}, infinity).
+
cmd(Client, RawCmd) ->
gen_server:call(Client, {cmd, RawCmd}).
@@ -198,6 +201,10 @@ handle_call({part, Channel}, _From, State) ->
gen_tcp:send(State#eirc_state.socket, ?PART(Channel)),
{reply, ok, State};
+handle_call({nick, NewNick}, _From, State) ->
+ gen_tcp:send(State#eirc_state.socket, ?NICK(NewNick)),
+ {reply, ok, State};
+
handle_call({cmd, RawCmd}, _From, State) ->
gen_tcp:send(State#eirc_state.socket, ?CMD(RawCmd)),
{reply, ok, State};

0 comments on commit c3e7d39

Please sign in to comment.