Esempio n. 1
0
        private void OnNewChannels(ChannelDetails[] channels)
        {
            foreach (ChannelDetails c in channels)
            {
                ObjectPath object_path  = c.Channel;
                string     channel_type = c.Properties["org.freedesktop.Telepathy.Channel.ChannelType"] as string;
                HandleType handle_type  = (HandleType)c.Properties["org.freedesktop.Telepathy.Channel.TargetHandleType"];
                uint       handle       = (uint)c.Properties["org.freedesktop.Telepathy.Channel.TargetHandle"];

                Console.WriteLine(MSG_PREFIX + "OnNewChannels: op {0}, channel_type {1}, handle_type {2}, handle {3}",
                                  object_path, channel_type, handle_type, handle);

                if (channel_type.Equals(Constants.CHANNEL_TYPE_DBUSTUBE))
                {
                    itube = bus.GetObject <IDBusTube> (Constants.CONNMANAGER_GABBLE_IFACE, object_path);
                    //itube.NewTube += OnNewTube;
                    itube.TubeChannelStateChanged += OnTubeChannelStateChanged;
                    itube.Closed += OnTubeClosed;

                    // get tube initiator handle
                    // should be = to self_handle on client
                    // should be != to self_handle on server
                    Properties p = bus.GetObject <Properties> (Constants.CONNMANAGER_GABBLE_IFACE, object_path);
                    tube_initiator = (uint)p.Get(Constants.CHANNEL_IFACE, "InitiatorHandle");

                    if (tube_initiator == self_handle)
                    {
                        Console.WriteLine(MSG_PREFIX + "Offering DTube");
                        addr = itube.Offer(new Dictionary <string, object>(), SocketAccessControl.Localhost);
                        Console.WriteLine(MSG_PREFIX + "Tube from {0} offered", addr);
                    }
                    else
                    {
                        addr = itube.Accept(SocketAccessControl.Localhost);
                        Console.WriteLine(MSG_PREFIX + "Tube from {0} accepted", addr);
                    }
                }
            }
        }
Esempio n. 2
0
 protected override void SetProxyObject()
 {
     tube = DBusUtility.GetProxy <IDBusTube> (Connection.BusName, ObjectPath);
 }
Esempio n. 3
0
        private void OnNewChannels(ChannelDetails[] channels)
        {
            foreach (ChannelDetails c in channels) {

                ObjectPath object_path = c.Channel;
                string channel_type = c.Properties["org.freedesktop.Telepathy.Channel.ChannelType"] as string;
                HandleType handle_type = (HandleType) c.Properties["org.freedesktop.Telepathy.Channel.TargetHandleType"];
                uint handle = (uint) c.Properties["org.freedesktop.Telepathy.Channel.TargetHandle"];

                Console.WriteLine (MSG_PREFIX + "OnNewChannels: op {0}, channel_type {1}, handle_type {2}, handle {3}",
                                   object_path, channel_type, handle_type, handle);

                if (channel_type.Equals (Constants.CHANNEL_TYPE_DBUSTUBE)) {
                    itube = bus.GetObject<IDBusTube> (Constants.CONNMANAGER_GABBLE_IFACE, object_path);
                    //itube.NewTube += OnNewTube;
                    itube.TubeChannelStateChanged += OnTubeChannelStateChanged;
                    itube.Closed += OnTubeClosed;

                    // get tube initiator handle
                    // should be = to self_handle on client
                    // should be != to self_handle on server
                    Properties p = bus.GetObject<Properties> (Constants.CONNMANAGER_GABBLE_IFACE, object_path);
                    tube_initiator = (uint) p.Get (Constants.CHANNEL_IFACE, "InitiatorHandle");

                    if (tube_initiator == self_handle) {
                        Console.WriteLine (MSG_PREFIX + "Offering DTube");
                        addr = itube.Offer (new Dictionary<string, object>(), SocketAccessControl.Localhost);
                        Console.WriteLine (MSG_PREFIX + "Tube from {0} offered", addr);
                    }
                    else {
                        addr = itube.Accept (SocketAccessControl.Localhost);
                        Console.WriteLine (MSG_PREFIX + "Tube from {0} accepted", addr);
                    }

                }
            }
        }