2005-11-11 19:12:02 +00:00
|
|
|
## notify.py
|
|
|
|
##
|
2005-12-09 17:15:30 +00:00
|
|
|
## Contributors for this file:
|
2005-11-11 19:12:02 +00:00
|
|
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
|
|
|
## - Nikos Kouremenos <kourem@gmail.com>
|
|
|
|
## - Dimitur Kirov <dkirov@gmail.com>
|
|
|
|
## - Andrew Sayman <lorien420@myrealbox.com>
|
|
|
|
##
|
2005-12-09 23:30:28 +00:00
|
|
|
## Copyright (C) 2003-2004 Yann Le Boulanger <asterix@lagaule.org>
|
|
|
|
## Vincent Hanquez <tab@snarc.org>
|
|
|
|
## Copyright (C) 2005 Yann Le Boulanger <asterix@lagaule.org>
|
|
|
|
## Vincent Hanquez <tab@snarc.org>
|
|
|
|
## Nikos Kouremenos <nkour@jabber.org>
|
|
|
|
## Dimitur Kirov <dkirov@gmail.com>
|
|
|
|
## Travis Shirk <travis@pobox.com>
|
|
|
|
## Norman Rasmussen <norman@rasmussen.co.za>
|
2005-11-11 19:12:02 +00:00
|
|
|
##
|
|
|
|
## DBUS/libnotify connection code:
|
|
|
|
## Copyright (C) 2005 by Sebastian Estienne
|
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published
|
|
|
|
## by the Free Software Foundation; version 2 only.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import gajim
|
|
|
|
import dialogs
|
2005-12-10 00:56:38 +00:00
|
|
|
import gobject
|
2005-11-11 19:12:02 +00:00
|
|
|
|
|
|
|
from common import gajim
|
2005-12-10 00:56:38 +00:00
|
|
|
from common import exceptions
|
2005-11-11 19:12:02 +00:00
|
|
|
from common import i18n
|
|
|
|
i18n.init()
|
|
|
|
_ = i18n._
|
|
|
|
|
2005-12-10 00:56:38 +00:00
|
|
|
import dbus_support
|
|
|
|
if dbus_support.supported:
|
|
|
|
import dbus
|
|
|
|
if dbus_support.version >= (0, 41, 0):
|
|
|
|
import dbus.glib
|
|
|
|
import dbus.service
|
2005-11-11 19:12:02 +00:00
|
|
|
|
|
|
|
def notify(event_type, jid, account, msg_type = '', file_props = None):
|
2005-12-10 00:56:38 +00:00
|
|
|
'''Notifies a user of an event. It first tries to a valid implementation of
|
|
|
|
the Desktop Notification Specification. If that fails, then we fall back to
|
|
|
|
the older style PopupNotificationWindow method.'''
|
|
|
|
if gajim.config.get('use_notif_daemon') and dbus_support.supported:
|
2005-11-11 19:12:02 +00:00
|
|
|
try:
|
2005-12-10 00:56:38 +00:00
|
|
|
DesktopNotification(event_type, jid, account, msg_type, file_props)
|
2005-11-11 19:12:02 +00:00
|
|
|
return
|
2005-12-11 16:58:20 +00:00
|
|
|
except dbus.dbus_bindings.DBusException, e:
|
Merged revisions 4987-4989,4991-4996,4999,5003 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r4987 | nk | 2006-01-03 04:00:51 -0700 (Tue, 03 Jan 2006) | 1 line
commit 48x48 transport online/offline imgs by Grenshad (I pngcrushed them)
........
r4988 | nk | 2006-01-03 04:32:01 -0700 (Tue, 03 Jan 2006) | 1 line
icon in notification window not always jabber now. MSN if he uses msn etc. thanks stian barmen for helping me test
........
r4989 | nk | 2006-01-03 04:40:44 -0700 (Tue, 03 Jan 2006) | 1 line
all strings I got report about them, are not translatable; pot/po update
........
r4991 | asterix | 2006-01-03 08:08:21 -0700 (Tue, 03 Jan 2006) | 2 lines
don't remove the jid entry in _contacts[account] when we remove a contact
........
r4992 | asterix | 2006-01-03 08:18:30 -0700 (Tue, 03 Jan 2006) | 2 lines
fix logic
........
r4993 | asterix | 2006-01-03 09:04:14 -0700 (Tue, 03 Jan 2006) | 2 lines
a GC_Contact can have a resource if we knoe his real JID
........
r4994 | asterix | 2006-01-03 09:32:58 -0700 (Tue, 03 Jan 2006) | 2 lines
missing argument in create_gc_contact
........
r4995 | asterix | 2006-01-03 10:36:41 -0700 (Tue, 03 Jan 2006) | 2 lines
we save gc_contact vcard instance in instances[self.account]['infos'][Fake_jid]
........
r4996 | asterix | 2006-01-03 11:17:43 -0700 (Tue, 03 Jan 2006) | 2 lines
in DataForm, a field of type 'list-single' can have no <value> element. Create a default one in such a case to prevent TB
........
r4999 | asterix | 2006-01-04 05:52:26 -0700 (Wed, 04 Jan 2006) | 2 lines
prevent TB when we move a contact that was in no group
........
r5003 | asterix | 2006-01-04 09:03:42 -0700 (Wed, 04 Jan 2006) | 2 lines
handle correctly unlabeled option values in DataForms
........
2006-01-05 03:17:36 +00:00
|
|
|
# Connection to D-Bus failed, try popup
|
2005-12-26 16:41:22 +00:00
|
|
|
gajim.log.debug(str(e))
|
2005-11-11 19:12:02 +00:00
|
|
|
except TypeError, e:
|
|
|
|
# This means that we sent the message incorrectly
|
2005-12-26 16:41:22 +00:00
|
|
|
gajim.log.debug(str(e))
|
2005-11-11 19:12:02 +00:00
|
|
|
instance = dialogs.PopupNotificationWindow(event_type, jid, account,
|
|
|
|
msg_type, file_props)
|
|
|
|
gajim.interface.roster.popup_notification_windows.append(instance)
|
|
|
|
|
2005-12-10 00:56:38 +00:00
|
|
|
class NotificationResponseManager:
|
|
|
|
'''Collects references to pending DesktopNotifications and manages there
|
|
|
|
signalling. This is necessary due to a bug in DBus where you can't remove
|
|
|
|
a signal from an interface once it's connected.'''
|
|
|
|
def __init__(self):
|
|
|
|
self.pending = {}
|
|
|
|
self.interface = None
|
|
|
|
|
|
|
|
def attach_to_interface(self):
|
|
|
|
if self.interface is not None:
|
|
|
|
return
|
|
|
|
self.interface = dbus_support.get_notifications_interface()
|
|
|
|
self.interface.connect_to_signal('ActionInvoked', self.on_action_invoked)
|
|
|
|
self.interface.connect_to_signal('NotificationClosed', self.on_closed)
|
2005-12-10 22:44:47 +00:00
|
|
|
|
2005-12-10 00:56:38 +00:00
|
|
|
def on_action_invoked(self, id, reason):
|
|
|
|
if self.pending.has_key(id):
|
|
|
|
notification = self.pending[id]
|
|
|
|
notification.on_action_invoked(id, reason)
|
|
|
|
del self.pending[id]
|
|
|
|
else:
|
|
|
|
# This happens in the case of a race condition where the user clicks
|
|
|
|
# on a popup before the program finishes registering this callback
|
|
|
|
gobject.timeout_add(1000, self.on_action_invoked, id, reason)
|
|
|
|
|
|
|
|
def on_closed(self, id, reason):
|
|
|
|
if self.pending.has_key(id):
|
|
|
|
del self.pending[id]
|
2005-12-10 22:44:47 +00:00
|
|
|
|
2005-12-10 00:56:38 +00:00
|
|
|
notification_response_manager = NotificationResponseManager()
|
|
|
|
|
|
|
|
class DesktopNotification:
|
|
|
|
'''A DesktopNotification that interfaces with DBus via the Desktop
|
|
|
|
Notification specification'''
|
|
|
|
def __init__(self, event_type, jid, account, msg_type = '', file_props = None):
|
|
|
|
self.account = account
|
|
|
|
self.jid = jid
|
|
|
|
self.msg_type = msg_type
|
|
|
|
self.file_props = file_props
|
|
|
|
|
Merged in trunk updates, including meta_contacts
Merged revisions 4951,4962-4969 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r4951 | nk | 2005-12-30 16:50:36 -0700 (Fri, 30 Dec 2005) | 1 line
fixes in greek transl
........
r4962 | asterix | 2006-01-01 11:41:04 -0700 (Sun, 01 Jan 2006) | 2 lines
merge meta_contacts branch with trunk. Meta contacts are not in gajim yet, but framework is here. We now use gajim.contacts.many_functions() to handle contacts and groupchat_contacts.
........
r4963 | asterix | 2006-01-01 11:43:24 -0700 (Sun, 01 Jan 2006) | 2 lines
correct contacts file
........
r4964 | asterix | 2006-01-01 11:47:26 -0700 (Sun, 01 Jan 2006) | 2 lines
dict.remove() doesn't exists, it's del dict[]
........
r4965 | asterix | 2006-01-01 11:50:15 -0700 (Sun, 01 Jan 2006) | 2 lines
some missing commits from branch
........
r4966 | asterix | 2006-01-01 11:53:30 -0700 (Sun, 01 Jan 2006) | 2 lines
end of gc_contact.nick -> gc_contact.name
........
r4967 | asterix | 2006-01-01 12:05:59 -0700 (Sun, 01 Jan 2006) | 2 lines
new ACE option: send_sha_in_gc_presence that allow to send sha info in groupchat presences
........
r4968 | asterix | 2006-01-01 12:12:36 -0700 (Sun, 01 Jan 2006) | 2 lines
0.9.1-2 in debian that solve the group bug (commit [4924])
........
r4969 | asterix | 2006-01-01 12:31:13 -0700 (Sun, 01 Jan 2006) | 2 lines
typo
........
2006-01-01 20:06:26 +00:00
|
|
|
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
|
|
|
if contact:
|
2006-01-10 18:30:57 +00:00
|
|
|
actor = contact.get_shown_name()
|
2005-12-10 00:56:38 +00:00
|
|
|
else:
|
|
|
|
actor = jid
|
|
|
|
|
2005-12-10 22:44:47 +00:00
|
|
|
txt = actor # default value of txt
|
Merged revisions 4987-4989,4991-4996,4999,5003 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r4987 | nk | 2006-01-03 04:00:51 -0700 (Tue, 03 Jan 2006) | 1 line
commit 48x48 transport online/offline imgs by Grenshad (I pngcrushed them)
........
r4988 | nk | 2006-01-03 04:32:01 -0700 (Tue, 03 Jan 2006) | 1 line
icon in notification window not always jabber now. MSN if he uses msn etc. thanks stian barmen for helping me test
........
r4989 | nk | 2006-01-03 04:40:44 -0700 (Tue, 03 Jan 2006) | 1 line
all strings I got report about them, are not translatable; pot/po update
........
r4991 | asterix | 2006-01-03 08:08:21 -0700 (Tue, 03 Jan 2006) | 2 lines
don't remove the jid entry in _contacts[account] when we remove a contact
........
r4992 | asterix | 2006-01-03 08:18:30 -0700 (Tue, 03 Jan 2006) | 2 lines
fix logic
........
r4993 | asterix | 2006-01-03 09:04:14 -0700 (Tue, 03 Jan 2006) | 2 lines
a GC_Contact can have a resource if we knoe his real JID
........
r4994 | asterix | 2006-01-03 09:32:58 -0700 (Tue, 03 Jan 2006) | 2 lines
missing argument in create_gc_contact
........
r4995 | asterix | 2006-01-03 10:36:41 -0700 (Tue, 03 Jan 2006) | 2 lines
we save gc_contact vcard instance in instances[self.account]['infos'][Fake_jid]
........
r4996 | asterix | 2006-01-03 11:17:43 -0700 (Tue, 03 Jan 2006) | 2 lines
in DataForm, a field of type 'list-single' can have no <value> element. Create a default one in such a case to prevent TB
........
r4999 | asterix | 2006-01-04 05:52:26 -0700 (Wed, 04 Jan 2006) | 2 lines
prevent TB when we move a contact that was in no group
........
r5003 | asterix | 2006-01-04 09:03:42 -0700 (Wed, 04 Jan 2006) | 2 lines
handle correctly unlabeled option values in DataForms
........
2006-01-05 03:17:36 +00:00
|
|
|
transport_name = gajim.get_transport_name_from_jid(jid)
|
|
|
|
|
|
|
|
if transport_name in ('aim', 'icq', 'msn', 'yahoo'):
|
|
|
|
prefix = transport_name
|
|
|
|
else:
|
|
|
|
prefix = 'jabber'
|
|
|
|
'''
|
|
|
|
if transport_name == 'aim':
|
|
|
|
prefix = 'aim'
|
|
|
|
elif transport_name == 'icq':
|
|
|
|
prefix = 'icq'
|
|
|
|
elif transport_name == 'msn':
|
|
|
|
prefix = 'msn'
|
|
|
|
elif transport_name == 'yahoo':
|
|
|
|
prefix = 'yahoo'
|
|
|
|
else:
|
|
|
|
prefix = 'jabber'
|
|
|
|
'''
|
2005-12-10 22:44:47 +00:00
|
|
|
|
2005-12-10 00:56:38 +00:00
|
|
|
if event_type == _('Contact Signed In'):
|
Merged revisions 4987-4989,4991-4996,4999,5003 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r4987 | nk | 2006-01-03 04:00:51 -0700 (Tue, 03 Jan 2006) | 1 line
commit 48x48 transport online/offline imgs by Grenshad (I pngcrushed them)
........
r4988 | nk | 2006-01-03 04:32:01 -0700 (Tue, 03 Jan 2006) | 1 line
icon in notification window not always jabber now. MSN if he uses msn etc. thanks stian barmen for helping me test
........
r4989 | nk | 2006-01-03 04:40:44 -0700 (Tue, 03 Jan 2006) | 1 line
all strings I got report about them, are not translatable; pot/po update
........
r4991 | asterix | 2006-01-03 08:08:21 -0700 (Tue, 03 Jan 2006) | 2 lines
don't remove the jid entry in _contacts[account] when we remove a contact
........
r4992 | asterix | 2006-01-03 08:18:30 -0700 (Tue, 03 Jan 2006) | 2 lines
fix logic
........
r4993 | asterix | 2006-01-03 09:04:14 -0700 (Tue, 03 Jan 2006) | 2 lines
a GC_Contact can have a resource if we knoe his real JID
........
r4994 | asterix | 2006-01-03 09:32:58 -0700 (Tue, 03 Jan 2006) | 2 lines
missing argument in create_gc_contact
........
r4995 | asterix | 2006-01-03 10:36:41 -0700 (Tue, 03 Jan 2006) | 2 lines
we save gc_contact vcard instance in instances[self.account]['infos'][Fake_jid]
........
r4996 | asterix | 2006-01-03 11:17:43 -0700 (Tue, 03 Jan 2006) | 2 lines
in DataForm, a field of type 'list-single' can have no <value> element. Create a default one in such a case to prevent TB
........
r4999 | asterix | 2006-01-04 05:52:26 -0700 (Wed, 04 Jan 2006) | 2 lines
prevent TB when we move a contact that was in no group
........
r5003 | asterix | 2006-01-04 09:03:42 -0700 (Wed, 04 Jan 2006) | 2 lines
handle correctly unlabeled option values in DataForms
........
2006-01-05 03:17:36 +00:00
|
|
|
img = prefix + '_online.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
ntype = 'presence.online'
|
|
|
|
elif event_type == _('Contact Signed Out'):
|
Merged revisions 4987-4989,4991-4996,4999,5003 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r4987 | nk | 2006-01-03 04:00:51 -0700 (Tue, 03 Jan 2006) | 1 line
commit 48x48 transport online/offline imgs by Grenshad (I pngcrushed them)
........
r4988 | nk | 2006-01-03 04:32:01 -0700 (Tue, 03 Jan 2006) | 1 line
icon in notification window not always jabber now. MSN if he uses msn etc. thanks stian barmen for helping me test
........
r4989 | nk | 2006-01-03 04:40:44 -0700 (Tue, 03 Jan 2006) | 1 line
all strings I got report about them, are not translatable; pot/po update
........
r4991 | asterix | 2006-01-03 08:08:21 -0700 (Tue, 03 Jan 2006) | 2 lines
don't remove the jid entry in _contacts[account] when we remove a contact
........
r4992 | asterix | 2006-01-03 08:18:30 -0700 (Tue, 03 Jan 2006) | 2 lines
fix logic
........
r4993 | asterix | 2006-01-03 09:04:14 -0700 (Tue, 03 Jan 2006) | 2 lines
a GC_Contact can have a resource if we knoe his real JID
........
r4994 | asterix | 2006-01-03 09:32:58 -0700 (Tue, 03 Jan 2006) | 2 lines
missing argument in create_gc_contact
........
r4995 | asterix | 2006-01-03 10:36:41 -0700 (Tue, 03 Jan 2006) | 2 lines
we save gc_contact vcard instance in instances[self.account]['infos'][Fake_jid]
........
r4996 | asterix | 2006-01-03 11:17:43 -0700 (Tue, 03 Jan 2006) | 2 lines
in DataForm, a field of type 'list-single' can have no <value> element. Create a default one in such a case to prevent TB
........
r4999 | asterix | 2006-01-04 05:52:26 -0700 (Wed, 04 Jan 2006) | 2 lines
prevent TB when we move a contact that was in no group
........
r5003 | asterix | 2006-01-04 09:03:42 -0700 (Wed, 04 Jan 2006) | 2 lines
handle correctly unlabeled option values in DataForms
........
2006-01-05 03:17:36 +00:00
|
|
|
img = prefix + '_offline.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
ntype = 'presence.offline'
|
|
|
|
elif event_type in (_('New Message'), _('New Single Message'),
|
|
|
|
_('New Private Message')):
|
|
|
|
ntype = 'im.received'
|
|
|
|
if event_type == _('New Private Message'):
|
|
|
|
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
|
|
|
|
room_name,t = gajim.get_room_name_and_server_from_room_jid(room_jid)
|
|
|
|
txt = _('%(nickname)s in room %(room_name)s has sent you a new message.')\
|
|
|
|
% {'nickname': nick, 'room_name': room_name}
|
2005-12-10 22:27:41 +00:00
|
|
|
img = 'priv_msg_recv.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
else:
|
|
|
|
#we talk about a name here
|
|
|
|
txt = _('%s has sent you a new message.') % actor
|
2005-12-10 22:27:41 +00:00
|
|
|
if event_type == _('New Message'):
|
|
|
|
img = 'chat_msg_recv.png'
|
|
|
|
else: # New Single Message
|
|
|
|
img = 'single_msg_recv.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
elif event_type == _('File Transfer Request'):
|
2005-12-11 18:40:25 +00:00
|
|
|
img = 'ft_request.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
ntype = 'transfer'
|
|
|
|
#we talk about a name here
|
|
|
|
txt = _('%s wants to send you a file.') % actor
|
|
|
|
elif event_type == _('File Transfer Error'):
|
2005-12-10 22:00:06 +00:00
|
|
|
img = 'ft_stopped.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
ntype = 'transfer.error'
|
|
|
|
elif event_type in (_('File Transfer Completed'), _('File Transfer Stopped')):
|
|
|
|
ntype = 'transfer.complete'
|
|
|
|
if file_props is not None:
|
|
|
|
if file_props['type'] == 'r':
|
|
|
|
# get the name of the sender, as it is in the roster
|
|
|
|
sender = unicode(file_props['sender']).split('/')[0]
|
Merged in trunk updates, including meta_contacts
Merged revisions 4951,4962-4969 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r4951 | nk | 2005-12-30 16:50:36 -0700 (Fri, 30 Dec 2005) | 1 line
fixes in greek transl
........
r4962 | asterix | 2006-01-01 11:41:04 -0700 (Sun, 01 Jan 2006) | 2 lines
merge meta_contacts branch with trunk. Meta contacts are not in gajim yet, but framework is here. We now use gajim.contacts.many_functions() to handle contacts and groupchat_contacts.
........
r4963 | asterix | 2006-01-01 11:43:24 -0700 (Sun, 01 Jan 2006) | 2 lines
correct contacts file
........
r4964 | asterix | 2006-01-01 11:47:26 -0700 (Sun, 01 Jan 2006) | 2 lines
dict.remove() doesn't exists, it's del dict[]
........
r4965 | asterix | 2006-01-01 11:50:15 -0700 (Sun, 01 Jan 2006) | 2 lines
some missing commits from branch
........
r4966 | asterix | 2006-01-01 11:53:30 -0700 (Sun, 01 Jan 2006) | 2 lines
end of gc_contact.nick -> gc_contact.name
........
r4967 | asterix | 2006-01-01 12:05:59 -0700 (Sun, 01 Jan 2006) | 2 lines
new ACE option: send_sha_in_gc_presence that allow to send sha info in groupchat presences
........
r4968 | asterix | 2006-01-01 12:12:36 -0700 (Sun, 01 Jan 2006) | 2 lines
0.9.1-2 in debian that solve the group bug (commit [4924])
........
r4969 | asterix | 2006-01-01 12:31:13 -0700 (Sun, 01 Jan 2006) | 2 lines
typo
........
2006-01-01 20:06:26 +00:00
|
|
|
name = gajim.contacts.get_first_contact_from_jid(account,
|
2006-01-10 18:30:57 +00:00
|
|
|
sender).get_shown_name()
|
2005-12-10 00:56:38 +00:00
|
|
|
filename = os.path.basename(file_props['file-name'])
|
|
|
|
if event_type == _('File Transfer Completed'):
|
|
|
|
txt = _('You successfully received %(filename)s from %(name)s.')\
|
|
|
|
% {'filename': filename, 'name': name}
|
2005-12-10 22:00:06 +00:00
|
|
|
img = 'ft_done.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
else: # ft stopped
|
|
|
|
txt = _('File transfer of %(filename)s from %(name)s stopped.')\
|
|
|
|
% {'filename': filename, 'name': name}
|
2005-12-10 22:00:06 +00:00
|
|
|
img = 'ft_stopped.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
else:
|
|
|
|
receiver = file_props['receiver']
|
|
|
|
if hasattr(receiver, 'jid'):
|
|
|
|
receiver = receiver.jid
|
|
|
|
receiver = receiver.split('/')[0]
|
|
|
|
# get the name of the contact, as it is in the roster
|
Merged in trunk updates, including meta_contacts
Merged revisions 4951,4962-4969 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r4951 | nk | 2005-12-30 16:50:36 -0700 (Fri, 30 Dec 2005) | 1 line
fixes in greek transl
........
r4962 | asterix | 2006-01-01 11:41:04 -0700 (Sun, 01 Jan 2006) | 2 lines
merge meta_contacts branch with trunk. Meta contacts are not in gajim yet, but framework is here. We now use gajim.contacts.many_functions() to handle contacts and groupchat_contacts.
........
r4963 | asterix | 2006-01-01 11:43:24 -0700 (Sun, 01 Jan 2006) | 2 lines
correct contacts file
........
r4964 | asterix | 2006-01-01 11:47:26 -0700 (Sun, 01 Jan 2006) | 2 lines
dict.remove() doesn't exists, it's del dict[]
........
r4965 | asterix | 2006-01-01 11:50:15 -0700 (Sun, 01 Jan 2006) | 2 lines
some missing commits from branch
........
r4966 | asterix | 2006-01-01 11:53:30 -0700 (Sun, 01 Jan 2006) | 2 lines
end of gc_contact.nick -> gc_contact.name
........
r4967 | asterix | 2006-01-01 12:05:59 -0700 (Sun, 01 Jan 2006) | 2 lines
new ACE option: send_sha_in_gc_presence that allow to send sha info in groupchat presences
........
r4968 | asterix | 2006-01-01 12:12:36 -0700 (Sun, 01 Jan 2006) | 2 lines
0.9.1-2 in debian that solve the group bug (commit [4924])
........
r4969 | asterix | 2006-01-01 12:31:13 -0700 (Sun, 01 Jan 2006) | 2 lines
typo
........
2006-01-01 20:06:26 +00:00
|
|
|
name = gajim.contacts.get_first_contact_from_jid(account,
|
2006-01-10 18:30:57 +00:00
|
|
|
receiver).get_shown_name()
|
2005-12-10 00:56:38 +00:00
|
|
|
filename = os.path.basename(file_props['file-name'])
|
|
|
|
if event_type == _('File Transfer Completed'):
|
|
|
|
txt = _('You successfully sent %(filename)s to %(name)s.')\
|
|
|
|
% {'filename': filename, 'name': name}
|
2005-12-10 22:00:06 +00:00
|
|
|
img = 'ft_done.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
else: # ft stopped
|
|
|
|
txt = _('File transfer of %(filename)s to %(name)s stopped.')\
|
|
|
|
% {'filename': filename, 'name': name}
|
2005-12-10 22:00:06 +00:00
|
|
|
img = 'ft_stopped.png'
|
2005-12-10 00:56:38 +00:00
|
|
|
else:
|
|
|
|
txt = ''
|
Merged revisions 5017-5020,5022-5029 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r5017 | asterix | 2006-01-06 01:55:51 -0700 (Fri, 06 Jan 2006) | 2 lines
use escape for pango markup
........
r5018 | asterix | 2006-01-06 02:21:39 -0700 (Fri, 06 Jan 2006) | 2 lines
missing new contacts function
........
r5019 | asterix | 2006-01-06 11:03:07 -0700 (Fri, 06 Jan 2006) | 2 lines
handle the click on toggle_gpg_encryption menuitem
........
r5020 | asterix | 2006-01-06 11:14:14 -0700 (Fri, 06 Jan 2006) | 2 lines
use the saved size even if a chat window is already opened
........
r5022 | asterix | 2006-01-07 03:43:47 -0700 (Sat, 07 Jan 2006) | 2 lines
we can now resume filetransfert
........
r5023 | asterix | 2006-01-07 03:56:31 -0700 (Sat, 07 Jan 2006) | 2 lines
[Knuckles] Google E-Mail Notification
........
r5024 | asterix | 2006-01-07 04:02:16 -0700 (Sat, 07 Jan 2006) | 2 lines
better string
........
r5025 | asterix | 2006-01-07 04:14:32 -0700 (Sat, 07 Jan 2006) | 2 lines
fix a TB
........
r5026 | asterix | 2006-01-07 05:36:55 -0700 (Sat, 07 Jan 2006) | 2 lines
we can now drag a file on a contact in the roster to send him a file
........
r5027 | asterix | 2006-01-07 06:26:28 -0700 (Sat, 07 Jan 2006) | 2 lines
contact.groups is always a list, even if emtpy
........
r5028 | asterix | 2006-01-07 06:54:30 -0700 (Sat, 07 Jan 2006) | 2 lines
make all buttons insensitive on a category row in disco
........
r5029 | asterix | 2006-01-07 07:19:25 -0700 (Sat, 07 Jan 2006) | 2 lines
auto open groupchat configuration window when we create a new room
........
2006-01-07 17:25:35 +00:00
|
|
|
elif event_type == _('New Email'):
|
|
|
|
txt = _('You have new E-mail on %s.') % (jid)
|
|
|
|
ntype = 'gmail.notify'
|
2005-12-12 15:15:56 +00:00
|
|
|
else:
|
|
|
|
# defaul failsafe values
|
|
|
|
img = 'chat_msg_recv.png' # img to display
|
|
|
|
ntype = 'im' # Notification Type
|
2005-12-10 00:56:38 +00:00
|
|
|
|
2005-12-10 22:00:06 +00:00
|
|
|
path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img)
|
2005-12-10 00:56:38 +00:00
|
|
|
path = os.path.abspath(path)
|
2005-12-10 22:44:47 +00:00
|
|
|
|
2005-12-10 00:56:38 +00:00
|
|
|
self.notif = dbus_support.get_notifications_interface()
|
|
|
|
if self.notif is None:
|
2005-12-11 16:58:20 +00:00
|
|
|
raise dbus.dbus_bindings.DBusException()
|
2005-12-30 21:37:36 +00:00
|
|
|
timeout = gajim.config.get('notification_timeout') # in seconds
|
2006-01-10 01:52:43 +00:00
|
|
|
try: self.id = self.notif.Notify(dbus.String(_('Gajim')),
|
2005-12-10 00:56:38 +00:00
|
|
|
dbus.String(path), dbus.UInt32(0), ntype, dbus.Byte(0),
|
|
|
|
dbus.String(event_type), dbus.String(txt),
|
2005-12-30 21:37:36 +00:00
|
|
|
[dbus.String(path)], {'default': 0}, [''], True, dbus.UInt32(timeout))
|
2006-01-10 01:52:43 +00:00
|
|
|
except AttributeError: # For libnotify 0.3.x
|
|
|
|
self.id = self.notif.Notify(dbus.String(_('Gajim')),
|
|
|
|
dbus.String(path), dbus.UInt32(0), dbus.String(event_type),
|
|
|
|
dbus.String(txt), dbus.String(""), {}, dbus.UInt32(timeout/1000))
|
2005-12-10 00:56:38 +00:00
|
|
|
notification_response_manager.attach_to_interface()
|
|
|
|
notification_response_manager.pending[self.id] = self
|
2005-12-10 22:44:47 +00:00
|
|
|
|
2005-12-10 00:56:38 +00:00
|
|
|
def on_action_invoked(self, id, reason):
|
|
|
|
if self.notif is None:
|
|
|
|
return
|
|
|
|
self.notif.CloseNotification(dbus.UInt32(id))
|
|
|
|
self.notif = None
|
2005-12-12 09:28:36 +00:00
|
|
|
if not self.msg_type:
|
|
|
|
self.msg_type = 'chat'
|
2005-12-11 10:32:11 +00:00
|
|
|
gajim.interface.handle_event(self.account, self.jid, self.msg_type)
|