void ServerManager::commandEntered() { if (command_.text().length() == 0) { return; } if (port_.text().length() == 0 || host_.text().length() == 0) { generalError("Incomplete server details.", "Please give the server name and port number."); return; } try { QRCON_DEBUG_MESSAGE("Open connection."); // It seems to be necessary to do this because the constData() function // returns whatever the last toAscii() command returned... QString password = password_.text(); QRCON_DEBUG_MESSAGE("password '" << password_.text().toAscii().constData() << "'"); /// \todo this should only be declared once actually, but what /// if it kicks you off? Is there some timout? Are you /// authed forever-- what!?! I think I will need a /// reconnect() method. Implies we should store the /// data from those fields tho. rcon::host h(host_.text().toAscii().constData(), port_.text().toAscii().constData()); rcon::connection conn(h, password.toAscii().constData()); emit connected(); output_.append(QString("<b>> ") + command_.text() + "</b>"); QRCON_DEBUG_MESSAGE("sending '" << command_.text().toAscii().constData() << "'"); rcon::command cmd(conn, command_.text().toAscii().constData()); output_.append(QString(cmd.data().c_str())); } /// \todo better exception handling catch (std::exception &e) { QRCON_DEBUG_MESSAGE("handling exception"); generalError("The command returned an error.", e.what()); } catch (...) { generalError("An unknown exception occured.", "An unhandled exception occured when dealing with the command. This is a program error.", QMessageBox::Critical ); } }
XObjectPtr Function::execute( XPathExecutionContext& executionContext, XalanNode* context, const XObjectArgVectorType& args, const Locator* locator) const { const XObjectArgVectorType::size_type theArgCount = args.size(); if (theArgCount == 0) { return execute(executionContext, context, locator); } else if (theArgCount == 1) { return execute(executionContext, context, args[0], locator); } else if (theArgCount == 2) { return execute(executionContext, context, args[0], args[1], locator); } else if (theArgCount == 3) { return execute(executionContext, context, args[0], args[1], args[2], locator); } else { generalError( executionContext, context, locator); return XObjectPtr(0); } }
XObjectPtr Function::execute( XPathExecutionContext& executionContext, XalanNode* context, const Locator* locator) const { generalError( executionContext, context, locator); return XObjectPtr(0); }