diff options
author | McCabe Maxsted | 2010-07-10 05:30:16 -0700 |
---|---|---|
committer | McCabe Maxsted | 2010-07-10 05:30:16 -0700 |
commit | cf09e00ee0affdc23c084222961408487cca4c30 (patch) | |
tree | 04aaa450ff7980ea6921d0b4f820fcb72219198f /linden/indra/newview/panelradar.cpp | |
parent | revamp autoenable joystick (diff) | |
download | meta-impy-cf09e00ee0affdc23c084222961408487cca4c30.zip meta-impy-cf09e00ee0affdc23c084222961408487cca4c30.tar.gz meta-impy-cf09e00ee0affdc23c084222961408487cca4c30.tar.bz2 meta-impy-cf09e00ee0affdc23c084222961408487cca4c30.tar.xz |
Changes that should make the 'Ban' button in the radar work for EMs as well as parcel mgrs
Diffstat (limited to 'linden/indra/newview/panelradar.cpp')
-rw-r--r-- | linden/indra/newview/panelradar.cpp | 372 |
1 files changed, 168 insertions, 204 deletions
diff --git a/linden/indra/newview/panelradar.cpp b/linden/indra/newview/panelradar.cpp index 9b4c5b4..c5fc3db 100644 --- a/linden/indra/newview/panelradar.cpp +++ b/linden/indra/newview/panelradar.cpp | |||
@@ -90,7 +90,8 @@ BOOL PanelRadar::postBuild() | |||
90 | childSetAction("unmute_btn", onClickUnmute, this); | 90 | childSetAction("unmute_btn", onClickUnmute, this); |
91 | childSetAction("ar_btn", onClickAR, this); | 91 | childSetAction("ar_btn", onClickAR, this); |
92 | //childSetAction("estate_eject_btn", onClickEjectFromEstate, this); | 92 | //childSetAction("estate_eject_btn", onClickEjectFromEstate, this); |
93 | childSetAction("estate_ban_btn", onClickBanFromEstate, this); | 93 | //childSetAction("estate_ban_btn", onClickBanFromEstate, this); |
94 | childSetAction("ban_btn", onClickBan, this); | ||
94 | 95 | ||
95 | setDefaultBtn("im_btn"); | 96 | setDefaultBtn("im_btn"); |
96 | 97 | ||
@@ -435,10 +436,11 @@ void PanelRadar::updateButtonStates() | |||
435 | childSetEnabled("cam_btn", enable_cam); | 436 | childSetEnabled("cam_btn", enable_cam); |
436 | childSetEnabled("freeze_btn", enable_estate); | 437 | childSetEnabled("freeze_btn", enable_estate); |
437 | childSetEnabled("eject_btn", enable_estate); | 438 | childSetEnabled("eject_btn", enable_estate); |
439 | childSetEnabled("ban_btn", enable_estate); | ||
438 | childSetEnabled("mute_btn", enable); | 440 | childSetEnabled("mute_btn", enable); |
439 | childSetEnabled("ar_btn", enable); | 441 | childSetEnabled("ar_btn", enable); |
440 | //childSetEnabled("estate_eject_btn", enable_estate); | 442 | //childSetEnabled("estate_eject_btn", enable_estate); |
441 | childSetEnabled("estate_ban_btn", enable_estate); | 443 | //childSetEnabled("estate_ban_btn", enable_estate); |
442 | 444 | ||
443 | if (enable_unmute) | 445 | if (enable_unmute) |
444 | { | 446 | { |
@@ -486,7 +488,7 @@ void PanelRadar::updateButtonStates() | |||
486 | } | 488 | } |
487 | 489 | ||
488 | 490 | ||
489 | bool PanelRadar::isKickable(const LLUUID &agent_id) | 491 | bool PanelRadar::isKickable(const LLUUID& agent_id) |
490 | { | 492 | { |
491 | if (agent_id.notNull()) | 493 | if (agent_id.notNull()) |
492 | { | 494 | { |
@@ -498,23 +500,28 @@ bool PanelRadar::isKickable(const LLUUID &agent_id) | |||
498 | if (region) | 500 | if (region) |
499 | { | 501 | { |
500 | const LLVector3& pos = avatar->getPositionRegion(); | 502 | const LLVector3& pos = avatar->getPositionRegion(); |
503 | |||
504 | if (region->isOwnedSelf(pos) || | ||
505 | region->canManageEstate()) | ||
506 | { | ||
507 | return true; | ||
508 | } | ||
509 | |||
501 | const LLVector3d& pos_global = avatar->getPositionGlobal(); | 510 | const LLVector3d& pos_global = avatar->getPositionGlobal(); |
502 | if (LLWorld::getInstance()->positionRegionValidGlobal(pos_global)) | 511 | if (LLWorld::getInstance()->positionRegionValidGlobal(pos_global)) |
503 | { | 512 | { |
504 | LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel(); | 513 | LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel(); |
505 | LLViewerParcelMgr::getInstance()->deselectLand(); | 514 | LLViewerParcelMgr::getInstance()->deselectLand(); |
506 | 515 | ||
507 | bool new_value = (region != NULL); | 516 | if (parcel) |
508 | |||
509 | if (new_value) | ||
510 | { | 517 | { |
511 | new_value = region->isOwnedSelf(pos); | 518 | if (region->isOwnedGroup(pos) && |
512 | if (!new_value || region->isOwnedGroup(pos)) | 519 | (LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN) || |
520 | LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED))) | ||
513 | { | 521 | { |
514 | new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN); | 522 | return true; |
515 | } | 523 | } |
516 | } | 524 | } |
517 | return new_value; | ||
518 | } | 525 | } |
519 | } | 526 | } |
520 | } | 527 | } |
@@ -546,7 +553,7 @@ LLUUID PanelRadar::getSelected() | |||
546 | } | 553 | } |
547 | 554 | ||
548 | 555 | ||
549 | std::string PanelRadar::getSelectedName(const LLUUID &agent_id) | 556 | std::string PanelRadar::getSelectedName(const LLUUID& agent_id) |
550 | { | 557 | { |
551 | std::string agent_name; | 558 | std::string agent_name; |
552 | if(!(gCacheName->getFullName(agent_id, agent_name) && agent_name != " ")) | 559 | if(!(gCacheName->getFullName(agent_id, agent_name) && agent_name != " ")) |
@@ -556,7 +563,7 @@ std::string PanelRadar::getSelectedName(const LLUUID &agent_id) | |||
556 | return agent_name; | 563 | return agent_name; |
557 | } | 564 | } |
558 | 565 | ||
559 | void PanelRadar::sendAvatarPropertiesRequest(const LLUUID &agent_id) | 566 | void PanelRadar::sendAvatarPropertiesRequest(const LLUUID& agent_id) |
560 | { | 567 | { |
561 | LL_DEBUGS("Radar") << "PanelRadar::sendAvatarPropertiesRequest()" << LL_ENDL; | 568 | LL_DEBUGS("Radar") << "PanelRadar::sendAvatarPropertiesRequest()" << LL_ENDL; |
562 | LLMessageSystem *msg = gMessageSystem; | 569 | LLMessageSystem *msg = gMessageSystem; |
@@ -614,10 +621,10 @@ void PanelRadar::onClickOfferTeleport(void* user_data) | |||
614 | } | 621 | } |
615 | 622 | ||
616 | //static | 623 | //static |
617 | void PanelRadar::onClickTeleport(void* userdata) | 624 | void PanelRadar::onClickTeleport(void* user_data) |
618 | { | 625 | { |
619 | PanelRadar *self = (PanelRadar*)userdata; | 626 | PanelRadar* self = (PanelRadar*)user_data; |
620 | LLScrollListItem *item = self->mRadarList->getFirstSelected(); | 627 | LLScrollListItem *item = self->mRadarList->getFirstSelected(); |
621 | 628 | ||
622 | if (item) | 629 | if (item) |
623 | { | 630 | { |
@@ -680,7 +687,7 @@ void PanelRadar::onClickInvite(void* user_data) | |||
680 | } | 687 | } |
681 | 688 | ||
682 | // static | 689 | // static |
683 | void PanelRadar::callback_invite_to_group(LLUUID group_id, void *user_data) | 690 | void PanelRadar::callback_invite_to_group(LLUUID group_id, void* user_data) |
684 | { | 691 | { |
685 | std::vector<LLUUID> agent_ids; | 692 | std::vector<LLUUID> agent_ids; |
686 | agent_ids.push_back(*(LLUUID *)user_data); | 693 | agent_ids.push_back(*(LLUUID *)user_data); |
@@ -710,7 +717,7 @@ void PanelRadar::onClickAddFriend(void* user_data) | |||
710 | // static | 717 | // static |
711 | void PanelRadar::onClickCam(void* user_data) | 718 | void PanelRadar::onClickCam(void* user_data) |
712 | { | 719 | { |
713 | PanelRadar *self = (PanelRadar*)user_data; | 720 | PanelRadar* self = (PanelRadar*)user_data; |
714 | self->lookAtAvatar(self->getSelected()); | 721 | self->lookAtAvatar(self->getSelected()); |
715 | } | 722 | } |
716 | 723 | ||
@@ -730,55 +737,96 @@ void PanelRadar::lookAtAvatar(const LLUUID& agent_id) | |||
730 | } | 737 | } |
731 | 738 | ||
732 | //static | 739 | //static |
733 | bool PanelRadar::callbackFreeze(const LLSD& notification, const LLSD& response, PanelRadar *self) | 740 | bool PanelRadar::callbackFreeze(const LLSD& notification, const LLSD& response) |
734 | { | 741 | { |
735 | S32 option = LLNotification::getSelectedOption(notification, response); | 742 | S32 option = LLNotification::getSelectedOption(notification, response); |
736 | if (option == 0) | 743 | if (option == 0) |
737 | { | 744 | { |
738 | sendFreeze(self->mSelectedAvatar, true); | 745 | sendFreeze(notification["payload"]["avatar_id"].asUUID(), true); |
739 | } | 746 | } |
740 | else if (option == 1) | 747 | else if (option == 1) |
741 | { | 748 | { |
742 | sendFreeze(self->mSelectedAvatar, false); | 749 | sendFreeze(notification["payload"]["avatar_id"].asUUID(), false); |
743 | } | 750 | } |
744 | return false; | 751 | return false; |
745 | } | 752 | } |
746 | 753 | ||
747 | //static | 754 | //static |
748 | bool PanelRadar::callbackEject(const LLSD& notification, const LLSD& response, PanelRadar *self) | 755 | bool PanelRadar::callbackEjectBan(const LLSD& notification, const LLSD& response) |
749 | { | 756 | { |
750 | S32 option = LLNotification::getSelectedOption(notification, response); | 757 | S32 option = LLNotification::getSelectedOption(notification, response); |
751 | if (option == 0) | 758 | if (2 == option) |
752 | { | 759 | { |
753 | sendEject(self->mSelectedAvatar, false); | 760 | // Cancel button. |
761 | return false; | ||
754 | } | 762 | } |
755 | else if (option == 1) | 763 | LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); |
764 | bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean(); | ||
765 | |||
766 | if (0 == option) | ||
767 | { | ||
768 | // Eject button | ||
769 | LLMessageSystem* msg = gMessageSystem; | ||
770 | LLViewerObject* avatar = gObjectList.findObject(avatar_id); | ||
771 | |||
772 | if (avatar) | ||
773 | { | ||
774 | U32 flags = 0x0; | ||
775 | msg->newMessage("EjectUser"); | ||
776 | msg->nextBlock("AgentData"); | ||
777 | msg->addUUID("AgentID", gAgent.getID() ); | ||
778 | msg->addUUID("SessionID", gAgent.getSessionID() ); | ||
779 | msg->nextBlock("Data"); | ||
780 | msg->addUUID("TargetID", avatar_id ); | ||
781 | msg->addU32("Flags", flags ); | ||
782 | msg->sendReliable( avatar->getRegion()->getHost() ); | ||
783 | } | ||
784 | } | ||
785 | else if (ban_enabled) | ||
756 | { | 786 | { |
757 | sendEject(self->mSelectedAvatar, true); | 787 | // This is tricky. It is similar to say if it is not an 'Eject' button, |
788 | // and it is also not an 'Cancle' button, and ban_enabled==ture, | ||
789 | // it should be the 'Eject and Ban' button. | ||
790 | LLMessageSystem* msg = gMessageSystem; | ||
791 | LLViewerObject* avatar = gObjectList.findObject(avatar_id); | ||
792 | |||
793 | if (avatar) | ||
794 | { | ||
795 | U32 flags = 0x1; | ||
796 | msg->newMessage("EjectUser"); | ||
797 | msg->nextBlock("AgentData"); | ||
798 | msg->addUUID("AgentID", gAgent.getID() ); | ||
799 | msg->addUUID("SessionID", gAgent.getSessionID() ); | ||
800 | msg->nextBlock("Data"); | ||
801 | msg->addUUID("TargetID", avatar_id ); | ||
802 | msg->addU32("Flags", flags ); | ||
803 | msg->sendReliable( avatar->getRegion()->getHost() ); | ||
804 | } | ||
758 | } | 805 | } |
759 | return false; | 806 | return false; |
760 | } | 807 | } |
761 | 808 | ||
762 | //static | 809 | //static |
763 | //bool PanelRadar::callbackEjectFromEstate(const LLSD& notification, const LLSD& response, PanelRadar *self) | 810 | // Don't use until the UI can be worked out |
811 | //bool PanelRadar::callbackEjectFromEstate(const LLSD& notification, const LLSD& response) | ||
764 | //{ | 812 | //{ |
765 | // S32 option = LLNotification::getSelectedOption(notification, response); | 813 | // S32 option = LLNotification::getSelectedOption(notification, response); |
766 | // if (option == 0) | 814 | // if (option == 0) |
767 | // { | 815 | // { |
768 | // strings_t strings; | 816 | // strings_t strings; |
769 | // strings.push_back(self->getSelected().asString()); | 817 | // strings.push_back(notification["payload"]["avatar_id"].asString()); |
770 | // sendEstateOwnerMessage(gMessageSystem, "kickestate", LLFloaterRegionInfo::getLastInvoice(), strings); | 818 | // sendEstateOwnerMessage(gMessageSystem, "kickestate", LLFloaterRegionInfo::getLastInvoice(), strings); |
771 | // } | 819 | // } |
772 | // return false; | 820 | // return false; |
773 | //} | 821 | //} |
774 | 822 | ||
775 | // static | 823 | // static |
776 | bool PanelRadar::callbackBanFromEstate(const LLSD& notification, const LLSD& response, PanelRadar *self) | 824 | bool PanelRadar::callbackBanFromEstate(const LLSD& notification, const LLSD& response) |
777 | { | 825 | { |
778 | S32 option = LLNotification::getSelectedOption(notification, response); | 826 | S32 option = LLNotification::getSelectedOption(notification, response); |
779 | if (option == 0) | 827 | if (option == 0) |
780 | { | 828 | { |
781 | LLPanelEstateInfo::sendEstateAccessDelta(ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_NO_REPLY, self->getSelected()); | 829 | LLPanelEstateInfo::sendEstateAccessDelta(ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_NO_REPLY, notification["payload"]["avatar_id"].asUUID()); |
782 | } | 830 | } |
783 | else if (option == 1) | 831 | else if (option == 1) |
784 | { | 832 | { |
@@ -794,39 +842,42 @@ bool PanelRadar::callbackBanFromEstate(const LLSD& notification, const LLSD& res | |||
794 | { | 842 | { |
795 | flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES; | 843 | flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES; |
796 | } | 844 | } |
797 | LLPanelEstateInfo::sendEstateAccessDelta(flags, self->getSelected()); | 845 | LLPanelEstateInfo::sendEstateAccessDelta(flags, notification["payload"]["avatar_id"].asUUID()); |
798 | } | 846 | } |
799 | } | 847 | } |
800 | return false; | 848 | return false; |
801 | } | 849 | } |
802 | 850 | ||
803 | // static | 851 | // static |
804 | void PanelRadar::onClickFreeze(void *user_data) | 852 | void PanelRadar::onClickFreeze(void* user_data) |
805 | { | 853 | { |
806 | PanelRadar *self = (PanelRadar*)user_data; | 854 | PanelRadar* self = (PanelRadar*)user_data; |
855 | LLSD payload; | ||
856 | payload["avatar_id"] = self->getSelected(); | ||
807 | LLSD args; | 857 | LLSD args; |
808 | args["AVATAR_NAME"] = self->getSelectedName(self->mSelectedAvatar); | 858 | args["AVATAR_NAME"] = self->getSelectedName(self->getSelected()); |
809 | LLNotifications::instance().add("FreezeAvatarFullname", | 859 | LLNotifications::instance().add("FreezeAvatarFullname", |
810 | args, | 860 | args, |
811 | LLSD(), | 861 | payload, |
812 | boost::bind(&callbackFreeze, _1, _2, self)); | 862 | callbackFreeze); |
813 | } | 863 | } |
814 | 864 | ||
815 | 865 | ||
816 | // static | 866 | // static |
817 | void PanelRadar::onClickUnfreeze(void *user_data) | 867 | void PanelRadar::onClickUnfreeze(void* user_data) |
818 | { | 868 | { |
819 | PanelRadar *self = (PanelRadar*)user_data; | 869 | PanelRadar* self = (PanelRadar*)user_data; |
820 | sendFreeze(self->getSelected(), false); | 870 | sendFreeze(self->getSelected(), false); |
821 | } | 871 | } |
822 | 872 | ||
823 | 873 | ||
824 | //static | 874 | //static |
825 | //void PanelRadar::onClickEjectFromEstate(void *user_data) | 875 | // Don't use until we can work out the UI |
876 | //void PanelRadar::onClickEjectFromEstate(void* user_data) | ||
826 | //{ | 877 | //{ |
827 | // PanelRadar *self = (PanelRadar*)user_data; | 878 | // PanelRadar* self = (PanelRadar*)user_data; |
828 | // LLSD args; | 879 | // LLSD args; |
829 | // args["AVATAR_NAME"] = self->getSelectedName(self->mSelectedAvatar); | 880 | // args["AVATAR_NAME"] = self->getSelectedName(self->getSelected()); |
830 | // LLNotifications::instance().add("EjectAvatarFullnameNoBan", | 881 | // LLNotifications::instance().add("EjectAvatarFullnameNoBan", |
831 | // args, | 882 | // args, |
832 | // LLSD(), | 883 | // LLSD(), |
@@ -835,9 +886,9 @@ void PanelRadar::onClickUnfreeze(void *user_data) | |||
835 | 886 | ||
836 | 887 | ||
837 | //static | 888 | //static |
838 | void PanelRadar::onClickMute(void *user_data) | 889 | void PanelRadar::onClickMute(void* user_data) |
839 | { | 890 | { |
840 | PanelRadar *self = (PanelRadar*)user_data; | 891 | PanelRadar* self = (PanelRadar*)user_data; |
841 | LLScrollListItem *item = self->mRadarList->getFirstSelected(); | 892 | LLScrollListItem *item = self->mRadarList->getFirstSelected(); |
842 | if (item != NULL) | 893 | if (item != NULL) |
843 | { | 894 | { |
@@ -859,9 +910,9 @@ void PanelRadar::onClickMute(void *user_data) | |||
859 | 910 | ||
860 | 911 | ||
861 | //static | 912 | //static |
862 | void PanelRadar::onClickUnmute(void *user_data) | 913 | void PanelRadar::onClickUnmute(void* user_data) |
863 | { | 914 | { |
864 | PanelRadar *self = (PanelRadar*)user_data; | 915 | PanelRadar* self = (PanelRadar*)user_data; |
865 | LLScrollListItem *item = self->mRadarList->getFirstSelected(); | 916 | LLScrollListItem *item = self->mRadarList->getFirstSelected(); |
866 | if (item != NULL) | 917 | if (item != NULL) |
867 | { | 918 | { |
@@ -883,23 +934,77 @@ void PanelRadar::onClickUnmute(void *user_data) | |||
883 | 934 | ||
884 | 935 | ||
885 | //static | 936 | //static |
886 | void PanelRadar::onClickEject(void *user_data) | 937 | void PanelRadar::onClickEject(void* user_data) |
887 | { | 938 | { |
888 | PanelRadar *self = (PanelRadar*)user_data; | 939 | PanelRadar* self = (PanelRadar*)user_data; |
889 | LLSD args; | 940 | LLSD payload; |
890 | args["EVIL_USER"] = self->getSelectedName(self->mSelectedAvatar); | 941 | payload["avatar_id"] = self->getSelected(); |
891 | LLNotifications::instance().add("EstateKickUser", | 942 | payload["ban_enabled"] = false; |
892 | args, | 943 | std::string fullname = self->getSelectedName(self->getSelected()); |
893 | LLSD(), | 944 | |
894 | boost::bind(&callbackEject, _1, _2, self)); | 945 | if (!fullname.empty()) |
946 | { | ||
947 | LLSD args; | ||
948 | args["AVATAR_NAME"] = fullname; | ||
949 | LLNotifications::instance().add("EjectAvatarFullnameNoBan", | ||
950 | args, | ||
951 | payload, | ||
952 | callbackEjectBan); | ||
953 | } | ||
954 | else | ||
955 | { | ||
956 | LLNotifications::instance().add("EjectAvatarNoBan", | ||
957 | LLSD(), | ||
958 | payload, | ||
959 | callbackEjectBan); | ||
960 | } | ||
895 | } | 961 | } |
896 | 962 | ||
897 | 963 | ||
898 | //static | 964 | //static |
899 | void PanelRadar::onClickAR(void *user_data) | 965 | void PanelRadar::onClickBan(void* user_data) |
900 | { | 966 | { |
901 | PanelRadar *self = (PanelRadar*)user_data; | 967 | // Ban for EMs |
902 | LLUUID agent_id = self->mSelectedAvatar; | 968 | PanelRadar* self = (PanelRadar*)user_data; |
969 | LLSD payload; | ||
970 | payload["avatar_id"] = self->getSelected(); | ||
971 | |||
972 | if (gAgent.canManageEstate()) | ||
973 | { | ||
974 | LLSD args; | ||
975 | args["ALL_ESTATES"] = "all estates"; | ||
976 | LLNotifications::instance().add("EstateBannedAgentAdd", args, payload, callbackBanFromEstate); | ||
977 | } | ||
978 | else // Ban for parcel owners | ||
979 | { | ||
980 | payload["ban_enabled"] = true; | ||
981 | std::string fullname = self->getSelectedName(self->getSelected()); | ||
982 | |||
983 | if (!fullname.empty()) | ||
984 | { | ||
985 | LLSD args; | ||
986 | args["AVATAR_NAME"] = fullname; | ||
987 | LLNotifications::instance().add("EjectAvatarFullname", | ||
988 | args, | ||
989 | payload, | ||
990 | callbackEjectBan); | ||
991 | } | ||
992 | else | ||
993 | { | ||
994 | LLNotifications::instance().add("EjectAvatarFullname", | ||
995 | LLSD(), | ||
996 | payload, | ||
997 | callbackEjectBan); | ||
998 | } | ||
999 | } | ||
1000 | } | ||
1001 | |||
1002 | |||
1003 | //static | ||
1004 | void PanelRadar::onClickAR(void* user_data) | ||
1005 | { | ||
1006 | PanelRadar* self = (PanelRadar*)user_data; | ||
1007 | LLUUID agent_id = self->getSelected(); | ||
903 | 1008 | ||
904 | if (agent_id.notNull()) | 1009 | if (agent_id.notNull()) |
905 | { | 1010 | { |
@@ -909,28 +1014,17 @@ void PanelRadar::onClickAR(void *user_data) | |||
909 | 1014 | ||
910 | 1015 | ||
911 | //static | 1016 | //static |
912 | void PanelRadar::onClickBanFromEstate(void *user_data) | 1017 | /* Don't use until the UI can be worked out |
1018 | void PanelRadar::onClickBanFromEstate(void* user_data) | ||
913 | { | 1019 | { |
914 | PanelRadar *self = (PanelRadar*)user_data; | 1020 | PanelRadar* self = (PanelRadar*)user_data; |
1021 | LLSD payload; | ||
1022 | payload["avatar_id"] = self->getSelected(); | ||
915 | LLSD args; | 1023 | LLSD args; |
916 | args["ALL_ESTATES"] = "all estates"; | 1024 | args["ALL_ESTATES"] = "all estates"; |
917 | LLNotifications::instance().add("EstateBannedAgentAdd", args, LLSD(), boost::bind(&callbackBanFromEstate, _1, _2, self)); | 1025 | LLNotifications::instance().add("EstateBannedAgentAdd", args, payload, callbackBanFromEstate); |
918 | } | ||
919 | |||
920 | |||
921 | // static | ||
922 | void PanelRadar::cmdEstateEject(const LLUUID &avatar) | ||
923 | { | ||
924 | sendEstateMessage("teleporthomeuser", avatar); | ||
925 | } | ||
926 | |||
927 | |||
928 | // static | ||
929 | void PanelRadar::cmdEstateBan(const LLUUID &avatar) | ||
930 | { | ||
931 | sendEstateMessage("teleporthomeuser", avatar); // Kick first, just to be sure | ||
932 | sendEstateBan(avatar); | ||
933 | } | 1026 | } |
1027 | */ | ||
934 | 1028 | ||
935 | 1029 | ||
936 | // static | 1030 | // static |
@@ -958,133 +1052,3 @@ void PanelRadar::sendFreeze(const LLUUID& avatar_id, bool freeze) | |||
958 | msg->sendReliable( avatar->getRegion()->getHost() ); | 1052 | msg->sendReliable( avatar->getRegion()->getHost() ); |
959 | } | 1053 | } |
960 | } | 1054 | } |
961 | |||
962 | |||
963 | // static | ||
964 | void PanelRadar::sendEject(const LLUUID& avatar_id, bool ban) | ||
965 | { | ||
966 | LLMessageSystem* msg = gMessageSystem; | ||
967 | LLViewerObject* avatar = gObjectList.findObject(avatar_id); | ||
968 | |||
969 | if (avatar) | ||
970 | { | ||
971 | U32 flags = 0x0; | ||
972 | if ( ban ) | ||
973 | { | ||
974 | // eject and add to ban list | ||
975 | flags |= 0x1; | ||
976 | } | ||
977 | |||
978 | msg->newMessage("EjectUser"); | ||
979 | msg->nextBlock("AgentData"); | ||
980 | msg->addUUID("AgentID", gAgent.getID() ); | ||
981 | msg->addUUID("SessionID", gAgent.getSessionID() ); | ||
982 | msg->nextBlock("Data"); | ||
983 | msg->addUUID("TargetID", avatar_id ); | ||
984 | msg->addU32("Flags", flags ); | ||
985 | msg->sendReliable( avatar->getRegion()->getHost() ); | ||
986 | } | ||
987 | } | ||
988 | |||
989 | |||
990 | // static | ||
991 | void PanelRadar::sendEstateMessage(const char* request, const LLUUID &target) | ||
992 | { | ||
993 | |||
994 | LLMessageSystem* msg = gMessageSystem; | ||
995 | LLUUID invoice; | ||
996 | |||
997 | // This seems to provide an ID so that the sim can say which request it's | ||
998 | // replying to. I think this can be ignored for now. | ||
999 | invoice.generate(); | ||
1000 | |||
1001 | llinfos << "Sending estate request '" << request << "'" << llendl; | ||
1002 | msg->newMessage("EstateOwnerMessage"); | ||
1003 | msg->nextBlockFast(_PREHASH_AgentData); | ||
1004 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
1005 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
1006 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | ||
1007 | msg->nextBlock("MethodData"); | ||
1008 | msg->addString("Method", request); | ||
1009 | msg->addUUID("Invoice", invoice); | ||
1010 | |||
1011 | // Agent id | ||
1012 | msg->nextBlock("ParamList"); | ||
1013 | msg->addString("Parameter", gAgent.getID().asString().c_str()); | ||
1014 | |||
1015 | // Target | ||
1016 | msg->nextBlock("ParamList"); | ||
1017 | msg->addString("Parameter", target.asString().c_str()); | ||
1018 | |||
1019 | msg->sendReliable(gAgent.getRegion()->getHost()); | ||
1020 | } | ||
1021 | |||
1022 | |||
1023 | // static | ||
1024 | void PanelRadar::sendEstateBan(const LLUUID& agent) | ||
1025 | { | ||
1026 | LLUUID invoice; | ||
1027 | U32 flags = ESTATE_ACCESS_BANNED_AGENT_ADD; | ||
1028 | |||
1029 | invoice.generate(); | ||
1030 | |||
1031 | LLMessageSystem* msg = gMessageSystem; | ||
1032 | msg->newMessage("EstateOwnerMessage"); | ||
1033 | msg->nextBlockFast(_PREHASH_AgentData); | ||
1034 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
1035 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
1036 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | ||
1037 | |||
1038 | msg->nextBlock("MethodData"); | ||
1039 | msg->addString("Method", "estateaccessdelta"); | ||
1040 | msg->addUUID("Invoice", invoice); | ||
1041 | |||
1042 | char buf[MAX_STRING]; /* Flawfinder: ignore*/ | ||
1043 | gAgent.getID().toString(buf); | ||
1044 | msg->nextBlock("ParamList"); | ||
1045 | msg->addString("Parameter", buf); | ||
1046 | |||
1047 | snprintf(buf, MAX_STRING, "%u", flags); /* Flawfinder: ignore */ | ||
1048 | msg->nextBlock("ParamList"); | ||
1049 | msg->addString("Parameter", buf); | ||
1050 | |||
1051 | agent.toString(buf); | ||
1052 | msg->nextBlock("ParamList"); | ||
1053 | msg->addString("Parameter", buf); | ||
1054 | |||
1055 | gAgent.sendReliableMessage(); | ||
1056 | } | ||
1057 | |||
1058 | //typedef std::vector<std::string> strings_t; | ||
1059 | //static void sendEstateOwnerMessage( | ||
1060 | // LLMessageSystem* msg, | ||
1061 | // const std::string& request, | ||
1062 | // const LLUUID& invoice, | ||
1063 | // const strings_t& strings) | ||
1064 | //{ | ||
1065 | // llinfos << "Sending estate request '" << request << "'" << llendl; | ||
1066 | // msg->newMessage("EstateOwnerMessage"); | ||
1067 | // msg->nextBlockFast(_PREHASH_AgentData); | ||
1068 | // msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
1069 | // msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
1070 | // msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | ||
1071 | // msg->nextBlock("MethodData"); | ||
1072 | // msg->addString("Method", request); | ||
1073 | // msg->addUUID("Invoice", invoice); | ||
1074 | // if(strings.empty()) | ||
1075 | // { | ||
1076 | // msg->nextBlock("ParamList"); | ||
1077 | // msg->addString("Parameter", NULL); | ||
1078 | // } | ||
1079 | // else | ||
1080 | // { | ||
1081 | // strings_t::const_iterator it = strings.begin(); | ||
1082 | // strings_t::const_iterator end = strings.end(); | ||
1083 | // for(; it != end; ++it) | ||
1084 | // { | ||
1085 | // msg->nextBlock("ParamList"); | ||
1086 | // msg->addString("Parameter", *it); | ||
1087 | // } | ||
1088 | // } | ||
1089 | // msg->sendReliable(gAgent.getRegion()->getHost()); | ||
1090 | //} | ||