diff options
author | Alexey Shchepin <alexey@process-one.net> | 2004-04-17 19:00:10 +0000 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2004-04-17 19:00:10 +0000 |
commit | 0ab31f08229106730d5f33298ae1b75a3df29968 (patch) | |
tree | d00997fee38205947bfd67fc49c3e48137c5ec53 /src/mod_irc | |
parent | * src/ejabberd.erl: Added searching of files in code:priv_lib (diff) |
* src/web/ejabberd_http.erl: Increased receive buffer
* src/mod_irc/mod_irc_connection.erl: Support for "/quote" command
SVN Revision: 224
Diffstat (limited to '')
-rw-r--r-- | src/mod_irc/mod_irc_connection.erl | 99 |
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; _ -> |