示例#1
0
    def send_message(self, guid, handle, message, subject, message_type,
                     recipient_encryption_key):
        MessageStore().save_message(guid, handle, "", recipient_encryption_key,
                                    subject, message_type, message, "",
                                    time.time(), "", True)

        def send(node_to_send):
            n = node_to_send if node_to_send is not None else Node(
                unhexlify(guid), "123.4.5.6", 1234)
            self.factory.mserver.send_message(
                n, recipient_encryption_key,
                Plaintext_Message.Type.Value(message_type.upper()), message,
                subject)

        self.factory.kserver.resolve(unhexlify(guid)).addCallback(send)
示例#2
0
 def __init__(self, web_socket_factory):
     self.ws = web_socket_factory
     self.db = MessageStore()