diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llpanelavatar.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llpanelavatar.cpp')
-rw-r--r-- | linden/indra/newview/llpanelavatar.cpp | 215 |
1 files changed, 82 insertions, 133 deletions
diff --git a/linden/indra/newview/llpanelavatar.cpp b/linden/indra/newview/llpanelavatar.cpp index 7827fa9..7253d75 100644 --- a/linden/indra/newview/llpanelavatar.cpp +++ b/linden/indra/newview/llpanelavatar.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -77,9 +78,6 @@ | |||
77 | #include "llweb.h" | 78 | #include "llweb.h" |
78 | #include "llinventorymodel.h" | 79 | #include "llinventorymodel.h" |
79 | #include "roles_constants.h" | 80 | #include "roles_constants.h" |
80 | |||
81 | #define kArraySize( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) ) | ||
82 | |||
83 | #include "lluictrlfactory.h" | 81 | #include "lluictrlfactory.h" |
84 | 82 | ||
85 | // Statics | 83 | // Statics |
@@ -140,79 +138,15 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, | |||
140 | EAcceptance* accept, | 138 | EAcceptance* accept, |
141 | std::string& tooltip_msg) | 139 | std::string& tooltip_msg) |
142 | { | 140 | { |
143 | BOOL handled = FALSE; | ||
144 | if(getParent()) | 141 | if(getParent()) |
145 | { | 142 | { |
146 | // check if inside | 143 | LLToolDragAndDrop::handleGiveDragAndDrop(mAgentID, LLUUID::null, drop, |
147 | //LLRect parent_rect = mParentView->getRect(); | 144 | cargo_type, cargo_data, accept); |
148 | //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0); | ||
149 | handled = TRUE; | ||
150 | 145 | ||
151 | // check the type | 146 | return TRUE; |
152 | switch(cargo_type) | ||
153 | { | ||
154 | case DAD_TEXTURE: | ||
155 | case DAD_SOUND: | ||
156 | case DAD_LANDMARK: | ||
157 | case DAD_SCRIPT: | ||
158 | case DAD_OBJECT: | ||
159 | case DAD_NOTECARD: | ||
160 | case DAD_CLOTHING: | ||
161 | case DAD_BODYPART: | ||
162 | case DAD_ANIMATION: | ||
163 | case DAD_GESTURE: | ||
164 | { | ||
165 | LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data; | ||
166 | if(gInventory.getItem(inv_item->getUUID()) | ||
167 | && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item)) | ||
168 | { | ||
169 | // *TODO: get multiple object transfers working | ||
170 | *accept = ACCEPT_YES_COPY_SINGLE; | ||
171 | if(drop) | ||
172 | { | ||
173 | LLToolDragAndDrop::giveInventory(mAgentID, inv_item); | ||
174 | } | ||
175 | } | ||
176 | else | ||
177 | { | ||
178 | // It's not in the user's inventory (it's probably | ||
179 | // in an object's contents), so disallow dragging | ||
180 | // it here. You can't give something you don't | ||
181 | // yet have. | ||
182 | *accept = ACCEPT_NO; | ||
183 | } | ||
184 | break; | ||
185 | } | ||
186 | case DAD_CATEGORY: | ||
187 | { | ||
188 | LLViewerInventoryCategory* inv_cat = (LLViewerInventoryCategory*)cargo_data; | ||
189 | if( gInventory.getCategory( inv_cat->getUUID() ) ) | ||
190 | { | ||
191 | // *TODO: get multiple object transfers working | ||
192 | *accept = ACCEPT_YES_COPY_SINGLE; | ||
193 | if(drop) | ||
194 | { | ||
195 | LLToolDragAndDrop::giveInventoryCategory(mAgentID, | ||
196 | inv_cat); | ||
197 | } | ||
198 | } | ||
199 | else | ||
200 | { | ||
201 | // It's not in the user's inventory (it's probably | ||
202 | // in an object's contents), so disallow dragging | ||
203 | // it here. You can't give something you don't | ||
204 | // yet have. | ||
205 | *accept = ACCEPT_NO; | ||
206 | } | ||
207 | break; | ||
208 | } | ||
209 | case DAD_CALLINGCARD: | ||
210 | default: | ||
211 | *accept = ACCEPT_NO; | ||
212 | break; | ||
213 | } | ||
214 | } | 147 | } |
215 | return handled; | 148 | |
149 | return FALSE; | ||
216 | } | 150 | } |
217 | 151 | ||
218 | 152 | ||
@@ -352,20 +286,24 @@ void LLPanelAvatarSecondLife::onDoubleClickGroup(void* data) | |||
352 | // static | 286 | // static |
353 | void LLPanelAvatarSecondLife::onClickPublishHelp(void *) | 287 | void LLPanelAvatarSecondLife::onClickPublishHelp(void *) |
354 | { | 288 | { |
355 | gViewerWindow->alertXml("ClickPublishHelpAvatar"); | 289 | LLNotifications::instance().add("ClickPublishHelpAvatar"); |
356 | } | 290 | } |
357 | 291 | ||
358 | // static | 292 | // static |
359 | void LLPanelAvatarSecondLife::onClickPartnerHelp(void *) | 293 | void LLPanelAvatarSecondLife::onClickPartnerHelp(void *) |
360 | { | 294 | { |
361 | gViewerWindow->alertXml("ClickPartnerHelpAvatar", onClickPartnerHelpLoadURL, (void*) NULL); | 295 | LLNotifications::instance().add("ClickPartnerHelpAvatar", LLSD(), LLSD(), onClickPartnerHelpLoadURL); |
362 | } | 296 | } |
363 | 297 | ||
364 | // static | 298 | // static |
365 | void LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL(S32 option, void* userdata) | 299 | bool LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL(const LLSD& notification, const LLSD& response) |
366 | { | 300 | { |
367 | if (option == 0) | 301 | S32 option = LLNotification::getSelectedOption(notification, response); |
368 | LLWeb::loadURL("http://secondlife.com/partner"); | 302 | if (option == 0) |
303 | { | ||
304 | LLWeb::loadURL("http://secondlife.com/partner"); | ||
305 | } | ||
306 | return false; | ||
369 | } | 307 | } |
370 | 308 | ||
371 | // static | 309 | // static |
@@ -389,7 +327,6 @@ LLPanelAvatarFirstLife::LLPanelAvatarFirstLife(const std::string& name, | |||
389 | { | 327 | { |
390 | } | 328 | } |
391 | 329 | ||
392 | |||
393 | void LLPanelAvatarFirstLife::enableControls(BOOL self) | 330 | void LLPanelAvatarFirstLife::enableControls(BOOL self) |
394 | { | 331 | { |
395 | childSetEnabled("img", self); | 332 | childSetEnabled("img", self); |
@@ -438,6 +375,8 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) | |||
438 | 375 | ||
439 | childSetDoubleClickCallback("groups", onDoubleClickGroup, this ); | 376 | childSetDoubleClickCallback("groups", onDoubleClickGroup, this ); |
440 | 377 | ||
378 | getChild<LLTextureCtrl>("img")->setFallbackImageName("default_profile_picture.j2c"); | ||
379 | |||
441 | return TRUE; | 380 | return TRUE; |
442 | } | 381 | } |
443 | 382 | ||
@@ -445,6 +384,9 @@ BOOL LLPanelAvatarFirstLife::postBuild(void) | |||
445 | { | 384 | { |
446 | BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); | 385 | BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); |
447 | enableControls(own_avatar); | 386 | enableControls(own_avatar); |
387 | |||
388 | getChild<LLTextureCtrl>("img")->setFallbackImageName("default_profile_picture.j2c"); | ||
389 | |||
448 | return TRUE; | 390 | return TRUE; |
449 | } | 391 | } |
450 | 392 | ||
@@ -495,17 +437,17 @@ BOOL LLPanelAvatarPicks::postBuild(void) | |||
495 | 437 | ||
496 | BOOL LLPanelAvatarAdvanced::postBuild() | 438 | BOOL LLPanelAvatarAdvanced::postBuild() |
497 | { | 439 | { |
498 | for(size_t ii = 0; ii < kArraySize(mWantToCheck); ++ii) | 440 | for(size_t ii = 0; ii < LL_ARRAY_SIZE(mWantToCheck); ++ii) |
499 | mWantToCheck[ii] = NULL; | 441 | mWantToCheck[ii] = NULL; |
500 | for(size_t ii = 0; ii < kArraySize(mSkillsCheck); ++ii) | 442 | for(size_t ii = 0; ii < LL_ARRAY_SIZE(mSkillsCheck); ++ii) |
501 | mSkillsCheck[ii] = NULL; | 443 | mSkillsCheck[ii] = NULL; |
502 | mWantToCount = (8>kArraySize(mWantToCheck))?kArraySize(mWantToCheck):8; | 444 | mWantToCount = (8>LL_ARRAY_SIZE(mWantToCheck))?LL_ARRAY_SIZE(mWantToCheck):8; |
503 | for(S32 tt=0; tt < mWantToCount; ++tt) | 445 | for(S32 tt=0; tt < mWantToCount; ++tt) |
504 | { | 446 | { |
505 | std::string ctlname = llformat("chk%d", tt); | 447 | std::string ctlname = llformat("chk%d", tt); |
506 | mWantToCheck[tt] = getChild<LLCheckBoxCtrl>(ctlname); | 448 | mWantToCheck[tt] = getChild<LLCheckBoxCtrl>(ctlname); |
507 | } | 449 | } |
508 | mSkillsCount = (6>kArraySize(mSkillsCheck))?kArraySize(mSkillsCheck):6; | 450 | mSkillsCount = (6>LL_ARRAY_SIZE(mSkillsCheck))?LL_ARRAY_SIZE(mSkillsCheck):6; |
509 | 451 | ||
510 | for(S32 tt=0; tt < mSkillsCount; ++tt) | 452 | for(S32 tt=0; tt < mSkillsCount; ++tt) |
511 | { | 453 | { |
@@ -589,7 +531,7 @@ void LLPanelAvatarWeb::onCommitURL(LLUICtrl* ctrl, void* data) | |||
589 | // static | 531 | // static |
590 | void LLPanelAvatarWeb::onClickWebProfileHelp(void *) | 532 | void LLPanelAvatarWeb::onClickWebProfileHelp(void *) |
591 | { | 533 | { |
592 | gViewerWindow->alertXml("ClickWebProfileHelpAvatar"); | 534 | LLNotifications::instance().add("ClickWebProfileHelpAvatar"); |
593 | } | 535 | } |
594 | 536 | ||
595 | void LLPanelAvatarWeb::load(std::string url) | 537 | void LLPanelAvatarWeb::load(std::string url) |
@@ -926,26 +868,25 @@ void LLPanelAvatarClassified::onClickNew(void* data) | |||
926 | { | 868 | { |
927 | LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; | 869 | LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; |
928 | 870 | ||
929 | gViewerWindow->alertXml("AddClassified",callbackNew,self); | 871 | LLNotifications::instance().add("AddClassified", LLSD(), LLSD(), boost::bind(&LLPanelAvatarClassified::callbackNew, self, _1, _2)); |
930 | 872 | ||
931 | } | 873 | } |
932 | 874 | ||
933 | // static | 875 | bool LLPanelAvatarClassified::callbackNew(const LLSD& notification, const LLSD& response) |
934 | void LLPanelAvatarClassified::callbackNew(S32 option, void* data) | ||
935 | { | 876 | { |
936 | LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; | 877 | S32 option = LLNotification::getSelectedOption(notification, response); |
937 | |||
938 | if (0 == option) | 878 | if (0 == option) |
939 | { | 879 | { |
940 | LLPanelClassified* panel_classified = new LLPanelClassified(false, false); | 880 | LLPanelClassified* panel_classified = new LLPanelClassified(false, false); |
941 | panel_classified->initNewClassified(); | 881 | panel_classified->initNewClassified(); |
942 | LLTabContainer* tabs = self->getChild<LLTabContainer>("classified tab"); | 882 | LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); |
943 | if(tabs) | 883 | if(tabs) |
944 | { | 884 | { |
945 | tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName()); | 885 | tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName()); |
946 | tabs->selectLastTab(); | 886 | tabs->selectLastTab(); |
947 | } | 887 | } |
948 | } | 888 | } |
889 | return false; | ||
949 | } | 890 | } |
950 | 891 | ||
951 | 892 | ||
@@ -962,18 +903,17 @@ void LLPanelAvatarClassified::onClickDelete(void* data) | |||
962 | } | 903 | } |
963 | if (!panel_classified) return; | 904 | if (!panel_classified) return; |
964 | 905 | ||
965 | LLStringUtil::format_map_t args; | 906 | LLSD args; |
966 | args["[NAME]"] = panel_classified->getClassifiedName(); | 907 | args["NAME"] = panel_classified->getClassifiedName(); |
967 | gViewerWindow->alertXml("DeleteClassified", args, callbackDelete, self); | 908 | LLNotifications::instance().add("DeleteClassified", args, LLSD(), boost::bind(&LLPanelAvatarClassified::callbackDelete, self, _1, _2)); |
968 | 909 | ||
969 | } | 910 | } |
970 | 911 | ||
971 | 912 | ||
972 | // static | 913 | bool LLPanelAvatarClassified::callbackDelete(const LLSD& notification, const LLSD& response) |
973 | void LLPanelAvatarClassified::callbackDelete(S32 option, void* data) | ||
974 | { | 914 | { |
975 | LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; | 915 | S32 option = LLNotification::getSelectedOption(notification, response); |
976 | LLTabContainer* tabs = self->getChild<LLTabContainer>("classified tab"); | 916 | LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); |
977 | LLPanelClassified* panel_classified=NULL; | 917 | LLPanelClassified* panel_classified=NULL; |
978 | if(tabs) | 918 | if(tabs) |
979 | { | 919 | { |
@@ -982,7 +922,7 @@ void LLPanelAvatarClassified::callbackDelete(S32 option, void* data) | |||
982 | 922 | ||
983 | LLMessageSystem* msg = gMessageSystem; | 923 | LLMessageSystem* msg = gMessageSystem; |
984 | 924 | ||
985 | if (!panel_classified) return; | 925 | if (!panel_classified) return false; |
986 | 926 | ||
987 | if (0 == option) | 927 | if (0 == option) |
988 | { | 928 | { |
@@ -1001,6 +941,7 @@ void LLPanelAvatarClassified::callbackDelete(S32 option, void* data) | |||
1001 | delete panel_classified; | 941 | delete panel_classified; |
1002 | panel_classified = NULL; | 942 | panel_classified = NULL; |
1003 | } | 943 | } |
944 | return false; | ||
1004 | } | 945 | } |
1005 | 946 | ||
1006 | 947 | ||
@@ -1120,24 +1061,23 @@ void LLPanelAvatarPicks::onClickDelete(void* data) | |||
1120 | 1061 | ||
1121 | if (!panel_pick) return; | 1062 | if (!panel_pick) return; |
1122 | 1063 | ||
1123 | LLStringUtil::format_map_t args; | 1064 | LLSD args; |
1124 | args["[PICK]"] = panel_pick->getPickName(); | 1065 | args["PICK"] = panel_pick->getPickName(); |
1125 | 1066 | ||
1126 | gViewerWindow->alertXml("DeleteAvatarPick", args, | 1067 | LLNotifications::instance().add("DeleteAvatarPick", args, LLSD(), |
1127 | callbackDelete, | 1068 | boost::bind(&LLPanelAvatarPicks::callbackDelete, self, _1, _2)); |
1128 | self); | ||
1129 | } | 1069 | } |
1130 | 1070 | ||
1131 | 1071 | ||
1132 | // static | 1072 | // static |
1133 | void LLPanelAvatarPicks::callbackDelete(S32 option, void* data) | 1073 | bool LLPanelAvatarPicks::callbackDelete(const LLSD& notification, const LLSD& response) |
1134 | { | 1074 | { |
1135 | LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; | 1075 | S32 option = LLNotification::getSelectedOption(notification, response); |
1136 | LLTabContainer* tabs = self->getChild<LLTabContainer>("picks tab"); | 1076 | LLTabContainer* tabs = getChild<LLTabContainer>("picks tab"); |
1137 | LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; | 1077 | LLPanelPick* panel_pick = tabs ? (LLPanelPick*)tabs->getCurrentPanel() : NULL; |
1138 | LLMessageSystem* msg = gMessageSystem; | 1078 | LLMessageSystem* msg = gMessageSystem; |
1139 | 1079 | ||
1140 | if (!panel_pick) return; | 1080 | if (!panel_pick) return false; |
1141 | 1081 | ||
1142 | if (0 == option) | 1082 | if (0 == option) |
1143 | { | 1083 | { |
@@ -1173,6 +1113,7 @@ void LLPanelAvatarPicks::callbackDelete(S32 option, void* data) | |||
1173 | delete panel_pick; | 1113 | delete panel_pick; |
1174 | panel_pick = NULL; | 1114 | panel_pick = NULL; |
1175 | } | 1115 | } |
1116 | return false; | ||
1176 | } | 1117 | } |
1177 | 1118 | ||
1178 | 1119 | ||
@@ -1778,7 +1719,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) | |||
1778 | msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_BornOn, born_on); | 1719 | msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_BornOn, born_on); |
1779 | msg->getString("PropertiesData","ProfileURL", profile_url); | 1720 | msg->getString("PropertiesData","ProfileURL", profile_url); |
1780 | msg->getU32Fast(_PREHASH_PropertiesData, _PREHASH_Flags, flags); | 1721 | msg->getU32Fast(_PREHASH_PropertiesData, _PREHASH_Flags, flags); |
1781 | 1722 | ||
1782 | identified = (flags & AVATAR_IDENTIFIED); | 1723 | identified = (flags & AVATAR_IDENTIFIED); |
1783 | transacted = (flags & AVATAR_TRANSACTED); | 1724 | transacted = (flags & AVATAR_TRANSACTED); |
1784 | age_verified = (flags & AVATAR_AGEVERIFIED); // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations | 1725 | age_verified = (flags & AVATAR_AGEVERIFIED); // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations |
@@ -1809,7 +1750,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) | |||
1809 | "AcctTypeCharterMember", | 1750 | "AcctTypeCharterMember", |
1810 | "AcctTypeEmployee" | 1751 | "AcctTypeEmployee" |
1811 | }; | 1752 | }; |
1812 | caption_index = llclamp(caption_index, (U8)0, (U8)(sizeof(ACCT_TYPE)/sizeof(ACCT_TYPE[0])-1)); | 1753 | caption_index = llclamp(caption_index, (U8)0, (U8)(LL_ARRAY_SIZE(ACCT_TYPE)-1)); |
1813 | args["[ACCTTYPE]"] = self->mPanelSecondLife->getString(ACCT_TYPE[caption_index]); | 1754 | args["[ACCTTYPE]"] = self->mPanelSecondLife->getString(ACCT_TYPE[caption_index]); |
1814 | 1755 | ||
1815 | std::string payment_text = " "; | 1756 | std::string payment_text = " "; |
@@ -1831,7 +1772,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) | |||
1831 | args["[PAYMENTINFO]"] = self->mPanelSecondLife->getString(payment_text); | 1772 | args["[PAYMENTINFO]"] = self->mPanelSecondLife->getString(payment_text); |
1832 | std::string age_text = age_verified ? "AgeVerified" : "NotAgeVerified"; | 1773 | std::string age_text = age_verified ? "AgeVerified" : "NotAgeVerified"; |
1833 | // Do not display age verification status at this time | 1774 | // Do not display age verification status at this time |
1834 | //args["[AGEVERIFICATION]"] = self->mPanelSecondLife->getString(age_text); | 1775 | //args["[[AGEVERIFICATION]]"] = self->mPanelSecondLife->getString(age_text); |
1835 | args["[AGEVERIFICATION]"] = " "; | 1776 | args["[AGEVERIFICATION]"] = " "; |
1836 | } | 1777 | } |
1837 | else | 1778 | else |
@@ -2183,85 +2124,93 @@ void LLPanelAvatar::onClickKick(void* userdata) | |||
2183 | gFloaterView->getNewFloaterPosition(&left, &top); | 2124 | gFloaterView->getNewFloaterPosition(&left, &top); |
2184 | LLRect rect(left, top, left+400, top-300); | 2125 | LLRect rect(left, top, left+400, top-300); |
2185 | 2126 | ||
2186 | gViewerWindow->alertXmlEditText("KickUser", LLStringUtil::format_map_t(), | 2127 | LLSD payload; |
2187 | NULL, NULL, | 2128 | payload["avatar_id"] = self->mAvatarID; |
2188 | LLPanelAvatar::finishKick, self); | 2129 | LLNotifications::instance().add("KickUser", LLSD(), payload, finishKick); |
2189 | } | 2130 | } |
2190 | 2131 | ||
2191 | // static | 2132 | //static |
2192 | void LLPanelAvatar::finishKick(S32 option, const std::string& text, void* userdata) | 2133 | bool LLPanelAvatar::finishKick(const LLSD& notification, const LLSD& response) |
2193 | { | 2134 | { |
2194 | LLPanelAvatar* self = (LLPanelAvatar*) userdata; | 2135 | S32 option = LLNotification::getSelectedOption(notification, response); |
2195 | 2136 | ||
2196 | if (option == 0) | 2137 | if (option == 0) |
2197 | { | 2138 | { |
2139 | LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); | ||
2198 | LLMessageSystem* msg = gMessageSystem; | 2140 | LLMessageSystem* msg = gMessageSystem; |
2199 | 2141 | ||
2200 | msg->newMessageFast(_PREHASH_GodKickUser); | 2142 | msg->newMessageFast(_PREHASH_GodKickUser); |
2201 | msg->nextBlockFast(_PREHASH_UserInfo); | 2143 | msg->nextBlockFast(_PREHASH_UserInfo); |
2202 | msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); | 2144 | msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); |
2203 | msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); | 2145 | msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); |
2204 | msg->addUUIDFast(_PREHASH_AgentID, self->mAvatarID ); | 2146 | msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); |
2205 | msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); | 2147 | msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); |
2206 | msg->addStringFast(_PREHASH_Reason, text ); | 2148 | msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); |
2207 | gAgent.sendReliableMessage(); | 2149 | gAgent.sendReliableMessage(); |
2208 | } | 2150 | } |
2151 | return false; | ||
2209 | } | 2152 | } |
2210 | 2153 | ||
2211 | // static | 2154 | // static |
2212 | void LLPanelAvatar::onClickFreeze(void* userdata) | 2155 | void LLPanelAvatar::onClickFreeze(void* userdata) |
2213 | { | 2156 | { |
2214 | gViewerWindow->alertXmlEditText("FreezeUser", LLStringUtil::format_map_t(), | 2157 | LLPanelAvatar* self = (LLPanelAvatar*) userdata; |
2215 | NULL, NULL, | 2158 | LLSD payload; |
2216 | LLPanelAvatar::finishFreeze, userdata); | 2159 | payload["avatar_id"] = self->mAvatarID; |
2160 | LLNotifications::instance().add("FreezeUser", LLSD(), payload, LLPanelAvatar::finishFreeze); | ||
2217 | } | 2161 | } |
2218 | 2162 | ||
2219 | // static | 2163 | // static |
2220 | void LLPanelAvatar::finishFreeze(S32 option, const std::string& text, void* userdata) | 2164 | bool LLPanelAvatar::finishFreeze(const LLSD& notification, const LLSD& response) |
2221 | { | 2165 | { |
2222 | LLPanelAvatar* self = (LLPanelAvatar*) userdata; | 2166 | S32 option = LLNotification::getSelectedOption(notification, response); |
2223 | 2167 | ||
2224 | if (option == 0) | 2168 | if (option == 0) |
2225 | { | 2169 | { |
2170 | LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); | ||
2226 | LLMessageSystem* msg = gMessageSystem; | 2171 | LLMessageSystem* msg = gMessageSystem; |
2227 | 2172 | ||
2228 | msg->newMessageFast(_PREHASH_GodKickUser); | 2173 | msg->newMessageFast(_PREHASH_GodKickUser); |
2229 | msg->nextBlockFast(_PREHASH_UserInfo); | 2174 | msg->nextBlockFast(_PREHASH_UserInfo); |
2230 | msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); | 2175 | msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); |
2231 | msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); | 2176 | msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); |
2232 | msg->addUUIDFast(_PREHASH_AgentID, self->mAvatarID ); | 2177 | msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); |
2233 | msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); | 2178 | msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); |
2234 | msg->addStringFast(_PREHASH_Reason, text ); | 2179 | msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); |
2235 | gAgent.sendReliableMessage(); | 2180 | gAgent.sendReliableMessage(); |
2236 | } | 2181 | } |
2182 | return false; | ||
2237 | } | 2183 | } |
2238 | 2184 | ||
2239 | // static | 2185 | // static |
2240 | void LLPanelAvatar::onClickUnfreeze(void* userdata) | 2186 | void LLPanelAvatar::onClickUnfreeze(void* userdata) |
2241 | { | 2187 | { |
2242 | gViewerWindow->alertXmlEditText("UnFreezeUser", LLStringUtil::format_map_t(), | 2188 | LLPanelAvatar* self = (LLPanelAvatar*) userdata; |
2243 | NULL, NULL, | 2189 | LLSD payload; |
2244 | LLPanelAvatar::finishUnfreeze, userdata); | 2190 | payload["avatar_id"] = self->mAvatarID; |
2191 | LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, LLPanelAvatar::finishUnfreeze); | ||
2245 | } | 2192 | } |
2246 | 2193 | ||
2247 | // static | 2194 | // static |
2248 | void LLPanelAvatar::finishUnfreeze(S32 option, const std::string& text, void* userdata) | 2195 | bool LLPanelAvatar::finishUnfreeze(const LLSD& notification, const LLSD& response) |
2249 | { | 2196 | { |
2250 | LLPanelAvatar* self = (LLPanelAvatar*) userdata; | 2197 | S32 option = LLNotification::getSelectedOption(notification, response); |
2251 | 2198 | std::string text = response["message"].asString(); | |
2252 | if (option == 0) | 2199 | if (option == 0) |
2253 | { | 2200 | { |
2201 | LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); | ||
2254 | LLMessageSystem* msg = gMessageSystem; | 2202 | LLMessageSystem* msg = gMessageSystem; |
2255 | 2203 | ||
2256 | msg->newMessageFast(_PREHASH_GodKickUser); | 2204 | msg->newMessageFast(_PREHASH_GodKickUser); |
2257 | msg->nextBlockFast(_PREHASH_UserInfo); | 2205 | msg->nextBlockFast(_PREHASH_UserInfo); |
2258 | msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); | 2206 | msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); |
2259 | msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); | 2207 | msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); |
2260 | msg->addUUIDFast(_PREHASH_AgentID, self->mAvatarID ); | 2208 | msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); |
2261 | msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); | 2209 | msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); |
2262 | msg->addStringFast(_PREHASH_Reason, text ); | 2210 | msg->addStringFast(_PREHASH_Reason, text ); |
2263 | gAgent.sendReliableMessage(); | 2211 | gAgent.sendReliableMessage(); |
2264 | } | 2212 | } |
2213 | return false; | ||
2265 | } | 2214 | } |
2266 | 2215 | ||
2267 | // static | 2216 | // static |