arcs

Amateur Radio Chat Server with a modern interface
git clone git://squid-tech.com/arcs.git
Log | Files | Refs | README

commit 1fa353e89eb20c5202acef60c51b47e906e27f61
parent 6b2fe2a038a00e77a144c7d6ae6286e46c207d68
Author: joshiemoore <jxm5210@g.rit.edu>
Date:   Fri, 20 Dec 2019 02:28:02 -0500

Add client mode

Diffstat:
Marcs.py | 37++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/arcs.py b/arcs.py @@ -273,16 +273,44 @@ def serverd(port, textdisplay): textdisplay.insert("end", dispmsg) +""" +Main client daemon that handles incoming messages. +This function behaves similarly to the server daemon, but it doesn't +route traffic anywhere. +""" +def clientd(port, textdisplay): + while True: + # receive and parse a packet + recv = AX25parse(AX25read(port)) + msg = recv[2] + + # clean up strange packets + # i'm not currently sure what to do with these or where they come from + if ":}" in msg: + msg = msg[msg.index(":}") + 2:] + + + # get the message recipient + dest = msg[1:10] + + # ignore the message if the client is not the recipient + if dest != padcall(MYCALL): + continue + + # trim the message + msg = msg[11:] + + dispmsg = padcall(recv[1]) + ": " + msg + + textdisplay.insert("end", dispmsg) + """ Send a chat message from the GUI, and clear the text box. """ - def chatGuiSend(port, entryText): sendMessage(port, MYCALL, HOST, _PATH, entryText.get()) entryText.set("") - - def main(): global _SERVER @@ -334,6 +362,9 @@ def main(): # start server daemon threading.Thread(target=serverd, args=[ser, display]).start() + else: + # start client daemon + threading.Thread(target=clientd, args=[ser, display]).start() # start the GUI