- add a confirmation dialog when we create a metacontact for the forst time. fixes #2259
- for server that doesn't support storinx privacy XML, add a warning dialog
This commit is contained in:
parent
83a5014b14
commit
e96edbb7a6
|
@ -216,6 +216,7 @@ class Config:
|
|||
'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickame.')],
|
||||
'gc_nicknames_colors': [ opt_str, '#a34526:#c000ff:#0012ff:#388a99:#38995d:#519938:#ff8a00:#94452d:#244b5a:#32645a', _('List of colors that will be used to color nicknames in group chats.'), True ],
|
||||
'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')],
|
||||
'confirm_metacontacts': [ opt_str, '', _('Should we show the confirm metacontacts creation dialog or not? Empty string means we never show the dialog.')],
|
||||
}
|
||||
|
||||
__options_per_key = {
|
||||
|
|
|
@ -85,6 +85,7 @@ class Connection(ConnectionHandlers):
|
|||
self.available_transports = {} # list of available transports on this
|
||||
# server {'icq': ['icq.server.com', 'icq2.server.com'], }
|
||||
self.vcard_supported = True
|
||||
self.metacontacts_supported = True
|
||||
# END __init__
|
||||
|
||||
def put_event(self, ev):
|
||||
|
|
|
@ -1011,6 +1011,8 @@ class ConnectionVcard:
|
|||
else:
|
||||
meta_list[tag] = [data]
|
||||
self.dispatch('METACONTACTS', meta_list)
|
||||
else:
|
||||
self.metacontacts_supported = False
|
||||
# We can now continue connection by requesting the roster
|
||||
self.connection.initRoster()
|
||||
elif self.awaiting_answers[id][0] == PRIVACY_ARRIVED:
|
||||
|
@ -1201,6 +1203,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
|
|||
if storage_tag:
|
||||
ns = storage_tag.getNamespace()
|
||||
if ns == 'storage:metacontacts':
|
||||
self.metacontacts_supported = False
|
||||
# Private XML Storage (JEP49) is not supported by server
|
||||
# Continue connecting
|
||||
self.connection.initRoster()
|
||||
|
|
|
@ -3699,34 +3699,55 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
|||
|
||||
def on_drop_in_contact(self, widget, account_source, c_source, account_dest,
|
||||
c_dest, was_big_brother, context, etime):
|
||||
# children must take the new tag too, so remember old tag
|
||||
old_tag = gajim.contacts.get_metacontacts_tag(account_source,
|
||||
c_source.jid)
|
||||
# remove the source row
|
||||
self.remove_contact(c_source, account_source)
|
||||
# brother inherite big brother groups
|
||||
c_source.groups = []
|
||||
for g in c_dest.groups:
|
||||
c_source.groups.append(g)
|
||||
gajim.connections[account_source].update_contact(c_source.jid,
|
||||
c_source.name, c_source.groups)
|
||||
gajim.contacts.add_metacontact(account_dest, c_dest.jid, account_source,
|
||||
c_source.jid)
|
||||
if was_big_brother:
|
||||
# add brothers too
|
||||
all_jid = gajim.contacts.get_metacontacts_jids(old_tag)
|
||||
for _account in all_jid:
|
||||
for _jid in all_jid[_account]:
|
||||
gajim.contacts.add_metacontact(account_dest, c_dest.jid,
|
||||
_account, _jid)
|
||||
_c = gajim.contacts.get_first_contact_from_jid(_account, _jid)
|
||||
self.remove_contact(_c, _account)
|
||||
self.add_contact_to_roster(_jid, _account)
|
||||
self.draw_contact(_jid, _account)
|
||||
self.add_contact_to_roster(c_source.jid, account_source)
|
||||
self.draw_contact(c_dest.jid, account_dest)
|
||||
if not gajim.connections[account_source].metacontacts_supported or not \
|
||||
gajim.connections[account_dest].metacontacts_supported:
|
||||
dialogs.WarningDialog(_('Metacontacts storage not supported by your server'), _('Your server does not support storing metacontacts information. So those information will not be save on next reconnection.'))
|
||||
def merge_contacts(widget = None):
|
||||
if widget: # dialog has been shown
|
||||
dlg.destroy()
|
||||
if dlg.is_checked(): # user does not want to be asked again
|
||||
gajim.config.set('confirm_metacontacts', 'no')
|
||||
else:
|
||||
gajim.config.set('confirm_metacontacts', 'yes')
|
||||
# children must take the new tag too, so remember old tag
|
||||
old_tag = gajim.contacts.get_metacontacts_tag(account_source,
|
||||
c_source.jid)
|
||||
# remove the source row
|
||||
self.remove_contact(c_source, account_source)
|
||||
# brother inherite big brother groups
|
||||
c_source.groups = []
|
||||
for g in c_dest.groups:
|
||||
c_source.groups.append(g)
|
||||
gajim.connections[account_source].update_contact(c_source.jid,
|
||||
c_source.name, c_source.groups)
|
||||
gajim.contacts.add_metacontact(account_dest, c_dest.jid,
|
||||
account_source, c_source.jid)
|
||||
if was_big_brother:
|
||||
# add brothers too
|
||||
all_jid = gajim.contacts.get_metacontacts_jids(old_tag)
|
||||
for _account in all_jid:
|
||||
for _jid in all_jid[_account]:
|
||||
gajim.contacts.add_metacontact(account_dest, c_dest.jid,
|
||||
_account, _jid)
|
||||
_c = gajim.contacts.get_first_contact_from_jid(_account, _jid)
|
||||
self.remove_contact(_c, _account)
|
||||
self.add_contact_to_roster(_jid, _account)
|
||||
self.draw_contact(_jid, _account)
|
||||
self.add_contact_to_roster(c_source.jid, account_source)
|
||||
self.draw_contact(c_dest.jid, account_dest)
|
||||
|
||||
context.finish(True, True, etime)
|
||||
context.finish(True, True, etime)
|
||||
|
||||
confirm_metacontacts = gajim.config.get('confirm_metacontacts')
|
||||
if confirm_metacontacts == 'no':
|
||||
merge_contacts()
|
||||
return
|
||||
pritext = _('You are about to create a metacontact. Are you sure you want to continue?')
|
||||
sectext = _('Metacontacts are a way to regroup several contacts in one line. Generaly it is used when the same person has several Jabber accounts or transport accounts.')
|
||||
dlg = dialogs.ConfirmationDialogCheck(pritext, sectext,
|
||||
_('Do _not ask me again'), on_response_ok = merge_contacts)
|
||||
if not confirm_metacontacts: # First time we see this window
|
||||
dlg.checkbutton.set_active(True)
|
||||
|
||||
def on_drop_in_group(self, widget, account, c_source, grp_dest, context,
|
||||
etime, grp_source = None):
|
||||
|
|
Loading…
Reference in New Issue