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:
parent
bc672b44ea
commit
b11b8caf9d
@ -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>
|
||||
|
||||
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)
|
||||
|
@ -668,24 +668,19 @@ handle_event(_Event, StateName, StateData) ->
|
||||
%%----------------------------------------------------------------------
|
||||
handle_sync_event({get_presence}, _From, StateName, StateData) ->
|
||||
User = StateData#state.user,
|
||||
Status =
|
||||
case StateData#state.pres_last of
|
||||
undefined ->
|
||||
"unavailable";
|
||||
PresLast ->
|
||||
case xml:get_path_s(PresLast, [{elem, "status"}, cdata]) of
|
||||
"" ->
|
||||
"available";
|
||||
Stat ->
|
||||
Stat
|
||||
end
|
||||
end,
|
||||
Reply = {User, Status},
|
||||
PresLast = StateData#state.pres_last,
|
||||
|
||||
Show = get_showtag(PresLast),
|
||||
Status = get_statustag(PresLast),
|
||||
|
||||
Reply = {User, Show, Status},
|
||||
{reply, Reply, StateName, StateData};
|
||||
|
||||
handle_sync_event(_Event, _From, StateName, StateData) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, StateName, StateData}.
|
||||
|
||||
|
||||
code_change(_OldVsn, StateName, StateData, _Extra) ->
|
||||
{ok, StateName, StateData}.
|
||||
|
||||
@ -1322,4 +1317,17 @@ resend_offline_messages(StateData) ->
|
||||
end, Rs)
|
||||
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.
|
||||
|
@ -55,7 +55,7 @@ send_text(State, Text) ->
|
||||
|
||||
receive_headers(State) ->
|
||||
Data = (State#state.sockmod):recv(State#state.socket, 0, 300000),
|
||||
?INFO_MSG("recv: ~p~n", [Data]),
|
||||
?DEBUG("recv: ~p~n", [Data]),
|
||||
case Data of
|
||||
{ok, {http_request, Method, Path, _Version}} ->
|
||||
receive_headers(State#state{request_method = Method,
|
||||
@ -72,6 +72,10 @@ receive_headers(State) ->
|
||||
{ok, {http_header, _, _, _, _}} ->
|
||||
receive_headers(State);
|
||||
{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),
|
||||
send_text(State, Out),
|
||||
ok;
|
||||
@ -110,7 +114,6 @@ process_request(#state{request_method = 'GET',
|
||||
process_request(false);
|
||||
{NPath, Query} ->
|
||||
LQuery = parse_urlencoded(Query),
|
||||
?INFO_MSG("path: ~p, query: ~p~n", [NPath, LQuery]),
|
||||
LPath = string:tokens(NPath, "/"),
|
||||
Request = #request{method = 'GET',
|
||||
path = LPath,
|
||||
@ -162,15 +165,13 @@ process_request(#state{request_method = 'POST',
|
||||
ssl:setopts(Socket, [{packet, 0}])
|
||||
end,
|
||||
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
|
||||
{'EXIT', _} ->
|
||||
process_request(false);
|
||||
{NPath, Query} ->
|
||||
?INFO_MSG("path: ~p, query: ~p~n", [NPath, Query]),
|
||||
LPath = string:tokens(NPath, "/"),
|
||||
LQuery = parse_urlencoded(Data),
|
||||
?INFO_MSG("client query: ~p~n", [LQuery]),
|
||||
Request = #request{method = 'POST',
|
||||
path = LPath,
|
||||
q = LQuery,
|
||||
|
Loading…
Reference in New Issue
Block a user