string FilterOnlineStatus(UUID otherUser, bool isOnline, uint lastLogout, List <FriendListItem> friends)
        {
            // Filter online status?
            if (isOnline)
            {
                if (otherUser == m_agentID)
                {
                    return("Online");
                }

                UserPreferencesData prefs = m_scene.CommsManager.UserService.RetrieveUserPreferences(otherUser);
                if (prefs != null)
                {
                    // This is where we check the "Only friend and groups know I'm online" option.
                    // Only applies to friends (not groups) in InWorldz (for now at least).
                    if (prefs.ListedInDirectory || IsMyFriend(otherUser, friends))
                    {
                        return("Online");    // everyone can see or these users are friends
                    }
                }

                // fake offline but "logged in today"
                return(DateTime.Now.ToString(VIEWER_DATE_FORMAT));
            }

            if (lastLogout == 0)
            {
                return("- Unknown -"); // '-' sorts as oldest
            }
            DateTime when = Util.UnixToLocalDateTime(lastLogout);

            return(when.ToString(VIEWER_DATE_FORMAT));
        }
        // Leggi PEC impostata in preferenze
        private static async Task Scenario_5()
        {
            string account = Utils.GetAccount();
            string url     = Constants.REST_MULTIDIALOGO_STAGE_HOST + "/users/" + account + "/preferences";

            HttpResponseMessage response = await SendRequest(url, null, "Get");

            if (response == null || response.Content == null)
            {
                return;
            }

            string responseBody = await response.Content.ReadAsStringAsync();

            UserPreferencesData userPreferences = JsonConvert.DeserializeObject <UserPreferencesData>(responseBody);

            Console.WriteLine("Pec:");
            Console.WriteLine("---------");
            Console.WriteLine("Indirizzo");
            Console.WriteLine("---------");
            foreach (string p in userPreferences.GetPec())
            {
                Console.WriteLine(p);
            }
        }
        // Leggi loghi impostati in preferenze
        private static async Task Scenario_4()
        {
            string account = Utils.GetAccount();
            string url     = Constants.REST_MULTIDIALOGO_STAGE_HOST + "/users/" + account + "/preferences";

            HttpResponseMessage response = await SendRequest(url, null, "Get");

            if (response == null || response.Content == null)
            {
                return;
            }

            string responseBody = await response.Content.ReadAsStringAsync();

            UserPreferencesData userPreferences = JsonConvert.DeserializeObject <UserPreferencesData>(responseBody);

            Console.WriteLine("Loghi:");
            Console.WriteLine("------------------------");
            Console.WriteLine("Id | Label | Default");
            Console.WriteLine("------------------------");
            foreach (SenderLetterWatermarkPreferences l in userPreferences.GetLoghi())
            {
                Console.WriteLine(l.ToString());
            }
        }
 public void SaveUserPreferences(UserPreferencesData userPrefs)
 {
     m_log.DebugFormat("[USERSTORAGE]: SaveUserPreferences plugin request for {0}", userPrefs.UserId);
     foreach (IUserDataPlugin plugin in m_plugins)
     {
         try
         {
             plugin.SaveUserPreferences(userPrefs);
         }
         catch (Exception e)
         {
             m_log.ErrorFormat("[USERSTORAGE]: Unable to save user preferences {0} via {1} ({2})", userPrefs.UserId, plugin.Name, e.ToString());
         }
     }
 }
        // Legge tipo di affrancatura impostata in preferenze
        private static async Task Scenario_8()
        {
            string account = Utils.GetAccount();
            string url     = Constants.REST_MULTIDIALOGO_STAGE_HOST + "/users/" + account + "/preferences";

            HttpResponseMessage response = await SendRequest(url, null, "Get");

            if (response == null || response.Content == null)
            {
                return;
            }

            string responseBody = await response.Content.ReadAsStringAsync();

            UserPreferencesData userPreferences = JsonConvert.DeserializeObject <UserPreferencesData>(responseBody);

            Console.WriteLine("Affrancatura impostata: " + userPreferences.GetSenderPostageType());
        }
        public UserPreferencesData RetrieveUserPreferences(UUID uuid)
        {
            m_log.DebugFormat("[USERSTORAGE]: RetrieveUserPreferences plugin request for {0}", uuid);
            foreach (IUserDataPlugin plugin in m_plugins)
            {
                try
                {
                    UserPreferencesData userPrefs = plugin.RetrieveUserPreferences(uuid);
                    if (userPrefs != null)
                    {
                        return(userPrefs);
                    }
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[USERSTORAGE]: Unable to retrieve user preferences {0} via {1} ({2})", uuid, plugin.Name, e.ToString());
                }
            }

            return(null);
        }
Esempio n. 7
0
        public XmlRpcResponse XmlRpcGetUserPreferences(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            // Check IP Endpoint Access
            if (!TrustManager.Instance.IsTrustedPeer(remoteClient))
            {
                return(Util.CreateTrustManagerAccessDeniedResponse());
            }

            // XmlRpcResponse response = new XmlRpcResponse();
            Hashtable requestData = (Hashtable)request.Params[0];

            UUID userId = UUID.Zero;

            UUID.TryParse((string)requestData["userId"], out userId);

            if (userId == UUID.Zero)
            {
                return(this.GenerateXmlRpcError("InvalidArgument", "UserId given is invalid"));
            }

            UserPreferencesData prefs = m_userDataBaseService.RetrieveUserPreferences(userId);

            if (prefs == null)
            {
                return(this.GenerateXmlRpcError("DatabaseError", "Database error retrieving user preferences"));
            }

            //return the prefs
            Hashtable responseData = new Hashtable();

            responseData["userId"]            = userId.ToString();
            responseData["recvIMsViaEmail"]   = prefs.ReceiveIMsViaEmail ? "1" : "0";
            responseData["listedInDirectory"] = prefs.ListedInDirectory ? "1" : "0";

            XmlRpcResponse response = new XmlRpcResponse();

            response.Value = responseData;

            return(response);
        }
 public void SaveUserPreferences(UserPreferencesData userPrefs)
 {
     m_storage.SaveUserPreferences(userPrefs);
 }
Esempio n. 9
0
 public abstract void SaveUserPreferences(UserPreferencesData userPrefs);
 public void SaveUserPreferences(UserPreferencesData userPrefs)
 {
     m_log.DebugFormat("[USERSTORAGE]: SaveUserPreferences plugin request for {0}", userPrefs.UserId);
     foreach (IUserDataPlugin plugin in m_plugins)
     {
         try
         {
             plugin.SaveUserPreferences(userPrefs);
         }
         catch (Exception e)
         {
             m_log.ErrorFormat("[USERSTORAGE]: Unable to save user preferences {0} via {1} ({2})", userPrefs.UserId, plugin.Name, e.ToString());
         }
     }
 }