def roster_background_thread(self, sr):
'''Entry for background roster update thread'''
try:
logging.debug('roster_thread for ' + str(sr))
# Allow test hooks with static ejabberd_controller
if hasattr(self.ctx, 'ejabberd_controller') and self.ctx.ejabberd_controller is not None:
e = self.ctx.ejabberd_controller
else:
e = ejabberdctl(self.ctx)
groups, commands = self.roster_update_users(e, sr)
self.roster_update_groups(e, groups)
# For some reason, the vcard changes are not pushed to the clients. Rinse and repeat.
# Maybe not necessary with synchronous thread?
# for cmd in commands:
# e.execute(cmd)
self.ctx.shared_roster_db.sync()
except AttributeError:
pass # For tests
except Exception, err:
(etype, value, tb) = sys.exc_info()
traceback.print_exception(etype, value, tb)
logging.warn('roster_groups thread: %s:\n%s'
% (str(err), ''.join(traceback.format_tb(tb))))
return False
评论列表
文章目录