Ejemplo n.º 1
0
        private uint[] GetContacts(string bus_name)
        {
            // use new Requests interface to create channel.
            // Connection.RequestChannel is deprecated
            IDictionary <string, object> channel_specs = new Dictionary <string, object>();

            channel_specs.Add(Constants.CHANNEL_IFACE + ".ChannelType", Constants.CHANNEL_TYPE_CONTACTLIST);
            channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetHandleType", HandleType.List);
            channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetID", "subscribe");

            bool       yours;
            ObjectPath chann_op = null;
            IDictionary <string, object> chann_props;

            try {
                irequests.EnsureChannel(channel_specs, out yours, out chann_op, out chann_props);
            }
            catch (Exception e) {
                Console.WriteLine(MSG_PREFIX + e);
            }

            IGroup contact_list = bus.GetObject <IGroup> (bus_name, chann_op); // use Group interface with Channel

            // get contacts
            uint[] contacts; //, local_pending, remote_pending;
            contacts = contact_list.Members;
            Console.WriteLine(MSG_PREFIX + "Got {0} Contacts!", contacts.Length);

            return(contacts);
        }