diff options
author | McCabe Maxsted | 2009-10-16 16:39:44 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-16 16:39:44 -0700 |
commit | ce82adec2a0124fe27f363653d2652b0f5c61f04 (patch) | |
tree | 35b3877b1d1fc92329a44a9a17d183b74b92890b /linden/indra/newview/rlvhandler.cpp | |
parent | Applied patch for VWR-6787 by Alissa Sabre - 'none' text in group window not ... (diff) | |
download | meta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.zip meta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.tar.gz meta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.tar.bz2 meta-impy-ce82adec2a0124fe27f363653d2652b0f5c61f04.tar.xz |
Applied RLVa-1.0.4e_20091010_SL-1.22.11-diff.patch
Diffstat (limited to 'linden/indra/newview/rlvhandler.cpp')
-rw-r--r-- | linden/indra/newview/rlvhandler.cpp | 122 |
1 files changed, 90 insertions, 32 deletions
diff --git a/linden/indra/newview/rlvhandler.cpp b/linden/indra/newview/rlvhandler.cpp index 6044aa9..69e2e2f 100644 --- a/linden/indra/newview/rlvhandler.cpp +++ b/linden/indra/newview/rlvhandler.cpp | |||
@@ -286,7 +286,7 @@ bool RlvHandler::setDetachable(S32 idxAttachPt, const LLUUID& idRlvObj, bool fDe | |||
286 | if (!fDetachable) | 286 | if (!fDetachable) |
287 | { | 287 | { |
288 | #ifdef RLV_EXPERIMENTAL_FIRSTUSE | 288 | #ifdef RLV_EXPERIMENTAL_FIRSTUSE |
289 | LLFirstUse::useRlvDetach(); | 289 | //LLFirstUse::useRlvDetach(); |
290 | #endif // RLV_EXPERIMENTAL_FIRSTUSE | 290 | #endif // RLV_EXPERIMENTAL_FIRSTUSE |
291 | 291 | ||
292 | // NOTE: m_Attachments can contain duplicate <idxAttachPt, idRlvObj> pairs (ie @detach:spine=n,detach=n from an attachment on spine) | 292 | // NOTE: m_Attachments can contain duplicate <idxAttachPt, idRlvObj> pairs (ie @detach:spine=n,detach=n from an attachment on spine) |
@@ -338,27 +338,47 @@ bool RlvHandler::setDetachable(S32 idxAttachPt, const LLUUID& idRlvObj, bool fDe | |||
338 | // Behaviour related functions | 338 | // Behaviour related functions |
339 | // | 339 | // |
340 | 340 | ||
341 | bool RlvHandler::hasBehaviourExcept(const std::string& strBehaviour, const LLUUID& idObj) const | ||
342 | { | ||
343 | for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) | ||
344 | if ( (idObj != itObj->second.m_UUID) && (itObj->second.hasBehaviour(strBehaviour)) ) | ||
345 | return true; | ||
346 | return false; | ||
347 | } | ||
348 | |||
349 | bool RlvHandler::hasBehaviourExcept(ERlvBehaviour eBehaviour, const std::string& strOption, const LLUUID& idObj) const | 341 | bool RlvHandler::hasBehaviourExcept(ERlvBehaviour eBehaviour, const std::string& strOption, const LLUUID& idObj) const |
350 | { | 342 | { |
351 | for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) | 343 | for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) |
352 | if ( (idObj != itObj->second.m_UUID) && (itObj->second.hasBehaviour(eBehaviour, strOption)) ) | 344 | if ( (idObj != itObj->second.m_UUID) && (itObj->second.hasBehaviour(eBehaviour, strOption, false)) ) |
353 | return true; | 345 | return true; |
354 | return false; | 346 | return false; |
355 | } | 347 | } |
356 | 348 | ||
357 | bool RlvHandler::hasBehaviourExcept(const std::string& strBehaviour, const std::string& strOption, const LLUUID& idObj) const | 349 | // Checked: 2009-10-04 (RLVa-1.0.4c) | Modified: RLVa-1.0.4c |
350 | bool RlvHandler::isException(ERlvBehaviour eBhvr, const RlvExceptionOption& varOption, ERlvExceptionCheck typeCheck) const | ||
358 | { | 351 | { |
359 | for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) | 352 | // We need to "strict check" exceptions only if: the restriction is actually in place *and* (isPermissive(eBhvr) == FALSE) |
360 | if ( (idObj != itObj->second.m_UUID) && (itObj->second.hasBehaviour(strBehaviour, strOption)) ) | 353 | if (RLV_CHECK_DEFAULT == typeCheck) |
361 | return true; | 354 | typeCheck = ( (hasBehaviour(eBhvr)) && (!isPermissive(eBhvr)) ) ? RLV_CHECK_STRICT : RLV_CHECK_PERMISSIVE; |
355 | |||
356 | std::list<LLUUID> objList; | ||
357 | if (RLV_CHECK_STRICT == typeCheck) | ||
358 | { | ||
359 | // If we're "strict checking" then we need the UUID of every object that currently has 'eBhvr' restricted | ||
360 | for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) | ||
361 | if (itObj->second.hasBehaviour(eBhvr, !hasBehaviour(RLV_BHVR_PERMISSIVE))) | ||
362 | objList.push_back(itObj->first); | ||
363 | } | ||
364 | |||
365 | for (rlv_exception_map_t::const_iterator itException = m_Exceptions.lower_bound(eBhvr), | ||
366 | endException = m_Exceptions.upper_bound(eBhvr); itException != endException; ++itException) | ||
367 | { | ||
368 | if (itException->second.varOption == varOption) | ||
369 | { | ||
370 | // For permissive checks we just return on the very first match | ||
371 | if (RLV_CHECK_PERMISSIVE == typeCheck) | ||
372 | return true; | ||
373 | |||
374 | // For strict checks we don't return until the list is empty (every object with 'eBhvr' restricted also contains the exception) | ||
375 | std::list<LLUUID>::iterator itList = std::find(objList.begin(), objList.end(), itException->second.idObject); | ||
376 | if (itList != objList.end()) | ||
377 | objList.erase(itList); | ||
378 | if (objList.empty()) | ||
379 | return true; | ||
380 | } | ||
381 | } | ||
362 | return false; | 382 | return false; |
363 | } | 383 | } |
364 | 384 | ||
@@ -509,7 +529,11 @@ BOOL RlvHandler::processAddCommand(const LLUUID& uuid, const RlvCommand& rlvCmd) | |||
509 | const std::string& strOption = rlvCmd.getOption(); | 529 | const std::string& strOption = rlvCmd.getOption(); |
510 | 530 | ||
511 | if ( (RLV_BHVR_UNKNOWN != eBehaviour) && (strOption.empty()) ) | 531 | if ( (RLV_BHVR_UNKNOWN != eBehaviour) && (strOption.empty()) ) |
532 | { | ||
533 | if (rlvCmd.isStrict()) | ||
534 | addException(uuid, RLV_BHVR_PERMISSIVE, eBehaviour); | ||
512 | m_Behaviours[eBehaviour]++; | 535 | m_Behaviours[eBehaviour]++; |
536 | } | ||
513 | 537 | ||
514 | switch (eBehaviour) | 538 | switch (eBehaviour) |
515 | { | 539 | { |
@@ -649,7 +673,7 @@ BOOL RlvHandler::processAddCommand(const LLUUID& uuid, const RlvCommand& rlvCmd) | |||
649 | case RLV_BHVR_FARTOUCH: | 673 | case RLV_BHVR_FARTOUCH: |
650 | { | 674 | { |
651 | #ifdef RLV_EXPERIMENTAL_FIRSTUSE | 675 | #ifdef RLV_EXPERIMENTAL_FIRSTUSE |
652 | LLFirstUse::useRlvFartouch(); | 676 | //LLFirstUse::useRlvFartouch(); |
653 | #endif // RLV_EXPERIMENTAL_FIRSTUSE | 677 | #endif // RLV_EXPERIMENTAL_FIRSTUSE |
654 | } | 678 | } |
655 | break; | 679 | break; |
@@ -695,9 +719,9 @@ BOOL RlvHandler::processAddCommand(const LLUUID& uuid, const RlvCommand& rlvCmd) | |||
695 | case RLV_BHVR_SHOWHOVERTEXT: // @showhovertext:<uuid>=n - Checked: 2009-07-09 (RLVa-0.2.2a) | Modified: RLVa-1.0.0f | 719 | case RLV_BHVR_SHOWHOVERTEXT: // @showhovertext:<uuid>=n - Checked: 2009-07-09 (RLVa-0.2.2a) | Modified: RLVa-1.0.0f |
696 | { | 720 | { |
697 | LLUUID idException(strOption); | 721 | LLUUID idException(strOption); |
698 | if (!idException.isNull()) // If there's an option it should be a valid UUID | 722 | if (idException.notNull()) // If there's an option it should be a valid UUID |
699 | { | 723 | { |
700 | addException(eBehaviour, LLUUID(strOption)); | 724 | addException(uuid, eBehaviour, idException); |
701 | 725 | ||
702 | // Clear the object's hover text | 726 | // Clear the object's hover text |
703 | LLViewerObject* pObj = gObjectList.findObject(idException); | 727 | LLViewerObject* pObj = gObjectList.findObject(idException); |
@@ -717,6 +741,13 @@ BOOL RlvHandler::processAddCommand(const LLUUID& uuid, const RlvCommand& rlvCmd) | |||
717 | } | 741 | } |
718 | } | 742 | } |
719 | break; | 743 | break; |
744 | case RLV_BHVR_SENDCHANNEL: // @sendchannel:<uuid>=add - Checked: 2009-10-05 (RLVa-1.0.4a) | Modified: RLVa-1.0.4a | ||
745 | { | ||
746 | S32 nChannel; // If there's an option it should be a valid (=positive and non-zero) chat channel | ||
747 | if ( (!strOption.empty()) && (LLStringUtil::convertToS32(strOption, nChannel)) && (nChannel > 0) ) | ||
748 | addException(uuid, eBehaviour, nChannel); | ||
749 | } | ||
750 | break; | ||
720 | case RLV_BHVR_RECVCHAT: // @recvchat:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 751 | case RLV_BHVR_RECVCHAT: // @recvchat:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
721 | case RLV_BHVR_RECVEMOTE: // @recvemote:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 752 | case RLV_BHVR_RECVEMOTE: // @recvemote:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
722 | case RLV_BHVR_RECVIM: // @recvim:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 753 | case RLV_BHVR_RECVIM: // @recvim:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
@@ -724,16 +755,20 @@ BOOL RlvHandler::processAddCommand(const LLUUID& uuid, const RlvCommand& rlvCmd) | |||
724 | case RLV_BHVR_TPLURE: // @tplure:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 755 | case RLV_BHVR_TPLURE: // @tplure:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
725 | case RLV_BHVR_ACCEPTTP: // @accepttp:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 756 | case RLV_BHVR_ACCEPTTP: // @accepttp:<uuid>=add - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
726 | { | 757 | { |
727 | addException(eBehaviour, LLUUID(strOption)); | 758 | LLUUID idException(strOption); |
759 | if (idException.notNull()) // If there's an option it should be a valid UUID | ||
760 | addException(uuid, eBehaviour, LLUUID(strOption)); | ||
728 | } | 761 | } |
729 | break; | 762 | break; |
730 | default: | 763 | case RLV_BHVR_UNKNOWN: |
731 | { | 764 | { |
732 | // Give our observers a chance to handle any command we don't | 765 | // Give our observers a chance to handle any command we don't |
733 | RlvEvent rlvEvent(uuid, rlvCmd); | 766 | RlvEvent rlvEvent(uuid, rlvCmd); |
734 | m_Emitter.update(&RlvObserver::onAddCommand, rlvEvent); | 767 | m_Emitter.update(&RlvObserver::onAddCommand, rlvEvent); |
735 | } | 768 | } |
736 | break; | 769 | break; |
770 | default: | ||
771 | break; | ||
737 | } | 772 | } |
738 | return TRUE; // Add command success/failure is decided by RlvObject::addCommand() | 773 | return TRUE; // Add command success/failure is decided by RlvObject::addCommand() |
739 | } | 774 | } |
@@ -756,7 +791,11 @@ BOOL RlvHandler::processRemoveCommand(const LLUUID& uuid, const RlvCommand& rlvC | |||
756 | const std::string& strOption = rlvCmd.getOption(); | 791 | const std::string& strOption = rlvCmd.getOption(); |
757 | 792 | ||
758 | if ( (RLV_BHVR_UNKNOWN != eBehaviour) && (strOption.empty()) ) | 793 | if ( (RLV_BHVR_UNKNOWN != eBehaviour) && (strOption.empty()) ) |
794 | { | ||
795 | if (rlvCmd.isStrict()) | ||
796 | removeException(uuid, RLV_BHVR_PERMISSIVE, eBehaviour); | ||
759 | m_Behaviours[eBehaviour]--; | 797 | m_Behaviours[eBehaviour]--; |
798 | } | ||
760 | 799 | ||
761 | switch (eBehaviour) | 800 | switch (eBehaviour) |
762 | { | 801 | { |
@@ -842,9 +881,9 @@ BOOL RlvHandler::processRemoveCommand(const LLUUID& uuid, const RlvCommand& rlvC | |||
842 | case RLV_BHVR_SHOWHOVERTEXT: // @showhovertext:<uuid>=y - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 881 | case RLV_BHVR_SHOWHOVERTEXT: // @showhovertext:<uuid>=y - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
843 | { | 882 | { |
844 | LLUUID idException(strOption); | 883 | LLUUID idException(strOption); |
845 | if (!idException.isNull()) // If there's an option it should be a valid UUID | 884 | if (idException.notNull()) // If there's an option it should be a valid UUID |
846 | { | 885 | { |
847 | removeException(eBehaviour, LLUUID(strOption)); | 886 | removeException(uuid, eBehaviour, idException); |
848 | 887 | ||
849 | // Restore the object's hover text | 888 | // Restore the object's hover text |
850 | LLViewerObject* pObj = gObjectList.findObject(idException); | 889 | LLViewerObject* pObj = gObjectList.findObject(idException); |
@@ -869,6 +908,13 @@ BOOL RlvHandler::processRemoveCommand(const LLUUID& uuid, const RlvCommand& rlvC | |||
869 | } | 908 | } |
870 | } | 909 | } |
871 | break; | 910 | break; |
911 | case RLV_BHVR_SENDCHANNEL: // @sendchannel:<uuid>=rem - Checked: 2009-10-05 (RLVa-1.0.4a) | Modified: RLVa-1.0.4a | ||
912 | { | ||
913 | S32 nChannel; // If there's an option it should be a valid (=positive and non-zero) chat channel | ||
914 | if ( (!strOption.empty()) && (LLStringUtil::convertToS32(strOption, nChannel)) && (nChannel > 0) ) | ||
915 | removeException(uuid, eBehaviour, nChannel); | ||
916 | } | ||
917 | break; | ||
872 | case RLV_BHVR_RECVCHAT: // @recvchat:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 918 | case RLV_BHVR_RECVCHAT: // @recvchat:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
873 | case RLV_BHVR_RECVEMOTE: // @recvemote:<uui>=red - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 919 | case RLV_BHVR_RECVEMOTE: // @recvemote:<uui>=red - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
874 | case RLV_BHVR_RECVIM: // @recvim:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 920 | case RLV_BHVR_RECVIM: // @recvim:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
@@ -876,16 +922,20 @@ BOOL RlvHandler::processRemoveCommand(const LLUUID& uuid, const RlvCommand& rlvC | |||
876 | case RLV_BHVR_TPLURE: // @recvim:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 922 | case RLV_BHVR_TPLURE: // @recvim:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
877 | case RLV_BHVR_ACCEPTTP: // @accepttp:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f | 923 | case RLV_BHVR_ACCEPTTP: // @accepttp:<uuid>=rem - Checked: 2009-07-09 (RLVa-1.0.0f) | Modified: RLVa-1.0.0f |
878 | { | 924 | { |
879 | removeException(eBehaviour, LLUUID(strOption)); | 925 | LLUUID idException(strOption); |
926 | if (idException.notNull()) // If there's an option it should be a valid UUID | ||
927 | removeException(uuid, eBehaviour, LLUUID(strOption)); | ||
880 | } | 928 | } |
881 | break; | 929 | break; |
882 | default: | 930 | case RLV_BHVR_UNKNOWN: |
883 | { | 931 | { |
884 | // Give our observers a chance to handle any command we don't | 932 | // Give our observers a chance to handle any command we don't |
885 | RlvEvent rlvEvent(uuid, rlvCmd); | 933 | RlvEvent rlvEvent(uuid, rlvCmd); |
886 | m_Emitter.update(&RlvObserver::onRemoveCommand, rlvEvent); | 934 | m_Emitter.update(&RlvObserver::onRemoveCommand, rlvEvent); |
887 | } | 935 | } |
888 | break; | 936 | break; |
937 | default: | ||
938 | break; | ||
889 | } | 939 | } |
890 | return TRUE; // Remove commands don't fail, doesn't matter what we return here | 940 | return TRUE; // Remove commands don't fail, doesn't matter what we return here |
891 | } | 941 | } |
@@ -1006,13 +1056,15 @@ BOOL RlvHandler::processForceCommand(const LLUUID& idObj, const RlvCommand& rlvC | |||
1006 | } | 1056 | } |
1007 | } | 1057 | } |
1008 | break; | 1058 | break; |
1009 | default: | 1059 | case RLV_BHVR_UNKNOWN: |
1010 | { | 1060 | { |
1011 | // Give our observers a chance to handle any command we don't | 1061 | // Give our observers a chance to handle any command we don't |
1012 | RlvEvent rlvEvent(idObj, rlvCmd); | 1062 | RlvEvent rlvEvent(idObj, rlvCmd); |
1013 | fHandled = m_Emitter.update(&RlvObserver::onForceCommand, rlvEvent); | 1063 | fHandled = m_Emitter.update(&RlvObserver::onForceCommand, rlvEvent); |
1014 | } | 1064 | } |
1015 | break; | 1065 | break; |
1066 | default: | ||
1067 | break; | ||
1016 | } | 1068 | } |
1017 | return fHandled; // If we handled it then it'll still be TRUE; if an observer doesn't handle it'll be FALSE | 1069 | return fHandled; // If we handled it then it'll still be TRUE; if an observer doesn't handle it'll be FALSE |
1018 | } | 1070 | } |
@@ -1030,6 +1082,9 @@ BOOL RlvHandler::processReplyCommand(const LLUUID& uuid, const RlvCommand& rlvCm | |||
1030 | case RLV_BHVR_VERSION: // @version=<channel> - Checked: 2009-07-12 (RLVa-1.0.0h) | 1082 | case RLV_BHVR_VERSION: // @version=<channel> - Checked: 2009-07-12 (RLVa-1.0.0h) |
1031 | strReply = getVersionString(); | 1083 | strReply = getVersionString(); |
1032 | break; | 1084 | break; |
1085 | case RLV_BHVR_VERSIONNUM: // @versionnum=<channel> - Checked: 2009-10-04 (RLVa-1.0.4b) | Added: RLVa-1.0.4b | ||
1086 | strReply = getVersionNumString(); | ||
1087 | break; | ||
1033 | case RLV_BHVR_GETOUTFIT: // @getoufit[:<layer>]=<channel> - Checked: 2009-07-12 (RLVa-1.0.0h) | Modified: RLVa-0.2.0d | 1088 | case RLV_BHVR_GETOUTFIT: // @getoufit[:<layer>]=<channel> - Checked: 2009-07-12 (RLVa-1.0.0h) | Modified: RLVa-0.2.0d |
1034 | { | 1089 | { |
1035 | // (Quirk: RLV 1.16.1 will execute @getoutfit=<channel> if <layer> is invalid, so we need to as well) | 1090 | // (Quirk: RLV 1.16.1 will execute @getoutfit=<channel> if <layer> is invalid, so we need to as well) |
@@ -1225,13 +1280,15 @@ BOOL RlvHandler::processReplyCommand(const LLUUID& uuid, const RlvCommand& rlvCm | |||
1225 | strReply = uuid.asString(); | 1280 | strReply = uuid.asString(); |
1226 | } | 1281 | } |
1227 | break; | 1282 | break; |
1228 | default: | 1283 | case RLV_BHVR_UNKNOWN: |
1229 | { | 1284 | { |
1230 | // Give our observers a chance to handle any command we don't | 1285 | // Give our observers a chance to handle any command we don't |
1231 | RlvEvent rlvEvent(uuid, rlvCmd); | 1286 | RlvEvent rlvEvent(uuid, rlvCmd); |
1232 | return m_Emitter.update(&RlvObserver::onReplyCommand, rlvEvent); | 1287 | return m_Emitter.update(&RlvObserver::onReplyCommand, rlvEvent); |
1233 | } | 1288 | } |
1234 | break; | 1289 | break; |
1290 | default: | ||
1291 | break; | ||
1235 | } | 1292 | } |
1236 | 1293 | ||
1237 | if (fHandled) | 1294 | if (fHandled) |
@@ -1318,7 +1375,7 @@ void RlvHandler::onAttach(LLViewerJointAttachment* pAttachPt, bool fFullyLoaded) | |||
1318 | itObj->second.m_fLookup = true; | 1375 | itObj->second.m_fLookup = true; |
1319 | 1376 | ||
1320 | // In both cases we should check for "@detach=n" and actually lock down the attachment point it got attached to | 1377 | // In both cases we should check for "@detach=n" and actually lock down the attachment point it got attached to |
1321 | if (itObj->second.hasBehaviour(RLV_BHVR_DETACH)) | 1378 | if (itObj->second.hasBehaviour(RLV_BHVR_DETACH, false)) |
1322 | { | 1379 | { |
1323 | // (Copy/paste from processAddCommand) | 1380 | // (Copy/paste from processAddCommand) |
1324 | setDetachable(idxAttachPt, pObj->getID(), false); | 1381 | setDetachable(idxAttachPt, pObj->getID(), false); |
@@ -1569,7 +1626,7 @@ void RlvHandler::filterChat(std::string& strUTF8Text, bool fFilterEmote) const | |||
1569 | { | 1626 | { |
1570 | strUTF8Text = "..."; // Emote contains illegal character (or character sequence) | 1627 | strUTF8Text = "..."; // Emote contains illegal character (or character sequence) |
1571 | } | 1628 | } |
1572 | else if (!hasBehaviour("emote")) | 1629 | else if (!hasBehaviour(RLV_BHVR_EMOTE)) |
1573 | { | 1630 | { |
1574 | int idx = strUTF8Text.find('.'); // Truncate at 20 characters or at the dot (whichever is shorter) | 1631 | int idx = strUTF8Text.find('.'); // Truncate at 20 characters or at the dot (whichever is shorter) |
1575 | strUTF8Text = utf8str_chtruncate(strUTF8Text, ( (idx > 0) && (idx < 20) ) ? idx + 1 : 20); | 1632 | strUTF8Text = utf8str_chtruncate(strUTF8Text, ( (idx > 0) && (idx < 20) ) ? idx + 1 : 20); |
@@ -1674,17 +1731,18 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const | |||
1674 | return false; // @sendchat wouldn't filter it so @redirchat won't redirect it either | 1731 | return false; // @sendchat wouldn't filter it so @redirchat won't redirect it either |
1675 | } | 1732 | } |
1676 | 1733 | ||
1677 | bool fSendChannel = hasBehaviour("sendchannel"); | 1734 | bool fSendChannel = hasBehaviour(RLV_BHVR_SENDCHANNEL); S32 nChannel = 0; |
1678 | for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) | 1735 | for (rlv_object_map_t::const_iterator itObj = m_Objects.begin(); itObj != m_Objects.end(); ++itObj) |
1679 | { | 1736 | { |
1680 | for (rlv_command_list_t::const_iterator itCmd = itObj->second.m_Commands.begin(), | 1737 | for (rlv_command_list_t::const_iterator itCmd = itObj->second.m_Commands.begin(), |
1681 | endCmd = itObj->second.m_Commands.end(); itCmd != endCmd; ++itCmd) | 1738 | endCmd = itObj->second.m_Commands.end(); itCmd != endCmd; ++itCmd) |
1682 | { | 1739 | { |
1683 | if ( ( ((!fIsEmote) && (RLV_BHVR_REDIRCHAT == itCmd->getBehaviourType())) || | 1740 | if ( ( ((!fIsEmote) && (RLV_BHVR_REDIRCHAT == itCmd->getBehaviourType())) || // Redirect if: (not an emote and @redirchat |
1684 | ((fIsEmote) && (RLV_BHVR_REDIREMOTE == itCmd->getBehaviourType())) ) && | 1741 | ((fIsEmote) && (RLV_BHVR_REDIREMOTE == itCmd->getBehaviourType())) ) && // OR an emote and @rediremote) |
1685 | ( (!fSendChannel) || (hasBehaviour("sendchannel", itCmd->getOption())) ) ) | 1742 | (LLStringUtil::convertToS32(itCmd->getOption(), nChannel)) && // AND the channel is a number |
1743 | ( (!fSendChannel) || (isException(RLV_BHVR_SENDCHANNEL, nChannel)) ) ) // AND we're allowed to send to that channel | ||
1686 | { | 1744 | { |
1687 | rlvSendChatReply(itCmd->getOption(), strUTF8Text); | 1745 | rlvSendChatReply(nChannel, strUTF8Text); |
1688 | } | 1746 | } |
1689 | } | 1747 | } |
1690 | } | 1748 | } |