Beispiel #1
0
        public static string GetIdleTime(string service_id, string username)
        {
            if (!init)
            {
                return(null);
            }

            Galago.Service service = Galago.Global.GetService(service_id, Galago.Origin.Remote, true);
            if (service == null)
            {
                return(null);
            }

            Galago.Account account = service.GetAccount(username, true);

            if (account == null)
            {
                return(null);
            }

            Galago.Presence presence = account.Presence;

            if (presence == null)
            {
                return(null);
            }

            string str = StringFu.DurationToPrettyString(DateTime.Now, presence.IdleStartTime);

            return(str);
        }
Beispiel #2
0
        public static Status GetPresence(string service_id, string username)
        {
            if (!init)
            {
                return(Status.NoStatus);
            }

            Galago.Service service = Galago.Global.GetService(service_id, Galago.Origin.Remote, true);
            if (service == null)
            {
                return(Status.NoStatus);
            }

            Galago.Account account = service.GetAccount(username, true);

            if (account == null)
            {
                return(Status.NoStatus);
            }

            Galago.Presence presence = account.Presence;

            if (presence == null)
            {
                return(Status.NoStatus);
            }

            Status     user_status = Status.NoStatus;
            StatusType active_status;

            if (presence.IsIdle)
            {
                user_status = Status.Idle;
                // FIXME: We should try to find a way to display the actual away message (if relivent)
            }
            else
            {
                active_status = presence.ActiveStatus.Primitive;
                switch (active_status)
                {
                case StatusType.Away:
                    user_status = Status.Away;
                    break;

                case StatusType.Offline:
                    user_status = Status.Offline;
                    break;

                case StatusType.Available:
                    user_status = Status.Available;
                    break;
                }
            }

            return(user_status);
        }