aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llcallingcard.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llcallingcard.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llcallingcard.h')
-rw-r--r--linden/indra/newview/llcallingcard.h243
1 files changed, 243 insertions, 0 deletions
diff --git a/linden/indra/newview/llcallingcard.h b/linden/indra/newview/llcallingcard.h
new file mode 100644
index 0000000..75d06ee
--- /dev/null
+++ b/linden/indra/newview/llcallingcard.h
@@ -0,0 +1,243 @@
1/**
2 * @file llcallingcard.h
3 * @brief Definition of the LLPreviewCallingCard class
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLCALLINGCARD_H
29#define LL_LLCALLINGCARD_H
30
31#include <map>
32#include <set>
33#include <string>
34#include <vector>
35#include "lluserrelations.h"
36#include "lluuid.h"
37#include "v3dmath.h"
38
39//class LLInventoryModel;
40//class LLInventoryObserver;
41class LLMessageSystem;
42class LLTrackingData;
43class LLFriendObserver
44{
45public:
46 // This enumeration is a way to refer to what changed in a more
47 // human readable format. You can mask the value provided by
48 // chaged() to see if the observer is interested in the change.
49 enum
50 {
51 NONE = 0,
52 ADD = 1,
53 REMOVE = 2,
54 ONLINE = 4,
55 POWERS = 8,
56 ALL = 0xffffffff
57 };
58 virtual ~LLFriendObserver() {}
59 virtual void changed(U32 mask) = 0;
60};
61
62/*
63struct LLBuddyInfo
64{
65 bool mIsOnline;
66 bool mIsEmpowered;
67 LLBuddyInfo() : mIsOnline(false), mIsEmpowered(false) {}
68};
69*/
70
71// This is used as a base class for doing operations on all buddies.
72class LLRelationshipFunctor
73{
74public:
75 virtual ~LLRelationshipFunctor() {}
76 virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy) = 0;
77};
78
79
80class LLAvatarTracker
81{
82public:
83 static LLAvatarTracker& instance() { return sInstance; }
84
85 void track(const LLUUID& avatar_id, const std::string& name);
86 void untrack(const LLUUID& avatar_id);
87 bool isTrackedAgentValid() { return mTrackedAgentValid; }
88 void setTrackedAgentValid(bool valid) { mTrackedAgentValid = valid; }
89 void findAgent();
90
91 // coarse update information
92 void setTrackedCoarseLocation(const LLVector3d& global_pos);
93
94 // dealing with the tracked agent location
95 bool haveTrackingInfo();
96 void getDegreesAndDist(F32& rot, F64& horiz_dist, F64& vert_dist);
97 LLVector3d getGlobalPos();
98
99 // Get the name passed in, returns null string if uninitialized.
100 const LLString& getName();
101
102 // Get the avatar being tracked, returns LLUUID::null if uninitialized
103 const LLUUID& getAvatarID();
104
105 // Deal with inventory
106 //void observe(LLInventoryModel* model);
107 //void inventoryChanged();
108
109 // add or remove agents from buddy list. Each method takes a set
110 // of buddies and returns how many were actually added or removed.
111 typedef std::map<LLUUID, LLRelationship*> buddy_map_t;
112
113 S32 addBuddyList(const buddy_map_t& buddies);
114 //S32 removeBuddyList(const buddy_list_t& exes);
115 void copyBuddyList(buddy_map_t& buddies) const;
116
117 // deal with termination of friendhsip
118 void terminateBuddy(const LLUUID& id);
119
120 // get full info
121 const LLRelationship* getBuddyInfo(const LLUUID& id) const;
122
123 // online status
124 void setBuddyOnline(const LLUUID& id, bool is_online);
125 bool isBuddyOnline(const LLUUID& id) const;
126
127 // simple empowered status
128 void setBuddyEmpowered(const LLUUID& id, bool is_empowered);
129 bool isBuddyEmpowered(const LLUUID& id) const;
130
131 // set the empower bit & message the server.
132 void empowerList(const buddy_map_t& list, bool grant);
133 void empower(const LLUUID& id, bool grant); // wrapper for above
134
135 // register callbacks
136 void registerCallbacks(LLMessageSystem* msg);
137
138 // Add/remove an observer. If the observer is destroyed, be sure
139 // to remove it. On destruction of the tracker, it will delete any
140 // observers left behind.
141 void addObserver(LLFriendObserver* observer);
142 void removeObserver(LLFriendObserver* observer);
143 void notifyObservers();
144
145 // Apply the functor to every buddy. Do not actually modify the
146 // buddy list in the functor or bad things will happen.
147 void applyFunctor(LLRelationshipFunctor& f);
148
149 static void formFriendship(const LLUUID& friend_id);
150
151protected:
152 void deleteTrackingData();
153 void agentFound(const LLUUID& prey,
154 const LLVector3d& estimated_global_pos);
155
156 // Message system functionality
157 static void processAgentFound(LLMessageSystem* msg, void**);
158 static void processOnlineNotification(LLMessageSystem* msg, void**);
159 static void processOfflineNotification(LLMessageSystem* msg, void**);
160 //static void processGrantedProxies(LLMessageSystem* msg, void**);
161 static void processTerminateFriendship(LLMessageSystem* msg, void**);
162 static void processChangeUserRights(LLMessageSystem* msg, void**);
163
164 void processNotify(LLMessageSystem* msg, bool online);
165 void processChange(LLMessageSystem* msg);
166
167protected:
168 static LLAvatarTracker sInstance;
169 LLTrackingData* mTrackingData;
170 bool mTrackedAgentValid;
171 U32 mModifyMask;
172 //LLInventoryModel* mInventory;
173 //LLInventoryObserver* mInventoryObserver;
174
175 buddy_map_t mBuddyInfo;
176
177 typedef std::vector<LLFriendObserver*> observer_list_t;
178 observer_list_t mObservers;
179
180private:
181 // do not implement
182 LLAvatarTracker(const LLAvatarTracker&);
183 bool operator==(const LLAvatarTracker&);
184
185public:
186 // don't you dare create or delete this object
187 LLAvatarTracker();
188 ~LLAvatarTracker();
189};
190
191// collect set of LLUUIDs we're a proxy for
192class LLCollectProxyBuddies : public LLRelationshipFunctor
193{
194public:
195 LLCollectProxyBuddies() {}
196 virtual ~LLCollectProxyBuddies() {}
197 virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
198 typedef std::set<LLUUID> buddy_list_t;
199 buddy_list_t mProxy;
200};
201
202// collect dictionary sorted map of name -> agent_id for every online buddy
203class LLCollectMappableBuddies : public LLRelationshipFunctor
204{
205public:
206 LLCollectMappableBuddies() {}
207 virtual ~LLCollectMappableBuddies() {}
208 virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
209 typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
210 buddy_map_t mMappable;
211 char mFirst[DB_FIRST_NAME_BUF_SIZE];
212 char mLast[DB_LAST_NAME_BUF_SIZE];
213};
214
215// collect dictionary sorted map of name -> agent_id for every online buddy
216class LLCollectOnlineBuddies : public LLRelationshipFunctor
217{
218public:
219 LLCollectOnlineBuddies() {}
220 virtual ~LLCollectOnlineBuddies() {}
221 virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
222 typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
223 buddy_map_t mOnline;
224 char mFirst[DB_FIRST_NAME_BUF_SIZE];
225 char mLast[DB_LAST_NAME_BUF_SIZE];
226};
227
228// collect dictionary sorted map of name -> agent_id for every buddy,
229// one map is offline and the other map is online.
230class LLCollectAllBuddies : public LLRelationshipFunctor
231{
232public:
233 LLCollectAllBuddies() {}
234 virtual ~LLCollectAllBuddies() {}
235 virtual bool operator()(const LLUUID& buddy_id, LLRelationship* buddy);
236 typedef std::map<std::string, LLUUID, LLDictionaryLess> buddy_map_t;
237 buddy_map_t mOnline;
238 buddy_map_t mOffline;
239 char mFirst[DB_FIRST_NAME_BUF_SIZE];
240 char mLast[DB_LAST_NAME_BUF_SIZE];
241};
242
243#endif // LL_LLCALLINGCARD_H