aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llmessageconfig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmessage/llmessageconfig.cpp')
-rw-r--r--linden/indra/llmessage/llmessageconfig.cpp47
1 files changed, 35 insertions, 12 deletions
diff --git a/linden/indra/llmessage/llmessageconfig.cpp b/linden/indra/llmessage/llmessageconfig.cpp
index 807a35b..e23ed07 100644
--- a/linden/indra/llmessage/llmessageconfig.cpp
+++ b/linden/indra/llmessage/llmessageconfig.cpp
@@ -66,6 +66,7 @@ public:
66 66
67 /* virtual */ void loadFile(); 67 /* virtual */ void loadFile();
68 void loadServerDefaults(const LLSD& data); 68 void loadServerDefaults(const LLSD& data);
69 void loadMaxQueuedEvents(const LLSD& data);
69 void loadMessages(const LLSD& data); 70 void loadMessages(const LLSD& data);
70 void loadCapBans(const LLSD& blacklist); 71 void loadCapBans(const LLSD& blacklist);
71 void loadMessageBans(const LLSD& blacklist); 72 void loadMessageBans(const LLSD& blacklist);
@@ -73,6 +74,7 @@ public:
73 74
74public: 75public:
75 LLSD mCapBans; 76 LLSD mCapBans;
77 S32 mMaxQueuedEvents;
76}; 78};
77 79
78std::string LLMessageConfigFile::filename() 80std::string LLMessageConfigFile::filename()
@@ -99,19 +101,20 @@ void LLMessageConfigFile::loadFile()
99 101
100 if (file.is_open()) 102 if (file.is_open())
101 { 103 {
102 llinfos << "Loading message.xml file at " << filename() << llendl; 104 LL_DEBUGS("AppInit") << "Loading message.xml file at " << filename() << LL_ENDL;
103 LLSDSerialize::fromXML(data, file); 105 LLSDSerialize::fromXML(data, file);
104 } 106 }
105 107
106 if (data.isUndefined()) 108 if (data.isUndefined())
107 { 109 {
108 llinfos << "LLMessageConfigFile::loadFile: file missing," 110 LL_INFOS("AppInit") << "LLMessageConfigFile::loadFile: file missing,"
109 " ill-formed, or simply undefined; not changing the" 111 " ill-formed, or simply undefined; not changing the"
110 " file" << llendl; 112 " file" << LL_ENDL;
111 return; 113 return;
112 } 114 }
113 } 115 }
114 loadServerDefaults(data); 116 loadServerDefaults(data);
117 loadMaxQueuedEvents(data);
115 loadMessages(data); 118 loadMessages(data);
116 loadCapBans(data); 119 loadCapBans(data);
117 loadMessageBans(data); 120 loadMessageBans(data);
@@ -122,6 +125,19 @@ void LLMessageConfigFile::loadServerDefaults(const LLSD& data)
122 mServerDefault = data["serverDefaults"][sServerName].asString(); 125 mServerDefault = data["serverDefaults"][sServerName].asString();
123} 126}
124 127
128const S32 DEFAULT_MAX_QUEUED_EVENTS = 100;
129void LLMessageConfigFile::loadMaxQueuedEvents(const LLSD& data)
130{
131 if (data.has("maxQueuedEvents"))
132 {
133 mMaxQueuedEvents = data["maxQueuedEvents"].asInteger();
134 }
135 else
136 {
137 mMaxQueuedEvents = DEFAULT_MAX_QUEUED_EVENTS;
138 }
139}
140
125void LLMessageConfigFile::loadMessages(const LLSD& data) 141void LLMessageConfigFile::loadMessages(const LLSD& data)
126{ 142{
127 mMessages = data["messages"]; 143 mMessages = data["messages"];
@@ -141,15 +157,15 @@ void LLMessageConfigFile::loadCapBans(const LLSD& data)
141 LLSD bans = data["capBans"]; 157 LLSD bans = data["capBans"];
142 if (!bans.isMap()) 158 if (!bans.isMap())
143 { 159 {
144 llinfos << "LLMessageConfigFile::loadCapBans: missing capBans section" 160 LL_INFOS("AppInit") << "LLMessageConfigFile::loadCapBans: missing capBans section"
145 << llendl; 161 << LL_ENDL;
146 return; 162 return;
147 } 163 }
148 164
149 mCapBans = bans; 165 mCapBans = bans;
150 166
151 llinfos << "LLMessageConfigFile::loadCapBans: " 167 LL_DEBUGS("AppInit") << "LLMessageConfigFile::loadCapBans: "
152 << bans.size() << " ban tests" << llendl; 168 << bans.size() << " ban tests" << LL_ENDL;
153} 169}
154 170
155void LLMessageConfigFile::loadMessageBans(const LLSD& data) 171void LLMessageConfigFile::loadMessageBans(const LLSD& data)
@@ -157,8 +173,8 @@ void LLMessageConfigFile::loadMessageBans(const LLSD& data)
157 LLSD bans = data["messageBans"]; 173 LLSD bans = data["messageBans"];
158 if (!bans.isMap()) 174 if (!bans.isMap())
159 { 175 {
160 llinfos << "LLMessageConfigFile::loadMessageBans: missing messageBans section" 176 LL_INFOS("AppInit") << "LLMessageConfigFile::loadMessageBans: missing messageBans section"
161 << llendl; 177 << LL_ENDL;
162 return; 178 return;
163 } 179 }
164 180
@@ -182,8 +198,8 @@ void LLMessageConfig::initClass(const std::string& server_name,
182 sServerName = server_name; 198 sServerName = server_name;
183 sConfigDir = config_dir; 199 sConfigDir = config_dir;
184 (void) LLMessageConfigFile::instance(); 200 (void) LLMessageConfigFile::instance();
185 llinfos << "LLMessageConfig::initClass config file " 201 LL_DEBUGS("AppInit") << "LLMessageConfig::initClass config file "
186 << config_dir << "/" << messageConfigFileName << llendl; 202 << config_dir << "/" << messageConfigFileName << LL_ENDL;
187} 203}
188 204
189//static 205//static
@@ -191,10 +207,10 @@ void LLMessageConfig::useConfig(const LLSD& config)
191{ 207{
192 LLMessageConfigFile &the_file = LLMessageConfigFile::instance(); 208 LLMessageConfigFile &the_file = LLMessageConfigFile::instance();
193 the_file.loadServerDefaults(config); 209 the_file.loadServerDefaults(config);
210 the_file.loadMaxQueuedEvents(config);
194 the_file.loadMessages(config); 211 the_file.loadMessages(config);
195 the_file.loadCapBans(config); 212 the_file.loadCapBans(config);
196 the_file.loadMessageBans(config); 213 the_file.loadMessageBans(config);
197
198} 214}
199 215
200//static 216//static
@@ -213,6 +229,13 @@ LLMessageConfig::Flavor LLMessageConfig::getServerDefaultFlavor()
213} 229}
214 230
215//static 231//static
232S32 LLMessageConfig::getMaxQueuedEvents()
233{
234 LLMessageConfigFile& file = LLMessageConfigFile::instance();
235 return file.mMaxQueuedEvents;
236}
237
238//static
216LLMessageConfig::Flavor LLMessageConfig::getMessageFlavor(const std::string& msg_name) 239LLMessageConfig::Flavor LLMessageConfig::getMessageFlavor(const std::string& msg_name)
217{ 240{
218 LLMessageConfigFile& file = LLMessageConfigFile::instance(); 241 LLMessageConfigFile& file = LLMessageConfigFile::instance();