aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lleventinfo.cpp
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/lleventinfo.cpp
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 '')
-rw-r--r--linden/indra/newview/lleventinfo.cpp153
1 files changed, 153 insertions, 0 deletions
diff --git a/linden/indra/newview/lleventinfo.cpp b/linden/indra/newview/lleventinfo.cpp
new file mode 100644
index 0000000..02ac3ed
--- /dev/null
+++ b/linden/indra/newview/lleventinfo.cpp
@@ -0,0 +1,153 @@
1/**
2 * @file lleventinfo.cpp
3 * @brief LLEventInfo class implementation
4 *
5 * Copyright (c) 2004-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#include "llviewerprecompiledheaders.h"
29#include "lleventinfo.h"
30
31#include "viewer.h" // for gPacificDaylightTime
32#include "lluuid.h"
33#include "message.h"
34
35LLEventInfo::cat_map LLEventInfo::sCategories;
36
37LLEventInfo::LLEventInfo(F32 global_x, F32 global_y,
38 const char* name,
39 U32 id,
40 S32 unix_time,
41 U32 event_flags)
42: mName( name ),
43 mID( id ),
44 mPosGlobal( global_x, global_y, 40.0 ),
45 mUnixTime( unix_time ),
46 mEventFlags(event_flags),
47 mSelected( FALSE )
48{
49 struct tm* timep;
50 // Convert to Pacific, based on server's opinion of whether
51 // it's daylight savings time there.
52 timep = utc_to_pacific_time(unix_time, gPacificDaylightTime);
53
54 S32 display_hour = timep->tm_hour % 12;
55 if (display_hour == 0) display_hour = 12;
56
57 mTimeStr = llformat("% 2d/% 2d % 2d:%02d %s",
58 timep->tm_mon+1,
59 timep->tm_year-100,
60 display_hour,
61 timep->tm_min,
62 (timep->tm_hour < 12 ? "AM" : "PM") );
63}
64
65
66void LLEventInfo::unpack(LLMessageSystem *msg)
67{
68 const U32 MAX_DESC_LENGTH = 1024;
69
70 U32 event_id;
71 msg->getU32("EventData", "EventID", event_id);
72 mID = event_id;
73
74 char buffer[MAX_DESC_LENGTH];
75 msg->getString("EventData", "Name", MAX_DESC_LENGTH, buffer);
76 mName = buffer;
77
78 msg->getString("EventData", "Category", MAX_DESC_LENGTH, buffer);
79 mCategoryStr = buffer;
80
81 msg->getString("EventData", "Date", MAX_DESC_LENGTH, buffer);
82 // *FIX: evil hack to let users know that we don't localize
83 // time information. Hack! This is WRONG.
84 mTimeStr = buffer;
85
86 U32 duration;
87 msg->getU32("EventData","Duration",duration);
88 mDuration = duration;
89
90 msg->getU32("EventData", "DateUTC", mUnixTime);
91
92 msg->getString("EventData", "Desc", MAX_DESC_LENGTH, buffer);
93 mDesc = buffer;
94
95 msg->getString("EventData", "Creator", MAX_DESC_LENGTH, buffer);
96 mRunByID = LLUUID(buffer);
97
98 U32 foo;
99 msg->getU32("EventData", "Cover", foo);
100
101 mHasCover = foo ? TRUE : FALSE;
102 if (mHasCover)
103 {
104 U32 cover;
105 msg->getU32("EventData", "Amount", cover);
106 mCover = cover;
107 }
108
109 char sim_name[256];
110 msg->getString("EventData", "SimName", 256, sim_name);
111 mSimName.assign(sim_name);
112
113 msg->getVector3d("EventData", "GlobalPos", mPosGlobal);
114
115 // Mature content
116 U32 event_flags;
117 msg->getU32("EventData", "EventFlags", event_flags);
118 mEventFlags = event_flags;
119}
120
121// static
122void LLEventInfo::loadCategories(LLUserAuth::options_t event_options)
123{
124 LLUserAuth::options_t::iterator resp_it;
125 for (resp_it = event_options.begin();
126 resp_it != event_options.end();
127 ++resp_it)
128 {
129 const LLUserAuth::response_t& response = *resp_it;
130
131 LLUserAuth::response_t::const_iterator option_it;
132
133 S32 cat_id = 0;
134 option_it = response.find("category_id");
135 if (option_it != response.end())
136 {
137 cat_id = atoi(option_it->second.c_str());
138 }
139 else
140 {
141 continue;
142 }
143
144 // Add the category id/name pair
145 option_it = response.find("category_name");
146 if (option_it != response.end())
147 {
148 LLEventInfo::sCategories[cat_id] = option_it->second;
149 }
150
151 }
152
153}