25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/web/ejabberd_http.erl: Removed debugging output

* src/ejabberd_c2s.erl: Fixed processing of get_presence request
(thanks to Mickael Remond)

SVN Revision: 212
This commit is contained in:
Alexey Shchepin 2004-03-10 21:54:54 +00:00
parent bc672b44ea
commit b11b8caf9d
3 changed files with 34 additions and 18 deletions

View File

@ -1,3 +1,10 @@
2004-03-10 Alexey Shchepin <alexey@sevcom.net>
* src/web/ejabberd_http.erl: Removed debugging output
* src/ejabberd_c2s.erl: Fixed processing of get_presence request
(thanks to Mickael Remond)
2004-03-08 Alexey Shchepin <alexey@sevcom.net> 2004-03-08 Alexey Shchepin <alexey@sevcom.net>
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan) * src/msgs/ru.msg: Updated (thanks to Sergei Golovan)

View File

@ -668,24 +668,19 @@ handle_event(_Event, StateName, StateData) ->
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
handle_sync_event({get_presence}, _From, StateName, StateData) -> handle_sync_event({get_presence}, _From, StateName, StateData) ->
User = StateData#state.user, User = StateData#state.user,
Status = PresLast = StateData#state.pres_last,
case StateData#state.pres_last of
undefined -> Show = get_showtag(PresLast),
"unavailable"; Status = get_statustag(PresLast),
PresLast ->
case xml:get_path_s(PresLast, [{elem, "status"}, cdata]) of Reply = {User, Show, Status},
"" ->
"available";
Stat ->
Stat
end
end,
Reply = {User, Status},
{reply, Reply, StateName, StateData}; {reply, Reply, StateName, StateData};
handle_sync_event(_Event, _From, StateName, StateData) -> handle_sync_event(_Event, _From, StateName, StateData) ->
Reply = ok, Reply = ok,
{reply, Reply, StateName, StateData}. {reply, Reply, StateName, StateData}.
code_change(_OldVsn, StateName, StateData, _Extra) -> code_change(_OldVsn, StateName, StateData, _Extra) ->
{ok, StateName, StateData}. {ok, StateName, StateData}.
@ -1322,4 +1317,17 @@ resend_offline_messages(StateData) ->
end, Rs) end, Rs)
end. end.
get_showtag(undefined) ->
"unavailable";
get_showtag(Presence) ->
case xml:get_path_s(Presence, [{elem, "show"}, cdata]) of
"" -> "available";
ShowTag -> ShowTag
end.
get_statustag(undefined) ->
"";
get_statustag(Presence) ->
case xml:get_path_s(Presence, [{elem, "status"}, cdata]) of
ShowTag -> ShowTag
end.

View File

@ -55,7 +55,7 @@ send_text(State, Text) ->
receive_headers(State) -> receive_headers(State) ->
Data = (State#state.sockmod):recv(State#state.socket, 0, 300000), Data = (State#state.sockmod):recv(State#state.socket, 0, 300000),
?INFO_MSG("recv: ~p~n", [Data]), ?DEBUG("recv: ~p~n", [Data]),
case Data of case Data of
{ok, {http_request, Method, Path, _Version}} -> {ok, {http_request, Method, Path, _Version}} ->
receive_headers(State#state{request_method = Method, receive_headers(State#state{request_method = Method,
@ -72,6 +72,10 @@ receive_headers(State) ->
{ok, {http_header, _, _, _, _}} -> {ok, {http_header, _, _, _, _}} ->
receive_headers(State); receive_headers(State);
{ok, http_eoh} -> {ok, http_eoh} ->
?INFO_MSG("(~w) http query: ~w ~s~n",
[State#state.socket,
State#state.request_method,
element(2, State#state.request_path)]),
Out = process_request(State), Out = process_request(State),
send_text(State, Out), send_text(State, Out),
ok; ok;
@ -110,7 +114,6 @@ process_request(#state{request_method = 'GET',
process_request(false); process_request(false);
{NPath, Query} -> {NPath, Query} ->
LQuery = parse_urlencoded(Query), LQuery = parse_urlencoded(Query),
?INFO_MSG("path: ~p, query: ~p~n", [NPath, LQuery]),
LPath = string:tokens(NPath, "/"), LPath = string:tokens(NPath, "/"),
Request = #request{method = 'GET', Request = #request{method = 'GET',
path = LPath, path = LPath,
@ -162,15 +165,13 @@ process_request(#state{request_method = 'POST',
ssl:setopts(Socket, [{packet, 0}]) ssl:setopts(Socket, [{packet, 0}])
end, end,
Data = recv_data(State, Len), Data = recv_data(State, Len),
?INFO_MSG("client data: ~p~n", [Data]), ?DEBUG("client data: ~p~n", [Data]),
case (catch url_decode_q_split(Path)) of case (catch url_decode_q_split(Path)) of
{'EXIT', _} -> {'EXIT', _} ->
process_request(false); process_request(false);
{NPath, Query} -> {NPath, Query} ->
?INFO_MSG("path: ~p, query: ~p~n", [NPath, Query]),
LPath = string:tokens(NPath, "/"), LPath = string:tokens(NPath, "/"),
LQuery = parse_urlencoded(Data), LQuery = parse_urlencoded(Data),
?INFO_MSG("client query: ~p~n", [LQuery]),
Request = #request{method = 'POST', Request = #request{method = 'POST',
path = LPath, path = LPath,
q = LQuery, q = LQuery,