/*
* px *
Copyright (c) 2008 Shawn Hladky
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "pxheaders.h"
#include "pxclient.h"
#include "commands/extendedcommands.h"
#include "commands/helpcommand.h"
pxClient::~pxClient()
{
//delete _argv;
}
void
pxClient::SetArgv( int argc, char *const *argv )
{
// save off argv and arc for later use
_argv = argv;
_argc = argc;
StrDict::SetArgv(argc, argv);
}
//
// Look for an extended command and run it if found.
//
void
pxClient::Run( const char *func, bool tagged, bool CaseSensitive, int ServerLevel, ClientUser* ui )
{
//ClientApi api;
StrRef cmd( func );
pxBaseCommand* command = 0;
// special treatment for help
if (cmd == "help")
{
helpCommand hc;
hc.Run(ui, this, _argv, _argc);
return;
}
// spin through the extended commands and see if we have a match
for (int i=0; i < N_COMMANDS; i++)
{
if (cmd.Compare(*ExtendedCommands[i]->CommandString()) == 0)
{
command = ExtendedCommands[i];
}
}
if (command)
{
if (tagged)
command->SetTag();
if (CaseSensitive)
command->SetNoCase();
command->SetServerLevel(ServerLevel);
// We have an extended command, run it
command->Run(ui, this, _argv, _argc);
} else {
//this->StrDict::SetArgv( _argc, _argv );
// Standard command, run
ClientApi::Run( func, ui );
}
return;
} | # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #4 | 6351 | Shawn Hladky |
px: fixing -X flag. fixing help commands |
||
| #3 | 6348 | Shawn Hladky | px: fixing -x flag for extended commands | ||
| #2 | 6332 | Shawn Hladky |
px: Updates to build script. Trying to fix -x option (still not right) Fix api download script |
||
| #1 | 6308 | Shawn Hladky | px: Initial submit |