Upstream tarball 9440
[amule.git] / src / TextClient.cpp
blob08352df7fd3eb0b27af1de85dd386ebb215ad9d1
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2008 Angel Vidal ( kry@amule.org )
5 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #ifdef HAVE_CONFIG_H
28 #include "config.h" // Needed for VERSION
29 #endif
31 #include <common/ClientVersion.h>
33 #include "TextClient.h"
35 #ifndef __WXMSW__
36 #include <unistd.h> // Do_not_auto_remove
37 #endif
40 //-------------------------------------------------------------------
43 //-------------------------------------------------------------------
45 #include <ec/cpp/ECSpecialTags.h>
47 #include <wx/tokenzr.h>
49 #include <common/Format.h> // Needed for CFormat
50 #include "OtherFunctions.h"
51 #include "KnownFile.h" // Needed for Priority Levels
52 #include "DataToText.cpp" // Needed for PriorityToStr
54 #define APP_INIT_SIZE_X 640
55 #define APP_INIT_SIZE_Y 480
57 #define theApp (*((CamulecmdApp*)wxTheApp))
59 //-------------------------------------------------------------------
61 enum {
62 CMD_ID_STATUS,
63 CMD_ID_RESUME,
64 CMD_ID_PAUSE,
65 CMD_ID_PRIORITY_LOW,
66 CMD_ID_PRIORITY_NORMAL,
67 CMD_ID_PRIORITY_HIGH,
68 CMD_ID_PRIORITY_AUTO,
69 CMD_ID_CANCEL,
70 CMD_ID_CONNECT,
71 CMD_ID_CONNECT_ED2K,
72 CMD_ID_CONNECT_KAD,
73 CMD_ID_DISCONNECT,
74 CMD_ID_DISCONNECT_ED2K,
75 CMD_ID_DISCONNECT_KAD,
76 CMD_ID_RELOAD_SHARED,
77 CMD_ID_RELOAD_IPFILTER,
78 CMD_ID_SET_IPFILTER_ON,
79 CMD_ID_SET_IPFILTER_OFF,
80 CMD_ID_SET_IPFILTER_CLIENTS_ON,
81 CMD_ID_SET_IPFILTER_CLIENTS_OFF,
82 CMD_ID_SET_IPFILTER_SERVERS_ON,
83 CMD_ID_SET_IPFILTER_SERVERS_OFF,
84 CMD_ID_SET_IPFILTER_LEVEL,
85 CMD_ID_GET_IPFILTER,
86 CMD_ID_GET_IPFILTER_STATE,
87 CMD_ID_GET_IPFILTER_STATE_CLIENTS,
88 CMD_ID_GET_IPFILTER_STATE_SERVERS,
89 CMD_ID_GET_IPFILTER_LEVEL,
90 CMD_ID_SHOW_UL,
91 CMD_ID_SHOW_DL,
92 CMD_ID_SHOW_LOG,
93 CMD_ID_SHOW_SERVERS,
94 CMD_ID_SHOW_SHARED,
95 CMD_ID_RESET_LOG,
96 CMD_ID_SHUTDOWN,
97 CMD_ID_ADDLINK,
98 CMD_ID_SET_BWLIMIT_UP,
99 CMD_ID_SET_BWLIMIT_DOWN,
100 CMD_ID_GET_BWLIMITS,
101 CMD_ID_STATTREE,
102 CMD_ID_SEARCH,
103 CMD_ID_SEARCH_GLOBAL,
104 CMD_ID_SEARCH_LOCAL,
105 CMD_ID_SEARCH_KAD,
106 CMD_ID_SEARCH_RESULTS,
107 CMD_ID_SEARCH_PROGRESS,
108 CMD_ID_DOWNLOAD,
109 // IDs for deprecated commands
110 CMD_ID_SET_IPFILTER
114 // method to create a SearchFile
115 SearchFile::SearchFile(CEC_SearchFile_Tag *tag)
117 nHash = tag->FileHash();
118 sHash = nHash.Encode();
119 sFileName = tag->FileName();
120 lFileSize = tag->SizeFull();
121 lSourceCount = tag->SourceCount();
122 bPresent = tag->AlreadyHave();
125 //-------------------------------------------------------------------
126 IMPLEMENT_APP (CamulecmdApp)
127 //-------------------------------------------------------------------
129 void CamulecmdApp::OnInitCmdLine(wxCmdLineParser& parser)
131 CaMuleExternalConnector::OnInitCmdLine(parser);
132 parser.AddOption(wxT("c"), wxT("command"),
133 _("Execute <str> and exit."),
134 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
137 bool CamulecmdApp::OnCmdLineParsed(wxCmdLineParser& parser)
139 m_HasCmdOnCmdLine = parser.Found(wxT("command"), &m_CmdString);
140 m_interactive = !m_HasCmdOnCmdLine;
141 return CaMuleExternalConnector::OnCmdLineParsed(parser);
144 void CamulecmdApp::TextShell(const wxString& prompt)
146 if (m_HasCmdOnCmdLine)
147 Parse_Command(m_CmdString);
148 else
149 CaMuleExternalConnector::TextShell(prompt);
152 int CamulecmdApp::ProcessCommand(int CmdId)
154 wxString args = GetCmdArgs();
155 CECPacket *request = 0;
156 std::list<CECPacket *> request_list;
157 int tmp_int = 0;
158 EC_SEARCH_TYPE search_type = EC_SEARCH_KAD;
160 // Implementation of the deprecated command 'SetIPFilter'.
161 if (CmdId == CMD_ID_SET_IPFILTER) {
162 if ( ! args.IsEmpty() ) {
163 if (args.IsSameAs(wxT("ON"), false)) {
164 CmdId = CMD_ID_SET_IPFILTER_ON;
165 } else if (args.IsSameAs(wxT("OFF"), false)) {
166 CmdId = CMD_ID_SET_IPFILTER_OFF;
167 } else {
168 return CMD_ERR_INVALID_ARG;
170 } else {
171 CmdId = CMD_ID_GET_IPFILTER_STATE;
175 switch (CmdId) {
176 case CMD_ID_STATUS:
177 request_list.push_back(new CECPacket(EC_OP_STAT_REQ, EC_DETAIL_CMD));
178 break;
180 case CMD_ID_SHUTDOWN:
181 request_list.push_back(new CECPacket(EC_OP_SHUTDOWN));
182 break;
184 case CMD_ID_CONNECT:
185 if ( !args.IsEmpty() ) {
186 unsigned int ip[4];
187 unsigned int port;
188 // Not much we can do against this unicode2char.
189 int result = sscanf(unicode2char(args), "%d.%d.%d.%d:%d", &ip[0], &ip[1], &ip[2], &ip[3], &port);
190 if (result != 5) {
191 // Try to resolve DNS -- good for dynamic IP servers
192 wxString serverName(args.BeforeFirst(wxT(':')));
193 long lPort;
194 bool ok = args.AfterFirst(wxT(':')).ToLong(&lPort);
195 port = (unsigned int)lPort;
196 wxIPV4address a;
197 a.Hostname(serverName);
198 a.Service(port);
199 result = sscanf(unicode2char(a.IPAddress()), "%d.%d.%d.%d", &ip[0], &ip[1], &ip[2], &ip[3]);
200 if (serverName.IsEmpty() || !ok || (result != 4)) {
201 Show(_("Invalid IP format. Use xxx.xxx.xxx.xxx:xxxx\n"));
202 return 0;
205 EC_IPv4_t addr;
206 addr.m_ip[0] = ip[0];
207 addr.m_ip[1] = ip[1];
208 addr.m_ip[2] = ip[2];
209 addr.m_ip[3] = ip[3];
210 addr.m_port = port;
211 request = new CECPacket(EC_OP_SERVER_CONNECT);
212 request->AddTag(CECTag(EC_TAG_SERVER, addr));
213 request_list.push_back(request);
214 } else {
215 request_list.push_back(new CECPacket(EC_OP_CONNECT));
217 break;
219 case CMD_ID_CONNECT_ED2K:
220 request_list.push_back(new CECPacket(EC_OP_SERVER_CONNECT));
221 break;
223 case CMD_ID_CONNECT_KAD:
224 request_list.push_back(new CECPacket(EC_OP_KAD_START));
225 break;
227 case CMD_ID_DISCONNECT:
228 request_list.push_back(new CECPacket(EC_OP_DISCONNECT));
229 break;
231 case CMD_ID_DISCONNECT_ED2K:
232 request_list.push_back(new CECPacket(EC_OP_SERVER_DISCONNECT));
233 break;
235 case CMD_ID_DISCONNECT_KAD:
236 request_list.push_back(new CECPacket(EC_OP_KAD_STOP));
237 break;
239 case CMD_ID_RELOAD_SHARED:
240 request_list.push_back(new CECPacket(EC_OP_SHAREDFILES_RELOAD));
241 break;
243 case CMD_ID_RELOAD_IPFILTER:
244 request_list.push_back(new CECPacket(EC_OP_IPFILTER_RELOAD));
245 break;
247 case CMD_ID_SET_IPFILTER_ON:
248 case CMD_ID_SET_IPFILTER_CLIENTS_ON:
249 case CMD_ID_SET_IPFILTER_SERVERS_ON:
250 tmp_int = 1;
251 case CMD_ID_SET_IPFILTER_OFF:
252 case CMD_ID_SET_IPFILTER_CLIENTS_OFF:
253 case CMD_ID_SET_IPFILTER_SERVERS_OFF:
255 if (CmdId == CMD_ID_SET_IPFILTER_CLIENTS_ON || CmdId == CMD_ID_SET_IPFILTER_CLIENTS_OFF) {
256 CmdId = CMD_ID_GET_IPFILTER_STATE_CLIENTS;
257 } else if (CmdId == CMD_ID_SET_IPFILTER_SERVERS_ON || CmdId == CMD_ID_SET_IPFILTER_SERVERS_OFF) {
258 CmdId = CMD_ID_GET_IPFILTER_STATE_SERVERS;
259 } else {
260 CmdId = CMD_ID_GET_IPFILTER_STATE;
263 request = new CECPacket(EC_OP_SET_PREFERENCES);
264 CECEmptyTag prefs(EC_TAG_PREFS_SECURITY);
265 if (CmdId != CMD_ID_GET_IPFILTER_STATE_SERVERS) {
266 prefs.AddTag(CECTag(EC_TAG_IPFILTER_CLIENTS, (uint8)tmp_int));
268 if (CmdId != CMD_ID_GET_IPFILTER_STATE_CLIENTS) {
269 prefs.AddTag(CECTag(EC_TAG_IPFILTER_SERVERS, (uint8)tmp_int));
271 request->AddTag(prefs);
272 request_list.push_back(request);
274 case CMD_ID_GET_IPFILTER:
275 case CMD_ID_GET_IPFILTER_STATE:
276 case CMD_ID_GET_IPFILTER_STATE_CLIENTS:
277 case CMD_ID_GET_IPFILTER_STATE_SERVERS:
278 request = new CECPacket(EC_OP_GET_PREFERENCES);
279 request->AddTag(CECTag(EC_TAG_SELECT_PREFS, (uint32)EC_PREFS_SECURITY));
280 request_list.push_back(request);
281 break;
283 case CMD_ID_SET_IPFILTER_LEVEL:
284 if (!args.IsEmpty()) // This 'if' must stay as long as we support the deprecated 'IPLevel' command.
286 unsigned long int level = 0;
287 if (args.ToULong(&level) == true && level < 256) {
288 request = new CECPacket(EC_OP_SET_PREFERENCES);
289 CECEmptyTag prefs(EC_TAG_PREFS_SECURITY);
290 prefs.AddTag(CECTag(EC_TAG_IPFILTER_LEVEL, (uint8)level));
291 request->AddTag(prefs);
292 request_list.push_back(request);
293 } else {
294 return CMD_ERR_INVALID_ARG;
297 CmdId = CMD_ID_GET_IPFILTER_LEVEL;
298 case CMD_ID_GET_IPFILTER_LEVEL:
299 request = new CECPacket(EC_OP_GET_PREFERENCES);
300 request->AddTag(CECTag(EC_TAG_SELECT_PREFS, (uint32)EC_PREFS_SECURITY));
301 request_list.push_back(request);
302 break;
304 case CMD_ID_PAUSE:
305 case CMD_ID_CANCEL:
306 case CMD_ID_RESUME:
308 if ( args.IsEmpty() ) {
309 Show(_("This command requires an argument. Valid arguments: 'all', filename, or a number.\n"));
310 return 0;
311 } else {
312 wxStringTokenizer argsTokenizer(args);
313 wxString token;
314 CMD4Hash hash;
316 // Grab the entire dl queue right away
317 CECPacket request_all(EC_OP_GET_DLOAD_QUEUE, EC_DETAIL_CMD);
318 const CECPacket *reply_all = SendRecvMsg_v2(&request_all);
320 if (reply_all) {
321 switch(CmdId) {
322 case CMD_ID_PAUSE:
323 request = new CECPacket(EC_OP_PARTFILE_PAUSE); break;
324 case CMD_ID_CANCEL:
325 request = new CECPacket(EC_OP_PARTFILE_DELETE); break;
326 case CMD_ID_RESUME:
327 request = new CECPacket(EC_OP_PARTFILE_RESUME); break;
328 default: wxFAIL;
331 // We loop through all the arguments
332 while(argsTokenizer.HasMoreTokens()) {
333 token=argsTokenizer.GetNextToken();
335 // If the user requested all, then we select all files and exit the loop
336 // since there is little point to add anything more to "everything"
337 if( token == wxT("all") ) {
338 for (size_t i = 0; i < reply_all->GetTagCount(); i++) {
339 const CECTag *tag = reply_all->GetTagByIndex(i);
340 if (tag) {
341 request->AddTag(CECTag(EC_TAG_PARTFILE, tag->GetMD4Data()));
343 break;
345 } else if ( hash.Decode(token.Trim(false).Trim(true)) ) {
346 if ( !hash.IsEmpty() ) {
347 Show(_("Processing by hash: "+token+wxT("\n")));
348 request->AddTag(CECTag(EC_TAG_PARTFILE, hash));
350 } else {
351 // Go through the dl queue and look at each filename
352 for (size_t i = 0; i < reply_all->GetTagCount(); i++) {
353 CEC_PartFile_Tag *tag = (CEC_PartFile_Tag *)reply_all->GetTagByIndex(i);
354 if (tag) {
355 wxString partmetname = tag->PartMetName();
357 // We check for filename, XXX.pat.met, XXX.part, XXX
358 if( tag->FileName() == token ||
359 partmetname == token ||
360 partmetname.Truncate(partmetname.Len()-4) == token ||
361 partmetname.Truncate(partmetname.Len()-5) == token) {
362 Show(_("Processing by filename: "+token+wxT("\n")));
363 request->AddTag(CECTag(EC_TAG_PARTFILE, tag->GetMD4Data()));
367 } // End of filename check else
368 } // End of argument token loop
370 request_list.push_back(request);
372 delete reply_all;
374 } // End of dl queue processing
376 } // end of command processing
377 break;
380 case CMD_ID_PRIORITY_LOW:
381 case CMD_ID_PRIORITY_NORMAL:
382 case CMD_ID_PRIORITY_HIGH:
383 case CMD_ID_PRIORITY_AUTO:
384 if ( args.IsEmpty() ) {
385 Show(_("This command requires an argument. Valid arguments: a file hash.\n"));
386 return 0;
387 } else {
388 CMD4Hash hash;
389 if (hash.Decode(args.Trim(false).Trim(true))) {
390 if (!hash.IsEmpty()) {
391 request = new CECPacket(EC_OP_PARTFILE_PRIO_SET);
392 CECTag hashtag(EC_TAG_PARTFILE, hash);
393 switch(CmdId) {
394 case CMD_ID_PRIORITY_LOW:
395 hashtag.AddTag(CECTag(EC_TAG_PARTFILE_PRIO, (uint8)PR_LOW));
396 break;
397 case CMD_ID_PRIORITY_NORMAL:
398 hashtag.AddTag(CECTag(EC_TAG_PARTFILE_PRIO, (uint8)PR_NORMAL));
399 break;
400 case CMD_ID_PRIORITY_HIGH:
401 hashtag.AddTag(CECTag(EC_TAG_PARTFILE_PRIO, (uint8)PR_HIGH));
402 break;
403 case CMD_ID_PRIORITY_AUTO:
404 hashtag.AddTag(CECTag(EC_TAG_PARTFILE_PRIO, (uint8)PR_AUTO));
405 break;
406 default: wxFAIL;
408 request->AddTag(hashtag);
409 request_list.push_back(request);
410 } else {
411 Show(_("Not a valid number\n"));
412 return 0;
414 } else {
415 Show(_("Not a valid hash (length should be exactly 32 chars)\n"));
416 return 0;
419 break;
421 case CMD_ID_SHOW_UL:
422 request_list.push_back(new CECPacket(EC_OP_GET_ULOAD_QUEUE));
423 break;
425 case CMD_ID_SHOW_DL:
426 request_list.push_back(new CECPacket(EC_OP_GET_DLOAD_QUEUE));
427 break;
429 case CMD_ID_SHOW_LOG:
430 request_list.push_back(new CECPacket(EC_OP_GET_LOG));
431 break;
433 case CMD_ID_SHOW_SERVERS:
434 request_list.push_back(new CECPacket(EC_OP_GET_SERVER_LIST, EC_DETAIL_CMD));
435 break;
437 case CMD_ID_RESET_LOG:
438 request_list.push_back(new CECPacket(EC_OP_RESET_LOG));
439 break;
441 case CMD_ID_ADDLINK:
442 if (args.compare(0, 7, wxT("ed2k://")) == 0) {
443 //aMule doesn't like AICH links without |/| in front of h=
444 if (args.Find(wxT("|h=")) > -1 && args.Find(wxT("|/|h=")) == -1) {
445 args.Replace(wxT("|h="),wxT("|/|h="));
448 request = new CECPacket(EC_OP_ADD_LINK);
449 request->AddTag(CECTag(EC_TAG_STRING, args));
450 request_list.push_back(request);
451 break;
453 case CMD_ID_SET_BWLIMIT_UP:
454 tmp_int = EC_TAG_CONN_MAX_UL - EC_TAG_CONN_MAX_DL;
455 case CMD_ID_SET_BWLIMIT_DOWN:
456 tmp_int += EC_TAG_CONN_MAX_DL;
458 unsigned long int limit;
459 if (args.ToULong(&limit)) {
460 request = new CECPacket(EC_OP_SET_PREFERENCES);
461 CECEmptyTag prefs(EC_TAG_PREFS_CONNECTIONS);
462 prefs.AddTag(CECTag(tmp_int, (uint16)limit));
463 request->AddTag(prefs);
464 request_list.push_back(request);
465 } else {
466 return CMD_ERR_INVALID_ARG;
469 case CMD_ID_GET_BWLIMITS:
470 request = new CECPacket(EC_OP_GET_PREFERENCES);
471 request->AddTag(CECTag(EC_TAG_SELECT_PREFS, (uint32)EC_PREFS_CONNECTIONS));
472 request_list.push_back(request);
473 break;
475 case CMD_ID_STATTREE:
476 request = new CECPacket(EC_OP_GET_STATSTREE);
477 if (!args.IsEmpty()) {
478 unsigned long int max_versions;
479 if (args.ToULong(&max_versions)) {
480 if (max_versions < 256) {
481 request->AddTag(CECTag(EC_TAG_STATTREE_CAPPING, (uint8)max_versions));
482 } else {
483 delete request;
484 return CMD_ERR_INVALID_ARG;
486 } else {
487 delete request;
488 return CMD_ERR_INVALID_ARG;
491 request_list.push_back(request);
492 break;
493 case CMD_ID_SEARCH_GLOBAL:
494 search_type = EC_SEARCH_GLOBAL;
495 case CMD_ID_SEARCH_LOCAL:
496 if (search_type != EC_SEARCH_GLOBAL){
497 search_type = EC_SEARCH_LOCAL;
499 case CMD_ID_SEARCH_KAD:
500 if (search_type != EC_SEARCH_GLOBAL && search_type != EC_SEARCH_LOCAL){
501 search_type = EC_SEARCH_KAD;
503 if (!args.IsEmpty())
505 wxString search = args;
506 wxString type = wxT("");
507 wxString extention = wxT("");
508 uint32 avail = 0;
509 uint32 min_size = 0;
510 uint32 max_size = 0;
512 request = new CECPacket(EC_OP_SEARCH_START);
513 request->AddTag(CEC_Search_Tag (search, search_type, type, extention, avail, min_size, max_size));
514 request_list.push_back(request);
516 break;
517 case CMD_ID_SEARCH:
518 printf("No search type defined.\nType 'help search' to get more help.\n");
519 break;
522 case CMD_ID_SEARCH_RESULTS:
523 request_list.push_back(new CECPacket(EC_OP_SEARCH_RESULTS, EC_DETAIL_FULL));
524 break;
526 case CMD_ID_SEARCH_PROGRESS:
527 request_list.push_back(new CECPacket(EC_OP_SEARCH_PROGRESS));
528 break;
530 case CMD_ID_DOWNLOAD:
531 if (!args.IsEmpty())
533 unsigned long int id = 0;
534 if (args.ToULong(&id) == true && id < m_Results_map.size()) {
536 SearchFile* file = m_Results_map[id];
537 printf("Download File: %lu %s\n", id, (const char*)unicode2char(file->sFileName));
538 request = new CECPacket(EC_OP_DOWNLOAD_SEARCH_RESULT);
539 // get with id the hash and category=0
540 uint32 category = 0;
541 CECTag hashtag(EC_TAG_PARTFILE, file->nHash);
542 hashtag.AddTag(CECTag(EC_TAG_PARTFILE_CAT, category));
543 request->AddTag(hashtag);
544 request_list.push_back(request);
545 } else {
546 return CMD_ERR_INVALID_ARG;
549 break;
551 default:
552 return CMD_ERR_PROCESS_CMD;
555 m_last_cmd_id = CmdId;
557 if ( ! request_list.empty() ) {
558 std::list<CECPacket *>::iterator it = request_list.begin();
559 while ( it != request_list.end() ) {
560 CECPacket *curr = *it++;
561 const CECPacket *reply = SendRecvMsg_v2(curr);
562 delete curr;
563 if ( reply ) {
564 Process_Answer_v2(reply);
565 delete reply;
568 request_list.resize(0);
571 if (CmdId == CMD_ID_SHUTDOWN)
572 return CMD_ID_QUIT;
573 else
574 return CMD_OK;
578 * Method to show the results in the console
580 void CamulecmdApp::ShowResults(CResultMap results_map)
582 unsigned int name_max = 80;
583 unsigned int mb_max = 5;
584 unsigned int nr_max = 5;
585 unsigned long int id = 0;
586 wxString output, name, sources, mb , kb;
588 printf("Nr. Filename: Size(MB): Sources: \n");
589 printf("-----------------------------------------------------------------------------------------------------------\n");
591 for( std::map<unsigned long int,SearchFile*>::iterator iter = results_map.begin(); iter != results_map.end(); iter++ ) {
592 id = (*iter).first;
593 SearchFile* file = (*iter).second;
595 output.Printf(wxT("%i. "), id);
596 output = output.SubString(0, nr_max).Append(file->sFileName).Append(' ', name_max);
597 mb.Printf(wxT(" %d"), file->lFileSize/1024/1024);
598 kb.Printf(wxT(".%d"), file->lFileSize/1024%1024);
599 output = output.SubString(0, nr_max + name_max + mb_max - mb.Length() ).Append(mb).Append(kb);
600 printf("%s %ld\n",(const char*)unicode2char(output), file->lSourceCount );
605 // Formats a statistics (sub)tree to text
606 wxString StatTree2Text(CEC_StatTree_Node_Tag *tree, int depth)
608 if (!tree) {
609 return wxEmptyString;
611 wxString result = wxString(wxChar(' '), depth) + tree->GetDisplayString() + wxT("\n");
612 for (size_t i = 0; i < tree->GetTagCount(); ++i) {
613 CEC_StatTree_Node_Tag *tmp = (CEC_StatTree_Node_Tag*)tree->GetTagByIndex(i);
614 if (tmp->GetTagName() == EC_TAG_STATTREE_NODE) {
615 result += StatTree2Text(tmp, depth + 1);
618 return result;
622 * Format EC packet into text form for output to console
624 void CamulecmdApp::Process_Answer_v2(const CECPacket *response)
626 wxString s;
627 wxString msgFailedUnknown(_("Request failed with an unknown error."));
628 wxASSERT(response);
629 switch (response->GetOpCode()) {
630 case EC_OP_NOOP:
631 s << _("Operation was successful.");
632 break;
633 case EC_OP_FAILED:
634 if (response->GetTagCount()) {
635 const CECTag *tag = response->GetTagByIndex(0);
636 if (tag) {
637 s << CFormat(_("Request failed with the following error: %s")) % wxGetTranslation(tag->GetStringData());
638 } else {
639 s << msgFailedUnknown;
641 } else {
642 s << msgFailedUnknown;
644 break;
645 case EC_OP_SET_PREFERENCES:
647 const CECTag *tab = response->GetTagByNameSafe(EC_TAG_PREFS_SECURITY);
648 const CECTag *ipfilterLevel = tab->GetTagByName(EC_TAG_IPFILTER_LEVEL);
649 if (ipfilterLevel) {
650 if (m_last_cmd_id == CMD_ID_GET_IPFILTER ||
651 m_last_cmd_id == CMD_ID_GET_IPFILTER_STATE ||
652 m_last_cmd_id == CMD_ID_GET_IPFILTER_STATE_CLIENTS) {
653 s << wxString::Format(_("IP filtering for clients is %s.\n"),
654 (tab->GetTagByName(EC_TAG_IPFILTER_CLIENTS) == NULL) ? _("OFF") : _("ON"));
656 if (m_last_cmd_id == CMD_ID_GET_IPFILTER ||
657 m_last_cmd_id == CMD_ID_GET_IPFILTER_STATE ||
658 m_last_cmd_id == CMD_ID_GET_IPFILTER_STATE_SERVERS) {
659 s << wxString::Format(_("IP filtering for servers is %s.\n"),
660 (tab->GetTagByName(EC_TAG_IPFILTER_SERVERS) == NULL) ? _("OFF") : _("ON"));
662 if (m_last_cmd_id == CMD_ID_GET_IPFILTER ||
663 m_last_cmd_id == CMD_ID_GET_IPFILTER_LEVEL) {
664 s << wxString::Format(_("Current IPFilter Level is %d.\n"),
665 ipfilterLevel->GetInt());
668 tab = response->GetTagByNameSafe(EC_TAG_PREFS_CONNECTIONS);
669 const CECTag *connMaxUL = tab->GetTagByName(EC_TAG_CONN_MAX_UL);
670 const CECTag *connMaxDL = tab->GetTagByName(EC_TAG_CONN_MAX_DL);
671 if (connMaxUL && connMaxDL) {
672 s << wxString::Format(_("Bandwidth limits: Up: %u kB/s, Down: %u kB/s.\n"),
673 (uint16)connMaxUL->GetInt(),
674 (uint16)connMaxDL->GetInt());
677 break;
678 case EC_OP_STRINGS:
679 for (size_t i = 0; i < response->GetTagCount(); ++i) {
680 const CECTag *tag = response->GetTagByIndex(i);
681 if (tag) {
682 s << tag->GetStringData() << wxT("\n");
683 } else {
686 break;
687 case EC_OP_STATS: {
688 CEC_ConnState_Tag *connState = (CEC_ConnState_Tag*)response->GetTagByName(EC_TAG_CONNSTATE);
689 if (connState) {
690 s << _("eD2k") << wxT(": ");
691 if (connState->IsConnectedED2K()) {
692 CECTag *server = connState->GetTagByName(EC_TAG_SERVER);
693 CECTag *serverName = server ? server->GetTagByName(EC_TAG_SERVER_NAME) : NULL;
694 if (server && serverName) {
695 s << CFormat(_("Connected to %s %s %s")) %
696 serverName->GetStringData() %
697 server->GetIPv4Data().StringIP() %
698 (connState->HasLowID() ? _("with LowID") : _("with HighID"));
700 } else if (connState->IsConnectingED2K()) {
701 s << _("Now connecting");
702 } else {
703 s << _("Not connected");
705 s << wxT('\n') << _("Kad") << wxT(": ");
706 if (connState->IsKadRunning()) {
707 if (connState->IsConnectedKademlia()) {
708 s << _("Connected") << wxT(" (");
709 if (connState->IsKadFirewalled()) {
710 s << _("firewalled");
711 } else {
712 s << _("ok");
714 s << wxT(')');
715 } else {
716 s << _("Not connected");
718 } else {
719 s << _("Not running");
721 s << wxT('\n');
723 const CECTag *tmpTag;
724 if ((tmpTag = response->GetTagByName(EC_TAG_STATS_DL_SPEED)) != 0) {
725 s << CFormat(_("\nDownload:\t%s")) % CastItoSpeed(tmpTag->GetInt());
727 if ((tmpTag = response->GetTagByName(EC_TAG_STATS_UL_SPEED)) != 0) {
728 s << CFormat(_("\nUpload:\t%s")) % CastItoSpeed(tmpTag->GetInt());
730 if ((tmpTag = response->GetTagByName(EC_TAG_STATS_UL_QUEUE_LEN)) != 0) {
731 s << wxString::Format(_("\nClients in queue:\t%d\n"), tmpTag->GetInt());
733 if ((tmpTag = response->GetTagByName(EC_TAG_STATS_TOTAL_SRC_COUNT)) != 0) {
734 s << wxString::Format(_("\nTotal sources:\t%d\n"), tmpTag->GetInt());
736 break;
738 case EC_OP_DLOAD_QUEUE:
739 for (size_t i = 0; i < response->GetTagCount(); ++i) {
740 CEC_PartFile_Tag *tag =
741 (CEC_PartFile_Tag *)response->GetTagByIndex(i);
742 if (tag) {
743 uint64 filesize, donesize;
744 filesize = tag->SizeFull();
745 donesize = tag->SizeDone();
746 s << tag->FileHashString() << wxT(" ") <<
747 tag->FileName() <<
748 wxString::Format(wxT("\n\t [%.1f%%] %4i/%4i "),
749 ((float)donesize) / ((float)filesize)*100.0,
750 (int)tag->SourceCount() - (int)tag->SourceNotCurrCount(),
751 (int)tag->SourceCount()) <<
752 ((int)tag->SourceCountA4AF() ? wxString::Format(wxT("+%2.2i "),(int)tag->SourceCountA4AF()) : wxString(wxT(" "))) <<
753 ((int)tag->SourceXferCount() ? wxString::Format(wxT("(%2.2i) - "),(int)tag->SourceXferCount()) : wxString(wxT(" - "))) <<
754 tag->GetFileStatusString();
755 s << wxT(" - ") << tag->PartMetName();
756 if (tag->Prio() < 10) {
757 s << wxT(" - ") << PriorityToStr((int)tag->Prio(), 0);
758 } else {
759 s << wxT(" - ") << PriorityToStr((tag->Prio() - 10), 1);
761 if ( tag->SourceXferCount() > 0) {
762 s << wxT(" - ") + CastItoSpeed(tag->Speed());
764 s << wxT("\n");
767 break;
768 case EC_OP_ULOAD_QUEUE:
769 for (size_t i = 0; i < response->GetTagCount(); ++i) {
770 const CECTag *tag = response->GetTagByIndex(i);
771 const CECTag *clientName = tag ? tag->GetTagByName(EC_TAG_CLIENT_NAME) : NULL;
772 const CECTag *partfileName = tag ? tag->GetTagByName(EC_TAG_PARTFILE_NAME) : NULL;
773 const CECTag *partfileSizeXfer = tag ? tag->GetTagByName(EC_TAG_PARTFILE_SIZE_XFER) : NULL;
774 const CECTag *partfileSpeed = tag ? tag->GetTagByName(EC_TAG_CLIENT_UP_SPEED) : NULL;
775 if (tag && clientName && partfileName && partfileSizeXfer && partfileSpeed) {
776 s << wxT("\n") <<
777 wxString::Format(wxT("%10u "), tag->GetInt()) <<
778 clientName->GetStringData() << wxT(" ") <<
779 partfileName->GetStringData() << wxT(" ") <<
780 CastItoXBytes(partfileSizeXfer->GetInt()) << wxT(" ") <<
781 CastItoSpeed(partfileSpeed->GetInt());
784 break;
785 case EC_OP_LOG:
786 for (size_t i = 0; i < response->GetTagCount(); ++i) {
787 const CECTag *tag = response->GetTagByIndex(i);
788 if (tag) {
789 s << tag->GetStringData() << wxT("\n");
790 } else {
793 break;
794 case EC_OP_SERVER_LIST:
795 for (size_t i = 0; i < response->GetTagCount(); i++) {
796 const CECTag *tag = response->GetTagByIndex(i);
797 const CECTag *serverName = tag ? tag->GetTagByName(EC_TAG_SERVER_NAME) : NULL;
798 if (tag && serverName) {
799 wxString ip = tag->GetIPv4Data().StringIP();
800 ip.Append(' ', 24 - ip.Length());
801 s << ip << serverName->GetStringData() << wxT("\n");
804 break;
805 case EC_OP_STATSTREE:
806 s << StatTree2Text((CEC_StatTree_Node_Tag*)response->GetTagByName(EC_TAG_STATTREE_NODE), 0);
807 break;
809 case EC_OP_SEARCH_RESULTS:
810 m_Results_map.clear();
811 s << wxString::Format(_("Number of search results: %i\n"),response->GetTagCount());
812 for (size_t i = 0; i < response->GetTagCount(); i++) {
813 CEC_SearchFile_Tag *tag = (CEC_SearchFile_Tag *)response->GetTagByIndex(i);
814 //printf("Tag FileName: %s \n",(const char*)unicode2char(tag->FileName()));
815 //if (tag != NULL)
816 m_Results_map[i] = new SearchFile(tag);
817 //const CECTag *tag = response->GetTagByIndex(i);
820 ShowResults(m_Results_map);
821 break;
823 case EC_OP_SEARCH_PROGRESS:
824 s << _("TODO - show progress of a search");
825 // gives compilation error!!
826 // const CECTag *tab = response->GetTagByNameSafe(EC_TAG_SEARCH_STATUS);
827 //s << wxString::Format(_("Search progress: %u %% \n"),(const char*)unicode2char(tab->GetStringData()));
828 break;
829 default:
830 s << wxString::Format(_("Received an unknown reply from the server, OpCode = %#x."), response->GetOpCode());
832 Process_Answer(s);
835 void CamulecmdApp::OnInitCommandSet()
837 CCommandTree *tmp;
838 CCommandTree *tmp2;
839 CCommandTree *tmp3;
841 CaMuleExternalConnector::OnInitCommandSet();
843 m_commands.AddCommand(wxT("Status"), CMD_ID_STATUS, wxTRANSLATE("Show short status information."),
844 wxTRANSLATE("Show connection status, current up/download speeds, etc.\n"), CMD_PARAM_NEVER);
846 m_commands.AddCommand(wxT("Statistics"), CMD_ID_STATTREE, wxTRANSLATE("Show full statistics tree."),
847 wxTRANSLATE("Optionally, a number in the range 0-255 can be passed as an argument to this\ncommand, which tells how many entries of the client version subtrees should be\nshown. Passing 0 or omitting it means 'unlimited'.\n\nExample: 'statistics 5' will show only the top 5 versions for each client type.\n"));
849 m_commands.AddCommand(wxT("Shutdown"), CMD_ID_SHUTDOWN, wxTRANSLATE("Shut down aMule."),
850 wxTRANSLATE("Shut down the remote running core (amule/amuled).\nThis will also shut down the text client, since it is unusable without a\nrunning core.\n"), CMD_PARAM_NEVER);
852 tmp = m_commands.AddCommand(wxT("Reload"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Reloads the given object."), wxEmptyString, CMD_PARAM_NEVER);
853 tmp->AddCommand(wxT("Shared"), CMD_ID_RELOAD_SHARED, wxTRANSLATE("Reloads shared files list."), wxEmptyString, CMD_PARAM_NEVER);
854 tmp->AddCommand(wxT("IPFilter"), CMD_ID_RELOAD_IPFILTER, wxTRANSLATE("Reloads IP Filter table from file."), wxEmptyString, CMD_PARAM_NEVER);
856 tmp = m_commands.AddCommand(wxT("Connect"), CMD_ID_CONNECT, wxTRANSLATE("Connect to the network."),
857 wxTRANSLATE("This will connect to all networks that are enabled in Preferences.\nYou may also optionally specify a server address in IP:Port form, to connect to\nthat server only. The IP must be a dotted decimal IPv4 address,\nor a resolvable DNS name."), CMD_PARAM_OPTIONAL);
858 tmp->AddCommand(wxT("ED2K"), CMD_ID_CONNECT_ED2K, wxTRANSLATE("Connect to eD2k only."), wxEmptyString, CMD_PARAM_NEVER);
859 tmp->AddCommand(wxT("Kad"), CMD_ID_CONNECT_KAD, wxTRANSLATE("Connect to Kad only."), wxEmptyString, CMD_PARAM_NEVER);
861 tmp = m_commands.AddCommand(wxT("Disconnect"), CMD_ID_DISCONNECT, wxTRANSLATE("Disconnect from the network."),
862 wxTRANSLATE("This will disconnect from all networks that are currently connected.\n"), CMD_PARAM_NEVER);
863 tmp->AddCommand(wxT("ED2K"), CMD_ID_DISCONNECT_ED2K, wxTRANSLATE("Disconnect from eD2k only."), wxEmptyString, CMD_PARAM_NEVER);
864 tmp->AddCommand(wxT("Kad"), CMD_ID_DISCONNECT_KAD, wxTRANSLATE("Disconnect from Kad only."), wxEmptyString, CMD_PARAM_NEVER);
866 m_commands.AddCommand(wxT("Add"), CMD_ID_ADDLINK, wxTRANSLATE("Adds an eD2k or magnet link to core."),
867 wxTRANSLATE("The eD2k link to be added can be:\n*) a file link (ed2k://|file|...), it will be added to the download queue,\n*) a server link (ed2k://|server|...), it will be added to the server list,\n*) or a serverlist link, in which case all servers in the list will be added to the\n server list.\n\nThe magnet link must contain the eD2k hash and file length.\n"), CMD_PARAM_ALWAYS);
869 tmp = m_commands.AddCommand(wxT("Set"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Set a preference value."),
870 wxEmptyString, CMD_PARAM_NEVER);
872 tmp2 = tmp->AddCommand(wxT("IPFilter"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Set IPFilter preferences."), wxEmptyString, CMD_PARAM_NEVER);
873 tmp2->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_ON, wxTRANSLATE("Turn IP filtering on for both clients and servers."), wxEmptyString, CMD_PARAM_NEVER);
874 tmp2->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_OFF, wxTRANSLATE("Turn IP filtering off for both clients and servers."), wxEmptyString, CMD_PARAM_NEVER);
875 tmp3 = tmp2->AddCommand(wxT("Clients"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Enable/Disable IP filtering for clients."), wxEmptyString, CMD_PARAM_NEVER);
876 tmp3->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_CLIENTS_ON, wxTRANSLATE("Turn IP filtering on for clients."), wxEmptyString, CMD_PARAM_NEVER);
877 tmp3->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_CLIENTS_OFF, wxTRANSLATE("Turn IP filtering off for clients."), wxEmptyString, CMD_PARAM_NEVER);
878 tmp3 = tmp2->AddCommand(wxT("Servers"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Enable/Disable IP filtering for servers."), wxEmptyString, CMD_PARAM_NEVER);
879 tmp3->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_SERVERS_ON, wxTRANSLATE("Turn IP filtering on for servers."), wxEmptyString, CMD_PARAM_NEVER);
880 tmp3->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_SERVERS_OFF, wxTRANSLATE("Turn IP filtering off for servers."), wxEmptyString, CMD_PARAM_NEVER);
881 tmp2->AddCommand(wxT("Level"), CMD_ID_SET_IPFILTER_LEVEL, wxTRANSLATE("Select IP filtering level."),
882 wxTRANSLATE("Valid filtering levels are in the range 0-255, and it's default (initial)\nvalue is 127.\n"), CMD_PARAM_ALWAYS);
884 tmp2 = tmp->AddCommand(wxT("BwLimit"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Set bandwidth limits."),
885 wxTRANSLATE("The value given to these commands has to be in kilobytes/sec.\n"), CMD_PARAM_NEVER);
886 tmp2->AddCommand(wxT("Up"), CMD_ID_SET_BWLIMIT_UP, wxTRANSLATE("Set upload bandwidth limit."),
887 wxT("The given value must be in kilobytes/sec.\n"), CMD_PARAM_ALWAYS);
888 tmp2->AddCommand(wxT("Down"), CMD_ID_SET_BWLIMIT_DOWN, wxTRANSLATE("Set download bandwidth limit."),
889 wxT("The given value must be in kilobytes/sec.\n"), CMD_PARAM_ALWAYS);
891 tmp = m_commands.AddCommand(wxT("Get"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Get and display a preference value."),
892 wxEmptyString, CMD_PARAM_NEVER);
894 tmp2 = tmp->AddCommand(wxT("IPFilter"), CMD_ID_GET_IPFILTER, wxTRANSLATE("Get IPFilter preferences."), wxEmptyString, CMD_PARAM_NEVER);
895 tmp3 = tmp2->AddCommand(wxT("State"), CMD_ID_GET_IPFILTER_STATE, wxTRANSLATE("Get IPFilter state for both clients and servers."), wxEmptyString, CMD_PARAM_NEVER);
896 tmp3->AddCommand(wxT("Clients"), CMD_ID_GET_IPFILTER_STATE_CLIENTS, wxTRANSLATE("Get IPFilter state for clients only."), wxEmptyString, CMD_PARAM_NEVER);
897 tmp3->AddCommand(wxT("Servers"), CMD_ID_GET_IPFILTER_STATE_SERVERS, wxTRANSLATE("Get IPFilter state for servers only."), wxEmptyString, CMD_PARAM_NEVER);
898 tmp2->AddCommand(wxT("Level"), CMD_ID_GET_IPFILTER_LEVEL, wxTRANSLATE("Get IPFilter level."), wxEmptyString, CMD_PARAM_NEVER);
900 tmp->AddCommand(wxT("BwLimits"), CMD_ID_GET_BWLIMITS, wxTRANSLATE("Get bandwidth limits."), wxEmptyString, CMD_PARAM_NEVER);
902 tmp = m_commands.AddCommand(wxT("Search"), CMD_ID_SEARCH, wxTRANSLATE("Makes a search."),
903 wxTRANSLATE("A search type has to be specified by giving the type:\n GLOBAL\n LOCAL\n KAD\nExample: 'search kad file' will execute a kad search for \"file\".\n"), CMD_PARAM_ALWAYS);
904 tmp->AddCommand(wxT("global"), CMD_ID_SEARCH_GLOBAL, wxTRANSLATE("Executes a global search."), wxEmptyString, CMD_PARAM_ALWAYS);
905 tmp->AddCommand(wxT("local"), CMD_ID_SEARCH_LOCAL, wxTRANSLATE("Executes a local search"), wxEmptyString, CMD_PARAM_ALWAYS);
906 tmp->AddCommand(wxT("kad"), CMD_ID_SEARCH_KAD, wxTRANSLATE("Executes a kad search"), wxEmptyString, CMD_PARAM_ALWAYS);
908 m_commands.AddCommand(wxT("Results"), CMD_ID_SEARCH_RESULTS, wxTRANSLATE("Shows the results of the last search."),
909 wxTRANSLATE("Returns the results of the previous search.\n"), CMD_PARAM_NEVER);
911 m_commands.AddCommand(wxT("Progress"), CMD_ID_SEARCH_PROGRESS, wxTRANSLATE("Shows the progress of a search."),
912 wxTRANSLATE("Shows the progress of a search.\n"), CMD_PARAM_NEVER);
914 m_commands.AddCommand(wxT("Download"), CMD_ID_DOWNLOAD, wxTRANSLATE("Start downloading a file"),
915 wxTRANSLATE("The number of a file from the last search has to be given.\nExample: 'download 12' will start to download the file with the number 12 of the previous search.\n"), CMD_PARAM_ALWAYS);
919 // TODO: These commands below need implementation and/or rewrite!
922 m_commands.AddCommand(wxT("Pause"), CMD_ID_PAUSE, wxTRANSLATE("Pause download."),
923 wxEmptyString, CMD_PARAM_ALWAYS);
925 m_commands.AddCommand(wxT("Resume"), CMD_ID_RESUME, wxTRANSLATE("Resume download."),
926 wxEmptyString, CMD_PARAM_ALWAYS);
928 m_commands.AddCommand(wxT("Cancel"), CMD_ID_CANCEL, wxTRANSLATE("Cancel download."),
929 wxEmptyString, CMD_PARAM_ALWAYS);
931 tmp = m_commands.AddCommand(wxT("Priority"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Set download priority."),
932 wxTRANSLATE("Set priority of a download to Low, Normal, High or Auto.\n"), CMD_PARAM_ALWAYS);
933 tmp->AddCommand(wxT("Low"), CMD_ID_PRIORITY_LOW, wxTRANSLATE("Set priority to low."), wxEmptyString, CMD_PARAM_ALWAYS);
934 tmp->AddCommand(wxT("Normal"), CMD_ID_PRIORITY_NORMAL, wxTRANSLATE("Set priority to normal."), wxEmptyString, CMD_PARAM_ALWAYS);
935 tmp->AddCommand(wxT("High"), CMD_ID_PRIORITY_HIGH, wxTRANSLATE("Set priority to high."), wxEmptyString, CMD_PARAM_ALWAYS);
936 tmp->AddCommand(wxT("Auto"), CMD_ID_PRIORITY_AUTO, wxTRANSLATE("Set priority to auto."), wxEmptyString, CMD_PARAM_ALWAYS);
938 tmp = m_commands.AddCommand(wxT("Show"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Show queues/lists."),
939 wxTRANSLATE("Shows upload/download queue, server list or shared files list.\n"), CMD_PARAM_NEVER);
940 tmp->AddCommand(wxT("UL"), CMD_ID_SHOW_UL, wxTRANSLATE("Show upload queue."), wxEmptyString, CMD_PARAM_NEVER);
941 tmp->AddCommand(wxT("DL"), CMD_ID_SHOW_DL, wxTRANSLATE("Show download queue."), wxEmptyString, CMD_PARAM_NEVER);
942 tmp->AddCommand(wxT("Log"), CMD_ID_SHOW_LOG, wxTRANSLATE("Show log."), wxEmptyString, CMD_PARAM_NEVER);
943 tmp->AddCommand(wxT("Servers"), CMD_ID_SHOW_SERVERS, wxTRANSLATE("Show servers list."), wxEmptyString, CMD_PARAM_NEVER);
944 // tmp->AddCommand(wxT("Shared"), CMD_ID_SHOW_SHARED, wxTRANSLATE("Show shared files list."), wxEmptyString, CMD_PARAM_NEVER);
946 m_commands.AddCommand(wxT("Reset"), CMD_ID_RESET_LOG, wxTRANSLATE("Reset log."), wxEmptyString, CMD_PARAM_NEVER);
949 // Deprecated commands, kept for backwards compatibility only.
952 #define DEPRECATED(OLDCMD, ID, NEWCMD, PARAM) \
953 m_commands.AddCommand(wxT(OLDCMD), CMD_ID_##ID | CMD_DEPRECATED, CFormat(wxTRANSLATE("Deprecated command, use '%s' instead.")) % wxT(NEWCMD), \
954 CFormat(wxTRANSLATE("This is a deprecated command, and may be removed in the future.\nUse '%s' instead.\n")) % wxT(NEWCMD), CMD_PARAM_##PARAM)
956 DEPRECATED("Stats", STATUS, "Status", NEVER);
957 DEPRECATED("SetIPFilter", SET_IPFILTER, "Set IPFilter", OPTIONAL);
958 DEPRECATED("GetIPLevel", GET_IPFILTER_LEVEL, "Get IPFilter Level", NEVER);
959 DEPRECATED("SetIPLevel", SET_IPFILTER_LEVEL, "Set IPFilter Level", ALWAYS);
960 DEPRECATED("IPLevel", SET_IPFILTER_LEVEL, "Get/Set IPFilter Level", OPTIONAL);
961 DEPRECATED("Servers", SHOW_SERVERS, "Show Servers", NEVER);
962 DEPRECATED("GetBWLimits", GET_BWLIMITS, "Get BwLimits", NEVER);
963 DEPRECATED("SetUpBWLimit", SET_BWLIMIT_UP, "Set BwLimit Up", ALWAYS);
964 DEPRECATED("SetDownBWLimit", SET_BWLIMIT_DOWN, "Set BwLimit Down", ALWAYS);
967 int CamulecmdApp::OnRun()
969 ConnectAndRun(wxT("aMulecmd"), wxT(VERSION));
970 return 0;
972 // File_checked_for_headers