mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-02-02 17:34:47 -05:00
Create messageboard.mu
This commit is contained in:
parent
f37ce14822
commit
570b99d814
41
nomadnet/apps/messageboard/messageboard.mu
Normal file
41
nomadnet/apps/messageboard/messageboard.mu
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/python3
|
||||
import time
|
||||
import os
|
||||
import RNS.vendor.umsgpack as msgpack
|
||||
|
||||
message_board_peer = 'please_replace'
|
||||
userdir = os.path.expanduser("~")
|
||||
|
||||
if os.path.isdir("/etc/nomadmb") and os.path.isfile("/etc/nomadmb/config"):
|
||||
configdir = "/etc/nomadmb"
|
||||
elif os.path.isdir(userdir+"/.config/nomadmb") and os.path.isfile(userdir+"/.config/nomadmb/config"):
|
||||
configdir = userdir+"/.config/nomadmb"
|
||||
else:
|
||||
configdir = userdir+"/.nomadmb"
|
||||
|
||||
storagepath = configdir+"/storage"
|
||||
if not os.path.isdir(storagepath):
|
||||
os.makedirs(storagepath)
|
||||
|
||||
boardpath = configdir+"/storage/board"
|
||||
|
||||
print('`!`F222`Bddd`cNomadNet Message Board')
|
||||
|
||||
print('-')
|
||||
print('`a`b`f')
|
||||
print("")
|
||||
print("To add a message to the board just converse with the NomadNet Message Board at `[lxmf@{}]".format(message_board_peer))
|
||||
time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
|
||||
print("Last Updated: {}".format(time_string))
|
||||
print("")
|
||||
print('>Messages')
|
||||
print(" Date Time Username Message")
|
||||
f = open(boardpath, "rb")
|
||||
board_contents = msgpack.unpack(f)
|
||||
board_contents.reverse()
|
||||
|
||||
for content in board_contents:
|
||||
print("`a{}".format(content.rstrip()))
|
||||
print("")
|
||||
|
||||
f.close()
|
Loading…
x
Reference in New Issue
Block a user