예제 #1
0
        private bool IsContactCapable(string bus_name, ObjectPath op, uint handle)
        {
            Console.WriteLine(MSG_PREFIX + "Getting Contact capabilities");

            uint[] handles = new uint[1];
            handles[0] = handle;

            IDictionary <uint, RequestableChannelClass[]> caps;
            IContactCapabilities icaps = bus.GetObject <IContactCapabilities> (bus_name, op);

            caps = icaps.GetContactCapabilities(handles);

            if (caps.ContainsKey(handle))
            {
                RequestableChannelClass[] rccs = caps[handle];
                for (int i = 0; i < rccs.Length; i++)
                {
                    if (rccs[i].FixedProperties.ContainsKey(Constants.CHANNEL_TYPE_DBUSTUBE + ".ServiceName") &&
                        rccs[i].FixedProperties[Constants.CHANNEL_TYPE_DBUSTUBE + ".ServiceName"].Equals(DTUBETEST_IFACE))
                    {
                        Console.WriteLine(MSG_PREFIX + "Contact supports service name {0}", DTUBETEST_IFACE);
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #2
0
        private void SetTubeCapability(string bus_name, ObjectPath op)
        {
            Console.WriteLine(MSG_PREFIX + "Setting Contact capabilities");

            IContactCapabilities icaps = bus.GetObject <IContactCapabilities> (bus_name, op);

            IDictionary <string, object> [] caps = new Dictionary <string, object> [1];
            caps[0] = new Dictionary <string, object> ();
            caps[0].Add("org.freedesktop.Telepathy.Channel.TargetHandleType", HandleType.Contact);
            caps[0].Add("org.freedesktop.Telepathy.Channel.ChannelType", Constants.CHANNEL_TYPE_DBUSTUBE);
            caps[0].Add(Constants.CHANNEL_TYPE_DBUSTUBE + ".ServiceName", DTUBETEST_IFACE);

            icaps.SetSelfCapabilities(caps);
        }
예제 #3
0
        protected virtual void Initialize()
        {
            requests     = DBusUtility.GetProxy <IRequests> (bus, bus_name, object_path);
            capabilities = DBusUtility.GetProxy <IContactCapabilities> (bus, bus_name, object_path);


            conn.StatusChanged     += OnStatusChanged;
            conn.SelfHandleChanged += OnSelfHandleChanged;

            LoadCapabilities();

            dispatch_manager = new DispatchManager(this);


            CreateRoster();
        }
        protected internal virtual void Initialize()
        {
            capabilities = Connection.ContactCapabilities;
            capabilities.ContactCapabilitiesChanged += OnContactCapabilitiesChanged;

            if (Status > ConnectionPresenceType.Offline && Status < ConnectionPresenceType.Unknown)
            {
                uint [] handle = { Handle };

                IDictionary <uint, RequestableChannelClass []> dictionary =
                    capabilities.GetContactCapabilities(handle);

                if (dictionary.ContainsKey(Handle))
                {
                    //Log.DebugFormat ("{0} Loading services on Contact.Initialize()", this.Name);
                    LoadSupportedChannels(dictionary [Handle]);
                }
            }

            avatar = new Avatar(this);
        }
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (capabilities != null)
                {
                    try {
                        capabilities.ContactCapabilitiesChanged -= OnContactCapabilitiesChanged;
                    }
                    catch (Exception) {}
                    capabilities = null;
                }

                if (avatar != null)
                {
                    avatar.Dispose();
                    avatar = null;
                }

                roster = null;
            }
        }
예제 #6
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (dispatch_manager != null)
            {
                dispatch_manager.Dispose();
            }

            if (ChannelHandler == null)
            {
                ChannelHandler.Destroy();
            }

            if (roster != null)
            {
                roster.Dispose();
                roster = null;
            }

            if (conn != null)
            {
                try {
                    conn.SelfHandleChanged -= OnSelfHandleChanged;
                    conn.StatusChanged     -= OnStatusChanged;
                }
                catch (Exception) {}
                conn = null;
            }

            capabilities     = null;
            dispatch_manager = null;
            requests         = null;
        }