summaryrefslogtreecommitdiff
path: root/src/mod_irc/mod_irc_connection.erl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mod_irc/mod_irc_connection.erl99
1 files changed, 58 insertions, 41 deletions
diff --git a/src/mod_irc/mod_irc_connection.erl b/src/mod_irc/mod_irc_connection.erl
index c32fa3d7..671c9832 100644
--- a/src/mod_irc/mod_irc_connection.erl
+++ b/src/mod_irc/mod_irc_connection.erl
@@ -234,6 +234,43 @@ handle_info({route_chan, Channel, Resource,
StateData#state.myname, StateData#state.nick),
StateData#state.user, El),
Body = xml:get_path_s(El, [{elem, "body"}, cdata]),
+ case Body of
+ "/quote " ++ Rest ->
+ ?SEND(Rest ++ "\r\n");
+ _ ->
+ Body1 =
+ case Body of
+ [$/, $m, $e, $ | Rest] ->
+ "\001ACTION " ++ Rest ++ "\001";
+ _ ->
+ Body
+ end,
+ Strings = string:tokens(Body1, "\n"),
+ Res = lists:concat(
+ lists:map(
+ fun(S) ->
+ io_lib:format(
+ "PRIVMSG #~s :~s\r\n",
+ [Channel, S])
+ end, Strings)),
+ ?SEND(Res)
+ end;
+ Subject ->
+ Strings = string:tokens(Subject, "\n"),
+ Res = lists:concat(
+ lists:map(
+ fun(S) ->
+ io_lib:format("TOPIC #~s :~s\r\n",
+ [Channel, S])
+ end, Strings)),
+ ?SEND(Res)
+ end;
+ "chat" ->
+ Body = xml:get_path_s(El, [{elem, "body"}, cdata]),
+ case Body of
+ "/quote " ++ Rest ->
+ ?SEND(Rest ++ "\r\n");
+ _ ->
Body1 = case Body of
[$/, $m, $e, $ | Rest] ->
"\001ACTION " ++ Rest ++ "\001";
@@ -244,36 +281,11 @@ handle_info({route_chan, Channel, Resource,
Res = lists:concat(
lists:map(
fun(S) ->
- io_lib:format("PRIVMSG #~s :~s\r\n",
- [Channel, S])
- end, Strings)),
- ?SEND(Res);
- Subject ->
- Strings = string:tokens(Subject, "\n"),
- Res = lists:concat(
- lists:map(
- fun(S) ->
- io_lib:format("TOPIC #~s :~s\r\n",
- [Channel, S])
+ io_lib:format("PRIVMSG ~s :~s\r\n",
+ [Resource, S])
end, Strings)),
?SEND(Res)
end;
- "chat" ->
- Body = xml:get_path_s(El, [{elem, "body"}, cdata]),
- Body1 = case Body of
- [$/, $m, $e, $ | Rest] ->
- "\001ACTION " ++ Rest ++ "\001";
- _ ->
- Body
- end,
- Strings = string:tokens(Body1, "\n"),
- Res = lists:concat(
- lists:map(
- fun(S) ->
- io_lib:format("PRIVMSG ~s :~s\r\n",
- [Resource, S])
- end, Strings)),
- ?SEND(Res);
"error" ->
stop;
_ ->
@@ -330,20 +342,25 @@ handle_info({route_nick, Nick,
case xml:get_attr_s("type", Attrs) of
"chat" ->
Body = xml:get_path_s(El, [{elem, "body"}, cdata]),
- Body1 = case Body of
- [$/, $m, $e, $ | Rest] ->
- "\001ACTION " ++ Rest ++ "\001";
- _ ->
- Body
- end,
- Strings = string:tokens(Body1, "\n"),
- Res = lists:concat(
- lists:map(
- fun(S) ->
- io_lib:format("PRIVMSG ~s :~s\r\n",
- [Nick, S])
- end, Strings)),
- ?SEND(Res);
+ case Body of
+ "/quote " ++ Rest ->
+ ?SEND(Rest ++ "\r\n");
+ _ ->
+ Body1 = case Body of
+ [$/, $m, $e, $ | Rest] ->
+ "\001ACTION " ++ Rest ++ "\001";
+ _ ->
+ Body
+ end,
+ Strings = string:tokens(Body1, "\n"),
+ Res = lists:concat(
+ lists:map(
+ fun(S) ->
+ io_lib:format("PRIVMSG ~s :~s\r\n",
+ [Nick, S])
+ end, Strings)),
+ ?SEND(Res)
+ end;
"error" ->
stop;
_ ->