From 894f0abdfa813a43e571873714534b4007701472 Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 2 Jul 2010 23:38:22 +0200 Subject: [PATCH] Prevent Dialyzer warnings about case inside macro --- src/mod_muc/mod_muc_room.erl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mod_muc/mod_muc_room.erl b/src/mod_muc/mod_muc_room.erl index b984e6a4c..772fc1143 100644 --- a/src/mod_muc/mod_muc_room.erl +++ b/src/mod_muc/mod_muc_room.erl @@ -3145,12 +3145,15 @@ set_config(XEl, StateData) -> end end. +-define(SET_BOOL_XOPT_FALSE(Opt), set_xoption(Opts, Config#config{Opt = false})). +-define(SET_BOOL_XOPT_TRUE (Opt), set_xoption(Opts, Config#config{Opt = true})). + -define(SET_BOOL_XOPT(Opt, Val), case Val of - "0" -> set_xoption(Opts, Config#config{Opt = false}); - "false" -> set_xoption(Opts, Config#config{Opt = false}); - "1" -> set_xoption(Opts, Config#config{Opt = true}); - "true" -> set_xoption(Opts, Config#config{Opt = true}); + "0" -> ?SET_BOOL_XOPT_FALSE(Opt); + "false" -> ?SET_BOOL_XOPT_FALSE(Opt); + "1" -> ?SET_BOOL_XOPT_TRUE(Opt); + "true" -> ?SET_BOOL_XOPT_TRUE(Opt); _ -> {error, 'bad-request'} end). @@ -3208,9 +3211,9 @@ set_xoption([{"anonymous", [Val]} | Opts], Config) -> set_xoption([{"muc#roomconfig_whois", [Val]} | Opts], Config) -> case Val of "moderators" -> - ?SET_BOOL_XOPT(anonymous, "1"); + ?SET_BOOL_XOPT_TRUE(anonymous); "anyone" -> - ?SET_BOOL_XOPT(anonymous, "0"); + ?SET_BOOL_XOPT_FALSE(anonymous); _ -> {error, 'bad-request'} end;