diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llchatbar.cpp | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp index 1dffae3..1de3690 100644 --- a/linden/indra/newview/llchatbar.cpp +++ b/linden/indra/newview/llchatbar.cpp | |||
@@ -79,7 +79,10 @@ LLChatBar *gChatBar = NULL; | |||
79 | 79 | ||
80 | // legacy calllback glue | 80 | // legacy calllback glue |
81 | void toggleChatHistory(void* user_data); | 81 | void toggleChatHistory(void* user_data); |
82 | void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); | 82 | //void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); |
83 | // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a | ||
84 | void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); | ||
85 | // [/RLVa:KB] | ||
83 | 86 | ||
84 | 87 | ||
85 | class LLChatBarGestureObserver : public LLGestureManagerObserver | 88 | class LLChatBarGestureObserver : public LLGestureManagerObserver |
@@ -516,7 +519,10 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) | |||
516 | 519 | ||
517 | S32 length = raw_text.length(); | 520 | S32 length = raw_text.length(); |
518 | 521 | ||
519 | if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences | 522 | //if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences |
523 | // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | ||
524 | if ( (length > 0) && (raw_text[0] != '/') && (!gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) ) | ||
525 | // [/RLVa:KB] | ||
520 | { | 526 | { |
521 | gAgent.startTyping(); | 527 | gAgent.startTyping(); |
522 | } | 528 | } |
@@ -621,6 +627,21 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL | |||
621 | utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); | 627 | utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); |
622 | } | 628 | } |
623 | 629 | ||
630 | // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b | ||
631 | if ( (0 == channel) && (rlv_handler_t::isEnabled()) ) | ||
632 | { | ||
633 | // Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation) | ||
634 | if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour("chatnormal")) ) | ||
635 | type = CHAT_TYPE_WHISPER; | ||
636 | else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour("chatshout")) ) | ||
637 | type = CHAT_TYPE_NORMAL; | ||
638 | else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour("chatwhisper")) ) | ||
639 | type = CHAT_TYPE_NORMAL; | ||
640 | |||
641 | animate &= !gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT); | ||
642 | } | ||
643 | // [/RLVa:KB] | ||
644 | |||
624 | // Don't animate for chats people can't hear (chat to scripts) | 645 | // Don't animate for chats people can't hear (chat to scripts) |
625 | if (animate && (channel == 0)) | 646 | if (animate && (channel == 0)) |
626 | { | 647 | { |
@@ -656,8 +677,57 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL | |||
656 | send_chat_from_viewer(utf8_out_text, type, channel); | 677 | send_chat_from_viewer(utf8_out_text, type, channel); |
657 | } | 678 | } |
658 | 679 | ||
659 | void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) | 680 | // void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) |
681 | // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a | ||
682 | void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) | ||
683 | // [/RLVa:KB] | ||
660 | { | 684 | { |
685 | // [RLVa:KB] - Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e | ||
686 | // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc) | ||
687 | if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) ) | ||
688 | { | ||
689 | if (0 == channel) | ||
690 | { | ||
691 | // (We already did this before, but LLChatHandler::handle() calls this directly) | ||
692 | if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour("chatnormal")) ) | ||
693 | type = CHAT_TYPE_WHISPER; | ||
694 | else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour("chatshout")) ) | ||
695 | type = CHAT_TYPE_NORMAL; | ||
696 | else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour("chatwhisper")) ) | ||
697 | type = CHAT_TYPE_NORMAL; | ||
698 | |||
699 | // Redirect chat if needed | ||
700 | if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE)) ) && | ||
701 | (gRlvHandler.redirectChatOrEmote(utf8_out_text)) ) ) | ||
702 | { | ||
703 | return; | ||
704 | } | ||
705 | |||
706 | // Filter public chat if sendchat restricted (and filter anything that redirchat didn't redirect) | ||
707 | if ( (gRlvHandler.hasBehaviour("sendchat")) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) ) | ||
708 | gRlvHandler.filterChat(utf8_out_text, true); | ||
709 | } | ||
710 | else | ||
711 | { | ||
712 | // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception) | ||
713 | if ( (gRlvHandler.hasBehaviour("sendchannel")) && (!gRlvHandler.hasBehaviour("sendchannel", llformat("%d", channel))) ) | ||
714 | return; | ||
715 | |||
716 | // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) | ||
717 | if (channel >= CHAT_CHANNEL_DEBUG) | ||
718 | { | ||
719 | bool fIsEmote = rlvIsEmote(utf8_out_text); | ||
720 | if ( (gRlvHandler.hasBehaviour("sendchat")) || | ||
721 | ((!fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT))) || | ||
722 | ((fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE))) ) | ||
723 | { | ||
724 | return; | ||
725 | } | ||
726 | } | ||
727 | } | ||
728 | } | ||
729 | // [/RLVa:KB] | ||
730 | |||
661 | LLMessageSystem* msg = gMessageSystem; | 731 | LLMessageSystem* msg = gMessageSystem; |
662 | msg->newMessageFast(_PREHASH_ChatFromViewer); | 732 | msg->newMessageFast(_PREHASH_ChatFromViewer); |
663 | msg->nextBlockFast(_PREHASH_AgentData); | 733 | msg->nextBlockFast(_PREHASH_AgentData); |