summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-04-27 22:53:58 +0200
committermathieui <mathieui@mathieui.net>2012-04-27 22:53:58 +0200
commit3bd893e6b446db9c6fa16bf8cbf9b1f03ae78bcd (patch)
treeb1fe25aa136942fe658784ab392174bc6b436c65
parentf71e2a9cb13446b27239023a1e7c796e15c8fc47 (diff)
downloadpoezio-3bd893e6b446db9c6fa16bf8cbf9b1f03ae78bcd.tar.gz
poezio-3bd893e6b446db9c6fa16bf8cbf9b1f03ae78bcd.tar.bz2
poezio-3bd893e6b446db9c6fa16bf8cbf9b1f03ae78bcd.tar.xz
poezio-3bd893e6b446db9c6fa16bf8cbf9b1f03ae78bcd.zip
Update group commands
-rw-r--r--src/tabs.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 1f44da88..8683add1 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1811,15 +1811,15 @@ class RosterInfoTab(Tab):
jid = JID(args[0]).bare
name = args[1] if len(args) == 2 else ''
- contact = roster.get_contact_by_jid(jid)
- if not contact:
+ contact = roster[jid]
+ if contact is None:
self.core.information(_('No such JID in roster'), 'Error')
return
groups = set(contact.groups)
subscription = contact.subscription
- if self.core.xmpp.update_roster(jid, name=name, groups=groups, subscription=subscription):
- contact.name = name
+ if not self.core.xmpp.update_roster(jid, name=name, groups=groups, subscription=subscription):
+ self.core.information('The name could not be set.', 'Error')
def command_groupadd(self, args):
"""
@@ -1831,8 +1831,8 @@ class RosterInfoTab(Tab):
jid = JID(args[0]).bare
group = args[1]
- contact = roster.get_contact_by_jid(jid)
- if not contact:
+ contact = roster[jid]
+ if contact is None:
self.core.information(_('No such JID in roster'), 'Error')
return
@@ -1850,7 +1850,7 @@ class RosterInfoTab(Tab):
name = contact.name
subscription = contact.subscription
if self.core.xmpp.update_roster(jid, name=name, groups=new_groups, subscription=subscription):
- roster.edit_groups_of_contact(contact, new_groups)
+ roster.update_contact_groups(jid)
def command_groupremove(self, args):
"""
@@ -1862,8 +1862,8 @@ class RosterInfoTab(Tab):
jid = JID(args[0]).bare
group = args[1]
- contact = roster.get_contact_by_jid(jid)
- if not contact:
+ contact = roster[jid]
+ if contact is None:
self.core.information(_('No such JID in roster'), 'Error')
return
@@ -1880,7 +1880,7 @@ class RosterInfoTab(Tab):
name = contact.name
subscription = contact.subscription
if self.core.xmpp.update_roster(jid, name=name, groups=new_groups, subscription=subscription):
- roster.edit_groups_of_contact(contact, new_groups)
+ roster.update_contact_groups(jid)
def command_remove(self, args):
"""