llfloaterreporter.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /**
  2. * @file llfloaterreporter.h
  3. * @author Andrew Meadows
  4. * @brief Bug and abuse reports.
  5. *
  6. * $LicenseInfo:firstyear=2006&license=viewergpl$
  7. *
  8. * Copyright (c) 2006-2009, Linden Research, Inc.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #ifndef LL_LLFLOATERREPORTER_H
  34. #define LL_LLFLOATERREPORTER_H
  35. #include <list>
  36. #include "llextendedstatus.h"
  37. #include "llfloater.h"
  38. #include "llimage.h"
  39. #include "llstring.h"
  40. #include "llvector3.h"
  41. class LLAvatarName;
  42. class LLComboBox;
  43. class LLMessageSystem;
  44. class LLVector3d;
  45. struct LLResourceData;
  46. // These flags are used to label info requests to the server:
  47. #if 0 // Deprecated
  48. constexpr U32 BUG_REPORT_REQUEST = 0x01 << 0;
  49. #endif
  50. constexpr U32 COMPLAINT_REPORT_REQUEST = 0x01 << 1;
  51. constexpr U32 OBJECT_PAY_REQUEST = 0x01 << 2;
  52. // ************************************************************
  53. // THESE ENUMS ARE IN THE DATABASE!!!
  54. //
  55. // The process for adding a new report type is to:
  56. // 1. Issue a command to the database to insert the new value:
  57. // insert into user_report_type (description)
  58. // values ('${new type name}');
  59. // 2. Record the integer value assigned:
  60. // select type from user_report_type
  61. // where description='${new type name}';
  62. // 3. Add it here.
  63. // ${NEW TYPE NAME}_REPORT = ${type_number};
  64. //
  65. // Failure to follow this process WILL result in incorrect
  66. // queries on user reports.
  67. // ************************************************************
  68. enum EReportType
  69. {
  70. NULL_REPORT = 0, // don't use this value anywhere
  71. UNKNOWN_REPORT = 1,
  72. #if 0
  73. BUG_REPORT = 2, // Deprecated
  74. #endif
  75. COMPLAINT_REPORT = 3,
  76. CS_REQUEST_REPORT = 4
  77. };
  78. class LLFloaterReporter final : public LLFloater,
  79. public LLFloaterSingleton<LLFloaterReporter>
  80. {
  81. friend class LLUISingleton<LLFloaterReporter,
  82. VisibilityPolicy<LLFloater> >;
  83. protected:
  84. LOG_CLASS(LLFloaterReporter);
  85. public:
  86. ~LLFloaterReporter() override;
  87. bool postBuild() override;
  88. // Used by LLSelectMgr to pass the selected object properties
  89. void setPickedObjectProperties(const std::string& object_name,
  90. const std::string& owner_name,
  91. const LLUUID& owner_id);
  92. static bool showFromMenu();
  93. static void showFromAvatar(const LLUUID& avatar_id,
  94. const std::string& desc = LLStringUtil::null,
  95. S32 abuse_category = -1);
  96. static void showFromObject(const LLUUID& object_id,
  97. const LLUUID& experience_id = LLUUID::null);
  98. static void showFromExperience(const LLUUID& experience_id);
  99. private:
  100. // Open only via the show*() methods above
  101. LLFloaterReporter(const LLSD&);
  102. void takeScreenshot();
  103. void uploadImage();
  104. bool validateReport();
  105. void setReporterID();
  106. LLSD gatherReport();
  107. void sendReportViaLegacy(const LLSD& report);
  108. void sendReportViaCaps(const std::string& url, const std::string& sshot_url,
  109. const LLSD& report);
  110. static void finishedARPost(const LLSD&);
  111. void setPosBox(const LLVector3d& pos);
  112. void getObjectInfo(const LLUUID& object_id);
  113. void getExperienceInfo(const LLUUID& experience_id);
  114. void setFromAvatarID(const LLUUID& avatar_id);
  115. static LLFloaterReporter* createNewReporter();
  116. static void closePickTool(void* userdata);
  117. static void onClickSend(void* userdata);
  118. static void onClickCancel(void* userdata);
  119. static void onClickObjPicker(void* userdata);
  120. static void onClickSelectAbuser(void* userdata);
  121. static void uploadDoneCallback(const LLUUID& uuid, void* userdata,
  122. S32 result, LLExtStat ext_status);
  123. static void onAvatarNameCache(const LLUUID& avatar_id,
  124. const LLAvatarName& av_name);
  125. static void callbackAvatarID(const std::vector<std::string>& names,
  126. const std::vector<LLUUID>& ids,
  127. void* userdata);
  128. static void requestAbuseCategoriesCoro(const std::string& url);
  129. private:
  130. LLPointer<LLImageRaw> mImageRaw;
  131. LLComboBox* mCategoryCombo;
  132. LLResourceData* mResourceDatap;
  133. LLUUID mObjectID;
  134. LLUUID mScreenID;
  135. LLUUID mAbuserID;
  136. LLUUID mExperienceID;
  137. LLVector3 mPosition;
  138. std::string mDefaultSummary;
  139. // Store the real name, not the link, for upstream reporting
  140. std::string mOwnerName;
  141. bool mPicking;
  142. bool mCopyrightWarningSeen;
  143. };
  144. #endif