Annotation of /linden_release/linden/indra/llinventory/lluserrelations.cpp
Parent Directory
|
Revision Log
Revision 100 - (view) (download)
| 1 : | mjm | 57 | /** |
| 2 : | * @file lluserrelations.cpp | ||
| 3 : | * @author Phoenix | ||
| 4 : | * @date 2006-10-12 | ||
| 5 : | * @brief Implementation of a simple cache of user relations. | ||
| 6 : | * | ||
| 7 : | * $LicenseInfo:firstyear=2006&license=viewergpl$ | ||
| 8 : | * | ||
| 9 : | mjm | 100 | * Copyright (c) 2006-2009, Linden Research, Inc. |
| 10 : | mjm | 57 | * |
| 11 : | * Second Life Viewer Source Code | ||
| 12 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 13 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 14 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 15 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 16 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 17 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 18 : | * | ||
| 19 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 20 : | * it is applied to this Source Code. View the full text of the exception | ||
| 21 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 22 : | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 23 : | * | ||
| 24 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 25 : | * that you have read and understood your obligations described above, | ||
| 26 : | * and agree to abide by those obligations. | ||
| 27 : | * | ||
| 28 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 29 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 30 : | * COMPLETENESS OR PERFORMANCE. | ||
| 31 : | * $/LicenseInfo$ | ||
| 32 : | */ | ||
| 33 : | |||
| 34 : | #include "linden_common.h" | ||
| 35 : | #include "lluserrelations.h" | ||
| 36 : | |||
| 37 : | // static | ||
| 38 : | const U8 LLRelationship::GRANTED_VISIBLE_MASK = LLRelationship::GRANT_MODIFY_OBJECTS | LLRelationship::GRANT_MAP_LOCATION; | ||
| 39 : | const LLRelationship LLRelationship::DEFAULT_RELATIONSHIP = LLRelationship(GRANT_ONLINE_STATUS, GRANT_ONLINE_STATUS, false); | ||
| 40 : | |||
| 41 : | LLRelationship::LLRelationship() : | ||
| 42 : | mGrantToAgent(0), | ||
| 43 : | mGrantFromAgent(0), | ||
| 44 : | mChangeSerialNum(0), | ||
| 45 : | mIsOnline(false) | ||
| 46 : | { | ||
| 47 : | } | ||
| 48 : | |||
| 49 : | LLRelationship::LLRelationship(S32 grant_to, S32 grant_from, bool is_online) : | ||
| 50 : | mGrantToAgent(grant_to), | ||
| 51 : | mGrantFromAgent(grant_from), | ||
| 52 : | mChangeSerialNum(0), | ||
| 53 : | mIsOnline(is_online) | ||
| 54 : | { | ||
| 55 : | } | ||
| 56 : | |||
| 57 : | bool LLRelationship::isOnline() const | ||
| 58 : | { | ||
| 59 : | return mIsOnline; | ||
| 60 : | } | ||
| 61 : | |||
| 62 : | void LLRelationship::online(bool is_online) | ||
| 63 : | { | ||
| 64 : | mIsOnline = is_online; | ||
| 65 : | mChangeSerialNum++; | ||
| 66 : | } | ||
| 67 : | |||
| 68 : | bool LLRelationship::isRightGrantedTo(S32 rights) const | ||
| 69 : | { | ||
| 70 : | return ((mGrantToAgent & rights) == rights); | ||
| 71 : | } | ||
| 72 : | |||
| 73 : | bool LLRelationship::isRightGrantedFrom(S32 rights) const | ||
| 74 : | { | ||
| 75 : | return ((mGrantFromAgent & rights) == rights); | ||
| 76 : | } | ||
| 77 : | |||
| 78 : | S32 LLRelationship::getRightsGrantedTo() const | ||
| 79 : | { | ||
| 80 : | return mGrantToAgent; | ||
| 81 : | } | ||
| 82 : | |||
| 83 : | S32 LLRelationship::getRightsGrantedFrom() const | ||
| 84 : | { | ||
| 85 : | return mGrantFromAgent; | ||
| 86 : | } | ||
| 87 : | |||
| 88 : | void LLRelationship::grantRights(S32 to_agent, S32 from_agent) | ||
| 89 : | { | ||
| 90 : | mGrantToAgent |= to_agent; | ||
| 91 : | mGrantFromAgent |= from_agent; | ||
| 92 : | mChangeSerialNum++; | ||
| 93 : | } | ||
| 94 : | |||
| 95 : | void LLRelationship::revokeRights(S32 to_agent, S32 from_agent) | ||
| 96 : | { | ||
| 97 : | mGrantToAgent &= ~to_agent; | ||
| 98 : | mGrantFromAgent &= ~from_agent; | ||
| 99 : | mChangeSerialNum++; | ||
| 100 : | } | ||
| 101 : | |||
| 102 : | |||
| 103 : | |||
| 104 : | /* | ||
| 105 : | bool LLGrantedRights::getNextRights( | ||
| 106 : | LLUUID& agent_id, | ||
| 107 : | S32& to_agent, | ||
| 108 : | S32& from_agent) const | ||
| 109 : | { | ||
| 110 : | rights_map_t::const_iterator iter = mRights.upper_bound(agent_id); | ||
| 111 : | if(iter == mRights.end()) return false; | ||
| 112 : | agent_id = (*iter).first; | ||
| 113 : | to_agent = (*iter).second.mToAgent; | ||
| 114 : | from_agent = (*iter).second.mFromAgent; | ||
| 115 : | return true; | ||
| 116 : | } | ||
| 117 : | */ |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

