From b2a2e0f135f54a562c7157066df5412d32608482 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 31 Jan 2017 17:50:04 +0100 Subject: [PATCH] Support non-JID lines in command create_rooms_file --- src/mod_muc_admin.erl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl index 55f182ba3..feaa42b1f 100644 --- a/src/mod_muc_admin.erl +++ b/src/mod_muc_admin.erl @@ -529,7 +529,9 @@ destroy_rooms_file(Filename) -> read_rooms(_F, eof, L) -> L; - +read_rooms(F, no_room, L) -> + RJID2 = read_room(F), + read_rooms(F, RJID2, L); read_rooms(F, RJID, L) -> RJID2 = read_room(F), read_rooms(F, RJID2, [RJID | L]). @@ -548,9 +550,12 @@ read_room(F) -> %% This function is quite rudimentary %% and may not be accurate split_roomjid(RoomJID) -> - [Name, Host] = binary:split(RoomJID, <<"@">>), + split_roomjid2(binary:split(RoomJID, <<"@">>)). +split_roomjid2([Name, Host]) -> [_MUC_service_name, ServerHost] = binary:split(Host, <<".">>), - {Name, Host, ServerHost}. + {Name, Host, ServerHost}; +split_roomjid2(_) -> + no_room. %%---------------------------- %% Create Rooms in File -- 2.40.0