from buildbot.process import results
from twisted.words.protocols.jabber.jid import JID
from wokkel import client, xmppim
-
+from functools import partial
class SlackStatusPush(HttpStatusPushBase):
name = "SlackStatusPush"
yield utils.getDetailsForBuild(self.master, build, wantProperties=True)
body = self.format(build)
factory = client.DeferredClientFactory(JID("notify_bot@immae.fr/buildbot"), self.password)
- factory.streamManager.logTraffic = True
d = client.clientCreator(factory)
- def send_message(stream):
+ def send_message(recipient, stream):
message = xmppim.Message(recipient=JID(recipient), body=body)
message.stanzaType = 'chat'
stream.send(message.toElement())
# To allow chaining
return stream
for recipient in self.recipients:
- d.addCallback(send_message)
+ d.addCallback(partial(send_message, recipient))
d.addCallback(lambda _: factory.streamManager.xmlstream.sendFooter())
d.addErrback(log.err)