OsIndependentString* TextSecurePreferences::GetMmsUserAgent(OsIndependentContext* context, OsIndependentString* defaultUserAgent)
{
  bool useCustom = GetBooleanPreference(context, (OsIndependentString*)MMS_CUSTOM_USER_AGENT, false);
  if (useCustom)
    return GetStringPreference(context, (OsIndependentString*)MMS_USER_AGENT, defaultUserAgent);
  else
    return defaultUserAgent;
}
bool GetHomeDirectory(std::string& HomeDirectory)
{
   TDEBUG_ENTER("GetHomeDirectory");
   std::string home("");
   bool SuccessValue;

   // We usually recalculate home every time - so ignore the
   // value in the registry.  The user can turn that off though!
   if (!GetBooleanPreference("Always Recalculate Home"))
      home = GetStringPreference("HOME");

   if (home.empty() || !IsDirectory(home.c_str()))
      SuccessValue = GetCalculatedHomeDirectory(home);
   else
      SuccessValue = true;

   TDEBUG_TRACE("Home directory is " << home);
 
   SuccessValue = (SuccessValue && !home.empty() && IsDirectory(home.c_str()));
   if (SuccessValue)
      HomeDirectory = home;

   return SuccessValue;
}
bool TextSecurePreferences::HasPromptedDefaultSmsProvider(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)PROMPTED_DEFAULT_SMS_PREF, false);
}
bool TextSecurePreferences::HasPromptedPushRegistration(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)PROMPTED_PUSH_REGISTRATION_PREF, false);
}
bool TextSecurePreferences::IsSmsDeliveryReportsEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)SMS_DELIVERY_REPORT_PREF, false);
}
bool TextSecurePreferences::IsInThreadNotifications(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)IN_THREAD_NOTIFICATION_PREF, true);
}
bool TextSecurePreferences::IsWifiSmsEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)WIFI_SMS_PREF, false);
}
bool TextSecurePreferences::IsRatingEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)RATING_ENABLED_PREF, true);
}
bool TextSecurePreferences::IsNotificationVibrateEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)VIBRATE_PREF, true);
}
bool TextSecurePreferences::IsScreenSecurityEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)SCREEN_SECURITY_PREF, true);
}
bool TextSecurePreferences::GetUseCustomMmscPassword(OsIndependentContext* context)
{
  bool legacy = TextSecurePreferences::IsLegacyUseLocalApnsEnabled(context);
  return GetBooleanPreference(context, (OsIndependentString*)MMSC_CUSTOM_PASSWORD_PREF, legacy);
}
bool TextSecurePreferences::GetUseCustomMmscUsername(OsIndependentContext* context)
{
  bool legacy = TextSecurePreferences::IsLegacyUseLocalApnsEnabled(context);
  return GetBooleanPreference(context, (OsIndependentString*)MMSC_CUSTOM_USERNAME_PREF, legacy);
}
bool TextSecurePreferences::IsPasswordDisabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)DISABLE_PASSPHRASE_PREF, false);
}
bool TextSecurePreferences::IsEnterSendsEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)ENTER_SENDS_PREF, false);
}
bool TextSecurePreferences::IsInterceptAllSmsEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)ALL_SMS_PREF, true);
}
bool TextSecurePreferences::IsNotificationsEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)NOTIFICATION_PREF, true);
}
bool TextSecurePreferences::IsLegacyUseLocalApnsEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)ENABLE_MANUAL_MMS_PREF, false);
}
bool TextSecurePreferences::IsThreadLengthTrimmingEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)THREAD_TRIM_ENABLED, false);
}
bool TextSecurePreferences::IsVerifying(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)VERIFYING_STATE_PREF, false);
}
bool TextSecurePreferences::IsWebsocketRegistered(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)WEBSOCKET_REGISTERED_PREF, false);
}
bool TextSecurePreferences::IsPushRegistered(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)REGISTERED_GCM_PREF, false);
}
bool TextSecurePreferences::IsPassphraseTimeoutEnabled(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)PASSPHRASE_TIMEOUT_PREF, false);
}
bool TextSecurePreferences::IsSignedPreKeyRegistered(OsIndependentContext* context)
{
  return GetBooleanPreference(context, (OsIndependentString*)SIGNED_PREKEY_REGISTERED_PREF, false);
}