[Xfce4-commits] <postler:master> Add a 'realname' field for IMAP accounts
Christian Dywan
noreply at xfce.org
Sat Jul 10 00:24:08 CEST 2010
Updating branch refs/heads/master
to f1d1d343b6e26d045e587be02f192414c9a486b0 (commit)
from 64dd3be49bffa8447efff8afd9f6c0b9eb8c39e6 (commit)
commit f1d1d343b6e26d045e587be02f192414c9a486b0
Author: Christian Dywan <christian at twotoasts.de>
Date: Mon Jun 28 23:01:58 2010 +0200
Add a 'realname' field for IMAP accounts
postler/postler-accounts.vala | 3 +++
postler/postler-composer.vala | 16 +++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/postler/postler-accounts.vala b/postler/postler-accounts.vala
index c37577c..89dea25 100644
--- a/postler/postler-accounts.vala
+++ b/postler/postler-accounts.vala
@@ -19,6 +19,7 @@ namespace Postler {
public class AccountInfo : GLib.Object {
public string name;
public AccountType type;
+ public string realname;
public string address;
public string receive;
public string send;
@@ -110,6 +111,8 @@ public class Postler.Accounts : GLib.Object {
else if (type == "imap") {
info.type = AccountType.IMAP;
info.path = data_path + name;
+ if (keyfile.has_key (group, "realname"))
+ info.realname = keyfile.get_string (group, "realname");
if (keyfile.has_key (group, "address"))
info.address = keyfile.get_string (group, "address");
if (keyfile.has_key (group, "username"))
diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 13a10ea..48ab748 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -82,9 +82,10 @@ public class Postler.Composer : Gtk.Window {
return;
}
- string from = combo_from.get_active_text ();
+ string sender = combo_from.get_active_text ();
+ string[] from = Postler.Messages.parse_address (sender);
foreach (var info in accounts.get_infos ()) {
- if (info.address != null && from in info.address) {
+ if (info.address != null && from[1] in info.address) {
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."));
@@ -95,7 +96,7 @@ public class Postler.Composer : Gtk.Window {
string header = ("From: %s\nTo: %s\n%s%s"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Subject: %s\nDate: %s\nX-Mailer: %s\n\n").printf (
- from,
+ sender,
entry_to.text,
copy != "" ? "CC: " : "", copy != "" ? copy + "\n" : "",
entry_subject.text,
@@ -267,8 +268,13 @@ public class Postler.Composer : Gtk.Window {
if (account_info.address != null) {
string[] addresses = account_info.address.split (",");
if (addresses[0] != null) {
- foreach (string address in addresses)
- combo_from.append_text (address);
+ foreach (string address in addresses) {
+ if (account_info.realname != null)
+ combo_from.append_text ("%s <%s>".printf (
+ account_info.realname, address));
+ else
+ combo_from.append_text (address);
+ }
}
else
combo_from.append_text (account_info.address);
More information about the Xfce4-commits
mailing list