aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewermessage.cpp63
1 files changed, 36 insertions, 27 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index c337044..2011275 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -129,8 +129,9 @@
129#include "llweb.h" 129#include "llweb.h"
130#include "llworld.h" 130#include "llworld.h"
131#include "pipeline.h" 131#include "pipeline.h"
132#include "viewer.h" 132#include "llappviewer.h"
133#include "llfloaterworldmap.h" 133#include "llfloaterworldmap.h"
134#include "llviewerdisplay.h"
134#include "llkeythrottle.h" 135#include "llkeythrottle.h"
135 136
136#include <boost/tokenizer.hpp> 137#include <boost/tokenizer.hpp>
@@ -153,8 +154,6 @@ static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds
153 154
154extern BOOL gDebugClicks; 155extern BOOL gDebugClicks;
155 156
156extern void bad_network_handler();
157
158// function prototypes 157// function prototypes
159void open_offer(const std::vector<LLUUID>& items, const std::string& from_name); 158void open_offer(const std::vector<LLUUID>& items, const std::string& from_name);
160void friendship_offer_callback(S32 option, void* user_data); 159void friendship_offer_callback(S32 option, void* user_data);
@@ -209,8 +208,8 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_
209 LLMessageSystem* msg = gMessageSystem; 208 LLMessageSystem* msg = gMessageSystem;
210 msg->newMessageFast(_PREHASH_MoneyTransferRequest); 209 msg->newMessageFast(_PREHASH_MoneyTransferRequest);
211 msg->nextBlockFast(_PREHASH_AgentData); 210 msg->nextBlockFast(_PREHASH_AgentData);
212 msg->addUUIDFast(_PREHASH_AgentID, agent_get_id()); 211 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
213 msg->addUUIDFast(_PREHASH_SessionID, agent_get_session_id()); 212 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
214 msg->nextBlockFast(_PREHASH_MoneyData); 213 msg->nextBlockFast(_PREHASH_MoneyData);
215 msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID() ); 214 msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID() );
216 msg->addUUIDFast(_PREHASH_DestID, uuid); 215 msg->addUUIDFast(_PREHASH_DestID, uuid);
@@ -248,7 +247,7 @@ void process_logout_reply(LLMessageSystem* msg, void**)
248 msg->getUUID("AgentData", "AgentID", agent_id); 247 msg->getUUID("AgentData", "AgentID", agent_id);
249 LLUUID session_id; 248 LLUUID session_id;
250 msg->getUUID("AgentData", "SessionID", session_id); 249 msg->getUUID("AgentData", "SessionID", session_id);
251 if((agent_id != agent_get_id()) || (session_id != agent_get_session_id())) 250 if((agent_id != gAgent.getID()) || (session_id != gAgent.getSessionID()))
252 { 251 {
253 llwarns << "Bogus Logout Reply" << llendl; 252 llwarns << "Bogus Logout Reply" << llendl;
254 } 253 }
@@ -285,7 +284,7 @@ void process_logout_reply(LLMessageSystem* msg, void**)
285 gInventory.accountForUpdate(parents); 284 gInventory.accountForUpdate(parents);
286 gInventory.notifyObservers(); 285 gInventory.notifyObservers();
287 } 286 }
288 app_force_quit(NULL); 287 LLAppViewer::instance()->forceQuit();
289} 288}
290 289
291void process_layer_data(LLMessageSystem *mesgsys, void **user_data) 290void process_layer_data(LLMessageSystem *mesgsys, void **user_data)
@@ -789,7 +788,7 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
789 // Use the name of the last item giver, who is probably the person 788 // Use the name of the last item giver, who is probably the person
790 // spamming you. JC 789 // spamming you. JC
791 std::ostringstream message; 790 std::ostringstream message;
792 message << gSecondLife; 791 message << LLAppViewer::instance()->getSecondLifeTitle();
793 if (!from_name.empty()) 792 if (!from_name.empty())
794 { 793 {
795 message << ": Items coming in too fast from " << from_name; 794 message << ": Items coming in too fast from " << from_name;
@@ -2715,7 +2714,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2715 << x << ":" << y 2714 << x << ":" << y
2716 << " current pos " << gAgent.getPositionGlobal() 2715 << " current pos " << gAgent.getPositionGlobal()
2717 << llendl; 2716 << llendl;
2718 do_disconnect("You were sent to an invalid region."); 2717 LLAppViewer::instance()->forceDisconnect("You were sent to an invalid region.");
2719 return; 2718 return;
2720 2719
2721 } 2720 }
@@ -2895,7 +2894,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
2895 } 2894 }
2896 2895
2897 // We have already requested to log out. Don't send agent updates. 2896 // We have already requested to log out. Don't send agent updates.
2898 if(gLogoutRequestSent) 2897 if(LLAppViewer::instance()->logoutRequestSent())
2899 { 2898 {
2900 return; 2899 return;
2901 } 2900 }
@@ -3242,10 +3241,13 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data)
3242 F32 phase; 3241 F32 phase;
3243 U64 space_time_usec; 3242 U64 space_time_usec;
3244 3243
3244 U32 seconds_per_day;
3245 U32 seconds_per_year;
3246
3245 // "SimulatorViewerTimeMessage" 3247 // "SimulatorViewerTimeMessage"
3246 mesgsys->getU64Fast(_PREHASH_TimeInfo, _PREHASH_UsecSinceStart, space_time_usec); 3248 mesgsys->getU64Fast(_PREHASH_TimeInfo, _PREHASH_UsecSinceStart, space_time_usec);
3247 mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerDay, gSecondsPerDay); 3249 mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerDay, seconds_per_day);
3248 mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerYear, gSecondsPerYear); 3250 mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerYear, seconds_per_year);
3249 3251
3250 // This should eventually be moved to an "UpdateHeavenlyBodies" message 3252 // This should eventually be moved to an "UpdateHeavenlyBodies" message
3251 mesgsys->getF32Fast(_PREHASH_TimeInfo, _PREHASH_SunPhase, phase); 3253 mesgsys->getF32Fast(_PREHASH_TimeInfo, _PREHASH_SunPhase, phase);
@@ -3930,7 +3932,7 @@ void process_kick_user(LLMessageSystem *msg, void** /*user_data*/)
3930 3932
3931 msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, 2048, message); 3933 msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, 2048, message);
3932 3934
3933 do_disconnect(message); 3935 LLAppViewer::instance()->forceDisconnect(message);
3934} 3936}
3935 3937
3936 3938
@@ -4069,18 +4071,18 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data)
4069 process_alert_core(buffer, modal); 4071 process_alert_core(buffer, modal);
4070} 4072}
4071 4073
4072void process_alert_core(const char* buffer, BOOL modal) 4074void process_alert_core(const std::string& message, BOOL modal)
4073{ 4075{
4074 // make sure the cursor is back to the usual default since the 4076 // make sure the cursor is back to the usual default since the
4075 // alert is probably due to some kind of error. 4077 // alert is probably due to some kind of error.
4076 gViewerWindow->getWindow()->resetBusyCount(); 4078 gViewerWindow->getWindow()->resetBusyCount();
4077 4079
4078 // HACK -- handle callbacks for specific alerts 4080 // HACK -- handle callbacks for specific alerts
4079 if( !strcmp( buffer, "You died and have been teleported to your home location" ) ) 4081 if ( message == "You died and have been teleported to your home location")
4080 { 4082 {
4081 gViewerStats->incStat(LLViewerStats::ST_KILLED_COUNT); 4083 gViewerStats->incStat(LLViewerStats::ST_KILLED_COUNT);
4082 } 4084 }
4083 else if( !strcmp( buffer, "Home position set." ) ) 4085 else if( message == "Home position set." )
4084 { 4086 {
4085 // save the home location image to disk 4087 // save the home location image to disk
4086 LLString snap_filename = gDirUtilp->getLindenUserDir(); 4088 LLString snap_filename = gDirUtilp->getLindenUserDir();
@@ -4089,19 +4091,26 @@ void process_alert_core(const char* buffer, BOOL modal)
4089 gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidth(), gViewerWindow->getWindowHeight(), FALSE, FALSE); 4091 gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidth(), gViewerWindow->getWindowHeight(), FALSE, FALSE);
4090 } 4092 }
4091 4093
4092 const char ALERT_PREFIX[] = "ALERT: "; 4094 const std::string ALERT_PREFIX("ALERT: ");
4093 const size_t ALERT_PREFIX_LEN = sizeof(ALERT_PREFIX) - 1; 4095 const std::string NOTIFY_PREFIX("NOTIFY: ");
4094 if (!strncmp(buffer, ALERT_PREFIX, ALERT_PREFIX_LEN)) 4096 if (message.find(ALERT_PREFIX) == 0)
4095 { 4097 {
4096 // Allow the server to spawn a named alert so that server alerts can be 4098 // Allow the server to spawn a named alert so that server alerts can be
4097 // translated out of English. JC 4099 // translated out of English.
4098 std::string alert_name(buffer + ALERT_PREFIX_LEN); 4100 std::string alert_name(message.substr(ALERT_PREFIX.length()));
4099 LLAlertDialog::showXml(alert_name); 4101 LLAlertDialog::showXml(alert_name);
4100 } 4102 }
4101 else if (buffer[0] == '/') 4103 else if (message.find(NOTIFY_PREFIX) == 0)
4104 {
4105 // Allow the server to spawn a named notification so that server notifications can be
4106 // translated out of English.
4107 std::string notify_name(message.substr(NOTIFY_PREFIX.length()));
4108 LLNotifyBox::showXml(notify_name);
4109 }
4110 else if (message[0] == '/')
4102 { 4111 {
4103 // System message is important, show in upper-right box not tip 4112 // System message is important, show in upper-right box not tip
4104 LLString text(buffer+1); 4113 LLString text(message.substr(1));
4105 LLString::format_map_t args; 4114 LLString::format_map_t args;
4106 if (text.substr(0,17) == "RESTART_X_MINUTES") 4115 if (text.substr(0,17) == "RESTART_X_MINUTES")
4107 { 4116 {
@@ -4128,14 +4137,14 @@ void process_alert_core(const char* buffer, BOOL modal)
4128 { 4137 {
4129 // *TODO:translate 4138 // *TODO:translate
4130 LLString::format_map_t args; 4139 LLString::format_map_t args;
4131 args["[ERROR_MESSAGE]"] = buffer; 4140 args["[ERROR_MESSAGE]"] = message;
4132 gViewerWindow->alertXml("ErrorMessage", args); 4141 gViewerWindow->alertXml("ErrorMessage", args);
4133 } 4142 }
4134 else 4143 else
4135 { 4144 {
4136 // *TODO:translate 4145 // *TODO:translate
4137 LLString::format_map_t args; 4146 LLString::format_map_t args;
4138 args["[MESSAGE]"] = buffer; 4147 args["[MESSAGE]"] = message;
4139 LLNotifyBox::showXml("SystemMessageTip", args); 4148 LLNotifyBox::showXml("SystemMessageTip", args);
4140 } 4149 }
4141} 4150}
@@ -5365,7 +5374,7 @@ void invalid_message_callback(LLMessageSystem* msg,
5365 void*, 5374 void*,
5366 EMessageException exception) 5375 EMessageException exception)
5367{ 5376{
5368 bad_network_handler(); 5377 LLAppViewer::instance()->badNetworkHandler();
5369} 5378}
5370 5379
5371// Please do not add more message handlers here. This file is huge. 5380// Please do not add more message handlers here. This file is huge.