support of contacts in no group
This commit is contained in:
parent
96419ac1d8
commit
f3deefc372
|
@ -106,11 +106,6 @@ class EditGroupsDialog:
|
|||
def group_toggled_cb(self, cell, path):
|
||||
self.changes_made = True
|
||||
model = self.list.get_model()
|
||||
if model[path][1] and len(self.user.groups) == 1: # we try to remove
|
||||
# the last group
|
||||
ErrorDialog(_('Cannot remove last group'),
|
||||
_('At least one contact group must be present.')).get_response()
|
||||
return
|
||||
model[path][1] = not model[path][1]
|
||||
if model[path][1]:
|
||||
self.user.groups.append(model[path][0].decode('utf-8'))
|
||||
|
|
|
@ -528,8 +528,6 @@ class Interface:
|
|||
self.roster.remove_contact(c, account)
|
||||
if _('not in the roster') in c.groups:
|
||||
c.groups.remove(_('not in the roster'))
|
||||
if len(c.groups) == 0:
|
||||
c.groups = [_('General')]
|
||||
self.roster.add_contact_to_roster(c.jid, account)
|
||||
gajim.connections[account].update_contact(c.jid, c.name, c.groups)
|
||||
else:
|
||||
|
@ -541,7 +539,7 @@ class Interface:
|
|||
name = jid.split('@', 1)[0]
|
||||
name = name.split('%', 1)[0]
|
||||
contact1 = gajim.contacts.create_contact(jid = jid, name = name,
|
||||
groups = [_('General')], show = 'online', status = 'online',
|
||||
groups = None, show = 'online', status = 'online',
|
||||
ask = 'to', resource = array[1], keyID = keyID)
|
||||
gajim.contacts.add_contact(account, contact1)
|
||||
self.roster.add_contact_to_roster(jid, account)
|
||||
|
|
|
@ -149,17 +149,13 @@ class RosterWindow:
|
|||
if contact.jid.find('@') <= 0:
|
||||
# if not '@' or '@' starts the jid ==> agent
|
||||
contact.groups = [_('Transports')]
|
||||
elif contact.groups == []:
|
||||
contact.groups.append(_('General'))
|
||||
|
||||
hide = True
|
||||
if contact.sub in ('both', 'to'):
|
||||
hide = False
|
||||
elif contact.ask == 'subscribe':
|
||||
hide = False
|
||||
# FIXME: uncomment when we support contacts in no group
|
||||
# elif contact.name or len(contact.groups):
|
||||
elif contact.name:
|
||||
elif contact.name or len(contact.groups):
|
||||
hide = False
|
||||
|
||||
# JEP-0162
|
||||
|
@ -172,7 +168,10 @@ class RosterWindow:
|
|||
return
|
||||
|
||||
model = self.tree.get_model()
|
||||
for g in contact.groups:
|
||||
groups = contact.groups
|
||||
if not groups:
|
||||
groups = [_('General')]
|
||||
for g in groups:
|
||||
iterG = self.get_group_iter(g, account)
|
||||
if not iterG:
|
||||
IterAcct = self.get_account_iter(account)
|
||||
|
@ -1244,8 +1243,8 @@ class RosterWindow:
|
|||
if not pseudo:
|
||||
pseudo = jid
|
||||
gajim.connections[account].request_subscription(jid, txt)
|
||||
if not group:
|
||||
group = _('General')
|
||||
if group:
|
||||
group = [group]
|
||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||
if not contact:
|
||||
keyID = ''
|
||||
|
@ -1254,18 +1253,17 @@ class RosterWindow:
|
|||
if jid in attached_keys:
|
||||
keyID = attached_keys[attached_keys.index(jid) + 1]
|
||||
contact = gajim.contacts.create_contact(jid = jid, name = pseudo,
|
||||
groups = [group], show = 'requested', status = '', ask = 'none',
|
||||
groups = group, show = 'requested', status = '', ask = 'none',
|
||||
sub = 'subscribe', keyID = keyID)
|
||||
gajim.contacts.add_contact(account, c)
|
||||
gajim.contacts.add_contact(account, contact)
|
||||
else:
|
||||
c = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||
if not _('not in the roster') in c.groups:
|
||||
if not _('not in the roster') in contact.groups:
|
||||
dialogs.InformationDialog(_('Subscription request has been sent'),
|
||||
_('If "%s" accepts this request you will know his or her status.') %jid)
|
||||
_('If "%s" accepts this request you will know his or her status.') % jid)
|
||||
return
|
||||
c.groups = [group]
|
||||
c.name = pseudo
|
||||
self.remove_contact(c, account)
|
||||
contact.groups = group
|
||||
contact.name = pseudo
|
||||
self.remove_contact(contact, account)
|
||||
self.add_contact_to_roster(jid, account)
|
||||
|
||||
def revoke_auth(self, widget, jid, account):
|
||||
|
|
Loading…
Reference in New Issue