/usr/share/pyshared/coherence/mirabeau.py is in python-coherence 0.6.6.2-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2009 Philippe Normand <phil@base-art.net>
from coherence.dbus_constants import BUS_NAME, DEVICE_IFACE, SERVICE_IFACE
from coherence.extern.telepathy.mirabeau_tube_publisher import MirabeauTubePublisherConsumer
from coherence.tube_service import TubeDeviceProxy
from coherence import log
class Mirabeau(log.Loggable):
logCategory = "mirabeau"
def __init__(self, config, coherence_instance):
log.Loggable.__init__(self)
self._tube_proxies = []
self._coherence = coherence_instance
chatroom = config['chatroom']
manager = config['manager']
protocol = config['protocol']
# account dict keys are different for each protocol so we
# assume the user gave the right account parameters depending
# on the specified protocol.
account = config['account']
try:
allowed_devices = config["allowed_devices"].split(",")
except KeyError:
allowed_devices = None
tubes_to_offer = {BUS_NAME: {}, DEVICE_IFACE: {}, SERVICE_IFACE: {}}
callbacks = dict(found_peer_callback=self.found_peer,
disapeared_peer_callback=self.disapeared_peer,
got_devices_callback=self.got_devices)
self._tube_publisher = MirabeauTubePublisherConsumer(manager, protocol,
account, chatroom,
tubes_to_offer,
self._coherence,
allowed_devices,
**callbacks)
def found_peer(self, peer):
print "found", peer
def disapeared_peer(self, peer):
print "disapeared", peer
def got_devices(self, devices):
external_address = self._coherence.external_address
for device in devices:
uuid = device.get_id()
print "MIRABEAU found:", uuid
self._tube_proxies.append(TubeDeviceProxy(self._coherence, device,
external_address))
def start(self):
self._tube_publisher.start()
def stop(self):
self._tube_publisher.stop()
|