Skip to content

Commit

Permalink
Blacklist instead of whitelist relayed message attributes and child e…
Browse files Browse the repository at this point in the history
…lements
  • Loading branch information
Jack Bates committed Jun 4, 2009
1 parent 7f3d8e2 commit 722b28f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions qubot
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ class Qubot:

def message(self, element):
if element['from'].startswith(unicode(jid)) and element.body:
message = domish.Element((None, 'message'))
message = element

del message['from']

message['to'] = 'qubit@conference.jabber.org'
message['type'] = 'groupchat'
message.addElement('body', content=str(element.body))

self.xmlstream.send(message)

if 'qubit@conference.jabber.org/qubot' != element['from'] and element.body and re.search('qubot', str(element.body), re.I):
message = domish.Element((None, 'message'))

message['to'] = 'qubit@conference.jabber.org'
message['type'] = 'groupchat'

message.addElement('body', content='don\'t taunt qubot')

self.xmlstream.send(message)

def authd(self, xmlstream):
Expand Down

0 comments on commit 722b28f

Please sign in to comment.