Example #1
0
        public void SetStatus(ConnectionPresenceType status, string message)
        {
            ISimplePresence simplePresence = Bus.Session.GetObject <ISimplePresence> (connectionBusIFace, connectionPath);
//			Properties simplePresenceProperties = Bus.Session.GetObject<Properties> (connectionBusIFace, connectionPath);
//			IDictionary<string, object> lstStatus = (IDictionary<string, object>) simplePresenceProperties.Get("org.freedesktop.Telepathy.Connection.Interface.SimplePresence", "Statuses");

            List <BaseStatus> possibleStatusLst = EmpathyStatus.GetStatusList(status);

            // TODO: utiliser SimplePresence au lieu de Presence
            IPresence presence = Bus.Session.GetObject <IPresence> (connectionBusIFace, connectionPath);
            IDictionary <string, StatusSpec> lstStatus = presence.GetStatuses();

            foreach (BaseStatus oneStatus in possibleStatusLst)
            {
                StatusSpec statusSpec;
                if (lstStatus.TryGetValue(oneStatus.ToString(), out statusSpec))
                {
                    if (statusSpec.MaySetOnSelf)
                    {
                        simplePresence.SetPresence(oneStatus.ToString(), message);
                        return;
                    }
                }
            }
        }
Example #2
0
        public override void UpdateItems()
        {
            // suppression des preset status déja lus
            statuses.RemoveAll(new System.Predicate <Item>(delegate(Item val) { return(val is EmpathySavedStatusItem); }));

            // lire les status enregistrés
            XmlDocument statusList = new XmlDocument();

            try {
                statusList.Load(PresetsFile);

                foreach (XmlNode statusNode in statusList.GetElementsByTagName("status"))
                {
                    string pres    = statusNode.Attributes.GetNamedItem("presence").Value;
                    string message = statusNode.InnerText;

                    statuses.Add(new EmpathySavedStatusItem(EmpathyStatus.GetPresence(pres), message));
                }
            } catch (Exception e) {
                Log <EmpathySavedStatusItemSource> .Error("Error reading presets statuses: {0}", e.Message);

                Log <EmpathySavedStatusItemSource> .Debug(e.StackTrace);
            }
        }