summaryrefslogtreecommitdiff
path: root/src/jwebmail/webmail.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jwebmail/webmail.py')
-rw-r--r--src/jwebmail/webmail.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/jwebmail/webmail.py b/src/jwebmail/webmail.py
index cb4d5db..9c446c2 100644
--- a/src/jwebmail/webmail.py
+++ b/src/jwebmail/webmail.py
@@ -190,11 +190,11 @@ def writemail():
return render_template("writemail.html", form=WriteForm())
-def move(folder):
+def move(folder=""):
folders = get_read_mails_logged_in().folders()
- mm = request.args.getlist("mail")
- to_folder = request.args["folder"]
+ mm = request.form.getlist("mail")
+ to_folder = request.form["select-folder"]
if folder not in folders or to_folder not in folders:
raise ValueError("folder not valid")
@@ -206,6 +206,27 @@ def move(folder):
return redirect(url_for("displayheaders"), 303)
+def remove(folder=""):
+ folders = get_read_mails_logged_in().add_folder("Trash")
+
+ mm = request.form.getlist("mail")
+
+ folders = get_read_mails_logged_in().folders()
+
+ if folder not in folders:
+ raise ValueError("folder not valid")
+
+ if folder == "Trash":
+ for m in mm:
+ get_read_mails_logged_in().remove(m, folder)
+ else:
+ for m in mm:
+ get_read_mails_logged_in().move(m, folder, "Trash")
+
+ flash(gettext("succ_remove"))
+ return redirect(url_for("displayheaders"), 303)
+
+
def sendmail():
form = WriteForm()