Merge branch 'command-system-regressions' into 'master'

Fix various regressions in the command system

See merge request !63
This commit is contained in:
Philipp Hörist 2017-03-07 17:19:11 +01:00
commit 205f5f3044
4 changed files with 13 additions and 10 deletions

View File

@ -54,6 +54,13 @@ from common.connection_handlers_events import MessageOutgoingEvent
from command_system.implementation.middleware import ChatCommandProcessor from command_system.implementation.middleware import ChatCommandProcessor
from command_system.implementation.middleware import CommandTools from command_system.implementation.middleware import CommandTools
# The members of these modules are not referenced directly anywhere in this
# module, but still they need to be kept around. Importing them automatically
# registers the contained CommandContainers with the command system, thereby
# populating the list of available commands.
import command_system.implementation.standard
import command_system.implementation.execute
try: try:
import gtkspell import gtkspell
HAS_GTK_SPELL = True HAS_GTK_SPELL = True

View File

@ -15,7 +15,7 @@
""" """
Provides a tiny framework with simple, yet powerful and extensible Provides a tiny framework with simple, yet powerful and extensible
architecture to implement commands in a streight and flexible, architecture to implement commands in a straight and flexible,
declarative way. declarative way.
""" """
@ -67,7 +67,7 @@ class CommandProcessor(object):
""" """
# This defines a command prefix (or an initializer), which should # This defines a command prefix (or an initializer), which should
# preceede a a text in order it to be processed as a command. # precede a text in order for it to be processed as a command.
COMMAND_PREFIX = '/' COMMAND_PREFIX = '/'
def process_as_command(self, text): def process_as_command(self, text):

View File

@ -75,7 +75,7 @@ class ChatCommandProcessor(CommandProcessor):
self.command_succeeded = True self.command_succeeded = True
def looks_like_command(self, text, body, name, arguments): def looks_like_command(self, text, body, name, arguments):
# Command escape stuff ggoes here. If text was prepended by the # Command escape stuff goes here. If text was prepended by the
# command prefix twice, like //not_a_command (if prefix is set # command prefix twice, like //not_a_command (if prefix is set
# to /) then it will be escaped, that is sent just as a regular # to /) then it will be escaped, that is sent just as a regular
# message with one (only one) prefix removed, so message will be # message with one (only one) prefix removed, so message will be

View File

@ -24,7 +24,7 @@ import dialogs
from common import gajim from common import gajim
from common import helpers from common import helpers
from common.exceptions import GajimGeneralException from common.exceptions import GajimGeneralException
from common.logger import Constants from common.logger import KindConstant
from ..errors import CommandError from ..errors import CommandError
from ..framework import CommandContainer, command, doc from ..framework import CommandContainer, command, doc
@ -32,10 +32,6 @@ from ..mapping import generate_usage
from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands from .hosts import ChatCommands, PrivateChatCommands, GroupChatCommands
# This holds constants fron the logger, which we'll be using in some of our
# commands.
lc = Constants()
class StandardCommonCommands(CommandContainer): class StandardCommonCommands(CommandContainer):
""" """
This command container contains standard commands which are common This command container contains standard commands which are common
@ -104,10 +100,10 @@ class StandardCommonCommands(CommandContainer):
raise CommandError(_("Limit must be an integer")) raise CommandError(_("Limit must be an integer"))
for row in results: for row in results:
contact, time, kind, show, message, subject = row contact, time, kind, show, message, subject, log_line_id = row
if not contact: if not contact:
if kind == lc.KIND_CHAT_MSG_SENT: if kind == KindConstant.CHAT_MSG_SENT:
contact = gajim.nicks[self.account] contact = gajim.nicks[self.account]
else: else:
contact = self.contact.name contact = self.contact.name