HelpMessageHandler filter corrections
darcs-hash:20080520062733-86b55-8c84151b75f97df4df86055f148841753ba18708.gz
This commit is contained in:
@@ -93,7 +93,7 @@ class RootDiscoGetItemsHandler(DiscoHandler):
|
||||
def __init__(self, component):
|
||||
DiscoHandler.__init__(self, component)
|
||||
self.__logger = logging.getLogger("jcl.jabber.RootDiscoGetItemsHandler")
|
||||
|
||||
|
||||
def handle(self, stanza, lang_class, node, disco_obj, data):
|
||||
"""Discovery get_items on root node"""
|
||||
from_jid = stanza.get_from()
|
||||
@@ -127,7 +127,7 @@ class AccountTypeDiscoGetItemsHandler(DiscoHandler):
|
||||
def __init__(self, component):
|
||||
DiscoHandler.__init__(self, component)
|
||||
self.__logger = logging.getLogger("jcl.jabber.AccountTypeDiscoGetItemsHandler")
|
||||
|
||||
|
||||
def handle(self, stanza, lang_class, node, disco_obj, data):
|
||||
"""Discovery get_items on an account type node"""
|
||||
account_type = data
|
||||
|
||||
@@ -72,8 +72,13 @@ class HelpMessageHandler(Handler):
|
||||
"""
|
||||
Test if stanza body match the help regexp.
|
||||
"""
|
||||
return self.help_regexp.search(stanza.get_body()) \
|
||||
or self.help_regexp.search(stanza.get_subject())
|
||||
body = stanza.get_body()
|
||||
subject = stanza.get_subject()
|
||||
if subject and self.help_regexp.search(subject):
|
||||
return subject
|
||||
if body and self.help_regexp.search(body):
|
||||
return body
|
||||
return None
|
||||
|
||||
def handle(self, stanza, lang_class, data):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user