2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2011 Angel Vidal ( kry@amule.org )
5 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
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
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.
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
28 #include "config.h" // Needed for VERSION
31 #include <common/ClientVersion.h>
33 #include "TextClient.h"
36 #include <unistd.h> // Do_not_auto_remove
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 "Constants.h" // Needed for Priority Levels
52 #include "DataToText.h" // Needed for PriorityToStr
54 //-------------------------------------------------------------------
61 CMD_ID_PRIORITY_NORMAL
,
69 CMD_ID_DISCONNECT_ED2K
,
70 CMD_ID_DISCONNECT_KAD
,
72 CMD_ID_RELOAD_IPFILTER_LOCAL
,
73 CMD_ID_RELOAD_IPFILTER_NET
,
74 CMD_ID_SET_IPFILTER_ON
,
75 CMD_ID_SET_IPFILTER_OFF
,
76 CMD_ID_SET_IPFILTER_CLIENTS_ON
,
77 CMD_ID_SET_IPFILTER_CLIENTS_OFF
,
78 CMD_ID_SET_IPFILTER_SERVERS_ON
,
79 CMD_ID_SET_IPFILTER_SERVERS_OFF
,
80 CMD_ID_SET_IPFILTER_LEVEL
,
82 CMD_ID_GET_IPFILTER_STATE
,
83 CMD_ID_GET_IPFILTER_STATE_CLIENTS
,
84 CMD_ID_GET_IPFILTER_STATE_SERVERS
,
85 CMD_ID_GET_IPFILTER_LEVEL
,
94 CMD_ID_SET_BWLIMIT_UP
,
95 CMD_ID_SET_BWLIMIT_DOWN
,
102 CMD_ID_SEARCH_RESULTS
,
103 CMD_ID_SEARCH_PROGRESS
,
105 // IDs for deprecated commands
110 // method to create a SearchFile
111 SearchFile::SearchFile(const CEC_SearchFile_Tag
*tag
)
113 nHash
= tag
->FileHash();
114 sHash
= nHash
.Encode();
115 sFileName
= tag
->FileName();
116 lFileSize
= tag
->SizeFull();
117 lSourceCount
= tag
->SourceCount();
118 bPresent
= tag
->AlreadyHave();
121 //-------------------------------------------------------------------
122 IMPLEMENT_APP (CamulecmdApp
)
123 //-------------------------------------------------------------------
125 void CamulecmdApp::OnInitCmdLine(wxCmdLineParser
& parser
)
127 CaMuleExternalConnector::OnInitCmdLine(parser
, "amulecmd");
128 parser
.AddOption(wxT("c"), wxT("command"),
129 _("Execute <str> and exit."),
130 wxCMD_LINE_VAL_STRING
, wxCMD_LINE_PARAM_OPTIONAL
);
133 bool CamulecmdApp::OnCmdLineParsed(wxCmdLineParser
& parser
)
135 m_HasCmdOnCmdLine
= parser
.Found(wxT("command"), &m_CmdString
);
136 if (m_CmdString
.Lower().StartsWith(wxT("help")))
139 printf("%s %s\n", m_appname
, (const char *)unicode2char(GetMuleVersion()));
140 Parse_Command(m_CmdString
);
143 m_interactive
= !m_HasCmdOnCmdLine
;
144 return CaMuleExternalConnector::OnCmdLineParsed(parser
);
147 void CamulecmdApp::TextShell(const wxString
& prompt
)
149 if (m_HasCmdOnCmdLine
)
150 Parse_Command(m_CmdString
);
152 CaMuleExternalConnector::TextShell(prompt
);
155 int CamulecmdApp::ProcessCommand(int CmdId
)
157 wxString args
= GetCmdArgs();
158 CECPacket
*request
= 0;
159 std::list
<CECPacket
*> request_list
;
161 EC_SEARCH_TYPE search_type
= EC_SEARCH_KAD
;
163 // Implementation of the deprecated command 'SetIPFilter'.
164 if (CmdId
== CMD_ID_SET_IPFILTER
) {
165 if ( ! args
.IsEmpty() ) {
166 if (args
.IsSameAs(wxT("ON"), false)) {
167 CmdId
= CMD_ID_SET_IPFILTER_ON
;
168 } else if (args
.IsSameAs(wxT("OFF"), false)) {
169 CmdId
= CMD_ID_SET_IPFILTER_OFF
;
171 return CMD_ERR_INVALID_ARG
;
174 CmdId
= CMD_ID_GET_IPFILTER_STATE
;
180 request_list
.push_back(new CECPacket(EC_OP_STAT_REQ
, EC_DETAIL_CMD
));
183 case CMD_ID_SHUTDOWN
:
184 request_list
.push_back(new CECPacket(EC_OP_SHUTDOWN
));
188 if ( !args
.IsEmpty() ) {
191 // Not much we can do against this unicode2char.
192 int result
= sscanf(unicode2char(args
), "%3d.%3d.%3d.%3d:%5d", &ip
[0], &ip
[1], &ip
[2], &ip
[3], &port
);
194 // Try to resolve DNS -- good for dynamic IP servers
195 wxString
serverName(args
.BeforeFirst(wxT(':')));
197 bool ok
= args
.AfterFirst(wxT(':')).ToLong(&lPort
);
198 port
= (unsigned int)lPort
;
200 a
.Hostname(serverName
);
202 result
= sscanf(unicode2char(a
.IPAddress()), "%3d.%3d.%3d.%3d", &ip
[0], &ip
[1], &ip
[2], &ip
[3]);
203 if (serverName
.IsEmpty() || !ok
|| (result
!= 4)) {
204 Show(_("Invalid IP format. Use xxx.xxx.xxx.xxx:xxxx\n"));
209 addr
.m_ip
[0] = ip
[0];
210 addr
.m_ip
[1] = ip
[1];
211 addr
.m_ip
[2] = ip
[2];
212 addr
.m_ip
[3] = ip
[3];
214 request
= new CECPacket(EC_OP_SERVER_CONNECT
);
215 request
->AddTag(CECTag(EC_TAG_SERVER
, addr
));
216 request_list
.push_back(request
);
218 request_list
.push_back(new CECPacket(EC_OP_CONNECT
));
222 case CMD_ID_CONNECT_ED2K
:
223 request_list
.push_back(new CECPacket(EC_OP_SERVER_CONNECT
));
226 case CMD_ID_CONNECT_KAD
:
227 request_list
.push_back(new CECPacket(EC_OP_KAD_START
));
230 case CMD_ID_DISCONNECT
:
231 request_list
.push_back(new CECPacket(EC_OP_DISCONNECT
));
234 case CMD_ID_DISCONNECT_ED2K
:
235 request_list
.push_back(new CECPacket(EC_OP_SERVER_DISCONNECT
));
238 case CMD_ID_DISCONNECT_KAD
:
239 request_list
.push_back(new CECPacket(EC_OP_KAD_STOP
));
242 case CMD_ID_RELOAD_SHARED
:
243 request_list
.push_back(new CECPacket(EC_OP_SHAREDFILES_RELOAD
));
246 case CMD_ID_RELOAD_IPFILTER_LOCAL
:
247 request_list
.push_back(new CECPacket(EC_OP_IPFILTER_RELOAD
));
250 case CMD_ID_RELOAD_IPFILTER_NET
:
251 request
= new CECPacket(EC_OP_IPFILTER_UPDATE
);
252 request
->AddTag(EC_TAG_STRING
, args
);
253 request_list
.push_back(request
);
256 case CMD_ID_SET_IPFILTER_ON
:
257 case CMD_ID_SET_IPFILTER_CLIENTS_ON
:
258 case CMD_ID_SET_IPFILTER_SERVERS_ON
:
260 case CMD_ID_SET_IPFILTER_OFF
:
261 case CMD_ID_SET_IPFILTER_CLIENTS_OFF
:
262 case CMD_ID_SET_IPFILTER_SERVERS_OFF
:
264 if (CmdId
== CMD_ID_SET_IPFILTER_CLIENTS_ON
|| CmdId
== CMD_ID_SET_IPFILTER_CLIENTS_OFF
) {
265 CmdId
= CMD_ID_GET_IPFILTER_STATE_CLIENTS
;
266 } else if (CmdId
== CMD_ID_SET_IPFILTER_SERVERS_ON
|| CmdId
== CMD_ID_SET_IPFILTER_SERVERS_OFF
) {
267 CmdId
= CMD_ID_GET_IPFILTER_STATE_SERVERS
;
269 CmdId
= CMD_ID_GET_IPFILTER_STATE
;
272 request
= new CECPacket(EC_OP_SET_PREFERENCES
);
273 CECEmptyTag
prefs(EC_TAG_PREFS_SECURITY
);
274 if (CmdId
!= CMD_ID_GET_IPFILTER_STATE_SERVERS
) {
275 prefs
.AddTag(CECTag(EC_TAG_IPFILTER_CLIENTS
, (uint8
)tmp_int
));
277 if (CmdId
!= CMD_ID_GET_IPFILTER_STATE_CLIENTS
) {
278 prefs
.AddTag(CECTag(EC_TAG_IPFILTER_SERVERS
, (uint8
)tmp_int
));
280 request
->AddTag(prefs
);
281 request_list
.push_back(request
);
283 case CMD_ID_GET_IPFILTER
:
284 case CMD_ID_GET_IPFILTER_STATE
:
285 case CMD_ID_GET_IPFILTER_STATE_CLIENTS
:
286 case CMD_ID_GET_IPFILTER_STATE_SERVERS
:
287 request
= new CECPacket(EC_OP_GET_PREFERENCES
);
288 request
->AddTag(CECTag(EC_TAG_SELECT_PREFS
, (uint32
)EC_PREFS_SECURITY
));
289 request_list
.push_back(request
);
292 case CMD_ID_SET_IPFILTER_LEVEL
:
293 if (!args
.IsEmpty()) // This 'if' must stay as long as we support the deprecated 'IPLevel' command.
295 unsigned long int level
= 0;
296 if (args
.ToULong(&level
) == true && level
< 256) {
297 request
= new CECPacket(EC_OP_SET_PREFERENCES
);
298 CECEmptyTag
prefs(EC_TAG_PREFS_SECURITY
);
299 prefs
.AddTag(CECTag(EC_TAG_IPFILTER_LEVEL
, (uint8
)level
));
300 request
->AddTag(prefs
);
301 request_list
.push_back(request
);
303 return CMD_ERR_INVALID_ARG
;
306 CmdId
= CMD_ID_GET_IPFILTER_LEVEL
;
307 case CMD_ID_GET_IPFILTER_LEVEL
:
308 request
= new CECPacket(EC_OP_GET_PREFERENCES
);
309 request
->AddTag(CECTag(EC_TAG_SELECT_PREFS
, (uint32
)EC_PREFS_SECURITY
));
310 request_list
.push_back(request
);
317 if ( args
.IsEmpty() ) {
318 Show(_("This command requires an argument. Valid arguments: 'all', filename, or a number.\n"));
321 wxStringTokenizer
argsTokenizer(args
);
325 // Grab the entire dl queue right away
326 CECPacket
request_all(EC_OP_GET_DLOAD_QUEUE
, EC_DETAIL_CMD
);
327 const CECPacket
*reply_all
= SendRecvMsg_v2(&request_all
);
332 request
= new CECPacket(EC_OP_PARTFILE_PAUSE
); break;
334 request
= new CECPacket(EC_OP_PARTFILE_DELETE
); break;
336 request
= new CECPacket(EC_OP_PARTFILE_RESUME
); break;
340 // We loop through all the arguments
341 while(argsTokenizer
.HasMoreTokens()) {
342 token
=argsTokenizer
.GetNextToken();
344 // If the user requested all, then we select all files and exit the loop
345 // since there is little point to add anything more to "everything"
346 if( token
== wxT("all") ) {
347 for (CECPacket::const_iterator it
= reply_all
->begin(); it
!= reply_all
->end(); ++it
) {
348 const CEC_PartFile_Tag
*tag
= static_cast<const CEC_PartFile_Tag
*>(&*it
);
349 request
->AddTag(CECTag(EC_TAG_PARTFILE
, tag
->FileHash()));
352 } else if ( hash
.Decode(token
.Trim(false).Trim(true)) ) {
353 if ( !hash
.IsEmpty() ) {
354 Show(_("Processing by hash: "+token
+wxT("\n")));
355 request
->AddTag(CECTag(EC_TAG_PARTFILE
, hash
));
358 // Go through the dl queue and look at each filename
359 for (CECPacket::const_iterator it
= reply_all
->begin(); it
!= reply_all
->end(); ++it
) {
360 const CEC_PartFile_Tag
*tag
= static_cast<const CEC_PartFile_Tag
*>(&*it
);
361 wxString partmetname
= tag
->PartMetName();
363 // We check for filename, XXX.pat.met, XXX.part, XXX
364 if( tag
->FileName() == token
||
365 partmetname
== token
||
366 partmetname
.Truncate(partmetname
.Len()-4) == token
||
367 partmetname
.Truncate(partmetname
.Len()-5) == token
) {
368 Show(_("Processing by filename: "+token
+wxT("\n")));
369 request
->AddTag(CECTag(EC_TAG_PARTFILE
, tag
->FileHash()));
372 } // End of filename check else
373 } // End of argument token loop
375 request_list
.push_back(request
);
379 } // End of dl queue processing
381 } // end of command processing
385 case CMD_ID_PRIORITY_LOW
:
386 case CMD_ID_PRIORITY_NORMAL
:
387 case CMD_ID_PRIORITY_HIGH
:
388 case CMD_ID_PRIORITY_AUTO
:
389 if ( args
.IsEmpty() ) {
390 Show(_("This command requires an argument. Valid arguments: a file hash.\n"));
394 if (hash
.Decode(args
.Trim(false).Trim(true))) {
395 if (!hash
.IsEmpty()) {
396 request
= new CECPacket(EC_OP_PARTFILE_PRIO_SET
);
397 CECTag
hashtag(EC_TAG_PARTFILE
, hash
);
399 case CMD_ID_PRIORITY_LOW
:
400 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_LOW
));
402 case CMD_ID_PRIORITY_NORMAL
:
403 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_NORMAL
));
405 case CMD_ID_PRIORITY_HIGH
:
406 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_HIGH
));
408 case CMD_ID_PRIORITY_AUTO
:
409 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_AUTO
));
413 request
->AddTag(hashtag
);
414 request_list
.push_back(request
);
416 Show(_("Not a valid number\n"));
420 Show(_("Not a valid hash (length should be exactly 32 chars)\n"));
427 request_list
.push_back(new CECPacket(EC_OP_GET_ULOAD_QUEUE
));
431 request_list
.push_back(new CECPacket(EC_OP_GET_DLOAD_QUEUE
));
434 case CMD_ID_SHOW_LOG
:
435 request_list
.push_back(new CECPacket(EC_OP_GET_LOG
));
438 case CMD_ID_SHOW_SERVERS
:
439 request_list
.push_back(new CECPacket(EC_OP_GET_SERVER_LIST
, EC_DETAIL_CMD
));
442 case CMD_ID_SHOW_SHARED
:
443 request_list
.push_back(new CECPacket(EC_OP_GET_SHARED_FILES
));
446 case CMD_ID_RESET_LOG
:
447 request_list
.push_back(new CECPacket(EC_OP_RESET_LOG
));
451 if (args
.StartsWith(wxT("ed2k://"))) {
452 //aMule doesn't like AICH links without |/| in front of h=
453 if (args
.Find(wxT("|h=")) > -1 && args
.Find(wxT("|/|h=")) == -1) {
454 args
.Replace(wxT("|h="),wxT("|/|h="));
456 // repair links where | is replaced with %7C (Firefox)
457 if (args
.StartsWith(wxT("ed2k://%7C"))) {
458 args
.Replace(wxT("%7C"),wxT("|"));
461 request
= new CECPacket(EC_OP_ADD_LINK
);
462 request
->AddTag(CECTag(EC_TAG_STRING
, args
));
463 request_list
.push_back(request
);
466 case CMD_ID_SET_BWLIMIT_UP
:
467 tmp_int
= EC_TAG_CONN_MAX_UL
- EC_TAG_CONN_MAX_DL
;
468 case CMD_ID_SET_BWLIMIT_DOWN
:
469 tmp_int
+= EC_TAG_CONN_MAX_DL
;
471 unsigned long int limit
;
472 if (args
.ToULong(&limit
)) {
473 request
= new CECPacket(EC_OP_SET_PREFERENCES
);
474 CECEmptyTag
prefs(EC_TAG_PREFS_CONNECTIONS
);
475 prefs
.AddTag(CECTag(tmp_int
, (uint16
)limit
));
476 request
->AddTag(prefs
);
477 request_list
.push_back(request
);
479 return CMD_ERR_INVALID_ARG
;
482 case CMD_ID_GET_BWLIMITS
:
483 request
= new CECPacket(EC_OP_GET_PREFERENCES
);
484 request
->AddTag(CECTag(EC_TAG_SELECT_PREFS
, (uint32
)EC_PREFS_CONNECTIONS
));
485 request_list
.push_back(request
);
488 case CMD_ID_STATTREE
:
489 request
= new CECPacket(EC_OP_GET_STATSTREE
);
490 if (!args
.IsEmpty()) {
491 unsigned long int max_versions
;
492 if (args
.ToULong(&max_versions
)) {
493 if (max_versions
< 256) {
494 request
->AddTag(CECTag(EC_TAG_STATTREE_CAPPING
, (uint8
)max_versions
));
497 return CMD_ERR_INVALID_ARG
;
501 return CMD_ERR_INVALID_ARG
;
504 request_list
.push_back(request
);
506 case CMD_ID_SEARCH_GLOBAL
:
507 search_type
= EC_SEARCH_GLOBAL
;
508 case CMD_ID_SEARCH_LOCAL
:
509 if (search_type
!= EC_SEARCH_GLOBAL
){
510 search_type
= EC_SEARCH_LOCAL
;
512 case CMD_ID_SEARCH_KAD
:
513 if (search_type
!= EC_SEARCH_GLOBAL
&& search_type
!= EC_SEARCH_LOCAL
){
514 search_type
= EC_SEARCH_KAD
;
518 wxString search
= args
;
525 request
= new CECPacket(EC_OP_SEARCH_START
);
526 request
->AddTag(CEC_Search_Tag (search
, search_type
, type
, extention
, avail
, min_size
, max_size
));
527 request_list
.push_back(request
);
532 'help search' is a command to the program, do not translate it. */
533 Show(_("No search type defined.\nType 'help search' to get more help.\n"));
537 case CMD_ID_SEARCH_RESULTS
:
538 request_list
.push_back(new CECPacket(EC_OP_SEARCH_RESULTS
, EC_DETAIL_FULL
));
541 case CMD_ID_SEARCH_PROGRESS
:
542 request_list
.push_back(new CECPacket(EC_OP_SEARCH_PROGRESS
));
545 case CMD_ID_DOWNLOAD
:
548 unsigned long int id
= 0;
549 if (args
.ToULong(&id
) == true && id
< m_Results_map
.size()) {
551 SearchFile
* file
= m_Results_map
[id
];
552 Show(CFormat(_("Download File: %lu %s\n")) % id
% file
->sFileName
);
553 request
= new CECPacket(EC_OP_DOWNLOAD_SEARCH_RESULT
);
554 // get with id the hash and category=0
556 CECTag
hashtag(EC_TAG_PARTFILE
, file
->nHash
);
557 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_CAT
, category
));
558 request
->AddTag(hashtag
);
559 request_list
.push_back(request
);
561 return CMD_ERR_INVALID_ARG
;
567 return CMD_ERR_PROCESS_CMD
;
570 m_last_cmd_id
= CmdId
;
572 if ( ! request_list
.empty() ) {
573 std::list
<CECPacket
*>::iterator it
= request_list
.begin();
574 while ( it
!= request_list
.end() ) {
575 CECPacket
*curr
= *it
++;
576 if (curr
->GetOpCode() == EC_OP_SHUTDOWN
) {
581 const CECPacket
*reply
= SendRecvMsg_v2(curr
);
584 Process_Answer_v2(reply
);
588 request_list
.resize(0);
595 * Method to show the results in the console
597 void CamulecmdApp::ShowResults(CResultMap results_map
)
599 unsigned int name_max
= 80;
600 unsigned int mb_max
= 5;
601 unsigned int nr_max
= 5;
602 unsigned long int id
= 0;
603 wxString output
, name
, sources
, mb
, kb
;
605 printf("Nr. Filename: Size(MB): Sources: \n");
606 printf("-----------------------------------------------------------------------------------------------------------\n");
608 for( std::map
<unsigned long int,SearchFile
*>::iterator iter
= results_map
.begin(); iter
!= results_map
.end(); ++iter
) {
610 SearchFile
* file
= (*iter
).second
;
612 output
.Printf(wxT("%i. "), id
);
613 output
= output
.SubString(0, nr_max
).Append(file
->sFileName
).Append(' ', name_max
);
614 mb
.Printf(wxT(" %d"), file
->lFileSize
/1024/1024);
615 kb
.Printf(wxT(".%d"), file
->lFileSize
/1024%1024);
616 output
= output
.SubString(0, nr_max
+ name_max
+ mb_max
- mb
.Length() ).Append(mb
).Append(kb
);
617 printf("%s %ld\n",(const char*)unicode2char(output
), file
->lSourceCount
);
622 // Formats a statistics (sub)tree to text
623 wxString
StatTree2Text(const CEC_StatTree_Node_Tag
*tree
, int depth
)
626 return wxEmptyString
;
628 wxString result
= wxString(wxChar(' '), depth
) + tree
->GetDisplayString() + wxT("\n");
629 for (CECTag::const_iterator it
= tree
->begin(); it
!= tree
->end(); ++it
) {
630 const CEC_StatTree_Node_Tag
*tmp
= static_cast<const CEC_StatTree_Node_Tag
*>(&*it
);
631 if (tmp
->GetTagName() == EC_TAG_STATTREE_NODE
) {
632 result
+= StatTree2Text(tmp
, depth
+ 1);
639 * Format EC packet into text form for output to console
641 void CamulecmdApp::Process_Answer_v2(const CECPacket
*response
)
644 wxString
msgFailedUnknown(_("Request failed with an unknown error."));
646 switch (response
->GetOpCode()) {
648 s
<< _("Operation was successful.");
652 const CECTag
*tag
= response
->GetFirstTagSafe();
653 if (tag
->IsString()) {
654 s
<< CFormat(_("Request failed with the following error: %s")) % wxGetTranslation(tag
->GetStringData());
656 s
<< msgFailedUnknown
;
660 case EC_OP_SET_PREFERENCES
:
662 const CECTag
*tab
= response
->GetTagByNameSafe(EC_TAG_PREFS_SECURITY
);
663 const CECTag
*ipfilterLevel
= tab
->GetTagByName(EC_TAG_IPFILTER_LEVEL
);
665 if (m_last_cmd_id
== CMD_ID_GET_IPFILTER
||
666 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE
||
667 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE_CLIENTS
) {
668 s
+= CFormat(_("IP filtering for clients is %s.\n"))
669 % ((tab
->GetTagByName(EC_TAG_IPFILTER_CLIENTS
) == NULL
) ? _("OFF") : _("ON"));
671 if (m_last_cmd_id
== CMD_ID_GET_IPFILTER
||
672 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE
||
673 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE_SERVERS
) {
674 s
+= CFormat(_("IP filtering for servers is %s.\n"))
675 % ((tab
->GetTagByName(EC_TAG_IPFILTER_SERVERS
) == NULL
) ? _("OFF") : _("ON"));
677 if (m_last_cmd_id
== CMD_ID_GET_IPFILTER
||
678 m_last_cmd_id
== CMD_ID_GET_IPFILTER_LEVEL
) {
679 s
<< CFormat(_("Current IPFilter Level is %d.\n")) % ipfilterLevel
->GetInt();
682 tab
= response
->GetTagByNameSafe(EC_TAG_PREFS_CONNECTIONS
);
683 const CECTag
*connMaxUL
= tab
->GetTagByName(EC_TAG_CONN_MAX_UL
);
684 const CECTag
*connMaxDL
= tab
->GetTagByName(EC_TAG_CONN_MAX_DL
);
685 if (connMaxUL
&& connMaxDL
) {
686 s
<< CFormat(_("Bandwidth limits: Up: %u kB/s, Down: %u kB/s.\n"))
687 % connMaxUL
->GetInt() % connMaxDL
->GetInt();
692 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
693 const CECTag
&tag
= *it
;
694 s
<< tag
.GetStringData() << wxT("\n");
698 const CEC_ConnState_Tag
*connState
= static_cast<const CEC_ConnState_Tag
*>(response
->GetTagByName(EC_TAG_CONNSTATE
));
700 s
<< _("eD2k") << wxT(": ");
701 if (connState
->IsConnectedED2K()) {
702 const CECTag
*server
= connState
->GetTagByName(EC_TAG_SERVER
);
703 const CECTag
*serverName
= server
? server
->GetTagByName(EC_TAG_SERVER_NAME
) : NULL
;
704 if (server
&& serverName
) {
705 s
<< CFormat(_("Connected to %s %s %s")) %
706 serverName
->GetStringData() %
707 server
->GetIPv4Data().StringIP() %
708 (connState
->HasLowID() ? _("with LowID") : _("with HighID"));
710 } else if (connState
->IsConnectingED2K()) {
711 s
<< _("Now connecting");
713 s
<< _("Not connected");
715 s
<< wxT('\n') << _("Kad") << wxT(": ");
716 if (connState
->IsKadRunning()) {
717 if (connState
->IsConnectedKademlia()) {
718 s
<< _("Connected") << wxT(" (");
719 if (connState
->IsKadFirewalled()) {
720 s
<< _("firewalled");
726 s
<< _("Not connected");
729 s
<< _("Not running");
733 const CECTag
*tmpTag
;
734 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_DL_SPEED
)) != 0) {
735 s
<< CFormat(_("\nDownload:\t%s")) % CastItoSpeed(tmpTag
->GetInt());
737 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_UL_SPEED
)) != 0) {
738 s
<< CFormat(_("\nUpload:\t%s")) % CastItoSpeed(tmpTag
->GetInt());
740 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_UL_QUEUE_LEN
)) != 0) {
741 s
<< CFormat(_("\nClients in queue:\t%d\n")) % tmpTag
->GetInt();
743 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_TOTAL_SRC_COUNT
)) != 0) {
744 s
<< CFormat(_("\nTotal sources:\t%d\n")) % tmpTag
->GetInt();
748 case EC_OP_DLOAD_QUEUE
:
749 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
750 const CEC_PartFile_Tag
*tag
= static_cast<const CEC_PartFile_Tag
*>(&*it
);
751 uint64 filesize
, donesize
;
752 filesize
= tag
->SizeFull();
753 donesize
= tag
->SizeDone();
754 s
<< tag
->FileHashString() << wxT(" ") <<
756 (CFormat(wxT("\n\t [%.1f%%] %4i/%4i "))
757 % ((float)donesize
/ ((float)filesize
)*100.0)
758 % ((int)tag
->SourceCount() - (int)tag
->SourceNotCurrCount())
759 % (int)tag
->SourceCount()) <<
760 ((int)tag
->SourceCountA4AF() ? wxString(CFormat(wxT("+%2.2i ")) % (int)tag
->SourceCountA4AF()) : wxString(wxT(" "))) <<
761 ((int)tag
->SourceXferCount() ? wxString(CFormat(wxT("(%2.2i) - ")) % (int)tag
->SourceXferCount()) : wxString(wxT(" - "))) <<
762 tag
->GetFileStatusString();
763 s
<< wxT(" - ") << tag
->PartMetName();
764 if (tag
->DownPrio() < 10) {
765 s
<< wxT(" - ") << PriorityToStr((int)tag
->DownPrio(), 0);
767 s
<< wxT(" - ") << PriorityToStr((tag
->DownPrio() - 10), 1);
769 if ( tag
->SourceXferCount() > 0) {
770 s
<< wxT(" - ") + CastItoSpeed(tag
->Speed());
775 case EC_OP_ULOAD_QUEUE
:
776 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
777 const CECTag
*tag
= & *it
;
778 const CECTag
*clientName
= tag
->GetTagByName(EC_TAG_CLIENT_NAME
);
779 const CECTag
*partfileName
= tag
->GetTagByName(EC_TAG_PARTFILE_NAME
);
780 const CECTag
*partfileSizeXfer
= tag
->GetTagByName(EC_TAG_PARTFILE_SIZE_XFER
);
781 const CECTag
*partfileSpeed
= tag
->GetTagByName(EC_TAG_CLIENT_UP_SPEED
);
782 if (clientName
&& partfileName
&& partfileSizeXfer
&& partfileSpeed
) {
784 CFormat(wxT("%10u ")) % tag
->GetInt() <<
785 clientName
->GetStringData() << wxT(" ") <<
786 partfileName
->GetStringData() << wxT(" ") <<
787 CastItoXBytes(partfileSizeXfer
->GetInt()) << wxT(" ") <<
788 CastItoSpeed(partfileSpeed
->GetInt());
793 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
794 const CECTag
&tag
= *it
;
795 s
<< tag
.GetStringData() << wxT("\n");
798 case EC_OP_SERVER_LIST
:
799 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
800 const CECTag
&tag
= *it
;
801 const CECTag
*serverName
= tag
.GetTagByName(EC_TAG_SERVER_NAME
);
803 wxString ip
= tag
.GetIPv4Data().StringIP();
804 ip
.Append(' ', 24 - ip
.Length());
805 s
<< ip
<< serverName
->GetStringData() << wxT("\n");
810 case EC_OP_SHARED_FILES
:
811 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
812 const CEC_SharedFile_Tag
*tag
= static_cast<const CEC_SharedFile_Tag
*>(&*it
);
813 s
<< tag
->FileHashString() << wxT(" ");
814 wxString filePath
= tag
->FilePath();
815 bool ispartfile
= true;
816 if (filePath
.EndsWith(wxT(".part"))) {
817 for (unsigned i
= 0; i
< filePath
.Length() - 5; i
++) {
818 if (filePath
[i
] < wxT('0') || filePath
[i
] > wxT('9')) {
827 s
<< _("[PartFile]") << wxT(" ");
837 << wxT("\n\t") << PriorityToStr(tag
->UpPrio() % 10, tag
->UpPrio() >= 10) << wxT(" - ") << CFormat(wxT("%i(%i) / %i(%i) - %s (%s) - %.2f\n"))
838 % tag
->GetRequests() % tag
->GetAllRequests()
839 % tag
->GetAccepts() % tag
->GetAllAccepts()
840 % CastItoXBytes(tag
->GetXferred()) % CastItoXBytes(tag
->GetAllXferred())
841 % (static_cast<float>(tag
->GetAllXferred()) / static_cast<float>(tag
->SizeFull()));
845 case EC_OP_STATSTREE
:
846 s
<< StatTree2Text(static_cast<const CEC_StatTree_Node_Tag
*>(response
->GetTagByName(EC_TAG_STATTREE_NODE
)), 0);
849 case EC_OP_SEARCH_RESULTS
:
852 m_Results_map
.clear();
853 s
+= CFormat(_("Number of search results: %i\n")) % response
->GetTagCount();
854 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
855 const CEC_SearchFile_Tag
*tag
= static_cast<const CEC_SearchFile_Tag
*>(&*it
);
856 //printf("Tag FileName: %s \n",(const char*)unicode2char(tag->FileName()));
857 m_Results_map
[i
++] = new SearchFile(tag
);
859 ShowResults(m_Results_map
);
862 case EC_OP_SEARCH_PROGRESS
:
864 const CECTag
*tab
= response
->GetTagByNameSafe(EC_TAG_SEARCH_STATUS
);
865 uint32 progress
= tab
->GetInt();
866 if (progress
<= 100) {
867 s
+= CFormat(_("Search progress: %u %% \n")) % progress
;
869 s
+= _("Search progress not available");
874 s
+= CFormat(_("Received an unknown reply from the server, OpCode = %#x.")) % response
->GetOpCode();
879 void CamulecmdApp::OnInitCommandSet()
885 CaMuleExternalConnector::OnInitCommandSet();
887 m_commands
.AddCommand(wxT("Status"), CMD_ID_STATUS
, wxTRANSLATE("Show short status information."),
888 wxTRANSLATE("Show connection status, current up/download speeds, etc.\n"), CMD_PARAM_NEVER
);
890 m_commands
.AddCommand(wxT("Statistics"), CMD_ID_STATTREE
, wxTRANSLATE("Show full statistics tree."),
891 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"));
893 m_commands
.AddCommand(wxT("Shutdown"), CMD_ID_SHUTDOWN
, wxTRANSLATE("Shut down aMule."),
894 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
);
896 tmp
= m_commands
.AddCommand(wxT("Reload"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Reload the given object."), wxEmptyString
, CMD_PARAM_NEVER
);
897 tmp
->AddCommand(wxT("Shared"), CMD_ID_RELOAD_SHARED
, wxTRANSLATE("Reload shared files list."), wxEmptyString
, CMD_PARAM_NEVER
);
899 tmp2
= tmp
->AddCommand(wxT("IPFilter"), CMD_ID_RELOAD_IPFILTER_LOCAL
, wxTRANSLATE("Reload IP filtering table."), wxEmptyString
, CMD_PARAM_OPTIONAL
);
900 tmp2
->AddCommand(wxT("File"), CMD_ID_RELOAD_IPFILTER_LOCAL
, wxTRANSLATE("Reload current IP filtering table."), wxEmptyString
, CMD_PARAM_NEVER
);
901 tmp2
->AddCommand(wxT("Net"), CMD_ID_RELOAD_IPFILTER_NET
, wxTRANSLATE("Update IP filtering table from URL."),
902 wxTRANSLATE("If URL is omitted the URL from the preferences is used."), CMD_PARAM_OPTIONAL
);
904 tmp
= m_commands
.AddCommand(wxT("Connect"), CMD_ID_CONNECT
, wxTRANSLATE("Connect to the network."),
905 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
);
906 tmp
->AddCommand(wxT("ED2K"), CMD_ID_CONNECT_ED2K
, wxTRANSLATE("Connect to eD2k only."), wxEmptyString
, CMD_PARAM_NEVER
);
907 tmp
->AddCommand(wxT("Kad"), CMD_ID_CONNECT_KAD
, wxTRANSLATE("Connect to Kad only."), wxEmptyString
, CMD_PARAM_NEVER
);
909 tmp
= m_commands
.AddCommand(wxT("Disconnect"), CMD_ID_DISCONNECT
, wxTRANSLATE("Disconnect from the network."),
910 wxTRANSLATE("This will disconnect from all networks that are currently connected.\n"), CMD_PARAM_NEVER
);
911 tmp
->AddCommand(wxT("ED2K"), CMD_ID_DISCONNECT_ED2K
, wxTRANSLATE("Disconnect from eD2k only."), wxEmptyString
, CMD_PARAM_NEVER
);
912 tmp
->AddCommand(wxT("Kad"), CMD_ID_DISCONNECT_KAD
, wxTRANSLATE("Disconnect from Kad only."), wxEmptyString
, CMD_PARAM_NEVER
);
914 m_commands
.AddCommand(wxT("Add"), CMD_ID_ADDLINK
, wxTRANSLATE("Add an eD2k or magnet link to core."),
915 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
);
917 tmp
= m_commands
.AddCommand(wxT("Set"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set a preference value."),
918 wxEmptyString
, CMD_PARAM_NEVER
);
920 tmp2
= tmp
->AddCommand(wxT("IPFilter"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set IP filtering preferences."), wxEmptyString
, CMD_PARAM_NEVER
);
921 tmp2
->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_ON
, wxTRANSLATE("Turn IP filtering on for both clients and servers."), wxEmptyString
, CMD_PARAM_NEVER
);
922 tmp2
->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_OFF
, wxTRANSLATE("Turn IP filtering off for both clients and servers."), wxEmptyString
, CMD_PARAM_NEVER
);
923 tmp3
= tmp2
->AddCommand(wxT("Clients"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Enable/Disable IP filtering for clients."), wxEmptyString
, CMD_PARAM_NEVER
);
924 tmp3
->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_CLIENTS_ON
, wxTRANSLATE("Turn IP filtering on for clients."), wxEmptyString
, CMD_PARAM_NEVER
);
925 tmp3
->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_CLIENTS_OFF
, wxTRANSLATE("Turn IP filtering off for clients."), wxEmptyString
, CMD_PARAM_NEVER
);
926 tmp3
= tmp2
->AddCommand(wxT("Servers"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Enable/Disable IP filtering for servers."), wxEmptyString
, CMD_PARAM_NEVER
);
927 tmp3
->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_SERVERS_ON
, wxTRANSLATE("Turn IP filtering on for servers."), wxEmptyString
, CMD_PARAM_NEVER
);
928 tmp3
->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_SERVERS_OFF
, wxTRANSLATE("Turn IP filtering off for servers."), wxEmptyString
, CMD_PARAM_NEVER
);
929 tmp2
->AddCommand(wxT("Level"), CMD_ID_SET_IPFILTER_LEVEL
, wxTRANSLATE("Select IP filtering level."),
930 wxTRANSLATE("Valid filtering levels are in the range 0-255, and it's default (initial)\nvalue is 127.\n"), CMD_PARAM_ALWAYS
);
932 tmp2
= tmp
->AddCommand(wxT("BwLimit"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set bandwidth limits."),
933 wxTRANSLATE("The value given to these commands has to be in kilobytes/sec.\n"), CMD_PARAM_NEVER
);
934 tmp2
->AddCommand(wxT("Up"), CMD_ID_SET_BWLIMIT_UP
, wxTRANSLATE("Set upload bandwidth limit."),
935 wxTRANSLATE("The given value must be in kilobytes/sec.\n"), CMD_PARAM_ALWAYS
);
936 tmp2
->AddCommand(wxT("Down"), CMD_ID_SET_BWLIMIT_DOWN
, wxTRANSLATE("Set download bandwidth limit."),
937 wxTRANSLATE("The given value must be in kilobytes/sec.\n"), CMD_PARAM_ALWAYS
);
939 tmp
= m_commands
.AddCommand(wxT("Get"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Get and display a preference value."),
940 wxEmptyString
, CMD_PARAM_NEVER
);
942 tmp2
= tmp
->AddCommand(wxT("IPFilter"), CMD_ID_GET_IPFILTER
, wxTRANSLATE("Get IP filtering preferences."), wxEmptyString
, CMD_PARAM_NEVER
);
943 tmp3
= tmp2
->AddCommand(wxT("State"), CMD_ID_GET_IPFILTER_STATE
, wxTRANSLATE("Get IP filtering state for both clients and servers."), wxEmptyString
, CMD_PARAM_NEVER
);
944 tmp3
->AddCommand(wxT("Clients"), CMD_ID_GET_IPFILTER_STATE_CLIENTS
, wxTRANSLATE("Get IP filtering state for clients only."), wxEmptyString
, CMD_PARAM_NEVER
);
945 tmp3
->AddCommand(wxT("Servers"), CMD_ID_GET_IPFILTER_STATE_SERVERS
, wxTRANSLATE("Get IP filtering state for servers only."), wxEmptyString
, CMD_PARAM_NEVER
);
946 tmp2
->AddCommand(wxT("Level"), CMD_ID_GET_IPFILTER_LEVEL
, wxTRANSLATE("Get IP filtering level."), wxEmptyString
, CMD_PARAM_NEVER
);
948 tmp
->AddCommand(wxT("BwLimits"), CMD_ID_GET_BWLIMITS
, wxTRANSLATE("Get bandwidth limits."), wxEmptyString
, CMD_PARAM_NEVER
);
950 tmp
= m_commands
.AddCommand(wxT("Search"), CMD_ID_SEARCH
, wxTRANSLATE("Execute a search."),
951 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
);
952 tmp
->AddCommand(wxT("global"), CMD_ID_SEARCH_GLOBAL
, wxTRANSLATE("Execute a global search."), wxEmptyString
, CMD_PARAM_ALWAYS
);
953 tmp
->AddCommand(wxT("local"), CMD_ID_SEARCH_LOCAL
, wxTRANSLATE("Execute a local search"), wxEmptyString
, CMD_PARAM_ALWAYS
);
954 tmp
->AddCommand(wxT("kad"), CMD_ID_SEARCH_KAD
, wxTRANSLATE("Execute a kad search"), wxEmptyString
, CMD_PARAM_ALWAYS
);
956 m_commands
.AddCommand(wxT("Results"), CMD_ID_SEARCH_RESULTS
, wxTRANSLATE("Show the results of the last search."),
957 wxTRANSLATE("Return the results of the previous search.\n"), CMD_PARAM_NEVER
);
959 m_commands
.AddCommand(wxT("Progress"), CMD_ID_SEARCH_PROGRESS
, wxTRANSLATE("Show the progress of a search."),
960 wxTRANSLATE("Show the progress of a search.\n"), CMD_PARAM_NEVER
);
962 m_commands
.AddCommand(wxT("Download"), CMD_ID_DOWNLOAD
, wxTRANSLATE("Start downloading a file"),
963 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
);
967 // TODO: These commands below need implementation and/or rewrite!
970 m_commands
.AddCommand(wxT("Pause"), CMD_ID_PAUSE
, wxTRANSLATE("Pause download."),
971 wxEmptyString
, CMD_PARAM_ALWAYS
);
973 m_commands
.AddCommand(wxT("Resume"), CMD_ID_RESUME
, wxTRANSLATE("Resume download."),
974 wxEmptyString
, CMD_PARAM_ALWAYS
);
976 m_commands
.AddCommand(wxT("Cancel"), CMD_ID_CANCEL
, wxTRANSLATE("Cancel download."),
977 wxEmptyString
, CMD_PARAM_ALWAYS
);
979 tmp
= m_commands
.AddCommand(wxT("Priority"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set download priority."),
980 wxTRANSLATE("Set priority of a download to Low, Normal, High or Auto.\n"), CMD_PARAM_ALWAYS
);
981 tmp
->AddCommand(wxT("Low"), CMD_ID_PRIORITY_LOW
, wxTRANSLATE("Set priority to low."), wxEmptyString
, CMD_PARAM_ALWAYS
);
982 tmp
->AddCommand(wxT("Normal"), CMD_ID_PRIORITY_NORMAL
, wxTRANSLATE("Set priority to normal."), wxEmptyString
, CMD_PARAM_ALWAYS
);
983 tmp
->AddCommand(wxT("High"), CMD_ID_PRIORITY_HIGH
, wxTRANSLATE("Set priority to high."), wxEmptyString
, CMD_PARAM_ALWAYS
);
984 tmp
->AddCommand(wxT("Auto"), CMD_ID_PRIORITY_AUTO
, wxTRANSLATE("Set priority to auto."), wxEmptyString
, CMD_PARAM_ALWAYS
);
986 tmp
= m_commands
.AddCommand(wxT("Show"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Show queues/lists."),
987 wxTRANSLATE("Show upload/download queue, server list or shared files list.\n"), CMD_PARAM_ALWAYS
);
988 tmp
->AddCommand(wxT("UL"), CMD_ID_SHOW_UL
, wxTRANSLATE("Show upload queue."), wxEmptyString
, CMD_PARAM_NEVER
);
989 tmp
->AddCommand(wxT("DL"), CMD_ID_SHOW_DL
, wxTRANSLATE("Show download queue."), wxEmptyString
, CMD_PARAM_NEVER
);
990 tmp
->AddCommand(wxT("Log"), CMD_ID_SHOW_LOG
, wxTRANSLATE("Show log."), wxEmptyString
, CMD_PARAM_NEVER
);
991 tmp
->AddCommand(wxT("Servers"), CMD_ID_SHOW_SERVERS
, wxTRANSLATE("Show servers list."), wxEmptyString
, CMD_PARAM_NEVER
);
992 tmp
->AddCommand(wxT("Shared"), CMD_ID_SHOW_SHARED
, wxTRANSLATE("Show shared files list."), wxEmptyString
, CMD_PARAM_NEVER
);
994 m_commands
.AddCommand(wxT("Reset"), CMD_ID_RESET_LOG
, wxTRANSLATE("Reset log."), wxEmptyString
, CMD_PARAM_NEVER
);
997 // Deprecated commands, kept for backwards compatibility only.
1000 #define DEPRECATED(OLDCMD, ID, NEWCMD, PARAM) \
1001 m_commands.AddCommand(wxT(OLDCMD), CMD_ID_##ID | CMD_DEPRECATED, CFormat(wxTRANSLATE("Deprecated command, use '%s' instead.")) % wxT(NEWCMD), \
1002 CFormat(wxTRANSLATE("This is a deprecated command, and may be removed in the future.\nUse '%s' instead.\n")) % wxT(NEWCMD), CMD_PARAM_##PARAM)
1004 DEPRECATED("Stats", STATUS
, "Status", NEVER
);
1005 DEPRECATED("SetIPFilter", SET_IPFILTER
, "Set IPFilter", OPTIONAL
);
1006 DEPRECATED("GetIPLevel", GET_IPFILTER_LEVEL
, "Get IPFilter Level", NEVER
);
1007 DEPRECATED("SetIPLevel", SET_IPFILTER_LEVEL
, "Set IPFilter Level", ALWAYS
);
1008 DEPRECATED("IPLevel", SET_IPFILTER_LEVEL
, "Get/Set IPFilter Level", OPTIONAL
);
1009 DEPRECATED("Servers", SHOW_SERVERS
, "Show Servers", NEVER
);
1010 DEPRECATED("GetBWLimits", GET_BWLIMITS
, "Get BwLimits", NEVER
);
1011 DEPRECATED("SetUpBWLimit", SET_BWLIMIT_UP
, "Set BwLimit Up", ALWAYS
);
1012 DEPRECATED("SetDownBWLimit", SET_BWLIMIT_DOWN
, "Set BwLimit Down", ALWAYS
);
1015 int CamulecmdApp::OnRun()
1017 ConnectAndRun(wxT("aMulecmd"), wxT(VERSION
));
1021 // Dummy functions for EC logging
1022 bool ECLogIsEnabled()
1027 void DoECLogLine(const wxString
&)
1032 namespace MuleNotify
1034 void HandleNotification(const class CMuleNotiferBase
&) {}
1035 void HandleNotificationAlways(const class CMuleNotiferBase
&) {}
1038 // File_checked_for_headers