[birthday_reminder] Adapt to Gajim changes
This commit is contained in:
@@ -22,6 +22,7 @@ from gi.repository import GLib
|
|||||||
from gajim.common import configpaths
|
from gajim.common import configpaths
|
||||||
from gajim.common import app
|
from gajim.common import app
|
||||||
from gajim.common import ged
|
from gajim.common import ged
|
||||||
|
from gajim.common.nec import NetworkEvent
|
||||||
|
|
||||||
from gajim.plugins import GajimPlugin
|
from gajim.plugins import GajimPlugin
|
||||||
from gajim.plugins.plugins_i18n import _
|
from gajim.plugins.plugins_i18n import _
|
||||||
@@ -121,21 +122,24 @@ class BirthDayPlugin(GajimPlugin):
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
log.info('Issue notification for %s', jid)
|
log.info('Issue notification for %s', jid)
|
||||||
nick = contact.get_shown_name() or jid
|
name = GLib.markup_escape_text(contact.name)
|
||||||
app.notification.popup(
|
app.nec.push_incoming_event(
|
||||||
'reminder',
|
NetworkEvent('notification',
|
||||||
jid,
|
account=account,
|
||||||
account,
|
jid=jid,
|
||||||
icon_name='trophy-gold',
|
notif_type='reminder',
|
||||||
title=TITLE,
|
icon_name='trophy-gold',
|
||||||
text=TEXT % GLib.markup_escape_text(nick))
|
title=TITLE,
|
||||||
|
text=TEXT % name))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _find_contact(jid):
|
def _find_contact(jid):
|
||||||
accounts = app.contacts.get_accounts()
|
accounts = app.settings.get_active_accounts()
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
contact = app.contacts.get_contacts(account, jid)
|
client = app.get_client(account)
|
||||||
if contact is not None:
|
item = client.get_module('Roster').get_item(jid)
|
||||||
return account, contact[0]
|
if item is not None:
|
||||||
|
contact = client.get_module('Contacts').get_contact(jid)
|
||||||
|
return account, contact
|
||||||
|
return None, None
|
||||||
|
|||||||
Reference in New Issue
Block a user