diff options
Diffstat (limited to 'linden/indra/llinventory/lltransactionflags.cpp')
-rw-r--r-- | linden/indra/llinventory/lltransactionflags.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/linden/indra/llinventory/lltransactionflags.cpp b/linden/indra/llinventory/lltransactionflags.cpp index ffd3271..d4c97d1 100644 --- a/linden/indra/llinventory/lltransactionflags.cpp +++ b/linden/indra/llinventory/lltransactionflags.cpp | |||
@@ -3,6 +3,8 @@ | |||
3 | * @brief Some exported symbols and functions for dealing with | 3 | * @brief Some exported symbols and functions for dealing with |
4 | * transaction flags. | 4 | * transaction flags. |
5 | * | 5 | * |
6 | * $LicenseInfo:firstyear=2003&license=viewergpl$ | ||
7 | * | ||
6 | * Copyright (c) 2003-2007, Linden Research, Inc. | 8 | * Copyright (c) 2003-2007, Linden Research, Inc. |
7 | * | 9 | * |
8 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
@@ -25,11 +27,14 @@ | |||
25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
27 | * COMPLETENESS OR PERFORMANCE. | 29 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | ||
28 | */ | 31 | */ |
29 | 32 | ||
30 | #include "linden_common.h" | 33 | #include "linden_common.h" |
31 | 34 | ||
32 | #include "lltransactionflags.h" | 35 | #include "lltransactionflags.h" |
36 | #include "lltransactiontypes.h" | ||
37 | #include "lluuid.h" | ||
33 | 38 | ||
34 | const U8 TRANSACTION_FLAGS_NONE = 0; | 39 | const U8 TRANSACTION_FLAGS_NONE = 0; |
35 | const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1; | 40 | const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1; |
@@ -61,3 +66,85 @@ BOOL is_tf_owner_group(TransactionFlags flags) | |||
61 | return ((flags & TRANSACTION_FLAG_OWNER_GROUP) == TRANSACTION_FLAG_OWNER_GROUP); | 66 | return ((flags & TRANSACTION_FLAG_OWNER_GROUP) == TRANSACTION_FLAG_OWNER_GROUP); |
62 | } | 67 | } |
63 | 68 | ||
69 | void append_reason( | ||
70 | std::ostream& ostr, | ||
71 | S32 transaction_type, | ||
72 | const char* description) | ||
73 | { | ||
74 | switch( transaction_type ) | ||
75 | { | ||
76 | case TRANS_OBJECT_SALE: | ||
77 | ostr << " for " << (description ? description : "<unknown>"); | ||
78 | break; | ||
79 | case TRANS_LAND_SALE: | ||
80 | ostr << " for a parcel of land"; | ||
81 | break; | ||
82 | case TRANS_LAND_PASS_SALE: | ||
83 | ostr << " for a land access pass"; | ||
84 | break; | ||
85 | case TRANS_GROUP_LAND_DEED: | ||
86 | ostr << " for deeding land"; | ||
87 | default: | ||
88 | break; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | std::string build_transfer_message_to_source( | ||
93 | S32 amount, | ||
94 | const LLUUID& source_id, | ||
95 | const LLUUID& dest_id, | ||
96 | const std::string& dest_name, | ||
97 | S32 transaction_type, | ||
98 | const char* description) | ||
99 | { | ||
100 | lldebugs << "build_transfer_message_to_source: " << amount << " " | ||
101 | << source_id << " " << dest_id << " " << dest_name << " " | ||
102 | << (description?description:"(no desc)") << llendl; | ||
103 | if((0 == amount) || source_id.isNull()) return ll_safe_string(description); | ||
104 | std::ostringstream ostr; | ||
105 | if(dest_id.isNull()) | ||
106 | { | ||
107 | ostr << "You paid L$" << amount; | ||
108 | switch(transaction_type) | ||
109 | { | ||
110 | case TRANS_GROUP_CREATE: | ||
111 | ostr << " to create a group"; | ||
112 | break; | ||
113 | case TRANS_GROUP_JOIN: | ||
114 | ostr << " to join a group"; | ||
115 | break; | ||
116 | case TRANS_UPLOAD_CHARGE: | ||
117 | ostr << " to upload"; | ||
118 | break; | ||
119 | default: | ||
120 | break; | ||
121 | } | ||
122 | } | ||
123 | else | ||
124 | { | ||
125 | ostr << "You paid " << dest_name << " L$" << amount; | ||
126 | append_reason(ostr, transaction_type, description); | ||
127 | } | ||
128 | ostr << "."; | ||
129 | return ostr.str(); | ||
130 | } | ||
131 | |||
132 | std::string build_transfer_message_to_destination( | ||
133 | S32 amount, | ||
134 | const LLUUID& dest_id, | ||
135 | const LLUUID& source_id, | ||
136 | const std::string& source_name, | ||
137 | S32 transaction_type, | ||
138 | const char* description) | ||
139 | { | ||
140 | lldebugs << "build_transfer_message_to_dest: " << amount << " " | ||
141 | << dest_id << " " << source_id << " " << source_name << " " | ||
142 | << (description?description:"(no desc)") << llendl; | ||
143 | if(0 == amount) return std::string(); | ||
144 | if(dest_id.isNull()) return ll_safe_string(description); | ||
145 | std::ostringstream ostr; | ||
146 | ostr << source_name << " paid you L$" << amount; | ||
147 | append_reason(ostr, transaction_type, description); | ||
148 | ostr << "."; | ||
149 | return ostr.str(); | ||
150 | } | ||