diff options
Diffstat (limited to 'linden/indra/newview/llviewergenericmessage.cpp')
-rw-r--r-- | linden/indra/newview/llviewergenericmessage.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/linden/indra/newview/llviewergenericmessage.cpp b/linden/indra/newview/llviewergenericmessage.cpp index 56b168b..0e1ce49 100644 --- a/linden/indra/newview/llviewergenericmessage.cpp +++ b/linden/indra/newview/llviewergenericmessage.cpp | |||
@@ -1,9 +1,9 @@ | |||
1 | /** | 1 | /** |
2 | * @file llviewergenericmessage.cpp | 2 | * @file llviewergenericmessage.cpp |
3 | * @brief Handle processing of "generic messages" which contain short lists of strings. | 3 | * @brief Handle processing of "generic messages" which contain short lists of strings. |
4 | * @author James Cook | 4 | * @author James Cook |
5 | * | 5 | * |
6 | * Copyright (c) 2007-2007, Linden Research, Inc. | 6 | * Copyright (c) 2007-2007, Linden Research, Inc. |
7 | * | 7 | * |
8 | * Second Life Viewer Source Code | 8 | * Second Life Viewer Source Code |
9 | * The source code in this file ("Source Code") is provided by Linden Lab | 9 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -24,74 +24,74 @@ | |||
24 | * | 24 | * |
25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
27 | * COMPLETENESS OR PERFORMANCE. | 27 | * COMPLETENESS OR PERFORMANCE. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "llviewerprecompiledheaders.h" | 30 | #include "llviewerprecompiledheaders.h" |
31 | 31 | ||
32 | #include "llviewergenericmessage.h" | 32 | #include "llviewergenericmessage.h" |
33 | 33 | ||
34 | #include "lldispatcher.h" | 34 | #include "lldispatcher.h" |
35 | #include "lluuid.h" | 35 | #include "lluuid.h" |
36 | #include "message.h" | 36 | #include "message.h" |
37 | 37 | ||
38 | #include "llagent.h" | 38 | #include "llagent.h" |
39 | 39 | ||
40 | 40 | ||
41 | LLDispatcher gGenericDispatcher; | 41 | LLDispatcher gGenericDispatcher; |
42 | 42 | ||
43 | 43 | ||
44 | void send_generic_message(const char* method, | 44 | void send_generic_message(const char* method, |
45 | const std::vector<std::string>& strings, | 45 | const std::vector<std::string>& strings, |
46 | const LLUUID& invoice) | 46 | const LLUUID& invoice) |
47 | { | 47 | { |
48 | LLMessageSystem* msg = gMessageSystem; | 48 | LLMessageSystem* msg = gMessageSystem; |
49 | msg->newMessage("GenericMessage"); | 49 | msg->newMessage("GenericMessage"); |
50 | msg->nextBlockFast(_PREHASH_AgentData); | 50 | msg->nextBlockFast(_PREHASH_AgentData); |
51 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 51 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
52 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 52 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
53 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | 53 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used |
54 | msg->nextBlock("MethodData"); | 54 | msg->nextBlock("MethodData"); |
55 | msg->addString("Method", method); | 55 | msg->addString("Method", method); |
56 | msg->addUUID("Invoice", invoice); | 56 | msg->addUUID("Invoice", invoice); |
57 | if(strings.empty()) | 57 | if(strings.empty()) |
58 | { | 58 | { |
59 | msg->nextBlock("ParamList"); | 59 | msg->nextBlock("ParamList"); |
60 | msg->addString("Parameter", NULL); | 60 | msg->addString("Parameter", NULL); |
61 | } | 61 | } |
62 | else | 62 | else |
63 | { | 63 | { |
64 | std::vector<std::string>::const_iterator it = strings.begin(); | 64 | std::vector<std::string>::const_iterator it = strings.begin(); |
65 | std::vector<std::string>::const_iterator end = strings.end(); | 65 | std::vector<std::string>::const_iterator end = strings.end(); |
66 | for(; it != end; ++it) | 66 | for(; it != end; ++it) |
67 | { | 67 | { |
68 | msg->nextBlock("ParamList"); | 68 | msg->nextBlock("ParamList"); |
69 | msg->addString("Parameter", (*it).c_str()); | 69 | msg->addString("Parameter", (*it).c_str()); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | gAgent.sendReliableMessage(); | 72 | gAgent.sendReliableMessage(); |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | void process_generic_message(LLMessageSystem* msg, void**) | 77 | void process_generic_message(LLMessageSystem* msg, void**) |
78 | { | 78 | { |
79 | LLUUID agent_id; | 79 | LLUUID agent_id; |
80 | msg->getUUID("AgentData", "AgentID", agent_id); | 80 | msg->getUUID("AgentData", "AgentID", agent_id); |
81 | if (agent_id != gAgent.getID()) | 81 | if (agent_id != gAgent.getID()) |
82 | { | 82 | { |
83 | llwarns << "GenericMessage for wrong agent" << llendl; | 83 | llwarns << "GenericMessage for wrong agent" << llendl; |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | std::string request; | 87 | std::string request; |
88 | LLUUID invoice; | 88 | LLUUID invoice; |
89 | LLDispatcher::sparam_t strings; | 89 | LLDispatcher::sparam_t strings; |
90 | LLDispatcher::unpackMessage(msg, request, invoice, strings); | 90 | LLDispatcher::unpackMessage(msg, request, invoice, strings); |
91 | 91 | ||
92 | if(!gGenericDispatcher.dispatch(request, invoice, strings)) | 92 | if(!gGenericDispatcher.dispatch(request, invoice, strings)) |
93 | { | 93 | { |
94 | llwarns << "GenericMessage " << request << " failed to dispatch" | 94 | llwarns << "GenericMessage " << request << " failed to dispatch" |
95 | << llendl; | 95 | << llendl; |
96 | } | 96 | } |
97 | } | 97 | } |