Commit c1be5284 authored by Link Mauve's avatar Link Mauve

Fix core commands, broken in the previous commit.

parent 37cd7d19
......@@ -194,7 +194,7 @@ class Plugin(BasePlugin):
that we cannot/do not want to encrypt/decrypt messages.
"""
current_presence = self.core.get_status()
self.core.command_status('%s %s' % (current_presence.show or 'available', current_presence.message or '',))
self.core.command.status('%s %s' % (current_presence.show or 'available', current_presence.message or '',))
def on_normal_presence(self, presence):
"""
......@@ -293,7 +293,7 @@ class Plugin(BasePlugin):
"""
args = args.split()
if not args:
return self.core.command_help("gpg")
return self.core.command.help("gpg")
if len(args) >= 2:
jid = JID(args[1])
else:
......@@ -313,7 +313,7 @@ class Plugin(BasePlugin):
self.contacts[JID(jid).full] = 'disabled'
elif command == 'setkey':
if len(args) != 3:
return self.core.command_help("gpg")
return self.core.command.help("gpg")
if not self.config.has_section('keys'):
self.config.add_section('keys')
self.config.set(jid.bare, args[2], 'keys')
......
......@@ -178,7 +178,7 @@ class Plugin(BasePlugin):
rooms = self.config.get_by_tabname('rooms', server, default='').split(':')
for room in rooms:
room = '{}%{}@{}/{}'.format(room, server, gateway, nick)
self.core.command_join(room)
self.core.command.join(room)
def initial_connect(self):
gateway = self.config.get('gateway', 'irc.poez.io')
......@@ -204,7 +204,7 @@ class Plugin(BasePlugin):
delayed = self.api.create_delayed_event(5, self.join, gw, sect)
self.api.add_timed_event(delayed)
if not already_opened:
self.core.command_join(room_suffix + '/' + nick)
self.core.command.join(room_suffix + '/' + nick)
delayed = self.api.create_delayed_event(5, login, gateway, section,
login_nick, login_command,
room_suffix[1:])
......@@ -278,7 +278,7 @@ class Plugin(BasePlugin):
/irc_join <room or server>
"""
if not args:
return self.core.command_help('irc_join')
return self.core.command.help('irc_join')
sections = self.config.sections()
if 'irc' in sections:
sections.remove('irc')
......@@ -294,7 +294,7 @@ class Plugin(BasePlugin):
server.
"""
if args is None:
return self.core.command_help('irc_query')
return self.core.command.help('irc_query')
current_tab_info = self.get_current_tab_irc_info()
if not current_tab_info:
return
......@@ -305,9 +305,9 @@ class Plugin(BasePlugin):
message = args[1]
jid = '{}!{}@{}'.format(nickname, server, gateway)
if message:
self.core.command_message('{} "{}"'.format(jid, message))
self.core.command.message('{} "{}"'.format(jid, message))
else:
self.core.command_message('{}'.format(jid))
self.core.command.message('{}'.format(jid))
def join_server_rooms(self, section):
"""
......@@ -324,7 +324,7 @@ class Plugin(BasePlugin):
suffix = '%{}@{}{}'.format(section, gateway, nick)
for room in rooms:
self.core.command_join(room + suffix)
self.core.command.join(room + suffix)
def join_room(self, name):
"""
......@@ -339,7 +339,7 @@ class Plugin(BasePlugin):
if self.config.get_by_tabname('nickname', server):
room += '/' + self.config.get_by_tabname('nickname', server)
self.core.command_join(room)
self.core.command.join(room)
def get_current_tab_irc_info(self):
"""
......
......@@ -810,7 +810,7 @@ class Plugin(BasePlugin):
"""
args = common.shell_split(arg)
if not args:
return self.core.command_help('otr')
return self.core.command.help('otr')
action = args.pop(0)
tab = self.api.current_tab()
name = tab.name
......@@ -920,7 +920,7 @@ class Plugin(BasePlugin):
/otrsmp <ask|answer|abort> [question] [secret]
"""
if args is None or not args:
return self.core.command_help('otrsmp')
return self.core.command.help('otrsmp')
length = len(args)
action = args.pop(0)
if length == 2:
......
......@@ -58,7 +58,7 @@ class Plugin(BasePlugin):
@command_args_parser.raw
def command_ping(self, arg):
if not arg:
return self.core.command_help('ping')
return self.core.command.help('ping')
jid = safeJID(arg)
start = time.time()
def callback(iq):
......
......@@ -99,7 +99,7 @@ class Plugin(BasePlugin, pyinotify.Notifier):
if attached != self.attached:
self.attached = attached
status = 'available' if self.attached else 'away'
self.core.command_status(status)
self.core.command.status(status)
if self.config.get('use_csi'):
if self.attached:
self.core.xmpp.plugin['xep_0352'].send_active()
......
......@@ -52,7 +52,7 @@ class Plugin(BasePlugin):
def command_tell(self, args):
"""/tell <nick> <message>"""
if args is None:
self.core.command_help('tell')
self.core.command.help('tell')
return
nick, msg = args
tab = self.api.current_tab()
......
This diff is collapsed.
This diff is collapsed.
......@@ -648,7 +648,7 @@ class ChatTab(Tab):
/correct <fixed message>
"""
if not line:
self.core.command_help('correct')
self.core.command.help('correct')
return
if not self.last_sent_message:
self.core.information('There is no message to correct.')
......
......@@ -155,7 +155,7 @@ class ConversationTab(OneToOneTab):
/last_activity [jid]
"""
if args and args[0]:
return self.core.command_last_activity(args[0])
return self.core.command.last_activity(args[0])
def callback(iq):
if iq['type'] != 'result':
......@@ -223,7 +223,7 @@ class ConversationTab(OneToOneTab):
res.get('os') or 'an unknown platform')
self.core.information(version, 'Info')
if args:
return self.core.command_version(args[0])
return self.core.command.version(args[0])
jid = safeJID(self.name)
if not jid.resource:
if jid in roster:
......
......@@ -66,5 +66,5 @@ class MucListTab(ListTab):
row = self.listview.get_selected_row()
if not row:
return
self.core.command_join(row[1])
self.core.command.join(row[1])
......@@ -326,9 +326,9 @@ class MucTab(ChatTab):
def command_invite(self, args):
"""/invite <jid> [reason]"""
if args is None:
return self.core.command_help('invite')
return self.core.command.help('invite')
jid, reason = args
self.core.command_invite('%s %s "%s"' % (jid, self.name, reason))
self.core.command.invite('%s %s "%s"' % (jid, self.name, reason))
def completion_invite(self, the_input):
"""Completion for /invite"""
......@@ -352,7 +352,7 @@ class MucTab(ChatTab):
/info <nick>
"""
if args is None:
return self.core.command_help('info')
return self.core.command.help('info')
nick = args[0]
user = self.get_user_by_name(nick)
if not user:
......@@ -494,7 +494,7 @@ class MucTab(ChatTab):
User "random" to attribute a random color.
"""
if args is None:
return self.core.command_help('color')
return self.core.command.help('color')
nick = args[0]
color = args[1].lower()
user = self.get_user_by_name(nick)
......@@ -544,7 +544,7 @@ class MucTab(ChatTab):
res.get('os') or 'an unknown platform')
self.core.information(version, 'Info')
if args is None:
return self.core.command_help('version')
return self.core.command.help('version')
nick = args[0]
if nick in [user.nick for user in self.users]:
jid = safeJID(self.name).bare
......@@ -560,7 +560,7 @@ class MucTab(ChatTab):
/nick <nickname>
"""
if args is None:
return self.core.command_help('nick')
return self.core.command.help('nick')
nick = args[0]
if not self.joined:
return self.core.information('/nick only works in joined rooms',
......@@ -632,7 +632,7 @@ class MucTab(ChatTab):
/query <nick> [message]
"""
if args is None:
return self.core.command_help('query')
return self.core.command.help('query')
nick = args[0]
r = None
for user in self.users:
......@@ -719,7 +719,7 @@ class MucTab(ChatTab):
/kick <nick> [reason]
"""
if args is None:
return self.core.command_help('kick')
return self.core.command.help('kick')
if len(args) == 2:
msg = ' "%s"' % args[1]
else:
......@@ -735,7 +735,7 @@ class MucTab(ChatTab):
if iq['type'] == 'error':
self.core.room_error(iq, self.name)
if args is None:
return self.core.command_help('ban')
return self.core.command.help('ban')
if len(args) > 1:
msg = args[1]
else:
......@@ -765,7 +765,7 @@ class MucTab(ChatTab):
self.core.room_error(iq, self.name)
if args is None:
return self.core.command_help('role')
return self.core.command.help('role')
nick, role, reason = args[0], args[1].lower(), args[2]
......@@ -792,7 +792,7 @@ class MucTab(ChatTab):
self.core.room_error(iq, self.name)
if args is None:
return self.core.command_help('affiliation')
return self.core.command.help('affiliation')
nick, affiliation = args[0], args[1].lower()
......@@ -867,7 +867,7 @@ class MucTab(ChatTab):
/ignore <nick>
"""
if args is None:
return self.core.command_help('ignore')
return self.core.command.help('ignore')
nick = args[0]
user = self.get_user_by_name(nick)
......@@ -885,7 +885,7 @@ class MucTab(ChatTab):
/unignore <nick>
"""
if args is None:
return self.core.command_help('unignore')
return self.core.command.help('unignore')
nick = args[0]
user = self.get_user_by_name(nick)
......
......@@ -204,7 +204,7 @@ class PrivateTab(OneToOneTab):
res.get('os') or 'an unknown platform')
self.core.information(version, 'Info')
if args:
return self.core.command_version(args[0])
return self.core.command.version(args[0])
jid = safeJID(self.name)
fixes.get_version(self.core.xmpp, jid,
callback=callback)
......
......@@ -230,7 +230,7 @@ class RosterInfoTab(Tab):
/cert_add <name> <certfile> [cert-management]
"""
if not args or len(args) < 2:
return self.core.command_help('cert_add')
return self.core.command.help('cert_add')
def cb(iq):
if iq['type'] == 'error':
self.core.information('Unable to add the certificate.', 'Error')
......@@ -284,7 +284,7 @@ class RosterInfoTab(Tab):
/cert_disable <name>
"""
if not args:
return self.core.command_help('cert_disable')
return self.core.command.help('cert_disable')
def cb(iq):
if iq['type'] == 'error':
self.core.information('Unable to disable the certificate.', 'Error')
......@@ -301,7 +301,7 @@ class RosterInfoTab(Tab):
/cert_revoke <name>
"""
if not args:
return self.core.command_help('cert_revoke')
return self.core.command.help('cert_revoke')
def cb(iq):
if iq['type'] == 'error':
self.core.information('Unable to revoke the certificate.', 'Error')
......@@ -319,7 +319,7 @@ class RosterInfoTab(Tab):
/cert_fetch <name> <path>
"""
if not args or len(args) < 2:
return self.core.command_help('cert_fetch')
return self.core.command.help('cert_fetch')
def cb(iq):
if iq['type'] == 'error':
self.core.information('Unable to fetch the certificate.',
......@@ -485,7 +485,7 @@ class RosterInfoTab(Tab):
else:
self.core.information('No JID selected.', 'Error')
return
self.core.command_last_activity(jid)
self.core.command.last_activity(jid)
def resize(self):
self.need_resize = False
......@@ -646,7 +646,7 @@ class RosterInfoTab(Tab):
self.core.information('The name could not be set.', 'Error')
log.debug('Error in /name:\n%s', iq)
if args is None:
return self.core.command_help('name')
return self.core.command.help('name')
jid = safeJID(args[0]).bare
name = args[1] if len(args) == 2 else ''
......@@ -668,7 +668,7 @@ class RosterInfoTab(Tab):
Add the specified JID to the specified group
"""
if args is None:
return self.core.command_help('groupadd')
return self.core.command.help('groupadd')
jid = safeJID(args[0]).bare
group = args[1]
......@@ -708,7 +708,7 @@ class RosterInfoTab(Tab):
Remove the specified JID from the first specified group and add it to the second one
"""
if args is None:
return self.core.command_help('groupmove')
return self.core.command.help('groupmove')
jid = safeJID(args[0]).bare
group_from = args[1]
group_to = args[2]
......@@ -763,7 +763,7 @@ class RosterInfoTab(Tab):
Remove the specified JID from the specified group
"""
if args is None:
return self.core.command_help('groupremove')
return self.core.command.help('groupremove')
jid = safeJID(args[0]).bare
group = args[1]
......@@ -1125,9 +1125,9 @@ class RosterInfoTab(Tab):
selected_row = self.roster_win.get_selected_row()
if isinstance(selected_row, Contact):
for resource in selected_row.resources:
self.core.command_version(str(resource.jid))
self.core.command.version(str(resource.jid))
elif isinstance(selected_row, Resource):
self.core.command_version(str(selected_row.jid))
self.core.command.version(str(selected_row.jid))
else:
self.core.information('Nothing to get versions from', 'Info')
......
......@@ -203,7 +203,7 @@ class XMLTab(Tab):
def command_filter_id(self, args):
"""/filter_id <id>"""
if args is None:
return self.core.command_help('filter_id')
return self.core.command.help('filter_id')
self.update_filters(matcher.MatcherId(args[0]))
self.refresh()
......@@ -234,7 +234,7 @@ class XMLTab(Tab):
def command_dump(self, args):
"""/dump <filename>"""
if args is None:
return self.core.command_help('dump')
return self.core.command.help('dump')
if self.filters:
xml = self.filtered_buffer.messages[:]
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment