send decline to the same jid (bare or full) from which we received he invite

This commit is contained in:
Yann Leboulanger 2012-08-24 09:37:40 +02:00
parent f790007b06
commit 689f8370b8
2 changed files with 14 additions and 11 deletions

View File

@ -4463,14 +4463,16 @@ class PrivacyListsWindow:
PrivacyListWindow(self.account, name, 'EDIT')
class InvitationReceivedDialog:
def __init__(self, account, room_jid, contact_jid, password=None,
comment=None, is_continued=False):
def __init__(self, account, room_jid, contact_fjid, password=None,
comment=None, is_continued=False):
self.room_jid = room_jid
self.account = account
self.password = password
self.is_continued = is_continued
self.contact_jid = contact_jid
self.contact_fjid = contact_fjid
jid = gajim.get_jid_without_resource(contact_fjid)
pritext = _('''You are invited to a groupchat''')
#Don't translate $Contact
@ -4478,8 +4480,8 @@ class InvitationReceivedDialog:
sectext = _('$Contact has invited you to join a discussion')
else:
sectext = _('$Contact has invited you to group chat %(room_jid)s')\
% {'room_jid': room_jid}
contact = gajim.contacts.get_first_contact_from_jid(account, contact_jid)
% {'room_jid': room_jid}
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
contact_text = contact and contact.name or contact_jid
sectext = sectext.replace('$Contact', contact_text)
@ -4501,7 +4503,7 @@ class InvitationReceivedDialog:
def on_no(text):
gajim.connections[account].decline_invitation(self.room_jid,
self.contact_jid, text)
self.contact_fjid, text)
YesNoDialog(pritext, sectext, text_label=_('Reason:'),
on_response_yes=on_yes, on_response_no=on_no)

View File

@ -628,18 +628,19 @@ class Interface:
jid = gajim.get_jid_without_resource(obj.jid_from)
account = obj.conn.name
if helpers.allow_popup_window(account) or not self.systray_enabled:
dialogs.InvitationReceivedDialog(account, obj.room_jid, jid,
obj.password, obj.reason, is_continued=obj.is_continued)
dialogs.InvitationReceivedDialog(account, obj.room_jid,
obj.jid_from, obj.password, obj.reason,
is_continued=obj.is_continued)
return
self.add_event(account, jid, 'gc-invitation', (obj.room_jid,
self.add_event(account, obj.jid_from, 'gc-invitation', (obj.room_jid,
obj.reason, obj.password, obj.is_continued))
if helpers.allow_showing_notification(account):
path = gtkgui_helpers.get_icon_path('gajim-gc_invitation', 48)
event_type = _('Groupchat Invitation')
notify.popup(event_type, jid, account, 'gc-invitation', path,
event_type, obj.room_jid)
notify.popup(event_type, obj.jid_from, account, 'gc-invitation',
path, event_type, obj.room_jid)
def forget_gpg_passphrase(self, keyid):
if keyid in self.gpg_passphrase: