Beispiel #1
0
    def __init__(self, manager, protocol,
                 account, muc_id, existing_client=False):
        log.Loggable.__init__(self)
        self.account = account
        self.existing_client = existing_client
        self.channel_text = None
        self._unsent_messages = []
        self._tube_conns = {}
        self._tubes = {}
        self._channels = []
        self._pending_tubes = {}

        if self.existing_client:
            self.muc_id = self.existing_client.muc_id
            self.conn = self.existing_client.conn
            self.ready_cb(self.conn)
        else:
            if protocol == 'local-xmpp':
                self.muc_id = muc_id
            else:
                self.muc_id = "%s@%s" % (muc_id, self.account["fallback-conference-server"])
            self.conn = tp_connect(manager, protocol, account, self.ready_cb)
        conn_obj = self.conn[CONN_INTERFACE]
        conn_obj.connect_to_signal('StatusChanged', self.status_changed_cb)
        conn_obj.connect_to_signal('NewChannels', self.new_channels_cb)

        self.joined = False
Beispiel #2
0
    def __init__(self,
                 manager,
                 protocol,
                 account,
                 muc_id,
                 existing_client=False):
        log.Loggable.__init__(self)
        self.account = account
        self.existing_client = existing_client
        self.channel_text = None
        self._unsent_messages = []
        self._tube_conns = {}
        self._tubes = {}
        self._channels = []
        self._pending_tubes = {}

        if self.existing_client:
            self.muc_id = self.existing_client.muc_id
            self.conn = self.existing_client.conn
            self.ready_cb(self.conn)
        else:
            if protocol == 'local-xmpp':
                self.muc_id = muc_id
            else:
                self.muc_id = "%s@%s" % (
                    muc_id, self.account["fallback-conference-server"])
            self.conn = tp_connect(manager, protocol, account, self.ready_cb)
        conn_obj = self.conn[CONN_INTERFACE]
        conn_obj.connect_to_signal('StatusChanged', self.status_changed_cb)
        conn_obj.connect_to_signal('NewChannels', self.new_channels_cb)

        self.joined = False
Beispiel #3
0
def run(args=None):
    if not args:
        args = sys.argv[1:]

    loop = gobject.MainLoop()

    def found_peer(peer):
        pass

    def disapeared_peer(peer):
        pass

    def got_devices(devices):
        for device in devices:
            try:
                name = '%s (%s)' % (device.get_friendly_name(),
                                    ':'.join(device.get_device_type().split(':')[3:5]))
            except:
                continue
            print name
            #
            #print "  >",
            if device.get_friendly_name() == "Phil":
                for service in device.services:
                    if "Browse" in service.get_available_actions():
                        print service.action("browse", {'object_id':'0', 'process_result': 'no',
                                             'starting_index':'0','requested_count': '5'})

    # FIXME: hardcoded stuff
    nickname = "client2"
    conn = connect.tp_connect("salut", "local-xmpp",
                              {"first-name": nickname,
                               "last-name": "",
                               "published-name": nickname, "nickname": nickname})
    cli = MirabeauTubeConsumer(conn, "UPnPProxy",
                               found_peer_callback=found_peer,
                               disapeared_peer_callback=disapeared_peer,
                               got_devices_callback=got_devices)
    cli.start()

    try:
        loop.run()
    finally:
        cli.stop()