Add /add in conversation tabs.
This is a quick shortcut to add someone to your roster when talking with them. Fixes #3313. Also fixes typos.
This commit is contained in:
parent
c66c5a6e27
commit
83e28a2be8
2 changed files with 21 additions and 3 deletions
|
@ -61,6 +61,11 @@ class ConversationTab(OneToOneTab):
|
||||||
desc='Get the last activity of the given or the current contact.',
|
desc='Get the last activity of the given or the current contact.',
|
||||||
shortdesc='Get the activity.',
|
shortdesc='Get the activity.',
|
||||||
completion=self.core.completion.last_activity)
|
completion=self.core.completion.last_activity)
|
||||||
|
self.register_command('add', self.command_add,
|
||||||
|
desc='Add the current JID to your roster, ask them to'
|
||||||
|
' allow you to see his presence, and allow them to'
|
||||||
|
' see your presence.',
|
||||||
|
shortdesc='Add a user to your roster.')
|
||||||
self.resize()
|
self.resize()
|
||||||
self.update_commands()
|
self.update_commands()
|
||||||
self.update_keys()
|
self.update_keys()
|
||||||
|
@ -224,6 +229,19 @@ class ConversationTab(OneToOneTab):
|
||||||
fixes.get_version(self.core.xmpp, jid,
|
fixes.get_version(self.core.xmpp, jid,
|
||||||
callback=callback)
|
callback=callback)
|
||||||
|
|
||||||
|
@command_args_parser.ignored
|
||||||
|
def command_add(self):
|
||||||
|
"""
|
||||||
|
Add the current JID to the roster, and automatically
|
||||||
|
accept the reverse subscription
|
||||||
|
"""
|
||||||
|
jid = self.general_jid
|
||||||
|
if jid in roster and roster[jid].subscription in ('to', 'both'):
|
||||||
|
return self.core.information('Already subscribed.', 'Roster')
|
||||||
|
roster.add(jid)
|
||||||
|
roster.modified()
|
||||||
|
self.core.information('%s was added to the roster' % jid, 'Roster')
|
||||||
|
|
||||||
def resize(self):
|
def resize(self):
|
||||||
self.need_resize = False
|
self.need_resize = False
|
||||||
if self.size.tab_degrade_y:
|
if self.size.tab_degrade_y:
|
||||||
|
|
|
@ -82,8 +82,8 @@ class RosterInfoTab(Tab):
|
||||||
completion=self.completion_deny)
|
completion=self.completion_deny)
|
||||||
self.register_command('add', self.command_add,
|
self.register_command('add', self.command_add,
|
||||||
usage='<jid>',
|
usage='<jid>',
|
||||||
desc='Add the specified JID to your roster, ask him to'
|
desc='Add the specified JID to your roster, ask them to'
|
||||||
' allow you to see his presence, and allow him to'
|
' allow you to see his presence, and allow them to'
|
||||||
' see your presence.',
|
' see your presence.',
|
||||||
shortdesc='Add a user to your roster.')
|
shortdesc='Add a user to your roster.')
|
||||||
self.register_command('name', self.command_name,
|
self.register_command('name', self.command_name,
|
||||||
|
@ -618,7 +618,7 @@ class RosterInfoTab(Tab):
|
||||||
@command_args_parser.quoted(1)
|
@command_args_parser.quoted(1)
|
||||||
def command_add(self, args):
|
def command_add(self, args):
|
||||||
"""
|
"""
|
||||||
Add the specified JID to the roster, and set automatically
|
Add the specified JID to the roster, and automatically
|
||||||
accept the reverse subscription
|
accept the reverse subscription
|
||||||
"""
|
"""
|
||||||
if args is None:
|
if args is None:
|
||||||
|
|
Loading…
Reference in a new issue