{error, ?ERR_BAD_REQUEST}.
change_config(Config, StateData) ->
+ send_config_change_info(Config, StateData),
NSD = StateData#state{config = Config},
case {(StateData#state.config)#config.persistent,
Config#config.persistent}
_ -> {result, [], NSD}
end.
+send_config_change_info(Config, #state{config = Config}) -> ok;
+send_config_change_info(New, #state{config = Old} = StateData) ->
+ Codes = case {Old#config.logging, New#config.logging} of
+ {false, true} -> [<<"170">>];
+ {true, false} -> [<<"171">>];
+ _ -> []
+ end
+ ++
+ case {Old#config.anonymous, New#config.anonymous} of
+ {true, false} -> [<<"172">>];
+ {false, true} -> [<<"173">>];
+ _ -> []
+ end
+ ++
+ case Old#config{anonymous = New#config.anonymous,
+ logging = New#config.logging} of
+ New -> [];
+ _ -> [<<"104">>]
+ end,
+ StatusEls = [#xmlel{name = <<"status">>,
+ attrs = [{<<"code">>, Code}],
+ children = []} || Code <- Codes],
+ Message = #xmlel{name = <<"message">>,
+ attrs = [{<<"type">>, <<"groupchat">>},
+ {<<"id">>, randoms:get_string()}],
+ children = [#xmlel{name = <<"x">>,
+ attrs = [{<<"xmlns">>, ?NS_MUC_USER}],
+ children = StatusEls}]},
+ send_multiple(StateData#state.jid,
+ StateData#state.server_host,
+ StateData#state.users,
+ Message).
+
remove_nonmembers(StateData) ->
lists:foldl(fun ({_LJID, #user{jid = JID}}, SD) ->
Affiliation = get_affiliation(JID, SD),
end
end, RoomCfg#xdata.fields),
NewRoomCfg = #xdata{type = submit, fields = NewFields},
- %% BUG: We should not receive any sub_els!
- #iq{type = result, sub_els = [_|_]} =
- send_recv(Config, #iq{type = set, to = Room,
- sub_els = [#muc_owner{config = NewRoomCfg}]}),
+ ID = send(Config, #iq{type = set, to = Room,
+ sub_els = [#muc_owner{config = NewRoomCfg}]}),
+ ?recv2(#iq{type = result, id = ID},
+ #message{from = Room, type = groupchat,
+ sub_els = [#muc_user{status_codes = [104]}]}),
%% Set subject
send(Config, #message{to = Room, type = groupchat,
body = [#text{data = Subject}]}),