]> granicus.if.org Git - ejabberd/commitdiff
* src/web/ejabberd_http.erl: Increased receive buffer
authorAlexey Shchepin <alexey@process-one.net>
Sat, 17 Apr 2004 19:00:10 +0000 (19:00 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Sat, 17 Apr 2004 19:00:10 +0000 (19:00 +0000)
* src/mod_irc/mod_irc_connection.erl: Support for "/quote" command

SVN Revision: 224

ChangeLog
src/mod_irc/mod_irc_connection.erl
src/web/ejabberd_http.erl
src/web/ejabberd_http_poll.erl

index 8c021c2b937e568648b11c195bae359e5c9fb79d..5120bda74786a392b89359ac6695a9a3a9bdcca5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-17  Alexey Shchepin  <alexey@sevcom.net>
+
+       * src/web/ejabberd_http.erl: Increased receive buffer
+
+       * src/mod_irc/mod_irc_connection.erl: Support for "/quote" command
+
 2004-04-15  Alexey Shchepin  <alexey@sevcom.net>
 
        * src/ejabberd.erl: Added searching of files in code:priv_lib
index c32fa3d7a63a61a2dbd5e9e9e59439920d22cd35..671c9832887dd3d5c757032a0d45b2987c1909b7 100644 (file)
@@ -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;
            _ ->
index c5988d3421934d8477fb2f4029f37884b8cc7063..7569e11a98d88f94f7ac6e5822ab5d430ce16e9f 100644 (file)
@@ -40,9 +40,9 @@ start_link({SockMod, Socket}, Opts) ->
     ?INFO_MSG("started: ~p", [{SockMod, Socket}]),
     case SockMod of
        gen_tcp ->
-           inet:setopts(Socket, [{packet, http}]);
+           inet:setopts(Socket, [{packet, http}, {recbuf, 8192}]);
        ssl ->
-           ssl:setopts(Socket, [{packet, http}])
+           ssl:setopts(Socket, [{packet, http}, {recbuf, 8192}])
     end,
     {ok, proc_lib:spawn_link(ejabberd_http,
                             receive_headers,
index f53dba5bd03f6099270fa807cef19fde354c4614..4366d89d760efcaa26940396824676fb41b91cf5 100644 (file)
@@ -77,19 +77,19 @@ process_request(#request{path = [],
                         data = Data} = Request) ->
     case catch parse_request(Data) of
        {ok, ID1, Key, NewKey, Packet} ->
-           ID = case ID1 of
-                     "0" ->
-                         NewID = sha:sha(term_to_binary({now(), make_ref()})),
-                         {ok, Pid} = start(NewID, ""),
-                         mnesia:transaction(
-                           fun() ->
-                                   mnesia:write(#http_poll{id = NewID,
-                                                           pid = Pid})
-                           end),
-                         NewID;
-                     _ ->
-                         ID1
-                 end,
+           ID = if
+                    (ID1 == "0") or (ID1 == "mobile") ->
+                        NewID = sha:sha(term_to_binary({now(), make_ref()})),
+                        {ok, Pid} = start(NewID, ""),
+                        mnesia:transaction(
+                          fun() ->
+                                  mnesia:write(#http_poll{id = NewID,
+                                                          pid = Pid})
+                          end),
+                        NewID;
+                    true ->
+                        ID1
+                end,
            case http_put(ID, Key, NewKey, Packet) of
                {error, not_exists} ->
                    {200, ?BAD_REQUEST, ""};
@@ -106,6 +106,8 @@ process_request(#request{path = [],
                            if
                                ID == ID1 ->
                                    {200, [?CT], OutPacket};
+                               ID1 == "mobile" ->
+                                   {200, [?CT], [ID, $\n, OutPacket]};
                                true ->
                                    Cookie = "ID=" ++ ID ++ "; expires=-1",
                                    {200, [?CT, {"Set-Cookie", Cookie}],