[Xfce4-commits] <postler:master> Render messages sent by the user as You
Christian Dywan
noreply at xfce.org
Thu Jun 30 00:34:01 CEST 2011
Updating branch refs/heads/master
to e30e71add20ec01d25df9749ae64f23db8dc0664 (commit)
from 0f42dd65e8871b770c0d9fe699758942e09eb0bc (commit)
commit e30e71add20ec01d25df9749ae64f23db8dc0664
Author: Christian Dywan <christian at twotoasts.de>
Date: Wed Jun 29 22:02:09 2011 +0200
Render messages sent by the user as You
postler/postler-index.vala | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/postler/postler-index.vala b/postler/postler-index.vala
index 4311860..1dd0557 100644
--- a/postler/postler-index.vala
+++ b/postler/postler-index.vala
@@ -44,6 +44,19 @@ namespace Postler {
}
#endif
+ bool address_is_user (string address) {
+ var accounts = new Accounts ();
+ foreach (var account_info in accounts.get_infos ()) {
+ if (account_info.type == AccountType.SEARCH)
+ continue;
+ foreach (string the_address in account_info.address.split (",")) {
+ if (the_address == address)
+ return true;
+ }
+ }
+ return false;
+ }
+
bool row_or_done (int result) {
return result == Sqlite.ROW || result == Sqlite.DONE;
}
@@ -318,8 +331,15 @@ namespace Postler {
public Postler.Contact? guess_name (string address) throws GLib.Error {
Postler.Contact? contact = names.lookup (address);
- if (contact != null)
+ if (contact != null) {
+ if (address_is_user (address))
+ /* i18n: 'You' refers to the user, displayed next to messages the user sent */
+ return new Postler.Contact (_("You"), contact.avatar);
return contact;
+ }
+
+ if (address_is_user (address))
+ return new Postler.Contact (_("You"), null);
string? display_name = new Dexter.Dexter ().get_name (address);
if (display_name != null)
More information about the Xfce4-commits
mailing list