Skip to content
Browse files

Remove IF around irc tests. Updated weather command. Guard xmpp room …

…joining
  • Loading branch information...
1 parent 9a95163 commit 0455a0fc1d242a36bf2459ea8d90e917a16f8b8a @benmills benmills committed Mar 14, 2012
Showing with 14 additions and 5 deletions.
  1. +9 −1 src/command.erl
  2. +5 −1 src/jane_xmpp_server.erl
  3. +0 −3 test/jane_irc_server_test.erl
View
10 src/command.erl
@@ -298,7 +298,15 @@ commands() -> [
},
#command {
- matches = "is it raining in chicago",
+ matches = "git",
+ action = fun(_Sender, Body) ->
+ Sha = lists:last(string:tokens(Body, " ")),
+ string:join(["https://git.braintreeps.com/?p=gateway.git;a=commitdiff;h=", Sha], "")
+ end
+ },
+
+ #command {
+ matches = "(is it raining in chicago|weather)",
action = fun(_Sender, Body) ->
City = lists:last(string:tokens(Body, " ")),
ApiUrl = string:concat("http://isitraining.in/", City),
View
6 src/jane_xmpp_server.erl
@@ -84,7 +84,11 @@ handle_cast(silence, State) ->
handle_cast(unsilence, State) ->
{noreply, State#state{silenced=false}};
handle_cast({join_room, Room}, State) ->
- join_xmpp_room(State#state.session, ?app_env(xmpp_user_login), Room),
+ try join_xmpp_room(State#state.session, ?app_env(xmpp_user_login), Room)
+ catch
+ _ ->
+ handle_xmpp_failure()
+ end,
{noreply, State};
handle_cast(_, State) ->
{noreply, State}.
View
3 test/jane_irc_server_test.erl
@@ -2,8 +2,6 @@
-include_lib("eunit/include/eunit.hrl").
-include_lib("jane.hrl").
--ifdef(IRCTEST).
-
parse_irc_chat_packet_test() ->
ChatPacket = ":cosgroveb!~cosgroveb@127.0.y.p PRIVMSG #test :jane hello\r\n",
ExpectedPacket = #irc_packet{
@@ -98,4 +96,3 @@ irc_conn_faker_loop(Socket) ->
irc_conn_faker_loop(Socket);
_Other -> ok
end.
--endif.

0 comments on commit 0455a0f

Please sign in to comment.
Something went wrong with that request. Please try again.