reconnection fixes

This commit is contained in:
ingvar1995 2017-03-03 22:09:45 +03:00
parent b227ed627a
commit 0cfb8efefa
2 changed files with 8 additions and 3 deletions

View file

@ -193,7 +193,7 @@ class Contact(basecontact.BaseContact):
if not self._search_index:
return None
for i in range(self._search_index + 1, 0):
if type(self._corr[i]) is not TextMessage:
if self._corr[i].get_type() > 1:
continue
message = self._corr[i].get_data()[0]
if re.search(self._search_string, message, re.IGNORECASE) is not None:

View file

@ -41,6 +41,7 @@ class Profile(basecontact.BaseContact, Singleton):
self._call = calls.AV(tox.AV) # object with data about calls
self._incoming_calls = set()
self._load_history = True
self._waiting_for_reconnection = False
self._factory = items_factory.ItemsFactory(self._screen.friends_list, self._messages)
settings = Settings.get_instance()
self._sorting = settings['sorting']
@ -87,7 +88,7 @@ class Profile(basecontact.BaseContact, Singleton):
if status is not None:
self._tox.self_set_status(status)
else:
QtCore.QTimer.singleShot(45000, self.reconnect)
QtCore.QTimer.singleShot(50000, self.reconnect)
def set_name(self, value):
if self.name == value:
@ -855,9 +856,13 @@ class Profile(basecontact.BaseContact, Singleton):
self.update_filtration()
def reconnect(self):
if self._waiting_for_reconnection:
return
self._waiting_for_reconnection = False
if self.status is None or all(list(map(lambda x: x.status is None, self._contacts))) and len(self._contacts):
self._waiting_for_reconnection = True
self.reset(self._screen.reset)
QtCore.QTimer.singleShot(45000, self.reconnect)
QtCore.QTimer.singleShot(50000, self.reconnect)
def close(self):
for friend in self._contacts: