only add message to mailbox if user exists, comment out stuff

This commit is contained in:
KF7EEL 2022-02-23 09:11:10 -08:00
parent 563d3ec1fd
commit 1bd7495b7d
3 changed files with 35 additions and 31 deletions

View File

@ -1116,15 +1116,15 @@ class routerHBP(HBSYSTEM):
# just make a new one from the HBP header. This is good enough, and it saves lots of time
else:
self.STATUS[_slot]['RX_LC'] = LC_OPT + _dst_id + _rf_src
# Download rules
if _rf_src not in user_rules:
user_rules[_rf_src] = self.name
if _rf_src in user_rules:
## print('in')
if user_rules[_rf_src] != self.name:
user_rules[_rf_src] = self.name
## print('updated')
## print(user_rules)
## # Download rules
## if _rf_src not in user_rules:
## user_rules[_rf_src] = self.name
## if _rf_src in user_rules:
#### print('in')
## if user_rules[_rf_src] != self.name:
## user_rules[_rf_src] = self.name
#### print('updated')
#### print(user_rules)
for _bridge in BRIDGES:
## print(BRIDGES)
## print(_bridge)

View File

@ -1419,7 +1419,6 @@ def data_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _fr
## if int_id(_dst_id) == data_id:
if int_id(_dst_id) in data_id:
process_sms(_rf_src, msg_found, _call_type, UNIT_MAP[_rf_src][0])
## if int_id(_dst_id) != data_id:
if int_id(_dst_id) not in data_id:

View File

@ -3600,9 +3600,12 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + str(
server = _server,
system_name = _system_name
)
# Only add to mailbox if user exists
try:
usr_nm = User.query.filter(User.dmr_ids.ilike('%' + str(_rcv_id) + '%')).first()
add_sms_mail = MailBox(
snd_callsign = _snd_call,
rcv_callsign = _rcv_call,
rcv_callsign = str(usr_nm.username).upper(),
message = _msg,
time = datetime.datetime.utcnow(),
snd_id = _snd_id,
@ -3610,8 +3613,10 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + str(
server = _server,
system_name = _system_name
)
db.session.add(add_sms)
db.session.add(add_sms_mail)
except:
pass
db.session.add(add_sms)
db.session.commit()
def mailbox_add(_snd_call, _rcv_call, _msg, _snd_id, _rcv_id, _server, _system_name):
@ -5130,20 +5135,20 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + str(
@roles_required('Admin')
def test_peer_db():
if request.args.get('save_mode'):
if request.form.get('enabled') == 'true':
peer_enabled = False
use_acl = False
unit_enabled = False
peer_loose = True
if request.form.get('enabled') == 'True':
peer_enabled = True
## if request.form.get('loose') == 'true':
## peer_loose = True
if request.form.get('use_acl') == 'true':
if request.form.get('use_acl') == 'True':
use_acl = True
if request.form.get('enable_unit') == 'True':
unit_enabled = True
## else:
## peer_loose = False
peer_enabled = False
use_acl = False
unit_enabled = False
peer_loose = True
## print(request.form.get('enable_unit'))
## print(enable_unit)
if request.form.get('name_text') == '':
@ -5202,8 +5207,8 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + str(
<tr>
<td style="width: 175.567px;"><strong>&nbsp;Active:</strong></td>
<td style="width: 399.433px;">&nbsp;<select name="enabled">
<option value="true">True</option>
<option value="false">False</option>
<option value="True">True</option>
<option value="False">False</option>
</select></td>
</tr>
<tr>
@ -5414,8 +5419,8 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + str(
<td style="width: 175.567px;"><strong>&nbsp;Active:</strong></td>
<td style="width: 399.433px;">&nbsp;<select name="enabled">
<option value="''' + str(p.enabled) + '''" selected>Current: ''' + str(p.enabled) + '''</option>
<option value="true">True</option>
<option value="false">False</option>
<option value="True">True</option>
<option value="False">False</option>
</select></td>
</tr>
<tr>