messenger v0.9
This commit is contained in:
parent
5b54f3f636
commit
ae6bf0f96d
13 changed files with 105 additions and 115 deletions
|
|
@ -6,9 +6,7 @@ import mailroom
|
|||
|
||||
|
||||
# Independent loop that updates mailboxes.
|
||||
async def messenger():
|
||||
|
||||
print("Running Messenger")
|
||||
async def messenger():
|
||||
|
||||
while True:
|
||||
|
||||
|
|
@ -19,7 +17,6 @@ async def messenger():
|
|||
|
||||
# Grab a mailbox.
|
||||
mailbox = mailroom.que.get()
|
||||
print(f"Handling mailbox: {mailbox.name}.")
|
||||
|
||||
# Handle every message in outbox.
|
||||
while not mailbox.outbox.empty():
|
||||
|
|
@ -27,6 +24,7 @@ async def messenger():
|
|||
|
||||
# Get mailbox of target and put mail there.
|
||||
target_mailbox = mailroom.get_mailbox(message.target)
|
||||
print(f"{mailbox.name} -> {target_mailbox.name}: {message.text}")
|
||||
await target_mailbox.inbox.put(message)
|
||||
|
||||
# Put the mailbox back
|
||||
|
|
|
|||
Loading…
Reference in a new issue