]> granicus.if.org Git - ejabberd/commitdiff
Generate main XML file also when exporting only a vhost (EJAB-1098)
authorBadlop <badlop@process-one.net>
Mon, 23 Nov 2009 18:34:36 +0000 (18:34 +0000)
committerBadlop <badlop@process-one.net>
Mon, 23 Nov 2009 18:34:36 +0000 (18:34 +0000)
SVN Revision: 2753

src/ejabberd_piefxis.erl

index 4cc391fb8465577d0137223724368aa70a69e429..db50c1630cfdfc8831bd228d39d0e9fb826fcfbf 100644 (file)
@@ -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) ->