PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llgiveinventory.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 94 lines | 29 code | 13 blank | 52 comment | 0 complexity | 2af85f8df6fd5ce257e3790205e4eeb1 MD5 | raw file
 1/**
 2 * @file llgiveinventory.cpp
 3 * @brief LLGiveInventory class declaration
 4 *
 5 * $LicenseInfo:firstyear=2010&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LL_LLGIVEINVENTORY_H
28#define LL_LLGIVEINVENTORY_H
29
30class LLInventoryItem;
31class LLInventoryCategory;
32
33/**
34 * Class represented give inventory related actions.
35 *
36 * It has only static methods and is not intended to be instantiated for now.
37 */
38class LLGiveInventory
39{
40public:
41	/**
42	 * Checks if inventory item you are attempting to transfer to a resident can be given.
43	 *
44	 * @return true if you can give, otherwise false.
45	 */
46	static bool isInventoryGiveAcceptable(const LLInventoryItem* item);
47
48	/**
49	 * Checks if inventory item you are attempting to transfer to a group can be given.
50	 *
51	 * @return true if you can give, otherwise false.
52	 */
53	static bool isInventoryGroupGiveAcceptable(const LLInventoryItem* item);
54
55	/**
56	 * Gives passed inventory item to specified avatar in specified session.
57	 */
58	static bool doGiveInventoryItem(const LLUUID& to_agent,
59									const LLInventoryItem* item,
60									const LLUUID& im_session_id = LLUUID::null);
61
62	/**
63	 * Gives passed inventory category to specified avatar in specified session.
64	 */
65	static void doGiveInventoryCategory(const LLUUID& to_agent,
66									const LLInventoryCategory* item,
67									const LLUUID &session_id = LLUUID::null);
68
69	// give inventory item functionality
70	static bool handleCopyProtectedItem(const LLSD& notification, const LLSD& response);
71
72private:
73	// this class is not intended to be instantiated.
74	LLGiveInventory();
75
76	/**
77	 * logs "Inventory item offered" to IM
78	 */
79	static void logInventoryOffer(const LLUUID& to_agent,
80									const LLUUID &im_session_id = LLUUID::null);
81
82	static void commitGiveInventoryItem(const LLUUID& to_agent,
83									const LLInventoryItem* item,
84									const LLUUID &im_session_id = LLUUID::null);
85
86	// give inventory category functionality
87	static bool handleCopyProtectedCategory(const LLSD& notification, const LLSD& response);
88	static void commitGiveInventoryCategory(const LLUUID& to_agent,
89									const LLInventoryCategory* cat,
90									const LLUUID &im_session_id = LLUUID::null);
91
92};
93
94#endif // LL_LLGIVEINVENTORY_H