|
|
@ -112,8 +112,8 @@ def add_debug_info(msg): |
|
|
|
return msg |
|
|
|
|
|
|
|
|
|
|
|
class UserInterface(pEp.UserInterface): |
|
|
|
def notifyHandshake(self, me, partner, signal): |
|
|
|
|
|
|
|
def this_notifyHandshake(me, partner, signal): |
|
|
|
print(colored(str(signal), "yellow"), end=" ") |
|
|
|
output("on " + device_name + "" if not me.fpr else |
|
|
|
"for identities " + str(me.fpr) + " " + str(partner.fpr)) |
|
|
@ -134,12 +134,11 @@ class UserInterface(pEp.UserInterface): |
|
|
|
try: |
|
|
|
if not options.noanswer: |
|
|
|
if options.reject: |
|
|
|
self.deliverHandshakeResult(SYNC_HANDSHAKE_REJECTED) |
|
|
|
pEp.deliver_handshake_result(SYNC_HANDSHAKE_REJECTED) |
|
|
|
else: |
|
|
|
self.deliverHandshakeResult(SYNC_HANDSHAKE_ACCEPTED) |
|
|
|
|
|
|
|
pEp.deliver_handshake_result(SYNC_HANDSHAKE_ACCEPTED) |
|
|
|
except NameError: |
|
|
|
self.deliverHandshakeResult(SYNC_HANDSHAKE_ACCEPTED) |
|
|
|
pEp.deliver_handshake_result(SYNC_HANDSHAKE_ACCEPTED) |
|
|
|
if signal in end_on: |
|
|
|
global the_end |
|
|
|
the_end = True |
|
|
@ -153,6 +152,7 @@ def run(name, color=None, imap=False, own_ident=1, leave=False): |
|
|
|
|
|
|
|
global device_name |
|
|
|
device_name = name |
|
|
|
pEp.notify_handshake = this_notifyHandshake |
|
|
|
|
|
|
|
if color: |
|
|
|
global output |
|
|
@ -170,7 +170,7 @@ def run(name, color=None, imap=False, own_ident=1, leave=False): |
|
|
|
|
|
|
|
me = pEp.Identity(imap_settings.IMAP_EMAIL, name + " of " + imap_settings.IMAP_USER, name) |
|
|
|
pEp.myself(me) |
|
|
|
pEp.messageToSend = messageImapToSend |
|
|
|
pEp.message_to_send = messageImapToSend |
|
|
|
else: |
|
|
|
me = pEp.Identity("alice@peptest.ch", name + " of Alice Neuman", name) |
|
|
|
pEp.myself(me) |
|
|
@ -183,22 +183,19 @@ def run(name, color=None, imap=False, own_ident=1, leave=False): |
|
|
|
me3 = pEp.Identity("alice@pep.foundation", name + " of Alice Neuman", name) |
|
|
|
pEp.myself(me3) |
|
|
|
|
|
|
|
pEp.messageToSend = messageToSend |
|
|
|
pEp.message_to_send = messageToSend |
|
|
|
|
|
|
|
if multithreaded: |
|
|
|
from threading import Thread |
|
|
|
def sync_thread(): |
|
|
|
print(colored("********* ", "yellow") + colored("sync_thread entered", color)) |
|
|
|
ui = UserInterface() |
|
|
|
print(colored("********* ", "yellow") + colored("UserInterface object created", color)) |
|
|
|
pEp.do_sync_protocol() |
|
|
|
pEp.Sync.run() |
|
|
|
print(colored("********* ", "yellow") + colored("leaving sync_thread", color)) |
|
|
|
sync = Thread(target=sync_thread) |
|
|
|
sync.start() |
|
|
|
else: |
|
|
|
pEp.script_is_implementing_sync() |
|
|
|
sync = None |
|
|
|
ui = UserInterface() |
|
|
|
pEp.start_sync(); |
|
|
|
|
|
|
|
try: |
|
|
|
if leave: |
|
|
|