customizable muc host
+ add optional argument to the EjabberdMetrics class to customize the default muc host sub-domain
This commit is contained in:
		
							parent
							
								
									cf0357197e
								
							
						
					
					
						commit
						95616508ce
					
				| 
						 | 
				
			
			@ -13,8 +13,9 @@ class EjabberdMetrics:
 | 
			
		|||
    """
 | 
			
		||||
    class to fetch metrics per xmlrpc
 | 
			
		||||
    """
 | 
			
		||||
    def __init__(self, url, login=None, api="rpc"):
 | 
			
		||||
    def __init__(self, url, login=None, api="rpc", muc_host: str = 'conference'):
 | 
			
		||||
        self._login = login
 | 
			
		||||
        self.muc_host = muc_host
 | 
			
		||||
        if api == "rpc":
 | 
			
		||||
            self.url = url
 | 
			
		||||
            self._cmd = self._rpc
 | 
			
		||||
| 
						 | 
				
			
			@ -156,7 +157,7 @@ class EjabberdMetrics:
 | 
			
		|||
        host = "global"
 | 
			
		||||
        if vhost is not None:
 | 
			
		||||
            if self._verstring.major >= 19:
 | 
			
		||||
                host = "conference." + vhost
 | 
			
		||||
                host = '.'.join([self.muc_host, vhost])
 | 
			
		||||
            else:
 | 
			
		||||
                host = vhost
 | 
			
		||||
        result = self._cmd("muc_online_rooms", {"host": host})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue