aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llchatbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llchatbar.cpp76
1 files changed, 73 insertions, 3 deletions
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp
index 59aa572..eb1da05 100644
--- a/linden/indra/newview/llchatbar.cpp
+++ b/linden/indra/newview/llchatbar.cpp
@@ -78,7 +78,10 @@ LLChatBar *gChatBar = NULL;
78 78
79// legacy calllback glue 79// legacy calllback glue
80void toggleChatHistory(void* user_data); 80void toggleChatHistory(void* user_data);
81void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); 81//void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
82// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a
83void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel);
84// [/RLVa:KB]
82 85
83 86
84class LLChatBarGestureObserver : public LLGestureManagerObserver 87class LLChatBarGestureObserver : public LLGestureManagerObserver
@@ -482,7 +485,10 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
482 485
483 S32 length = raw_text.length(); 486 S32 length = raw_text.length();
484 487
485 if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences 488 //if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
489// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
490 if ( (length > 0) && (raw_text[0] != '/') && (!gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) )
491// [/RLVa:KB]
486 { 492 {
487 gAgent.startTyping(); 493 gAgent.startTyping();
488 } 494 }
@@ -586,6 +592,21 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL
586 utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); 592 utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
587 } 593 }
588 594
595// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b
596 if ( (0 == channel) && (rlv_handler_t::isEnabled()) )
597 {
598 // Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation)
599 if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour("chatnormal")) )
600 type = CHAT_TYPE_WHISPER;
601 else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour("chatshout")) )
602 type = CHAT_TYPE_NORMAL;
603 else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour("chatwhisper")) )
604 type = CHAT_TYPE_NORMAL;
605
606 animate &= !gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT);
607 }
608// [/RLVa:KB]
609
589 // Don't animate for chats people can't hear (chat to scripts) 610 // Don't animate for chats people can't hear (chat to scripts)
590 if (animate && (channel == 0)) 611 if (animate && (channel == 0))
591 { 612 {
@@ -621,8 +642,57 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL
621 send_chat_from_viewer(utf8_out_text, type, channel); 642 send_chat_from_viewer(utf8_out_text, type, channel);
622} 643}
623 644
624void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) 645// void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)
646// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a
647void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel)
648// [/RLVa:KB]
625{ 649{
650// [RLVa:KB] - Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e
651 // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc)
652 if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) )
653 {
654 if (0 == channel)
655 {
656 // (We already did this before, but LLChatHandler::handle() calls this directly)
657 if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour("chatnormal")) )
658 type = CHAT_TYPE_WHISPER;
659 else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour("chatshout")) )
660 type = CHAT_TYPE_NORMAL;
661 else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour("chatwhisper")) )
662 type = CHAT_TYPE_NORMAL;
663
664 // Redirect chat if needed
665 if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE)) ) &&
666 (gRlvHandler.redirectChatOrEmote(utf8_out_text)) ) )
667 {
668 return;
669 }
670
671 // Filter public chat if sendchat restricted (and filter anything that redirchat didn't redirect)
672 if ( (gRlvHandler.hasBehaviour("sendchat")) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) )
673 gRlvHandler.filterChat(utf8_out_text, true);
674 }
675 else
676 {
677 // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception)
678 if ( (gRlvHandler.hasBehaviour("sendchannel")) && (!gRlvHandler.hasBehaviour("sendchannel", llformat("%d", channel))) )
679 return;
680
681 // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers)
682 if (channel >= CHAT_CHANNEL_DEBUG)
683 {
684 bool fIsEmote = rlvIsEmote(utf8_out_text);
685 if ( (gRlvHandler.hasBehaviour("sendchat")) ||
686 ((!fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT))) ||
687 ((fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE))) )
688 {
689 return;
690 }
691 }
692 }
693 }
694// [/RLVa:KB]
695
626 LLMessageSystem* msg = gMessageSystem; 696 LLMessageSystem* msg = gMessageSystem;
627 msg->newMessageFast(_PREHASH_ChatFromViewer); 697 msg->newMessageFast(_PREHASH_ChatFromViewer);
628 msg->nextBlockFast(_PREHASH_AgentData); 698 msg->nextBlockFast(_PREHASH_AgentData);