mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/web/ejabberd_web_admin.erl: Added user's roster page
* src/mod_irc/mod_irc_connection.erl: Bugfix SVN Revision: 253
This commit is contained in:
parent
73d7e1161e
commit
a8f4e84503
@ -1,3 +1,9 @@
|
||||
2004-08-03 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/web/ejabberd_web_admin.erl: Added user's roster page
|
||||
|
||||
* src/mod_irc/mod_irc_connection.erl: Bugfix
|
||||
|
||||
2004-08-01 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/tls/tls.erl: Added recv_data/2 function
|
||||
|
@ -303,8 +303,8 @@ handle_info({route_chan, Channel, Resource,
|
||||
{xmlelement, "iq", Attrs, Els} = El},
|
||||
StateName, StateData) ->
|
||||
From = StateData#state.user,
|
||||
To = {lists:concat([Channel, "%", StateData#state.server]),
|
||||
StateData#state.myname, StateData#state.nick},
|
||||
To = jlib:make_jid(lists:concat([Channel, "%", StateData#state.server]),
|
||||
StateData#state.myname, StateData#state.nick),
|
||||
case jlib:iq_query_info(El) of
|
||||
#iq{xmlns = ?NS_MUC_ADMIN} = IQ ->
|
||||
iq_admin(StateData, Channel, From, To, IQ);
|
||||
|
@ -777,6 +777,13 @@ process_admin(#request{user = User,
|
||||
Res = user_info(U, Query, Lang),
|
||||
make_xhtml(Res, Lang);
|
||||
|
||||
process_admin(#request{user = User,
|
||||
path = ["user", U, "roster"],
|
||||
q = Query,
|
||||
lang = Lang} = Request) ->
|
||||
Res = user_roster(U, Query, Lang),
|
||||
make_xhtml(Res, Lang);
|
||||
|
||||
process_admin(#request{user = User,
|
||||
path = ["nodes"],
|
||||
q = Query,
|
||||
@ -1135,6 +1142,65 @@ user_parse_query(User, Query) ->
|
||||
end.
|
||||
|
||||
|
||||
-record(roster, {uj,
|
||||
user,
|
||||
jid,
|
||||
name = "",
|
||||
subscription = none,
|
||||
ask = none,
|
||||
groups = [],
|
||||
xattrs = [],
|
||||
xs = []}).
|
||||
|
||||
ask_to_pending(subscribe) -> out;
|
||||
ask_to_pending(unsubscribe) -> none;
|
||||
ask_to_pending(Ask) -> Ask.
|
||||
|
||||
user_roster(User, Query, Lang) ->
|
||||
%Res = user_parse_query(User, Query),
|
||||
Res = nothing, % TODO
|
||||
LUser = jlib:nameprep(User),
|
||||
Items = mnesia:dirty_index_read(roster, LUser, #roster.user),
|
||||
SItems = lists:sort(Items),
|
||||
FItems =
|
||||
case SItems of
|
||||
[] ->
|
||||
[?CT("None")];
|
||||
_ ->
|
||||
[?XE("table",
|
||||
[?XE("thead",
|
||||
[?XE("tr",
|
||||
[?XCT("td", "JID"),
|
||||
?XCT("td", "Name"),
|
||||
?XCT("td", "Subscription"),
|
||||
?XCT("td", "Pending")
|
||||
])]),
|
||||
?XE("tbody",
|
||||
lists:map(
|
||||
fun(R) ->
|
||||
?XE("tr",
|
||||
[?XE("td", [?C(jlib:jid_to_string(
|
||||
R#roster.jid))]),
|
||||
?XE("td", [?C(R#roster.name)]),
|
||||
?XE("td",
|
||||
[?C(atom_to_list(
|
||||
R#roster.subscription))]),
|
||||
?XE("td",
|
||||
[?C(atom_to_list(
|
||||
ask_to_pending(
|
||||
R#roster.ask)))])])
|
||||
end, SItems))])]
|
||||
end,
|
||||
[?XC("h1", "Roster of " ++ User)] ++
|
||||
case Res of
|
||||
ok -> [?CT("submitted"), ?P];
|
||||
error -> [?CT("bad format"), ?P];
|
||||
nothing -> []
|
||||
end ++
|
||||
[?XAE("form", [{"method", "post"}],
|
||||
FItems)].
|
||||
|
||||
|
||||
get_nodes(Lang) ->
|
||||
RunningNodes = mnesia:system_info(running_db_nodes),
|
||||
StoppedNodes = lists:usort(mnesia:system_info(db_nodes) ++
|
||||
|
Loading…
Reference in New Issue
Block a user