2016-12-29 13 views
0

prosody 서버를 다시 시작하지 않고 muc 구성 요소를 추가하려면 다음 코드를 수행 한 다음 나머지 API를 사용하여 실행하려고합니다. 하지만 muc 구성 요소를로드 할 수 없습니다.prosody 서버를 다시 시작하지 않고 muc 구성 요소를 추가하는 방법

--------------code begin--------------- 
localh hm = require "core.hostmanager"; 
local mm = require "core.modulemanager"; 

host= "muc.example.co"; 
hm.activate(host); 
local key= "component_module"; 
local value = "muc"; 
cmg._M.set(host, key, value); 
mm.load_modules_for_host(host); 

-----code end----------------- 

prosody 서버를 다시로드하지 않고 어떻게 muc 서비스 지점을 활성화 할 수 있습니까? 코드 아래 사용

답변

0

우리는 그것을

local muc_host= "test.example.com" 
local hm = require "core.hostmanager"; 
local cmg = require "core.configmanager"; 
local append_text= 'Component "'..muc_host..'" "muc" \n' 

      --appending the text to config file 
      local file_name="/etc/prosody/prosody.cfg.lua" 
      file = io.open(file_name, "a") 
      file:write(append_text) 
      file:close() 
      -- load & activate new muc server 
      local lstatus=cmg.load(file_name) 
      local new_server_status = hm.activate(muc_host) 
      mm.load_modules_for_host(host) 
을 할 수 달성 할 수