25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +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:
Alexey Shchepin 2004-08-02 22:17:05 +00:00
parent 73d7e1161e
commit a8f4e84503
3 changed files with 74 additions and 2 deletions

View File

@ -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> 2004-08-01 Alexey Shchepin <alexey@sevcom.net>
* src/tls/tls.erl: Added recv_data/2 function * src/tls/tls.erl: Added recv_data/2 function

View File

@ -303,8 +303,8 @@ handle_info({route_chan, Channel, Resource,
{xmlelement, "iq", Attrs, Els} = El}, {xmlelement, "iq", Attrs, Els} = El},
StateName, StateData) -> StateName, StateData) ->
From = StateData#state.user, From = StateData#state.user,
To = {lists:concat([Channel, "%", StateData#state.server]), To = jlib:make_jid(lists:concat([Channel, "%", StateData#state.server]),
StateData#state.myname, StateData#state.nick}, StateData#state.myname, StateData#state.nick),
case jlib:iq_query_info(El) of case jlib:iq_query_info(El) of
#iq{xmlns = ?NS_MUC_ADMIN} = IQ -> #iq{xmlns = ?NS_MUC_ADMIN} = IQ ->
iq_admin(StateData, Channel, From, To, IQ); iq_admin(StateData, Channel, From, To, IQ);

View File

@ -777,6 +777,13 @@ process_admin(#request{user = User,
Res = user_info(U, Query, Lang), Res = user_info(U, Query, Lang),
make_xhtml(Res, 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, process_admin(#request{user = User,
path = ["nodes"], path = ["nodes"],
q = Query, q = Query,
@ -1135,6 +1142,65 @@ user_parse_query(User, Query) ->
end. 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) -> get_nodes(Lang) ->
RunningNodes = mnesia:system_info(running_db_nodes), RunningNodes = mnesia:system_info(running_db_nodes),
StoppedNodes = lists:usort(mnesia:system_info(db_nodes) ++ StoppedNodes = lists:usort(mnesia:system_info(db_nodes) ++