mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Prevent case_clause error when ejabber_odbc:sql_query returns {error, Reason}
SVN Revision: 1538
This commit is contained in:
parent
2d226b39bf
commit
5c9069d677
@ -1,3 +1,9 @@
|
||||
2008-08-25 Christophe Romain <christophe.romain@process-one.net>
|
||||
|
||||
* src/mod_privacy_odbc.erl: Prevent case_clause error when
|
||||
ejabber_odbc:sql_query returns {error, Reason}
|
||||
* src/mod_vcard_odbc.erl: Likewise
|
||||
|
||||
2008-08-25 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
|
||||
|
@ -96,16 +96,14 @@ process_iq_get(_, From, _To, #iq{sub_el = SubEl},
|
||||
|
||||
process_lists_get(LUser, LServer, Active) ->
|
||||
Default = case catch sql_get_default_privacy_list(LUser, LServer) of
|
||||
{'EXIT', _Reason} ->
|
||||
none;
|
||||
{selected, ["name"], []} ->
|
||||
none;
|
||||
{selected, ["name"], [{DefName}]} ->
|
||||
DefName
|
||||
DefName;
|
||||
_ ->
|
||||
none
|
||||
end,
|
||||
case catch sql_get_privacy_list_names(LUser, LServer) of
|
||||
{'EXIT', _Reason2} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
{selected, ["name"], []} ->
|
||||
{result, [{xmlelement, "query", [{"xmlns", ?NS_PRIVACY}], []}]};
|
||||
{selected, ["name"], Names} ->
|
||||
@ -132,19 +130,17 @@ process_lists_get(LUser, LServer, Active) ->
|
||||
end,
|
||||
{result,
|
||||
[{xmlelement, "query", [{"xmlns", ?NS_PRIVACY}],
|
||||
ADItems}]}
|
||||
ADItems}]};
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end.
|
||||
|
||||
process_list_get(LUser, LServer, {value, Name}) ->
|
||||
case catch sql_get_privacy_list_id(LUser, LServer, Name) of
|
||||
{'EXIT', _Reason} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
{selected, ["id"], []} ->
|
||||
{error, ?ERR_ITEM_NOT_FOUND};
|
||||
{selected, ["id"], [{ID}]} ->
|
||||
case catch sql_get_privacy_list_data_by_id(ID, LServer) of
|
||||
{'EXIT', _Reason} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
{selected, ["t", "value", "action", "ord", "match_all",
|
||||
"match_iq", "match_message",
|
||||
"match_presence_in", "match_presence_out"],
|
||||
@ -154,8 +150,12 @@ process_list_get(LUser, LServer, {value, Name}) ->
|
||||
{result,
|
||||
[{xmlelement, "query", [{"xmlns", ?NS_PRIVACY}],
|
||||
[{xmlelement, "list",
|
||||
[{"name", Name}], LItems}]}]}
|
||||
end
|
||||
[{"name", Name}], LItems}]}]};
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end;
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end;
|
||||
|
||||
process_list_get(_LUser, _LServer, false) ->
|
||||
@ -294,6 +294,8 @@ process_default_set(LUser, LServer, false) ->
|
||||
case catch sql_unset_default_privacy_list(LUser, LServer) of
|
||||
{'EXIT', _Reason} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
{error, _Reason} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
_ ->
|
||||
{result, []}
|
||||
end.
|
||||
@ -301,21 +303,21 @@ process_default_set(LUser, LServer, false) ->
|
||||
|
||||
process_active_set(LUser, LServer, {value, Name}) ->
|
||||
case catch sql_get_privacy_list_id(LUser, LServer, Name) of
|
||||
{'EXIT', _Reason} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
{selected, ["id"], []} ->
|
||||
{error, ?ERR_ITEM_NOT_FOUND};
|
||||
{selected, ["id"], [{ID}]} ->
|
||||
case catch sql_get_privacy_list_data_by_id(ID, LServer) of
|
||||
{'EXIT', _Reason} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
{selected, ["t", "value", "action", "ord", "match_all",
|
||||
"match_iq", "match_message",
|
||||
"match_presence_in", "match_presence_out"],
|
||||
RItems} ->
|
||||
Items = lists:map(fun raw_to_item/1, RItems),
|
||||
{result, [], #userlist{name = Name, list = Items}}
|
||||
end
|
||||
{result, [], #userlist{name = Name, list = Items}};
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end;
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end;
|
||||
|
||||
process_active_set(_LUser, _LServer, false) ->
|
||||
@ -517,21 +519,21 @@ get_user_list(_, User, Server) ->
|
||||
LServer = jlib:nameprep(Server),
|
||||
|
||||
case catch sql_get_default_privacy_list(LUser, LServer) of
|
||||
{'EXIT', _Reason} ->
|
||||
#userlist{};
|
||||
{selected, ["name"], []} ->
|
||||
#userlist{};
|
||||
{selected, ["name"], [{Default}]} ->
|
||||
case catch sql_get_privacy_list_data(LUser, LServer, Default) of
|
||||
{'EXIT', _Reason} ->
|
||||
#userlist{};
|
||||
{selected, ["t", "value", "action", "ord", "match_all",
|
||||
"match_iq", "match_message",
|
||||
"match_presence_in", "match_presence_out"],
|
||||
RItems} ->
|
||||
Items = lists:map(fun raw_to_item/1, RItems),
|
||||
#userlist{name = Default, list = Items}
|
||||
end
|
||||
#userlist{name = Default, list = Items};
|
||||
_ ->
|
||||
#userlist{}
|
||||
end;
|
||||
_ ->
|
||||
#userlist{}
|
||||
end.
|
||||
|
||||
|
||||
|
@ -162,7 +162,7 @@ process_sm_iq(From, To, #iq{type = Type, sub_el = SubEl} = IQ) ->
|
||||
end;
|
||||
{selected, ["vcard"], []} ->
|
||||
IQ#iq{type = result, sub_el = []};
|
||||
{'EXIT', _Reason} ->
|
||||
_ ->
|
||||
IQ#iq{type = error,
|
||||
sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]}
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user