diff --git a/web/app.py b/web/app.py
index 8832670..64fb4bb 100644
--- a/web/app.py
+++ b/web/app.py
@@ -2488,6 +2488,30 @@ TG #: ''' + str(tg_d.tg) + '''
content = '
No posts by user.
'
all_post = ''
return render_template('ss.html', markup_content = Markup(content), all_post = Markup(post_content), user_id = dmr_id)
+
+ @app.route('/mail/', methods=['GET'])
+ @login_required
+ def get_mail(user):
+ if current_user.username == user:
+ if request.args.get('delete_mail'):
+ mailbox_del(int(request.args.get('delete_mail')))
+ content = '''Deleted message.
+ Redirecting in 3 seconds.
+ '''
+ else:
+ mail_all = MailBox.query.filter_by(rcv_callsign=user.upper()).order_by(MailBox.time.desc()).all()
+ content = ''
+ for i in mail_all:
+ content = content + '''
+
+ ''' + i.snd_callsign + ''' - ''' + str(i.snd_id) + ''' |
+ ''' + i.message + ''' |
+ ''' + str(i.time.strftime(time_format)) + ''' |
+ |
+
'''
+ else:
+ content = 'Not your mailbox.
'
+ return render_template('mail.html', markup_content = Markup(content), user_id = user)
@app.route('/talkgroups/') #, methods=['POST', 'GET'])
@@ -2797,8 +2821,39 @@ Name: ''' + p.name + ''' - Port: ''' + str(
server = _server,
system_name = _system_name
)
+ add_sms_mail = MailBox(
+ snd_callsign = _snd_call,
+ rcv_callsign = _rcv_call,
+ message = _msg,
+ time = datetime.datetime.utcnow(),
+ snd_id = _snd_id,
+ rcv_id = _rcv_id,
+ server = _server,
+ system_name = _system_name
+ )
db.session.add(add_sms)
+ db.session.add(add_sms_mail)
db.session.commit()
+
+ def mailbox_add(_snd_call, _rcv_call, _msg, _snd_id, _rcv_id, _server, _system_name):
+ add_sms_mail = MailBox(
+ snd_callsign = _snd_call,
+ rcv_callsign = _rcv_call,
+ message = _msg,
+ time = datetime.datetime.utcnow(),
+ snd_id = _snd_id,
+ rcv_id = _rcv_id,
+ server = _server,
+ system_name = _system_name
+ )
+ db.session.add(add_sms_mail)
+ db.session.commit()
+
+ def mailbox_del(_id):
+ mbd = MailBox.query.filter_by(id=_id).first()
+ db.session.delete(mbd)
+ db.session.commit()
+
def trim_bb():
trim_bb = BulletinBoard.query.all()
diff --git a/web/templates/flask_user_layout.html b/web/templates/flask_user_layout.html
index 190eac0..0190f8d 100644
--- a/web/templates/flask_user_layout.html
+++ b/web/templates/flask_user_layout.html
@@ -109,6 +109,9 @@
{% endif %}
+
+ Mailbox
+
Passphrase(s)
diff --git a/web/templates/mail.html b/web/templates/mail.html
new file mode 100644
index 0000000..6803097
--- /dev/null
+++ b/web/templates/mail.html
@@ -0,0 +1,30 @@
+{% extends 'flask_user/_public_base.html' %}
+{% block content %}
+
+ Mail
+
+
+
+
+
+
+
+
+ From |
+ Message |
+ Time |
+ Options |
+
+
+
+
+ {{markup_content}}
+
+
+
+
+
+
+
+
+{% endblock %}