Updating branch refs/heads/master
to 8774205db315a60e9a064e163a2f7e6c7acbea6a (commit)
from e8b479a9a5a465b5a5f005b9b16b3a2ed527bf65 (commit)
commit 8774205db315a60e9a064e163a2f7e6c7acbea6a
Author: Christian Dywan <[email protected]>
Date: Sun Jun 27 22:11:21 2010 +0200
Store sent message in Sent with a valid filename
postler/postler-composer.vala | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 3b4deb1..13a10ea 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -85,16 +85,12 @@ public class Postler.Composer : Gtk.Window {
string from = combo_from.get_active_text ();
foreach (var info in accounts.get_infos ()) {
if (info.address != null && from in info.address) {
- if (DirUtils.create_with_parents (info.path + "/Sent", 0700)
!= 0) {
- GLib.critical (_("Folder for sent messages couldn't be
created."));
+ if (!Postler.Messages.ensure_folder (info.path + "/Queue")
+ || !Postler.Messages.ensure_folder (info.path + "/Sent")) {
+ GLib.critical (_("Folders for sent messages couldn't be
created."));
return;
}
var now = new Soup.Date.from_now (0);
- /* TODO: Generate a valid Maildir filename and save to 'cur' */
- /* TODO: Handle failure to send */
- string filename = info.path + "/Sent/"
- + now.to_string (Soup.DateFormat.ISO8601_COMPACT)
- + Random.next_int ().to_string ();
string copy = entry_copy.text;
string header = ("From: %s\nTo: %s\n%s%s"
+ "Content-Type: text/plain; charset=UTF-8\n"
@@ -111,9 +107,13 @@ public class Postler.Composer : Gtk.Window {
var clipboard = content.get_clipboard
(Gdk.SELECTION_CLIPBOARD);
string body = clipboard.wait_for_text ();
try {
+ /* TODO: Put in /Queue/new/ first and move on success */
+ string filename = info.path + "/Sent/cur/"
+ + Postler.Messages.generate_maildir_filename ("S");
FileUtils.set_contents (filename, header + body, -1);
FileUtils.chmod (filename, 0700);
accounts.send (info, filename);
+ /* TODO: Handle failure to send */
destroy ();
} catch (GLib.Error error) {
GLib.critical (_("Failed to send message: %s"),
error.message);
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits