aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/rlvhelper.h
diff options
context:
space:
mode:
authorJacek Antonelli2009-10-09 10:11:45 -0500
committerJacek Antonelli2009-10-09 10:11:45 -0500
commitbb657bd4244d0b1b80f368a30e40531f573d3c5f (patch)
treeaef4e3c075ba760f48963d76c9300b6a8b323bf9 /linden/indra/newview/rlvhelper.h
parentGrid manager no longer appends "/" to URIs. (diff)
parentFixed money change notification happening after logout/login (diff)
downloadmeta-impy-bb657bd4244d0b1b80f368a30e40531f573d3c5f.zip
meta-impy-bb657bd4244d0b1b80f368a30e40531f573d3c5f.tar.gz
meta-impy-bb657bd4244d0b1b80f368a30e40531f573d3c5f.tar.bz2
meta-impy-bb657bd4244d0b1b80f368a30e40531f573d3c5f.tar.xz
Merge remote branch 'mccabe/next' into next
Diffstat (limited to 'linden/indra/newview/rlvhelper.h')
-rw-r--r--linden/indra/newview/rlvhelper.h390
1 files changed, 91 insertions, 299 deletions
diff --git a/linden/indra/newview/rlvhelper.h b/linden/indra/newview/rlvhelper.h
index a0e040e..f36989b 100644
--- a/linden/indra/newview/rlvhelper.h
+++ b/linden/indra/newview/rlvhelper.h
@@ -7,263 +7,90 @@
7#include "llviewercontrol.h" 7#include "llviewercontrol.h"
8#include "llviewerobjectlist.h" 8#include "llviewerobjectlist.h"
9#include "llwlparamset.h" 9#include "llwlparamset.h"
10 10#include "rlvdefines.h"
11#include "rlvmultistringsearch.h"
12 11
13// ============================================================================ 12// ============================================================================
14// Extensions 13// RlvCommand
15// 14//
16 15
17// Comment out if you don't want the Advanced / RLVa menu (may prevent enabling some extensions or experimental features - see below)
18#define RLV_ADVANCED_MENU
19// Comment out if you provide your own way to enable/disable RLVa
20#define RLV_ADVANCED_TOGGLE_RLVA
21
22// Provides access to "advanced" feature through the RLVa debug menu
23#define RLV_EXTENSION_ENABLE_WEAR // "Enable Wear"
24#define RLV_EXTENSION_HIDELOCKED // "Hide locked layers", "Hide locked attachments" and "Hide locked inventory"
25#define RLV_EXTENSION_FLOATER_RESTRICTIONS // Enables the Advanced / RLVa / Restrictions... floater
26
27// Extensions
28#define RLV_EXTENSION_CMD_GETSETDEBUG_EX // Extends the debug variables accessible through @getdebug_xxx/@setdebug_xxx
29#define RLV_EXTENSION_CMD_FINDFOLDERS // @findfolders:<option>=<channel> - @findfolder with multiple results
30#define RLV_EXTENSION_FLAG_NOSTRIP // Layers and attachments marked as "nostrip" are exempt from @detach/@remoutfit
31#define RLV_EXTENSION_STARTLOCATION // Reenables "Start Location" at login if not @tploc=n or @unsit=n restricted at last logoff
32#define RLV_EXPERIMENTAL // Enables/disables experimental features en masse
33
34// Experimental features
35#ifdef RLV_EXPERIMENTAL
36 // Stable (will mature to RLV_EXTENSION_XXX in next release if no bugs are found)
37 #define RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK // Enables "cleaner" UI responses when fartouch blocks something
38
39 // Under testing (stable, but requires further testing - safe for public release but may be quirky)
40
41 // Under development (don't include in public release)
42 #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
43 #endif // LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
44#endif // RLV_EXPERIMENTAL
45
46// ============================================================================
47// Defines
48//
49
50// Version of the specifcation we support
51const S32 RLV_VERSION_MAJOR = 1;
52const S32 RLV_VERSION_MINOR = 20;
53const S32 RLV_VERSION_PATCH = 0;
54
55// Implementation version
56const S32 RLVa_VERSION_MAJOR = 1;
57const S32 RLVa_VERSION_MINOR = 0;
58const S32 RLVa_VERSION_PATCH = 1;
59const S32 RLVa_VERSION_BUILD = 7;
60
61// The official viewer version we're patching against
62#define RLV_MAKE_TARGET(x, y, z) ((x << 16) | (y << 8) | z)
63#define RLV_TARGET RLV_MAKE_TARGET(1, 22, 11)
64
65// Defining these makes it easier if we ever need to change our tag
66#define RLV_WARNS LL_WARNS("RLV")
67#define RLV_INFOS LL_INFOS("RLV")
68#define RLV_DEBUGS LL_DEBUGS("RLV")
69
70#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
71 // Turn on extended debugging information
72 #define RLV_DEBUG
73 // Make sure we halt execution on errors
74 #define RLV_ERRS LL_ERRS("RLV")
75 // Uncomment to enable the Advanced / RLVa / Unit Tests menu (non-public)
76 //#define RLV_DEBUG_TESTS
77#else
78 // Uncomment if you want extended debugging information on release builds
79 //#define RLV_DEBUG
80 // Don't halt execution on errors in release
81 #define RLV_ERRS LL_WARNS("RLV")
82#endif // LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
83
84#define RLV_ROOT_FOLDER "#RLV"
85#define RLV_CMD_PREFIX '@'
86#define RLV_PUTINV_PREFIX "#RLV/~"
87#define RLV_SETROT_OFFSET F_PI_BY_TWO // @setrot is off by 90° with the rest of SL
88
89#define RLV_FOLDER_FLAG_NOSTRIP "nostrip"
90#define RLV_FOLDER_PREFIX_HIDDEN '.'
91#define RLV_FOLDER_PREFIX_PUTINV '~'
92
93// ============================================================================
94// Enumeration declarations
95//
96
97// NOTE: * any changes to this enumeration should be reflected in initLookupTable()
98// * only uncomment the ones we actually use in a switch() to keep the size of the lookup table down
99enum ERlvBehaviour {
100 RLV_BHVR_VERSION = 0, // "version"
101 RLV_BHVR_DETACH, // "detach"
102// RLV_BHVR_SENDCHAT, // "sendchat"
103// RLV_BHVR_EMOTE, // "emote"
104// RLV_BHVR_CHATSHOUT, // "chatshout"
105// RLV_BHVR_CHATNORMAL, // "chatnormal"
106// RLV_BHVR_CHATWHISPER, // "chatwhisper"
107 RLV_BHVR_REDIRCHAT, // "redirchat"
108 RLV_BHVR_REDIREMOTE, // "rediremote"
109 RLV_BHVR_SENDIM, // "sendim"
110 RLV_BHVR_RECVCHAT, // "recvchat"
111 RLV_BHVR_RECVEMOTE, // "recvemote"
112 RLV_BHVR_RECVIM, // "recvim"
113// RLV_BHVR_TPLM, // "tplm"
114 RLV_BHVR_TPLOC, // "tploc"
115 RLV_BHVR_TPLURE, // "tplure"
116 RLV_BHVR_SITTP, // "sittp"
117// RLV_BHVR_CLEAR, // "clear"
118 RLV_BHVR_EDIT, // "edit"
119 RLV_BHVR_REZ, // "rez"
120 RLV_BHVR_ADDOUTFIT, // "addoutfit"
121 RLV_BHVR_REMOUTFIT, // "remoutfit"
122 RLV_BHVR_GETOUTFIT, // "getoutfit"
123 RLV_BHVR_GETATTACH, // "getattach"
124 RLV_BHVR_SHOWINV, // "showinv"
125// RLV_BHVR_VIEWNOTE, // "viewnote"
126 RLV_BHVR_UNSIT, // "unsit"
127 RLV_BHVR_SIT, // "sit"
128// RLV_BHVR_SENDCHANNEL, // "sendchannel"
129 RLV_BHVR_GETSTATUS, // "getstatus"
130 RLV_BHVR_GETSTATUSALL, // "getstatusall"
131 RLV_BHVR_GETINV, // "getinv"
132 RLV_BHVR_GETINVWORN, // "getinvworn"
133 RLV_BHVR_FINDFOLDER, // "findfolder"
134 RLV_BHVR_FINDFOLDERS, // "findfolders"
135 RLV_BHVR_ATTACH, // "attach"
136 RLV_BHVR_ATTACHALL, // "attachall"
137 RLV_BHVR_DETACHALL, // "detachall"
138 RLV_BHVR_GETPATH, // "getpath"
139 RLV_BHVR_ATTACHTHIS, // "attachthis"
140 RLV_BHVR_ATTACHALLTHIS, // "attachallthis"
141 RLV_BHVR_DETACHTHIS, // "detachthis"
142 RLV_BHVR_DETACHALLTHIS, // "detachallthis"
143 RLV_BHVR_FARTOUCH, // "fartouch"
144 RLV_BHVR_SHOWWORLDMAP, // "showworldmap"
145 RLV_BHVR_SHOWMINIMAP, // "showminimap"
146 RLV_BHVR_SHOWLOC, // "showloc"
147 RLV_BHVR_TPTO, // "tpto"
148 RLV_BHVR_ACCEPTTP, // "accepttp"
149 RLV_BHVR_SHOWNAMES, // "shownames"
150 RLV_BHVR_FLY, // "fly"
151 RLV_BHVR_GETSITID, // "getsitid"
152 RLV_BHVR_SETDEBUG, // "setdebug"
153 RLV_BHVR_SETENV, // "setenv"
154 RLV_BHVR_DETACHME, // "detachme"
155 RLV_BHVR_SHOWHOVERTEXTALL, // "showhovertextall"
156 RLV_BHVR_SHOWHOVERTEXTWORLD, // "showhovertextworld"
157 RLV_BHVR_SHOWHOVERTEXTHUD, // "showhovertexthud"
158 RLV_BHVR_SHOWHOVERTEXT, // "showhovertext"
159 RLV_BHVR_NOTIFY, // "notify"
160
161 RLV_BHVR_COUNT,
162 RLV_BHVR_UNKNOWN
163};
164
165enum ERlvParamType {
166 RLV_TYPE_UNKNOWN,
167 RLV_TYPE_ADD, // <param> == "n"|"add"
168 RLV_TYPE_REMOVE, // <param> == "y"|"rem"
169 RLV_TYPE_FORCE, // <param> == "force"
170 RLV_TYPE_REPLY // <param> == <number>
171};
172
173enum ERlvCmdRet {
174 RLV_RET_NOERROR, // Command executed succesfully
175 RLV_RET_RETAINED, // Command was retained
176 RLV_RET_FAILED, // Command failed (general failure)
177 RLV_RET_FAILED_SYNTAX, // Command failed (syntax error)
178 RLV_RET_FAILED_UNSET, // Command failed (unset restriction)
179 RLV_RET_FAILED_DUPLICATE, // Command failed (duplicate)
180 RLV_RET_FAILED_OPTION, // Command failed (invalid option)
181 RLV_RET_UNKNOWN // Command unkown
182};
183
184// ============================================================================
185/*
186 * RlvCommand
187 * ==========
188 * Encapsulates an "RLV command" (duh :p)
189 *
190 */
191
192class RlvCommand 16class RlvCommand
193{ 17{
194public: 18public:
195 /*
196 * Constructors
197 */
198 explicit RlvCommand(const std::string& strCommand); 19 explicit RlvCommand(const std::string& strCommand);
199 RlvCommand(const RlvCommand& rlvCmd);
200 20
201 /* 21 /*
202 * Accessors 22 * Member functions
203 */ 23 */
204 BOOL isValid() const { return m_fValid; } 24public:
25 std::string asString() const;
26 const std::string& getBehaviour() const { return m_strBehaviour; }
27 ERlvBehaviour getBehaviourType() const { return m_eBehaviour; }
28 const std::string& getOption() const { return m_strOption; }
29 const std::string& getParam() const { return m_strParam; }
30 ERlvParamType getParamType() const { return m_eParamType; }
31 bool isValid() const { return m_fValid; }
205 32
206 const std::string& getBehaviour() const { return m_strBehaviour; } 33 static ERlvBehaviour getBehaviourFromString(const std::string& strBhvr);
207 ERlvBehaviour getBehaviourType() const { return m_eBehaviour; } 34 static const std::string& getStringFromBehaviour(ERlvBehaviour eBhvr);
208 const std::string& getOption() const { return m_strOption; }
209 const std::string& getParam() const { return m_strParam; }
210 ERlvParamType getParamType() const { return m_eParamType; }
211 35
212 std::string asString() const; 36 static void initLookupTable();
37protected:
38 static bool parseCommand(const std::string& strCommand, std::string& strBehaviour, std::string& strOption, std::string& strParam);
213 39
214 /* 40 /*
215 * Operators 41 * Operators
216 */ 42 */
43public:
217 bool operator ==(const RlvCommand&) const; 44 bool operator ==(const RlvCommand&) const;
218 45
219 // Parses an RLV command into its "tokens"
220 static BOOL parseCommand(/*[in]*/ const std::string& strCommand,
221 /*[out]*/ std::string& strBehaviour, /*[out]*/ std::string& strOption, /*[out]*/ std::string& strParam);
222 static void initLookupTable();
223
224 /* 46 /*
225 * Member variables 47 * Member variables
226 */ 48 */
227protected: 49protected:
228 BOOL m_fValid; 50 bool m_fValid;
229 std::string m_strBehaviour; 51 std::string m_strBehaviour;
230 ERlvBehaviour m_eBehaviour; 52 ERlvBehaviour m_eBehaviour;
231 std::string m_strOption; 53 std::string m_strOption;
232 std::string m_strParam; 54 std::string m_strParam;
233 ERlvParamType m_eParamType; 55 ERlvParamType m_eParamType;
234 56
235 static RlvMultiStringSearch m_BhvrLookup; 57 typedef std::map<std::string, ERlvBehaviour> RlvBhvrTable;
58 static RlvBhvrTable m_BhvrMap;
59
236 friend class RlvHandler; 60 friend class RlvHandler;
237}; 61};
62typedef std::list<RlvCommand> rlv_command_list_t;
238 63
239// ============================================================================ 64// ============================================================================
240/* 65// RlvObject
241 * RlvObject 66//
242 * =========
243 * Encapsulates an "RLV Object" (= an object that has issued an RLV command)
244 *
245 */
246
247typedef std::list<RlvCommand> rlv_command_list_t;
248 67
249class RlvObject 68class RlvObject
250{ 69{
251public: 70public:
252 RlvObject(const LLUUID& uuid) : m_UUID(uuid), m_nLookupMisses(0) { m_fLookup = (NULL != gObjectList.findObject(uuid)); } 71 RlvObject(const LLUUID& idObj);
253 72
254 BOOL addCommand(const RlvCommand& rlvCmd); 73 /*
255 BOOL removeCommand(const RlvCommand& rlvCmd); 74 * Member functions
256 75 */
257 BOOL hasBehaviour(ERlvBehaviour eBehaviour) const; 76public:
258 BOOL hasBehaviour(const std::string& strBehaviour) const; 77 bool addCommand(const RlvCommand& rlvCmd);
259 BOOL hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const; 78 bool removeCommand(const RlvCommand& rlvCmd);
260 BOOL hasBehaviour(const std::string& strBehaviour, const std::string& strOption) const;
261 79
262 std::string getStatusString(const std::string& strMatch) const; 80 std::string getStatusString(const std::string& strMatch) const;
81 bool hasBehaviour(ERlvBehaviour eBehaviour) const;
82 bool hasBehaviour(const std::string& strBehaviour) const;
83 bool hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const;
84 bool hasBehaviour(const std::string& strBehaviour, const std::string& strOption) const;
263 85
264 const rlv_command_list_t* getCommandList() const { return &m_Commands; } 86 const rlv_command_list_t* getCommandList() const { return &m_Commands; }
87
88 /*
89 * Member variables
90 */
265protected: 91protected:
266 LLUUID m_UUID; // The object's UUID 92 LLUUID m_UUID; // The object's UUID
93 S32 m_idxAttachPt; // The object's attachment point (or 0 if it's not an attachment)
267 bool m_fLookup; // TRUE if the object existed in gObjectList at one point in time 94 bool m_fLookup; // TRUE if the object existed in gObjectList at one point in time
268 S16 m_nLookupMisses; // Count of unsuccessful lookups in gObjectList by the GC 95 S16 m_nLookupMisses; // Count of unsuccessful lookups in gObjectList by the GC
269 rlv_command_list_t m_Commands; // List of behaviours held by this object (in the order they were received) 96 rlv_command_list_t m_Commands; // List of behaviours held by this object (in the order they were received)
@@ -272,23 +99,24 @@ protected:
272}; 99};
273 100
274// ============================================================================ 101// ============================================================================
275/* 102// RlvCriteriaCategoryCollector - Criteria based folder matching filter used by @findfolder and @findfolders
276 * RlvCriteriaCategoryCollector 103//
277 * ============================
278 * Criteria based folder matching filter used by @findfolder and @findfolders
279 *
280 */
281 104
282class RlvCriteriaCategoryCollector : public LLInventoryCollectFunctor 105class RlvCriteriaCategoryCollector : public LLInventoryCollectFunctor
283{ 106{
284public: 107public:
285 RlvCriteriaCategoryCollector(const std::string& strCriteria) 108 RlvCriteriaCategoryCollector(const std::string& strCriteria)
286 { 109 {
287 typedef boost::tokenizer<boost::char_separator<char> > tokenizer; 110 std::string::size_type idxIt, idxLast = 0;
288 boost::char_separator<char> sep("&&", "", boost::drop_empty_tokens); 111 while (idxLast < strCriteria.length())
289 tokenizer tokens(strCriteria, sep); 112 {
290 for (tokenizer::iterator itToken = tokens.begin(); itToken != tokens.end(); ++itToken) 113 idxIt = strCriteria.find("&&", idxLast);
291 m_Criteria.push_back(*itToken); 114 if (std::string::npos == idxIt)
115 idxIt = strCriteria.length();
116 if (idxIt != idxLast)
117 m_Criteria.push_back(strCriteria.substr(idxLast, idxIt - idxLast));
118 idxLast = idxIt + 2;
119 }
292 } 120 }
293 virtual ~RlvCriteriaCategoryCollector() {} 121 virtual ~RlvCriteriaCategoryCollector() {}
294 122
@@ -304,7 +132,7 @@ public:
304 return false; 132 return false;
305 133
306 for (std::list<std::string>::const_iterator itCrit = m_Criteria.begin(); itCrit != m_Criteria.end(); ++itCrit) 134 for (std::list<std::string>::const_iterator itCrit = m_Criteria.begin(); itCrit != m_Criteria.end(); ++itCrit)
307 if (-1 == strFolderName.find(*itCrit)) // Return false on the first mismatch 135 if (std::string::npos == strFolderName.find(*itCrit)) // Return false on the first mismatch
308 return false; 136 return false;
309 return true; 137 return true;
310 } 138 }
@@ -314,12 +142,8 @@ protected:
314}; 142};
315 143
316// ============================================================================ 144// ============================================================================
317/* 145// RlvWearableItemCollector - Inventory item filter used by attach/detach/attachall/detachall/getinvworn
318 * RlvWearableItemCollector 146//
319 * ========================
320 * Inventory item filter used by attach/detach/attachall/detachall/getinvworn (also used by "Add/Replace Outfit" and "Take Off Items")
321 *
322 */
323 147
324class RlvWearableItemCollector : public LLInventoryCollectFunctor 148class RlvWearableItemCollector : public LLInventoryCollectFunctor
325{ 149{
@@ -349,11 +173,8 @@ protected:
349}; 173};
350 174
351// ============================================================================ 175// ============================================================================
352/* 176// RlvRetainedCommand
353 * RlvRetainedCommand 177//
354 * ==================
355 *
356 */
357 178
358struct RlvRetainedCommand 179struct RlvRetainedCommand
359{ 180{
@@ -369,11 +190,8 @@ private:
369typedef std::list<RlvRetainedCommand> rlv_retained_list_t; 190typedef std::list<RlvRetainedCommand> rlv_retained_list_t;
370 191
371// ============================================================================ 192// ============================================================================
372/* 193// RlvWLSnapshot
373 * RlvWLSnapshot 194//
374 * =============
375 *
376 */
377 195
378struct RlvWLSnapshot 196struct RlvWLSnapshot
379{ 197{
@@ -389,24 +207,8 @@ private:
389}; 207};
390 208
391// ============================================================================ 209// ============================================================================
392/* 210// RlvSettings
393 * RlvSettings 211//
394 * ===========
395 *
396 */
397
398#define RLV_SETTING_MAIN "RestrainedLife"
399#define RLV_SETTING_DEBUG "RestrainedLifeDebug"
400#define RLV_SETTING_NOSETENV "RestrainedLifeNoSetEnv"
401#define RLV_SETTING_FORBIDGIVETORLV "RestrainedLifeForbidGiveToRLV"
402
403#define RLV_SETTING_ENABLEWEAR "RLVaEnableWear"
404#define RLV_SETTING_ENABLELEGACYNAMING "RLVaEnableLegacyNaming"
405#define RLV_SETTING_HIDELOCKEDLAYER "RLVaHideLockedLayers"
406#define RLV_SETTING_HIDELOCKEDATTACH "RLVaHideLockedAttachments"
407#define RLV_SETTING_HIDELOCKEDINVENTORY "RLVaHideLockedInventory"
408#define RLV_SETTING_LOGINLASTLOCATION "RLVaLoginLastLocation"
409#define RLV_SETTING_SHOWNAMETAGS "RLVaShowNameTags"
410 212
411inline BOOL rlvGetSettingBOOL(const std::string& strSetting, BOOL fDefault) 213inline BOOL rlvGetSettingBOOL(const std::string& strSetting, BOOL fDefault)
412{ 214{
@@ -427,6 +229,7 @@ public:
427 static BOOL getHideLockedLayers() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDLAYER, FALSE); } 229 static BOOL getHideLockedLayers() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDLAYER, FALSE); }
428 static BOOL getHideLockedAttach() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDATTACH, FALSE); } 230 static BOOL getHideLockedAttach() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDATTACH, FALSE); }
429 static BOOL getHideLockedInventory() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDINVENTORY, FALSE); } 231 static BOOL getHideLockedInventory() { return rlvGetSettingBOOL(RLV_SETTING_HIDELOCKEDINVENTORY, FALSE); }
232 static BOOL getShowNameTags() { return fShowNameTags; }
430 233
431 #ifdef RLV_EXTENSION_STARTLOCATION 234 #ifdef RLV_EXTENSION_STARTLOCATION
432 static BOOL getLoginLastLocation() { return rlvGetPerUserSettingsBOOL(RLV_SETTING_LOGINLASTLOCATION, TRUE); } 235 static BOOL getLoginLastLocation() { return rlvGetPerUserSettingsBOOL(RLV_SETTING_LOGINLASTLOCATION, TRUE); }
@@ -437,34 +240,12 @@ public:
437}; 240};
438 241
439// ============================================================================ 242// ============================================================================
440/* 243// State keeping classes/structure
441 * State keeping classes/structure 244//
442 *
443 */
444
445struct RlvRedirInfo
446{
447 S16 nRedirChat;
448 S16 nRedirEmote;
449
450 RlvRedirInfo() : nRedirChat(0), nRedirEmote(0) {}
451 bool isActive() { return (nRedirChat + nRedirEmote) != 0; }
452};
453
454struct RlvReattachInfo
455{
456 LLUUID idItem;
457 bool fInInventory;
458 bool fAssetSaved;
459
460 RlvReattachInfo() : idItem(), fInInventory(false), fAssetSaved(false) {}
461};
462 245
463// ============================================================================ 246// ============================================================================
464/* 247// Various helper classes/timers/functors
465 * Various helper classes/timers/functors 248//
466 *
467 */
468 249
469class RlvGCTimer : public LLEventTimer 250class RlvGCTimer : public LLEventTimer
470{ 251{
@@ -504,16 +285,14 @@ struct RlvSelectIsSittingOn : public LLSelectedNodeFunctor
504}; 285};
505 286
506// ============================================================================ 287// ============================================================================
507/* 288// Various helper functions
508 * Various helper functions 289//
509 *
510 */
511 290
512BOOL rlvAttachToEnabler(void* pParam); 291BOOL rlvAttachToEnabler(void* pParam);
513bool rlvCanDeleteOrReturn(); 292bool rlvCanDeleteOrReturn();
514S32 rlvGetDirectDescendentsCount(const LLInventoryCategory* pFolder, LLAssetType::EType type); 293S32 rlvGetDirectDescendentsCount(const LLInventoryCategory* pFolder, LLAssetType::EType type);
515bool rlvIsEmote(const std::string& strUTF8Text); 294bool rlvIsEmote(const std::string& strUTF8Text);
516bool rlvIsValidChannel(S32 nChannel); 295bool rlvIsValidReplyChannel(S32 nChannel);
517bool rlvIsWearingItem(const LLInventoryItem* pItem); 296bool rlvIsWearingItem(const LLInventoryItem* pItem);
518 297
519void rlvForceDetach(LLViewerJointAttachment* pAttachPt); 298void rlvForceDetach(LLViewerJointAttachment* pAttachPt);
@@ -521,20 +300,33 @@ void rlvSendBusyMessage(const LLUUID& idTo, const std::string& strMsg, const LLU
521bool rlvSendChatReply(const std::string& strChannel, const std::string& strReply); 300bool rlvSendChatReply(const std::string& strChannel, const std::string& strReply);
522bool rlvSendChatReply(S32 nChannel, const std::string& strReply); 301bool rlvSendChatReply(S32 nChannel, const std::string& strReply);
523 302
524void rlvStringReplace(std::string& strText, std::string strFrom, const std::string& strTo);
525std::string rlvGetFirstParenthesisedText(const std::string& strText, std::string::size_type* pidxMatch = NULL); 303std::string rlvGetFirstParenthesisedText(const std::string& strText, std::string::size_type* pidxMatch = NULL);
526std::string rlvGetLastParenthesisedText(const std::string& strText, std::string::size_type* pidxStart = NULL); 304std::string rlvGetLastParenthesisedText(const std::string& strText, std::string::size_type* pidxStart = NULL);
305void rlvStringReplace(std::string& strText, std::string strFrom, const std::string& strTo);
527 306
528#ifdef RLV_ADVANCED_TOGGLE_RLVA 307#ifdef RLV_ADVANCED_TOGGLE_RLVA
529 // "Advanced / RLVa / Enable RLV" menu option 308 // "Advanced / RLVa / Enable RLV" menu option
530 void rlvDbgToggleEnabled(void*); 309 void rlvToggleEnabled(void*);
531 BOOL rlvDbgGetEnabled(void*); 310 BOOL rlvGetEnabled(void*);
532#endif // RLV_ADVANCED_TOGGLE_RLVA 311#endif // RLV_ADVANCED_TOGGLE_RLVA
533 312
534// ============================================================================ 313// ============================================================================
314// Debug helper functions
315//
316
317// ============================================================================
535// Inlined class member functions 318// Inlined class member functions
536// 319//
537 320
321// Checked: 2009-09-19 (RLVa-1.0.3d)
322inline std::string RlvCommand::asString() const
323{
324 // NOTE: @clear=<param> should be represented as clear:<param>
325 return (m_eParamType != RLV_TYPE_CLEAR)
326 ? (!m_strOption.empty()) ? (std::string(m_strBehaviour)).append(":").append(m_strOption) : (std::string(m_strBehaviour))
327 : (!m_strParam.empty()) ? (std::string(m_strBehaviour)).append(":").append(m_strParam) : (std::string(m_strBehaviour));
328}
329
538inline bool RlvCommand::operator ==(const RlvCommand& rhs) const 330inline bool RlvCommand::operator ==(const RlvCommand& rhs) const
539{ 331{
540 // The specification notes that "@detach=n" is semantically identical to "@detach=add" (same for "y" and "rem" 332 // The specification notes that "@detach=n" is semantically identical to "@detach=add" (same for "y" and "rem"
@@ -561,10 +353,10 @@ inline bool rlvIsEmote(const std::string& strUTF8Text)
561 return (strUTF8Text.length() > 4) && ( (strUTF8Text.compare(0, 4, "/me ") == 0) || (strUTF8Text.compare(0, 4, "/me'") == 0) ); 353 return (strUTF8Text.length() > 4) && ( (strUTF8Text.compare(0, 4, "/me ") == 0) || (strUTF8Text.compare(0, 4, "/me'") == 0) );
562} 354}
563 355
564// Checked: 2009-08-05 (RLVa-1.0.1e) | Added: RLVa-1.0.0e 356// Checked: 2009-09-05 (RLVa-1.0.2a) | Added: RLVa-1.0.2a
565inline bool rlvIsValidChannel(S32 nChannel) 357inline bool rlvIsValidReplyChannel(S32 nChannel)
566{ 358{
567 return (nChannel >= 0) && (CHAT_CHANNEL_DEBUG != nChannel); 359 return (nChannel > 0) && (CHAT_CHANNEL_DEBUG != nChannel);
568} 360}
569 361
570// Checked: 2009-08-05 (RLVa-1.0.1e) | Added: RLVa-1.0.0e 362// Checked: 2009-08-05 (RLVa-1.0.1e) | Added: RLVa-1.0.0e