diff options
Diffstat (limited to 'linden/indra/newview/llimpanel.cpp')
-rw-r--r-- | linden/indra/newview/llimpanel.cpp | 108 |
1 files changed, 101 insertions, 7 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index 3a947bc..b259b80 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp | |||
@@ -79,6 +79,7 @@ | |||
79 | const S32 LINE_HEIGHT = 16; | 79 | const S32 LINE_HEIGHT = 16; |
80 | const S32 MIN_WIDTH = 200; | 80 | const S32 MIN_WIDTH = 200; |
81 | const S32 MIN_HEIGHT = 130; | 81 | const S32 MIN_HEIGHT = 130; |
82 | const U32 DEFAULT_RETRIES_COUNT = 3; | ||
82 | 83 | ||
83 | // | 84 | // |
84 | // Statics | 85 | // Statics |
@@ -502,6 +503,8 @@ void LLVoiceChannel::initClass() | |||
502 | LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const LLString& session_name) : | 503 | LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const LLString& session_name) : |
503 | LLVoiceChannel(session_id, session_name) | 504 | LLVoiceChannel(session_id, session_name) |
504 | { | 505 | { |
506 | mRetries = DEFAULT_RETRIES_COUNT; | ||
507 | mIsRetrying = FALSE; | ||
505 | } | 508 | } |
506 | 509 | ||
507 | LLVoiceChannelGroup::~LLVoiceChannelGroup() | 510 | LLVoiceChannelGroup::~LLVoiceChannelGroup() |
@@ -548,18 +551,92 @@ void LLVoiceChannelGroup::getChannelInfo() | |||
548 | } | 551 | } |
549 | } | 552 | } |
550 | 553 | ||
554 | void LLVoiceChannelGroup::setChannelInfo( | ||
555 | const LLString& uri, | ||
556 | const LLString& credentials) | ||
557 | { | ||
558 | setURI(uri); | ||
559 | |||
560 | mCredentials = credentials; | ||
561 | |||
562 | if (mState == STATE_NO_CHANNEL_INFO) | ||
563 | { | ||
564 | if(!mURI.empty() && !mCredentials.empty()) | ||
565 | { | ||
566 | setState(STATE_READY); | ||
567 | |||
568 | // if we are supposed to be active, reconnect | ||
569 | // this will happen on initial connect, as we request credentials on first use | ||
570 | if (sCurrentVoiceChannel == this) | ||
571 | { | ||
572 | // just in case we got new channel info while active | ||
573 | // should move over to new channel | ||
574 | activate(); | ||
575 | } | ||
576 | } | ||
577 | else | ||
578 | { | ||
579 | //*TODO: notify user | ||
580 | llwarns << "Received invalid credentials for channel " << mSessionName << llendl; | ||
581 | deactivate(); | ||
582 | } | ||
583 | } | ||
584 | else if ( mIsRetrying ) | ||
585 | { | ||
586 | // we have the channel info, just need to use it now | ||
587 | LLVoiceClient::getInstance()->setNonSpatialChannel( | ||
588 | mURI, | ||
589 | mCredentials); | ||
590 | } | ||
591 | } | ||
592 | |||
593 | void LLVoiceChannelGroup::handleStatusChange(EStatusType type) | ||
594 | { | ||
595 | // status updates | ||
596 | switch(type) | ||
597 | { | ||
598 | case STATUS_JOINED: | ||
599 | mRetries = 3; | ||
600 | mIsRetrying = FALSE; | ||
601 | default: | ||
602 | break; | ||
603 | } | ||
604 | |||
605 | LLVoiceChannel::handleStatusChange(type); | ||
606 | } | ||
607 | |||
551 | void LLVoiceChannelGroup::handleError(EStatusType status) | 608 | void LLVoiceChannelGroup::handleError(EStatusType status) |
552 | { | 609 | { |
553 | std::string notify; | 610 | std::string notify; |
554 | switch(status) | 611 | switch(status) |
555 | { | 612 | { |
556 | case ERROR_CHANNEL_LOCKED: | 613 | case ERROR_CHANNEL_LOCKED: |
557 | case ERROR_CHANNEL_FULL: | 614 | case ERROR_CHANNEL_FULL: |
558 | notify = "VoiceChannelFull"; | 615 | notify = "VoiceChannelFull"; |
559 | break; | 616 | break; |
560 | case ERROR_UNKNOWN: | 617 | case ERROR_NOT_AVAILABLE: |
618 | //clear URI and credentials | ||
619 | //set the state to be no info | ||
620 | //and activate | ||
621 | if ( mRetries > 0 ) | ||
622 | { | ||
623 | mRetries--; | ||
624 | mIsRetrying = TRUE; | ||
625 | mIgnoreNextSessionLeave = TRUE; | ||
626 | |||
627 | getChannelInfo(); | ||
628 | return; | ||
629 | } | ||
630 | else | ||
631 | { | ||
632 | notify = "VoiceChannelJoinFailed"; | ||
633 | mRetries = DEFAULT_RETRIES_COUNT; | ||
634 | mIsRetrying = FALSE; | ||
635 | } | ||
636 | |||
561 | break; | 637 | break; |
562 | default: | 638 | case ERROR_UNKNOWN: |
639 | default: | ||
563 | break; | 640 | break; |
564 | } | 641 | } |
565 | 642 | ||
@@ -570,10 +647,27 @@ void LLVoiceChannelGroup::handleError(EStatusType status) | |||
570 | // echo to im window | 647 | // echo to im window |
571 | gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, LLNotifyBox::getTemplateMessage(notify, mNotifyArgs).c_str()); | 648 | gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, LLNotifyBox::getTemplateMessage(notify, mNotifyArgs).c_str()); |
572 | } | 649 | } |
573 | 650 | ||
574 | LLVoiceChannel::handleError(status); | 651 | LLVoiceChannel::handleError(status); |
575 | } | 652 | } |
576 | 653 | ||
654 | void LLVoiceChannelGroup::setState(EState state) | ||
655 | { | ||
656 | switch(state) | ||
657 | { | ||
658 | case STATE_RINGING: | ||
659 | if ( !mIsRetrying ) | ||
660 | { | ||
661 | gIMMgr->addSystemMessage(mSessionID, "ringing", mNotifyArgs); | ||
662 | } | ||
663 | |||
664 | mState = state; | ||
665 | break; | ||
666 | default: | ||
667 | LLVoiceChannel::setState(state); | ||
668 | } | ||
669 | } | ||
670 | |||
577 | // | 671 | // |
578 | // LLVoiceChannelProximal | 672 | // LLVoiceChannelProximal |
579 | // | 673 | // |
@@ -710,7 +804,7 @@ void LLVoiceChannelP2P::handleStatusChange(EStatusType type) | |||
710 | break; | 804 | break; |
711 | } | 805 | } |
712 | 806 | ||
713 | LLVoiceChannelGroup::handleStatusChange(type); | 807 | LLVoiceChannel::handleStatusChange(type); |
714 | } | 808 | } |
715 | 809 | ||
716 | void LLVoiceChannelP2P::handleError(EStatusType type) | 810 | void LLVoiceChannelP2P::handleError(EStatusType type) |
@@ -724,7 +818,7 @@ void LLVoiceChannelP2P::handleError(EStatusType type) | |||
724 | break; | 818 | break; |
725 | } | 819 | } |
726 | 820 | ||
727 | LLVoiceChannelGroup::handleError(type); | 821 | LLVoiceChannel::handleError(type); |
728 | } | 822 | } |
729 | 823 | ||
730 | void LLVoiceChannelP2P::activate() | 824 | void LLVoiceChannelP2P::activate() |