while not selection == '0': print_menu() selection = input('>>> ') if selection == '0': pass elif selection == '1': print_messages() elif selection == '2': invio_messaggio() elif selection == '3': blocca_utente() elif selection == '4': sblocca_utente() else: print('\nOPZIONE NON DISPONIBILE') if __name__ == "__main__": mr = MessageReceiver(config.SERVER_URL, config.USER_ID, config.DB_PATH, config.MEDIA_FOLDER) print('Aggiornamento contatti...') update_users() mr.start() main_menu() mr.stop() mr.join()
def disconnect(self): self.disconnected = True MessageReceiver.stop() self.connection.close()