Be sure not to create a loop when we drag parent on one of his child. Fixes #1656

This commit is contained in:
Yann Leboulanger 2006-03-05 10:19:36 +00:00
parent 0c2ba59f98
commit 89f2afd048
1 changed files with 6 additions and 0 deletions

View File

@ -2837,6 +2837,12 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
# if context.action == gtk.gdk.ACTION_COPY: # if context.action == gtk.gdk.ACTION_COPY:
# # Keep only MOVE # # Keep only MOVE
# return # return
c_dest = gajim.contacts.get_contact_with_highest_priority(account,
jid_dest)
# are we creating a loop (child is parent and parent is child)?
if gajim.contacts.is_subcontact(account, c_dest) and \
gajim.contacts.get_parent_contact(account, c_dest).jid == jid_source:
return
gajim.contacts.add_subcontact(account, jid_dest, jid_source) gajim.contacts.add_subcontact(account, jid_dest, jid_source)
# remove the source row # remove the source row
context.finish(True, True, etime) context.finish(True, True, etime)