Skip to content

Commit

Permalink
wgc_xmpp: remove waiting on empty roster
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixaill committed Jan 3, 2020
1 parent e377a74 commit 6e4f4ba
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions wgc/wgc_xmpp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
import logging
from typing import Dict

Expand Down Expand Up @@ -80,12 +79,6 @@ def get_xmpp_domain(self) -> str:

#Roster checks
async def is_friend(self, account_id) -> bool:
while len(self.client_roster) == 0:
try:
await asyncio.sleep(1)
except asyncio.CancelledError:
break

for jid in self.client_roster:
friend_id = jid.split('@', 1)[0]
if friend_id == str(account_id):
Expand All @@ -97,12 +90,6 @@ async def is_friend(self, account_id) -> bool:
async def get_friends(self) -> Dict[str,str]:
result = dict()

while len(self.client_roster) == 0:
try:
await asyncio.sleep(1)
except asyncio.CancelledError:
break

for jid in self.client_roster:
user_id = jid.split('@', 1)[0]
if user_id == str(self._account_id):
Expand All @@ -113,12 +100,6 @@ async def get_friends(self) -> Dict[str,str]:


async def get_presence(self, user_id: str) -> str:
while len(self.client_roster) == 0:
try:
await asyncio.sleep(1)
except asyncio.CancelledError:
break

for jid in self.client_roster:
if jid.split('@', 1)[0] == str(user_id):
return 'online' if self._game.lower() in self.client_roster[jid].resources else 'offline'
Expand Down

0 comments on commit 6e4f4ba

Please sign in to comment.