def _service_removed_cb(self, interface, protocol, name, stype, domain, flags): e = Event ('service-removed', interface=interface, protocol=protocol, name=name, stype=stype, domain=domain, flags=flags) self.event_queue.append(e)
def _service_found(self, interface, protocol, name, stype, domain, host_name, aprotocol, pt, port, txt, flags): e = Event('service-resolved', service = self, interface = interface, protocol = protocol, name = name, stype = stype, host_name = host_name, aprotocol = aprotocol, pt = pt, port = port, txt = txt, flags = flags) self.event_queue.append(e)
def _service_added_cb(self, interface, protocol, name, stype, domain, flags): service = AvahiService(self.event_queue, self.bus, self.server, interface, protocol, name, stype, domain, protocol, 0) e = Event ('service-added', service = service, interface=interface, protocol=protocol, name=name, stype=stype, domain=domain, flags=flags) self.event_queue.append(e)
def __init__(self, event_function, name = None, remote_name = None): xmlstream.XmlStream.__init__(self) self.name = name self.remote_name = remote_name self.event_func = event_function self.event_function = event_function self.addObserver(xmlstream.STREAM_START_EVENT, lambda *args: self.event(Event('stream-opened'))) self.addObserver('//features', lambda x: self.event( make_stream_event('stream-features', x))) self.addObserver('//iq', lambda x: self.event( make_iq_event(x))) self.addObserver('//message', lambda x: self.event( make_message_event(x))) self.addObserver('//presence', lambda x: self.event( make_presence_event(x)))
def clientConnectionFailed(self, connector, reason): ClientFactory.clientConnectionFailed(self, connector, reason) e = Event('connection-result', succeeded = False, reason = reason) self.event_func(e)
def connected (self, stream): e = Event('connection-result', succeeded = True) self.event(e) self.send_header()
def buildProtocol(self, addr): p = self.protocol() p.factory = self e = Event('incoming-connection', listener = self) p.event(e) return p
def _service_failed(self, error): e = Event('service-failed', service = self, error = error) self.event_queue.append(e)
def _all_for_now_cb(self): self.event_queue.append(Event('service-all-for-now'))