mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-03-28 17:32:36 +01:00
bits&bytes
This commit is contained in:
@@ -351,7 +351,7 @@ surveyRecordLocation=True
|
||||
responseDelay = 2.2
|
||||
# delay in seconds for splits in messages to avoid message collision /throttling
|
||||
splitDelay = 2.5
|
||||
# message chunk size for sending at high success rate, chunkr allows exceeding by 3 characters
|
||||
# message chunk size in charcters, chunkr allows exceeding by 3 characters
|
||||
MESSAGE_CHUNK_SIZE = 160
|
||||
# Request Acknowledgement of message OTA
|
||||
wantAck = False
|
||||
|
||||
@@ -1089,8 +1089,6 @@ def handle_messages(message, deviceID, channel_number, msg_history, publicChanne
|
||||
response = ""
|
||||
header = "📨Messages:"
|
||||
# Calculate safe byte limit (account for header and some overhead)
|
||||
# Meshtastic has ~237 byte limit, use conservative 200 bytes for message content
|
||||
max_bytes = 200
|
||||
header_bytes = len(header.encode('utf-8'))
|
||||
available_bytes = max_bytes - header_bytes
|
||||
|
||||
|
||||
@@ -96,13 +96,15 @@ def bbs_post_message(subject, message, fromNode):
|
||||
if str(fromNode) in bbs_ban_list:
|
||||
logger.warning(f"System: Naughty node {fromNode}, tried to post a message: {subject}, {message} and was dropped.")
|
||||
return "Message posted. ID is: " + str(messageID)
|
||||
|
||||
# validate message length isnt three times the MESSAGE_CHUNK_SIZE
|
||||
if len(message) > (3 * MESSAGE_CHUNK_SIZE):
|
||||
return "Message too long, max length is " + str(3 * MESSAGE_CHUNK_SIZE) + " characters."
|
||||
# validate not a duplicate message
|
||||
for msg in bbs_messages:
|
||||
if msg[1].strip().lower() == subject.strip().lower() and msg[2].strip().lower() == message.strip().lower():
|
||||
messageID = msg[0]
|
||||
return "Message posted. ID is: " + str(messageID)
|
||||
|
||||
# validate its not overlength by keeping in chunker limit
|
||||
# append the message to the list
|
||||
bbs_messages.append([messageID, subject, message, fromNode])
|
||||
logger.info(f"System: NEW Message Posted, subject: {subject}, message: {message} from {fromNode}")
|
||||
@@ -153,6 +155,14 @@ def bbs_post_dm(toNode, message, fromNode):
|
||||
if str(fromNode) in bbs_ban_list:
|
||||
logger.warning(f"System: Naughty node {fromNode}, tried to post a message: {message} and was dropped.")
|
||||
return "DM Posted for node " + str(toNode)
|
||||
|
||||
# validate message length isnt three times the MESSAGE_CHUNK_SIZE
|
||||
if len(message) > (3 * MESSAGE_CHUNK_SIZE):
|
||||
return "Message too long, max length is " + str(3 * MESSAGE_CHUNK_SIZE) + " characters."
|
||||
# validate not a duplicate message
|
||||
for msg in bbs_dm:
|
||||
if msg[0] == int(toNode) and msg[1].strip().lower() == message.strip().lower():
|
||||
return "DM Posted for node " + str(toNode)
|
||||
|
||||
# append the message to the list
|
||||
bbs_dm.append([int(toNode), message, int(fromNode)])
|
||||
|
||||
@@ -31,6 +31,7 @@ seenNodes = [] # list to hold the last seen nodes
|
||||
surveyTracker, tictactoeTracker, hamtestTracker, hangmanTracker, golfTracker, mastermindTracker, vpTracker, blackjackTracker, lemonadeTracker, dwPlayerTracker = ([], [], [], [], [], [], [], [], [], [])
|
||||
cmdHistory = [] # list to hold the command history for lheard and history commands
|
||||
msg_history = [] # list to hold the message history for the messages command
|
||||
max_bytes = 200 # Meshtastic has ~237 byte limit, use conservative 200 bytes for message content
|
||||
|
||||
# Read the config file, if it does not exist, create basic config file
|
||||
config = configparser.ConfigParser()
|
||||
@@ -384,7 +385,7 @@ try:
|
||||
# messaging settings
|
||||
responseDelay = config['messagingSettings'].getfloat('responseDelay', 0.7) # default 0.7
|
||||
splitDelay = config['messagingSettings'].getfloat('splitDelay', 0) # default 0
|
||||
MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160
|
||||
MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160 chars
|
||||
wantAck = config['messagingSettings'].getboolean('wantAck', False) # default False
|
||||
maxBuffer = config['messagingSettings'].getint('maxBuffer', 200) # default 200
|
||||
enableHopLogs = config['messagingSettings'].getboolean('enableHopLogs', False) # default False
|
||||
|
||||
Reference in New Issue
Block a user