mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-01 17:53:00 +01:00
* src/mod_roster_odbc.erl: Bugfix
SVN Revision: 490
This commit is contained in:
parent
2d7fbf3964
commit
ef0b3ab24c
@ -1,3 +1,7 @@
|
||||
2006-01-24 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_roster_odbc.erl: Bugfix
|
||||
|
||||
2006-01-23 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/ejabberd_sm.erl: Partially rewritten to work more
|
||||
|
@ -108,9 +108,22 @@ process_local_iq(From, To, #iq{type = Type} = IQ) ->
|
||||
|
||||
|
||||
|
||||
process_iq_get(From, _To, #iq{sub_el = SubEl} = IQ) ->
|
||||
process_iq_get(From, To, #iq{sub_el = SubEl} = IQ) ->
|
||||
LUser = From#jid.luser,
|
||||
LServer = From#jid.lserver,
|
||||
US = {LUser, LServer},
|
||||
case catch ejabberd_hooks:run_fold(roster_get, To#jid.lserver, [], [US]) of
|
||||
Items when is_list(Items) ->
|
||||
XItems = lists:map(fun item_to_xml/1, Items),
|
||||
IQ#iq{type = result,
|
||||
sub_el = [{xmlelement, "query",
|
||||
[{"xmlns", ?NS_ROSTER}],
|
||||
XItems}]};
|
||||
_ ->
|
||||
IQ#iq{type = error, sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]}
|
||||
end.
|
||||
|
||||
get_user_roster(Acc, {LUser, LServer}) ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
case catch ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
@ -130,7 +143,7 @@ process_iq_get(From, _To, #iq{sub_el = SubEl} = IQ) ->
|
||||
_ ->
|
||||
[]
|
||||
end,
|
||||
XItems = lists:flatmap(
|
||||
RItems = lists:flatmap(
|
||||
fun(I) ->
|
||||
case raw_to_record(I) of
|
||||
error ->
|
||||
@ -146,33 +159,6 @@ process_iq_get(From, _To, #iq{sub_el = SubEl} = IQ) ->
|
||||
[item_to_xml(R#roster{groups = Groups})]
|
||||
end
|
||||
end, Items),
|
||||
IQ#iq{type = result,
|
||||
sub_el = [{xmlelement, "query",
|
||||
[{"xmlns", ?NS_ROSTER}],
|
||||
XItems}]};
|
||||
_ ->
|
||||
IQ#iq{type = error, sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]}
|
||||
end.
|
||||
|
||||
get_user_roster(Acc, {LUser, LServer}) ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
case catch ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
["select username, jid, nick, subscription, ask, "
|
||||
"server, subscribe, type from rosterusers "
|
||||
"where username='", Username, "'"]) of
|
||||
{selected, ["username", "jid", "nick", "subscription", "ask",
|
||||
"server", "subscribe", "type"],
|
||||
Items} when is_list(Items) ->
|
||||
RItems = lists:flatmap(
|
||||
fun(I) ->
|
||||
case raw_to_record(I) of
|
||||
error ->
|
||||
[];
|
||||
R ->
|
||||
[R]
|
||||
end
|
||||
end, Items),
|
||||
RItems ++ Acc;
|
||||
_ ->
|
||||
Acc
|
||||
|
Loading…
Reference in New Issue
Block a user