def typed_who(self, ignore): if len(self.manager.active_nodes) == 0: PynaDisplay.info('No nodes are active') return PynaDisplay.log('Active users') for node in self.manager.active_nodes: self.identity(node)
def __running__(self): '''Start up client thread, ''' # Provide information to user about its location and the client PynaDisplay.splash(self.manager.version) PynaDisplay.log('Node running on {0}:{1}\n'.format(self.location,self.port)) # Await initialization before starting client thread time.sleep(1) sender_thread = threading.Thread(target=self.ui.__running__) sender_thread.start()
def senderNeedsActivation(self, message, sender): """Checks to see if the sender is active or even authorized""" if self.manager.isActive(sender): return False if self.manager.isAuthorized(sender): self.manager.activate_node(sender) PynaDisplay.log("Registered {0} at {1}".format(sender["alias"], sender["location"])) return True return self.isAcceptableAnonymousMessage(message, sender)
def typed(self, filename): '''Attempt to import a node file''' active_nodes = self.manager.node_list.all_active() if len(active_nodes) == 0: PynaDisplay.info('No nodes are active') return print(' ') PynaDisplay.log('Active users') for node in active_nodes: node.identify() print(' ')
def does_sender_need_activation(self, message, sender): '''Checks to see if the sender is active or even authorized''' authorized_node = self.manager.node_list.find_node(sender['uid']) if authorized_node is not None: # Only show connection if coming from inactive if authorized_node.status == Node.Status.inactive: PynaDisplay.log('{0} (@{1}) is now online'.format(sender['alias'], sender['location'])) # Ensure that the node is active was_not_active = authorized_node.status != Node.Status.active self.activate_and_update(authorized_node, sender) return was_not_active return self.is_sender_authorized(message, sender)