Rev 1648 | Rev 1664 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1648 | Rev 1657 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | net::Manager::Instance()->ConnectSlots(net::Manager::SignalOnNewState::slot_type(&Console::SlotOnNewState, this, _1, _2, _3).track(this->tracker_), |
43 | net::Manager::Instance()->ConnectSlots(net::Manager::SignalOnNewState::slot_type(&Console::SlotOnNewState, this, _1, _2, _3).track(this->tracker_), |
| 44 | net::Manager::SignalOnNewData::slot_type(&Console::SlotOnNewData, this, _1, _2, _3).track(this->tracker_)); |
44 | net::Manager::SignalOnNewData::slot_type(&Console::SlotOnNewData, this, _1, _2, _3).track(this->tracker_)); |
| 45 | 45 | ||
| 46 | this->ExportFunction("ConsoleExport_PromptRequest", Console::Export_PromptRequest); |
46 | this->ExportFunction("ConsoleExport_PromptRequest", Console::Export_PromptRequest); |
| 47 | this->ExportFunction("ConsoleExport_AutoCompleteResponse", Console::Export_AutoCompleteResponse); |
47 | this->ExportFunction("ConsoleExport_AutoCompleteResponse", Console::Export_AutoCompleteResponse); |
| - | 48 | this->ExportFunction("ConsoleExport_LogToClient", Console::Export_LogToClient); |
|
| 48 | 49 | ||
| 49 | try |
50 | try |
| 50 | { |
51 | { |
| 51 | this->server_id_ = net::Manager::Instance()->StartServer(net::PROTOCOL_TCP, port); |
52 | this->server_id_ = net::Manager::Instance()->StartServer(net::PROTOCOL_TCP, port); |
| 52 | LOG.Info("Started TCP server on port " + boost::lexical_cast<std::string>(port) + "."); |
53 | LOG.Info("Started TCP server on port " + boost::lexical_cast<std::string>(port) + "."); |
| Line 199... | Line 200... | ||
| 199 | packet += common::PadNumber(prompt.length() + 1, 4); |
200 | packet += common::PadNumber(prompt.length() + 1, 4); |
| 200 | packet += *prompt; |
201 | packet += *prompt; |
| 201 | 202 | ||
| 202 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
203 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
| 203 | return v8::Boolean::New(true); |
204 | return v8::Boolean::New(true); |
| 204 | - | ||
| 205 | return v8::Boolean::New(false); |
- | |
| 206 | } |
205 | } |
| 207 | 206 | ||
| 208 | Value Console::Export_AutoCompleteResponse(const v8::Arguments& args) |
207 | Value Console::Export_AutoCompleteResponse(const v8::Arguments& args) |
| 209 | { |
208 | { |
| - | 209 | v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext()); |
|
| - | 210 | ||
| - | 211 | //LOG.Debug(std::string(__FUNCTION__) + " called!"); |
|
| - | 212 | ||
| - | 213 | if (args.Length() < 2) |
|
| - | 214 | { |
|
| - | 215 | LOG.Error(std::string(__FUNCTION__) + ": To few arguments."); |
|
| - | 216 | return v8::Boolean::New(false); |
|
| - | 217 | } |
|
| - | 218 | ||
| - | 219 | v8::String::AsciiValue result(args[1]); |
|
| - | 220 | ||
| - | 221 | std::string packet = "COMP"; |
|
| - | 222 | packet += common::PadNumber(result.length() + 1, 4); |
|
| - | 223 | packet += *result; |
|
| - | 224 | ||
| - | 225 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
|
| - | 226 | return v8::Boolean::New(true); |
|
| - | 227 | } |
|
| - | 228 | ||
| - | 229 | Value Console::Export_LogToClient(const v8::Arguments& args) |
|
| - | 230 | { |
|
| 210 | v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext()); |
231 | v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext()); |
| 211 | 232 | ||
| 212 | //LOG.Debug(std::string(__FUNCTION__) + " called!"); |
233 | //LOG.Debug(std::string(__FUNCTION__) + " called!"); |
| 213 | 234 | ||
| 214 | if (args.Length() < 2) |
235 | if (args.Length() < 2) |
| 215 | { |
236 | { |
| 216 | LOG.Error(std::string(__FUNCTION__) + ": To few arguments."); |
237 | LOG.Error(std::string(__FUNCTION__) + ": To few arguments."); |
| 217 | return v8::Boolean::New(false); |
238 | return v8::Boolean::New(false); |
| 218 | } |
239 | } |
| 219 | 240 | ||
| 220 | v8::String::AsciiValue |
241 | v8::String::AsciiValue text(args[1]); |
| - | 242 | ||
| - | 243 | std::string line = *text; |
|
| 221 | 244 | ||
| 222 | std::string packet = " |
245 | std::string packet = "TEXT"; |
| 223 | packet += common::PadNumber( |
246 | packet += common::PadNumber(line.length() + 1, 4); |
| 224 | packet += |
247 | packet += line; |
| 225 | 248 | ||
| 226 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
249 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
| 227 | return v8::Boolean::New(true); |
250 | return v8::Boolean::New(true); |
| 228 | - | ||
| 229 | return v8::Boolean::New(false); |
- | |
| 230 | } |
251 | } |
| 231 | 252 | ||
| 232 | }; // namespace plugin |
253 | }; // namespace plugin |
| 233 | }; // namespace vm |
254 | }; // namespace vm |
| 234 | }; // namespace atom |
255 | }; // namespace atom |