Compare commits

..

No commits in common. "ghetto_muc_fix" and "master" have entirely different histories.

1 changed files with 5 additions and 16 deletions

View File

@ -60,16 +60,6 @@ class EjabberdApiCalls(EjabberdApi):
return None
# ghetto method until we have a better solution
@staticmethod
def _parse_muc_count(vhost, data: (list, dict)) -> int:
tmp = 0
for el in list(map(lambda x: x.split(sep="@"), data)):
if vhost in el[1]:
tmp += 1
return tmp
def fetch_onlineuser(self):
tmp = self.cmd("connected_users_info", {})
if "connected_users_info" not in tmp:
@ -151,13 +141,12 @@ class EjabberdApiCalls(EjabberdApi):
def fetch_muc_count(self, vhost=None, muc_host="conference"):
host = "global"
result = self.cmd("muc_online_rooms", {"host": host})
if vhost is not None:
# if self.verstring.major >= 19:
# host = ".".join([muc_host, vhost])
# else:
# host = vhost
return self._parse_muc_count(vhost, result)
if self.verstring.major >= 19:
host = ".".join([muc_host, vhost])
else:
host = vhost
result = self.cmd("muc_online_rooms", {"host": host})
if "rooms" in result:
return len(result["rooms"])
return len(result)