@@ -468,123 +468,8 @@ class LLProfileHandler : public LLCommandHandler
468
468
};
469
469
LLProfileHandler gProfileHandler ;
470
470
471
-
472
- // ////////////////////////////////////////////////////////////////////////
473
- // LLAgentHandler
474
-
475
- class LLAgentHandler : public LLCommandHandler
476
- {
477
- public:
478
- // requires trusted browser to trigger
479
- LLAgentHandler () : LLCommandHandler(" agent" , UNTRUSTED_THROTTLE) { }
480
-
481
- bool handle (const LLSD& params, const LLSD& query_map,
482
- LLMediaCtrl* web)
483
- {
484
- if (params.size () < 2 ) return false ;
485
- LLUUID avatar_id;
486
- if (!avatar_id.set (params[0 ], FALSE ))
487
- {
488
- return false ;
489
- }
490
-
491
- const std::string verb = params[1 ].asString ();
492
- if (verb == " about" )
493
- {
494
- LLAvatarActions::showProfile (avatar_id);
495
- return true ;
496
- }
497
-
498
- if (verb == " inspect" )
499
- {
500
- LLFloaterReg::showInstance (" inspect_avatar" , LLSD ().with (" avatar_id" , avatar_id));
501
- return true ;
502
- }
503
-
504
- if (verb == " im" )
505
- {
506
- LLAvatarActions::startIM (avatar_id);
507
- return true ;
508
- }
509
-
510
- if (verb == " pay" )
511
- {
512
- if (!LLUI::getInstance ()->mSettingGroups [" config" ]->getBOOL (" EnableAvatarPay" ))
513
- {
514
- LLNotificationsUtil::add (" NoAvatarPay" , LLSD (), LLSD (), std::string (" SwitchToStandardSkinAndQuit" ));
515
- return true ;
516
- }
517
-
518
- LLAvatarActions::pay (avatar_id);
519
- return true ;
520
- }
521
-
522
- if (verb == " offerteleport" )
523
- {
524
- LLAvatarActions::offerTeleport (avatar_id);
525
- return true ;
526
- }
527
-
528
- if (verb == " requestfriend" )
529
- {
530
- LLAvatarActions::requestFriendshipDialog (avatar_id);
531
- return true ;
532
- }
533
-
534
- if (verb == " removefriend" )
535
- {
536
- LLAvatarActions::removeFriendDialog (avatar_id);
537
- return true ;
538
- }
539
-
540
- if (verb == " mute" )
541
- {
542
- if (! LLAvatarActions::isBlocked (avatar_id))
543
- {
544
- LLAvatarActions::toggleBlock (avatar_id);
545
- }
546
- return true ;
547
- }
548
-
549
- if (verb == " unmute" )
550
- {
551
- if (LLAvatarActions::isBlocked (avatar_id))
552
- {
553
- LLAvatarActions::toggleBlock (avatar_id);
554
- }
555
- return true ;
556
- }
557
-
558
- if (verb == " block" )
559
- {
560
- if (params.size () > 2 )
561
- {
562
- const std::string object_name = LLURI::unescape (params[2 ].asString ());
563
- LLMute mute (avatar_id, object_name, LLMute::OBJECT);
564
- LLMuteList::getInstance ()->add (mute);
565
- LLPanelBlockedList::showPanelAndSelect (mute.mID );
566
- }
567
- return true ;
568
- }
569
-
570
- if (verb == " unblock" )
571
- {
572
- if (params.size () > 2 )
573
- {
574
- const std::string object_name = params[2 ].asString ();
575
- LLMute mute (avatar_id, object_name, LLMute::OBJECT);
576
- LLMuteList::getInstance ()->remove (mute);
577
- }
578
- return true ;
579
- }
580
- return false ;
581
- }
582
- };
583
- LLAgentHandler gAgentHandler ;
584
-
585
-
586
471
// /----------------------------------------------------------------------------
587
- // / LLFloaterInventoryFinder
472
+ // / LLFloaterProfilePermissions
588
473
// /----------------------------------------------------------------------------
589
474
590
475
class LLFloaterProfilePermissions
@@ -605,7 +490,8 @@ class LLFloaterProfilePermissions
605
490
void fillRightsData ();
606
491
void rightsConfirmationCallback (const LLSD& notification, const LLSD& response);
607
492
void confirmModifyRights (bool grant);
608
- void onCommitRights ();
493
+ void onCommitSeeOnlineRights ();
494
+ void onCommitEditRights ();
609
495
610
496
void onApplyRights ();
611
497
void onCancel ();
@@ -651,7 +537,8 @@ BOOL LLFloaterProfilePermissions::postBuild()
651
537
mOkBtn = getChild<LLButton>(" perms_btn_ok" );
652
538
mCancelBtn = getChild<LLButton>(" perms_btn_cancel" );
653
539
654
- mEditObjectRights ->setCommitCallback ([this ](LLUICtrl*, void *) { onCommitRights (); }, nullptr );
540
+ mOnlineStatus ->setCommitCallback ([this ](LLUICtrl*, void *) { onCommitSeeOnlineRights (); }, nullptr );
541
+ mEditObjectRights ->setCommitCallback ([this ](LLUICtrl*, void *) { onCommitEditRights (); }, nullptr );
655
542
mOkBtn ->setCommitCallback ([this ](LLUICtrl*, void *) { onApplyRights (); }, nullptr );
656
543
mCancelBtn ->setCommitCallback ([this ](LLUICtrl*, void *) { onCancel (); }, nullptr );
657
544
@@ -704,7 +591,9 @@ void LLFloaterProfilePermissions::fillRightsData()
704
591
{
705
592
S32 rights = relation ->getRightsGrantedTo ();
706
593
707
- mOnlineStatus ->setValue (LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE );
594
+ BOOL see_online = LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE ;
595
+ mOnlineStatus ->setValue (see_online);
596
+ mMapRights ->setEnabled (see_online);
708
597
mMapRights ->setValue (LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE );
709
598
mEditObjectRights ->setValue (LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE );
710
599
}
@@ -733,13 +622,38 @@ void LLFloaterProfilePermissions::confirmModifyRights(bool grant)
733
622
boost::bind (&LLFloaterProfilePermissions::rightsConfirmationCallback, this , _1, _2));
734
623
}
735
624
736
- void LLFloaterProfilePermissions::onCommitRights ()
625
+ void LLFloaterProfilePermissions::onCommitSeeOnlineRights ()
626
+ {
627
+ bool see_online = mOnlineStatus ->getValue ().asBoolean ();
628
+ mMapRights ->setEnabled (see_online);
629
+ if (see_online)
630
+ {
631
+ const LLRelationship* relation = LLAvatarTracker::instance ().getBuddyInfo (mAvatarID );
632
+ if (relation )
633
+ {
634
+ S32 rights = relation ->getRightsGrantedTo ();
635
+ mMapRights ->setValue (LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE );
636
+ }
637
+ else
638
+ {
639
+ closeFloater ();
640
+ LL_INFOS (" ProfilePermissions" ) << " Floater closing since agent is no longer a friend" << LL_ENDL;
641
+ }
642
+ }
643
+ else
644
+ {
645
+ mMapRights ->setValue (FALSE );
646
+ }
647
+ }
648
+
649
+ void LLFloaterProfilePermissions::onCommitEditRights ()
737
650
{
738
651
const LLRelationship* buddy_relationship = LLAvatarTracker::instance ().getBuddyInfo (mAvatarID );
739
652
740
653
if (!buddy_relationship)
741
654
{
742
- LL_WARNS (" ProfilePermissions" ) << " Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL;
655
+ LL_WARNS (" ProfilePermissions" ) << " Trying to modify rights for non-friend avatar. Closing floater." << LL_ENDL;
656
+ closeFloater ();
743
657
return ;
744
658
}
745
659
@@ -844,6 +758,13 @@ BOOL LLPanelProfileSecondLife::postBuild()
844
758
845
759
getChild<LLButton>(" open_notes" )->setCommitCallback ([this ](LLUICtrl*, void *) { onOpenNotes (); }, nullptr );
846
760
761
+ mCanSeeOnlineIcon ->setMouseUpCallback ([this ](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog (); });
762
+ mCantSeeOnlineIcon ->setMouseUpCallback ([this ](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog (); });
763
+ mCanSeeOnMapIcon ->setMouseUpCallback ([this ](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog (); });
764
+ mCantSeeOnMapIcon ->setMouseUpCallback ([this ](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog (); });
765
+ mCanEditObjectsIcon ->setMouseUpCallback ([this ](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog (); });
766
+ mCantEditObjectsIcon ->setMouseUpCallback ([this ](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog (); });
767
+
847
768
return TRUE ;
848
769
}
849
770
@@ -995,9 +916,10 @@ void LLPanelProfileSecondLife::openGroupProfile()
995
916
void LLPanelProfileSecondLife::onAvatarNameCache (const LLUUID& agent_id, const LLAvatarName& av_name)
996
917
{
997
918
mAvatarNameCacheConnection .disconnect ();
998
- // Should be possible to get this from AgentProfile capability
999
- getChild<LLUICtrl>(" display_name" )->setValue ( av_name.getDisplayName () );
1000
- getChild<LLUICtrl>(" user_name" )->setValue (av_name.getAccountName ());
919
+ if (getIsLoaded ())
920
+ {
921
+ fillNameAgeData (av_name, mBornOn );
922
+ }
1001
923
}
1002
924
1003
925
void LLPanelProfileSecondLife::setNotesSnippet (std::string ¬es)
@@ -1049,10 +971,21 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
1049
971
// and to make sure icons in text will be up to date
1050
972
LLAvatarIconIDCache::getInstance ()->add (avatar_data->avatar_id , avatar_data->image_id );
1051
973
1052
- LLStringUtil::format_map_t args;
1053
- args[" [AGE]" ] = LLDateUtil::ageFromDate ( avatar_data->born_on , LLDate::now ());
1054
- std::string register_date = getString (" AgeFormat" , args);
1055
- getChild<LLUICtrl>(" user_age" )->setValue (register_date);
974
+ mBornOn = avatar_data->born_on ;
975
+
976
+ // Should be possible to get user and display names from AgentProfile capability
977
+ // but at the moment contraining this to limits of LLAvatarData
978
+ LLAvatarName av_name;
979
+ if (LLAvatarNameCache::get (avatar_data->avatar_id , &av_name))
980
+ {
981
+ fillNameAgeData (av_name, mBornOn );
982
+ }
983
+ else if (!mAvatarNameCacheConnection .connected ())
984
+ {
985
+ // shouldn't happen, but just in case
986
+ mAvatarNameCacheConnection = LLAvatarNameCache::get (getAvatarId (), boost::bind (&LLPanelProfileSecondLife::onAvatarNameCache, this , _1, _2));
987
+ }
988
+
1056
989
setDescriptionText (avatar_data->about_text );
1057
990
1058
991
if (avatar_data->image_id .notNull ())
@@ -1144,10 +1077,16 @@ void LLPanelProfileSecondLife::fillRightsData()
1144
1077
}
1145
1078
1146
1079
childSetVisible (" permissions_panel" , NULL != relation );
1147
- childSetVisible (" spacer_layout" , NULL == relation );
1148
- childSetVisible (" frind_layout" , NULL != relation );
1149
- childSetVisible (" online_layout" , false );
1150
- childSetVisible (" offline_layout" , false );
1080
+ }
1081
+
1082
+ void LLPanelProfileSecondLife::fillNameAgeData (const LLAvatarName &av_name, const LLDate &born_on)
1083
+ {
1084
+ LLStringUtil::format_map_t args;
1085
+ args[" [AGE]" ] = LLDateUtil::ageFromDate (born_on, LLDate::now ());
1086
+ args[" [NAME]" ] = av_name.getAccountName ();
1087
+ std::string register_date = getString (" NameAgeFormat" , args);
1088
+ getChild<LLUICtrl>(" user_name_age" )->setValue (register_date);
1089
+ getChild<LLUICtrl>(" display_name" )->setValue (av_name.getDisplayName ());
1151
1090
}
1152
1091
1153
1092
void LLPanelProfileSecondLife::onImageLoaded (BOOL success, LLViewerFetchedTexture *imagep)
@@ -1620,13 +1559,15 @@ void LLPanelProfileSecondLife::onShowAgentPermissionsDialog()
1620
1559
LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions (parent_floater, getAvatarId ());
1621
1560
mFloaterPermissionsHandle = perms->getHandle ();
1622
1561
perms->openFloater ();
1562
+ perms->setVisibleAndFrontmost (TRUE );
1623
1563
1624
1564
parent_floater->addDependentFloater (mFloaterPermissionsHandle );
1625
1565
}
1626
1566
}
1627
1567
else // already open
1628
1568
{
1629
- floater->closeFloater ();
1569
+ floater->setMinimized (FALSE );
1570
+ floater->setVisibleAndFrontmost (TRUE );
1630
1571
}
1631
1572
}
1632
1573
0 commit comments