Browse files

Send to everybody, Quaff messages locally.

A send to a channel should not echo to ourself. We capture this by
quaffing and silencing the message when the source matches our nick.
  • Loading branch information...
1 parent 0ccf0a9 commit 099015e10bf847ba5f79781d2cb89434e2695da7 @jlouis jlouis committed Jul 6, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/pony_client.erl
View
6 src/pony_client.erl
@@ -61,6 +61,10 @@ handle_cast({numeric, Numeric, Args},
#state { socket = Sock } = State) ->
out(Sock, pony_protocol:render_numeric(Numeric, Args)),
{noreply, State};
+handle_cast({msg, {privmsg, Nick, _Target, _Text}},
+ #state { nickname = Nick } = State) ->
+ %% Quaff messages to self
+ {noreply, State};
handle_cast({msg, M}, #state { socket = Sock } = State) ->
out(Sock, pony_protocol:render(M)),
{noreply, State};
@@ -170,7 +174,7 @@ handle_message(Prefix, Command, Args, #state { nickname = CurNick } = State) ->
[] ->
State;
Members when is_list(Members) ->
- [pony_client:msg(Pid, PM) || Pid <- Members -- [self()] ]
+ [pony_client:msg(Pid, PM) || Pid <- Members]
end,
State;
Pid when is_pid(Pid) ->

0 comments on commit 099015e

Please sign in to comment.