From 51594b60118c93f2e0f125feddd0d333746f7811 Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 23 Nov 2009 18:34:36 +0000 Subject: [PATCH] Generate main XML file also when exporting only a vhost (EJAB-1098) SVN Revision: 2753 --- src/ejabberd_piefxis.erl | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ejabberd_piefxis.erl b/src/ejabberd_piefxis.erl index 4cc391fb8..db50c1630 100644 --- a/src/ejabberd_piefxis.erl +++ b/src/ejabberd_piefxis.erl @@ -212,7 +212,7 @@ add_user(El, Domain, User, Password) -> El), ok; {atomic, exists} -> - ?INFO_MSG("User ~p@~p already exists, using stored profile...~n", + io:format("Account ~s@~s already exists, updating it...~n", [User, Domain]), io:format(""), ok = exmpp_xml:foreach( @@ -417,10 +417,10 @@ to_list(B) when is_atom(B) -> atom_to_list(B). %%%================================== -%%%% Export server +%%%% Export hosts -%% @spec (Dir::string()) -> ok -export_server(Dir) -> +%% @spec (Dir::string(), Hosts::[string()]) -> ok +export_hosts(Dir, Hosts) -> try_start_exmpp(), FnT = make_filename_template(), @@ -430,7 +430,6 @@ export_server(Dir) -> print(Fd, make_piefxis_xml_head()), print(Fd, make_piefxis_server_head()), - Hosts = ?MYHOSTS, FilesAndHosts = [{make_host_filename(FnT, Host), Host} || Host <- Hosts], [print(Fd, make_xinclude(FnH)) || {FnH, _Host} <- FilesAndHosts], @@ -442,15 +441,21 @@ export_server(Dir) -> ok. +%%%================================== +%%%% Export server + +%% @spec (Dir::string()) -> ok +export_server(Dir) -> + Hosts = ?MYHOSTS, + export_hosts(Dir, Hosts). + %%%================================== %%%% Export host %% @spec (Dir::string(), Host::string()) -> ok export_host(Dir, Host) -> - try_start_exmpp(), - FnT = make_filename_template(), - FnH = make_host_filename(FnT, Host), - export_host(Dir, FnH, Host). + Hosts = [Host], + export_hosts(Dir, Hosts). %% @spec (Dir::string(), Fn::string(), Host::string()) -> ok export_host(Dir, FnH, Host) ->