hbfloateruserauth.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * @file hbfloateruserauth.h
  3. * @brief The HBFloaterUserAuth class declaration
  4. *
  5. * $LicenseInfo:firstyear=2015&license=viewergpl$
  6. *
  7. * Copyright (c) 2015, Henri Beauchamp
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_HBFLOATERUSERAUTH_H
  33. #define LL_HBFLOATERUSERAUTH_H
  34. #include "llfloater.h"
  35. class LLButton;
  36. class LLLineEditor;
  37. class HBFloaterUserAuth final : public LLFloater
  38. {
  39. public:
  40. typedef void (*HBFloaterUserAuthCallback)(const LLUUID auth_id,
  41. const std::string username,
  42. const std::string password,
  43. bool validated);
  44. ~HBFloaterUserAuth() override;
  45. bool postBuild() override;
  46. void draw() override;
  47. static void request(const std::string& host, const std::string& realm,
  48. const LLUUID& auth_id,
  49. HBFloaterUserAuthCallback callback);
  50. private:
  51. HBFloaterUserAuth(const std::string& host, const std::string& realm,
  52. const LLUUID& auth_id,
  53. HBFloaterUserAuthCallback callback);
  54. void doCallback(bool validated);
  55. static void onButtonOK(void* user_data);
  56. static void onButtonCancel(void* user_data);
  57. static void onCommitCheckBox(LLUICtrl* ctrl, void* user_data);
  58. static bool onHandleKeyCallback(KEY key, MASK mask, LLLineEditor* caller,
  59. void* user_data);
  60. static void onKeystrokeCallback(LLLineEditor*, void* user_data);
  61. private:
  62. void (*mUserAuthCallback)(const LLUUID auth_id,
  63. const std::string username,
  64. const std::string password,
  65. bool validated);
  66. LLButton* mOKBtn;
  67. LLLineEditor* mUserNameInputLine;
  68. LLLineEditor* mPasswordInputLine;
  69. LLUUID mAuthId;
  70. std::string mHost;
  71. std::string mRealm;
  72. bool mMustClose;
  73. bool mCallbackDone;
  74. static uuid_list_t sAuthList;
  75. };
  76. #endif // LL_HBFLOATERUSERAUTH_H