def __init__(self, transport): transport.log("[Market] Initializing") # for now we have the id in the transport self._myself = transport._myself self._peers = transport._peers self._transport = transport self.query_ident = None self.reputation = Reputation(self._transport) self.orders = Orders(self._transport) # TODO: Persistent storage of nicknames and pages self.nicks = {} self.pages = {} # Register callbacks for incoming events transport.add_callback('peer', self.on_peer) transport.add_callback('query_page', self.on_query_page) transport.add_callback('page', self.on_page) transport.add_callback('negotiate_pubkey', self.on_negotiate_pubkey) transport.add_callback('proto_response_pubkey', self.on_response_pubkey) self.load_page() # Send Market Shout transport.send(shout({'text': 'Market Initialized'}))
def __init__(self, transport): transport.log("[market] Initializing") # for now we have the id in the transport self._myself = transport._myself self._peers = transport._peers self._transport = transport self.query_ident = None self.reputation = Reputation(self._transport) self.orders = Orders(self._transport) # if something comes in, store it: self.nicks = {} self.pages = {} # register callbacks for incoming events transport.add_callback('peer', self.on_peer) transport.add_callback('query_page', self.on_query_page) transport.add_callback('page', self.on_page) transport.add_callback('negotiate_pubkey', self.on_negotiate_pubkey) transport.add_callback('response_pubkey', self.on_response_pubkey) self.load_page() # send something transport.send(shout({'text': 'xxxxx'}))
def __init__(self, transport): transport.log("[Market] Initializing") # for now we have the id in the transport self._myself = transport._myself self._peers = transport._peers self._transport = transport self.query_ident = None self.reputation = Reputation(self._transport) self.orders = Orders(self._transport) self.order_entries = self.orders._orders # TODO: Persistent storage of nicknames and pages self.nicks = {} self.pages = {} # Connect to database MONGODB_URI = 'mongodb://localhost:27017' _dbclient = MongoClient() self._db = _dbclient.openbazaar # Register callbacks for incoming events transport.add_callback('query_myorders', self.on_query_myorders) transport.add_callback('peer', self.on_peer) transport.add_callback('query_page', self.on_query_page) transport.add_callback('page', self.on_page) transport.add_callback('negotiate_pubkey', self.on_negotiate_pubkey) transport.add_callback('proto_response_pubkey', self.on_response_pubkey) self.load_page() # Send Market Shout transport.send(shout({'text': 'Market Initialized'}))
def __init__(self, transport): self._log = logging.getLogger(self.__class__.__name__) self._log.info("Initializing") # for now we have the id in the transport self._myself = transport._myself self._peers = transport._peers self._transport = transport self.query_ident = None self.reputation = Reputation(self._transport) self.orders = Orders(self._transport) self.order_entries = self.orders._orders # TODO: Persistent storage of nicknames and pages self.nicks = {} self.pages = {} # Connect to database MONGODB_URI = 'mongodb://localhost:27017' _dbclient = MongoClient() self._db = _dbclient.openbazaar # Register callbacks for incoming events transport.add_callback('query_myorders', self.on_query_myorders) transport.add_callback('peer', self.on_peer) transport.add_callback('query_page', self.on_query_page) transport.add_callback('page', self.on_page) transport.add_callback('negotiate_pubkey', self.on_negotiate_pubkey) transport.add_callback('proto_response_pubkey', self.on_response_pubkey) self.load_page() # Send Market Shout transport.send(shout({'text': 'Market Initialized'}))
def test_on_message_not_ok(self): data = protocol.shout({}) self.tl.trigger_callbacks = mock.MagicMock() self.tl._on_message(data) self.tl.trigger_callbacks.assert_called_with(data['type'], data)
def client_shout(self, socket_handler, msg): msg['uri'] = self.transport.uri msg['pubkey'] = self.transport.pubkey msg['senderGUID'] = self.transport.guid msg['senderNick'] = self.transport.nickname self.transport.send(protocol.shout(msg))
def client_shout(self, socket_handler, msg): msg['uri'] = self._transport._uri msg['pubkey'] = self._transport.pubkey msg['senderGUID'] = self._transport.guid msg['senderNick'] = self._transport._nickname self._transport.send(protocol.shout(msg))
def client_shout(self, socket_handler, msg): self._transport.send(protocol.shout(msg))
def client_shout(self, socket_handler, msg): msg['uri'] = self._transport._uri msg['pubkey'] = self._transport.pubkey msg['guid'] = self._transport.guid print 'MESSAGE:',msg self._transport.send(protocol.shout(msg))