Comparison

plugins/mod_component.lua @ 13202:173038306750

plugins: Use get_option_enum where appropriate
author Kim Alvefur <zash@zash.se>
date Sat, 16 Jan 2021 21:04:58 +0100
parent 12977:74b9e05af71e
child 13213:50324f66ca2a
comparison
equal deleted inserted replaced
13201:65fb0d7a2312 13202:173038306750
83 session:close{ condition = "not-authorized", text = "Given token does not match calculated token" }; 83 session:close{ condition = "not-authorized", text = "Given token does not match calculated token" };
84 return true; 84 return true;
85 end 85 end
86 86
87 if env.connected then 87 if env.connected then
88 local policy = module:get_option_string("component_conflict_resolve", "kick_new"); 88 local policy = module:get_option_enum("component_conflict_resolve", "kick_new", "kick_old");
89 if policy == "kick_old" then 89 if policy == "kick_old" then
90 env.session:close{ condition = "conflict", text = "Replaced by a new connection" }; 90 env.session:close{ condition = "conflict", text = "Replaced by a new connection" };
91 else -- kick_new 91 else -- kick_new
92 module:log("error", "Second component attempted to connect, denying connection"); 92 module:log("error", "Second component attempted to connect, denying connection");
93 session:close{ condition = "conflict", text = "Component already connected" }; 93 session:close{ condition = "conflict", text = "Component already connected" };