Properly yield an error on /add without arguments

This commit is contained in:
Florent Le Coz 2015-05-26 14:28:34 +02:00
parent 03c2d2974a
commit 0c8fe4da30

View file

@ -619,10 +619,13 @@ class RosterInfoTab(Tab):
Add the specified JID to the roster, and set automatically
accept the reverse subscription
"""
jid = safeJID(safeJID(args[0]).bare)
if not jid:
if args is None:
self.core.information('No JID specified', 'Error')
return
jid = safeJID(safeJID(args[0]).bare)
if not str(jid):
self.core.information('The provided JID (%s) is not valid' % (args[0],), 'Error')
return
if jid in roster and roster[jid].subscription in ('to', 'both'):
return self.core.information('Already subscribed.', 'Roster')
roster.add(jid)