[kupfer] empathy: added show offline option a la pidgin
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] empathy: added show offline option a la pidgin
- Date: Sat, 19 Mar 2011 19:39:36 +0000 (UTC)
commit 3edae03a9b09c0c4fce37a345eda560f011ced93
Author: Jakh Daven <tuxcanfly gmail com>
Date: Sat Mar 19 17:16:58 2011 +0530
empathy: added show offline option a la pidgin
kupfer/plugin/empathy.py | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/empathy.py b/kupfer/plugin/empathy.py
index 0b70da3..b26d78b 100644
--- a/kupfer/plugin/empathy.py
+++ b/kupfer/plugin/empathy.py
@@ -20,6 +20,15 @@ from kupfer.obj.apps import AppLeafContentMixin
from kupfer.obj.grouping import ToplevelGroupingSource
from kupfer.obj.contacts import ContactLeaf, JabberContact, JABBER_JID_KEY
+__kupfer_settings__ = plugin_support.PluginSettings(
+ {
+ "key" : "show_offline",
+ "label": _("Show offline contacts"),
+ "type": bool,
+ "value": False,
+ },
+)
+
plugin_support.check_dbus_connection()
_STATUSES = {
@@ -185,6 +194,7 @@ class ContactsSource(AppLeafContentMixin, ToplevelGroupingSource,
return self._contacts
def _find_all_contacts(self, interface):
+ show_offline = __kupfer_settings__["show_offline"]
bus = dbus.SessionBus()
for valid_account in interface.Get(ACCOUNTMANAGER_IFACE, "ValidAccounts"):
account = bus.get_object(ACCOUNTMANAGER_IFACE, valid_account)
@@ -205,10 +215,13 @@ class ContactsSource(AppLeafContentMixin, ToplevelGroupingSource,
contact_attributes = [str(a) for a in contact_attributes]
contact_details = connection.GetContactAttributes(contacts, contact_attributes, False)
for contact, details in contact_details.iteritems():
+ status_code = details[_ATTRIBUTES.get("presence")][1]
+ if not show_offline and status_code == 'offline':
+ continue
yield EmpathyContact(
details[_ATTRIBUTES.get("jid")],
details[_ATTRIBUTES.get("alias")],
- _STATUSES.get(details[_ATTRIBUTES.get("presence")][1]),
+ _STATUSES.get(status_code),
'', # empathy does not provide resource here AFAIK
valid_account,
contact)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]