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
30 #include <common/ClientVersion.h>
34 #include "TextClient.h"
37 #include <unistd.h> // Do_not_auto_remove
41 //-------------------------------------------------------------------
44 //-------------------------------------------------------------------
46 #include <ec/cpp/ECSpecialTags.h>
48 #include <wx/tokenzr.h>
50 #include <common/Format.h> // Needed for CFormat
51 #include "OtherFunctions.h"
52 #include "Constants.h" // Needed for Priority Levels
53 #include "DataToText.h" // Needed for PriorityToStr
54 #include "MuleVersion.h" // Needed for GetMuleVersion()
56 //-------------------------------------------------------------------
63 CMD_ID_PRIORITY_NORMAL
,
71 CMD_ID_DISCONNECT_ED2K
,
72 CMD_ID_DISCONNECT_KAD
,
74 CMD_ID_RELOAD_IPFILTER_LOCAL
,
75 CMD_ID_RELOAD_IPFILTER_NET
,
76 CMD_ID_SET_IPFILTER_ON
,
77 CMD_ID_SET_IPFILTER_OFF
,
78 CMD_ID_SET_IPFILTER_CLIENTS_ON
,
79 CMD_ID_SET_IPFILTER_CLIENTS_OFF
,
80 CMD_ID_SET_IPFILTER_SERVERS_ON
,
81 CMD_ID_SET_IPFILTER_SERVERS_OFF
,
82 CMD_ID_SET_IPFILTER_LEVEL
,
84 CMD_ID_GET_IPFILTER_STATE
,
85 CMD_ID_GET_IPFILTER_STATE_CLIENTS
,
86 CMD_ID_GET_IPFILTER_STATE_SERVERS
,
87 CMD_ID_GET_IPFILTER_LEVEL
,
96 CMD_ID_SET_BWLIMIT_UP
,
97 CMD_ID_SET_BWLIMIT_DOWN
,
101 CMD_ID_SEARCH_GLOBAL
,
104 CMD_ID_SEARCH_RESULTS
,
105 CMD_ID_SEARCH_PROGRESS
,
107 // IDs for deprecated commands
112 // method to create a SearchFile
113 SearchFile::SearchFile(const CEC_SearchFile_Tag
*tag
)
115 nHash
= tag
->FileHash();
116 sHash
= nHash
.Encode();
117 sFileName
= tag
->FileName();
118 lFileSize
= tag
->SizeFull();
119 lSourceCount
= tag
->SourceCount();
120 bPresent
= tag
->AlreadyHave();
123 //-------------------------------------------------------------------
124 IMPLEMENT_APP (CamulecmdApp
)
125 //-------------------------------------------------------------------
127 void CamulecmdApp::OnInitCmdLine(wxCmdLineParser
& parser
)
129 CaMuleExternalConnector::OnInitCmdLine(parser
, "amulecmd");
130 parser
.AddOption(wxT("c"), wxT("command"),
131 _("Execute <str> and exit."),
132 wxCMD_LINE_VAL_STRING
, wxCMD_LINE_PARAM_OPTIONAL
);
135 bool CamulecmdApp::OnCmdLineParsed(wxCmdLineParser
& parser
)
137 m_HasCmdOnCmdLine
= parser
.Found(wxT("command"), &m_CmdString
);
138 if (m_CmdString
.Lower().StartsWith(wxT("help")))
141 printf("%s %s\n", m_appname
, (const char *)unicode2char(GetMuleVersion()));
142 Parse_Command(m_CmdString
);
145 m_interactive
= !m_HasCmdOnCmdLine
;
146 return CaMuleExternalConnector::OnCmdLineParsed(parser
);
149 void CamulecmdApp::TextShell(const wxString
& prompt
)
151 if (m_HasCmdOnCmdLine
)
152 Parse_Command(m_CmdString
);
154 CaMuleExternalConnector::TextShell(prompt
);
157 int CamulecmdApp::ProcessCommand(int CmdId
)
159 wxString args
= GetCmdArgs();
160 CECPacket
*request
= 0;
161 std::list
<CECPacket
*> request_list
;
163 EC_SEARCH_TYPE search_type
= EC_SEARCH_KAD
;
165 // Implementation of the deprecated command 'SetIPFilter'.
166 if (CmdId
== CMD_ID_SET_IPFILTER
) {
167 if ( ! args
.IsEmpty() ) {
168 if (args
.IsSameAs(wxT("ON"), false)) {
169 CmdId
= CMD_ID_SET_IPFILTER_ON
;
170 } else if (args
.IsSameAs(wxT("OFF"), false)) {
171 CmdId
= CMD_ID_SET_IPFILTER_OFF
;
173 return CMD_ERR_INVALID_ARG
;
176 CmdId
= CMD_ID_GET_IPFILTER_STATE
;
182 request_list
.push_back(new CECPacket(EC_OP_STAT_REQ
, EC_DETAIL_CMD
));
185 case CMD_ID_SHUTDOWN
:
186 request_list
.push_back(new CECPacket(EC_OP_SHUTDOWN
));
190 if ( !args
.IsEmpty() ) {
193 // Not much we can do against this unicode2char.
194 int result
= sscanf(unicode2char(args
), "%3d.%3d.%3d.%3d:%5d", &ip
[0], &ip
[1], &ip
[2], &ip
[3], &port
);
196 // Try to resolve DNS -- good for dynamic IP servers
197 wxString
serverName(args
.BeforeFirst(wxT(':')));
199 bool ok
= args
.AfterFirst(wxT(':')).ToLong(&lPort
);
200 port
= (unsigned int)lPort
;
202 a
.Hostname(serverName
);
204 result
= sscanf(unicode2char(a
.IPAddress()), "%3d.%3d.%3d.%3d", &ip
[0], &ip
[1], &ip
[2], &ip
[3]);
205 if (serverName
.IsEmpty() || !ok
|| (result
!= 4)) {
206 Show(_("Invalid IP format. Use xxx.xxx.xxx.xxx:xxxx\n"));
211 addr
.m_ip
[0] = ip
[0];
212 addr
.m_ip
[1] = ip
[1];
213 addr
.m_ip
[2] = ip
[2];
214 addr
.m_ip
[3] = ip
[3];
216 request
= new CECPacket(EC_OP_SERVER_CONNECT
);
217 request
->AddTag(CECTag(EC_TAG_SERVER
, addr
));
218 request_list
.push_back(request
);
220 request_list
.push_back(new CECPacket(EC_OP_CONNECT
));
224 case CMD_ID_CONNECT_ED2K
:
225 request_list
.push_back(new CECPacket(EC_OP_SERVER_CONNECT
));
228 case CMD_ID_CONNECT_KAD
:
229 request_list
.push_back(new CECPacket(EC_OP_KAD_START
));
232 case CMD_ID_DISCONNECT
:
233 request_list
.push_back(new CECPacket(EC_OP_DISCONNECT
));
236 case CMD_ID_DISCONNECT_ED2K
:
237 request_list
.push_back(new CECPacket(EC_OP_SERVER_DISCONNECT
));
240 case CMD_ID_DISCONNECT_KAD
:
241 request_list
.push_back(new CECPacket(EC_OP_KAD_STOP
));
244 case CMD_ID_RELOAD_SHARED
:
245 request_list
.push_back(new CECPacket(EC_OP_SHAREDFILES_RELOAD
));
248 case CMD_ID_RELOAD_IPFILTER_LOCAL
:
249 request_list
.push_back(new CECPacket(EC_OP_IPFILTER_RELOAD
));
252 case CMD_ID_RELOAD_IPFILTER_NET
:
253 request
= new CECPacket(EC_OP_IPFILTER_UPDATE
);
254 request
->AddTag(EC_TAG_STRING
, args
);
255 request_list
.push_back(request
);
258 case CMD_ID_SET_IPFILTER_ON
:
259 case CMD_ID_SET_IPFILTER_CLIENTS_ON
:
260 case CMD_ID_SET_IPFILTER_SERVERS_ON
:
262 case CMD_ID_SET_IPFILTER_OFF
:
263 case CMD_ID_SET_IPFILTER_CLIENTS_OFF
:
264 case CMD_ID_SET_IPFILTER_SERVERS_OFF
:
266 if (CmdId
== CMD_ID_SET_IPFILTER_CLIENTS_ON
|| CmdId
== CMD_ID_SET_IPFILTER_CLIENTS_OFF
) {
267 CmdId
= CMD_ID_GET_IPFILTER_STATE_CLIENTS
;
268 } else if (CmdId
== CMD_ID_SET_IPFILTER_SERVERS_ON
|| CmdId
== CMD_ID_SET_IPFILTER_SERVERS_OFF
) {
269 CmdId
= CMD_ID_GET_IPFILTER_STATE_SERVERS
;
271 CmdId
= CMD_ID_GET_IPFILTER_STATE
;
274 request
= new CECPacket(EC_OP_SET_PREFERENCES
);
275 CECEmptyTag
prefs(EC_TAG_PREFS_SECURITY
);
276 if (CmdId
!= CMD_ID_GET_IPFILTER_STATE_SERVERS
) {
277 prefs
.AddTag(CECTag(EC_TAG_IPFILTER_CLIENTS
, (uint8
)tmp_int
));
279 if (CmdId
!= CMD_ID_GET_IPFILTER_STATE_CLIENTS
) {
280 prefs
.AddTag(CECTag(EC_TAG_IPFILTER_SERVERS
, (uint8
)tmp_int
));
282 request
->AddTag(prefs
);
283 request_list
.push_back(request
);
285 case CMD_ID_GET_IPFILTER
:
286 case CMD_ID_GET_IPFILTER_STATE
:
287 case CMD_ID_GET_IPFILTER_STATE_CLIENTS
:
288 case CMD_ID_GET_IPFILTER_STATE_SERVERS
:
289 request
= new CECPacket(EC_OP_GET_PREFERENCES
);
290 request
->AddTag(CECTag(EC_TAG_SELECT_PREFS
, (uint32
)EC_PREFS_SECURITY
));
291 request_list
.push_back(request
);
294 case CMD_ID_SET_IPFILTER_LEVEL
:
295 if (!args
.IsEmpty()) // This 'if' must stay as long as we support the deprecated 'IPLevel' command.
297 unsigned long int level
= 0;
298 if (args
.ToULong(&level
) == true && level
< 256) {
299 request
= new CECPacket(EC_OP_SET_PREFERENCES
);
300 CECEmptyTag
prefs(EC_TAG_PREFS_SECURITY
);
301 prefs
.AddTag(CECTag(EC_TAG_IPFILTER_LEVEL
, (uint8
)level
));
302 request
->AddTag(prefs
);
303 request_list
.push_back(request
);
305 return CMD_ERR_INVALID_ARG
;
308 CmdId
= CMD_ID_GET_IPFILTER_LEVEL
;
309 case CMD_ID_GET_IPFILTER_LEVEL
:
310 request
= new CECPacket(EC_OP_GET_PREFERENCES
);
311 request
->AddTag(CECTag(EC_TAG_SELECT_PREFS
, (uint32
)EC_PREFS_SECURITY
));
312 request_list
.push_back(request
);
319 if ( args
.IsEmpty() ) {
320 Show(_("This command requires an argument. Valid arguments: 'all', filename, or a number.\n"));
323 wxStringTokenizer
argsTokenizer(args
);
327 // Grab the entire dl queue right away
328 CECPacket
request_all(EC_OP_GET_DLOAD_QUEUE
, EC_DETAIL_CMD
);
329 const CECPacket
*reply_all
= SendRecvMsg_v2(&request_all
);
334 request
= new CECPacket(EC_OP_PARTFILE_PAUSE
); break;
336 request
= new CECPacket(EC_OP_PARTFILE_DELETE
); break;
338 request
= new CECPacket(EC_OP_PARTFILE_RESUME
); break;
342 // We loop through all the arguments
343 while(argsTokenizer
.HasMoreTokens()) {
344 token
=argsTokenizer
.GetNextToken();
346 // If the user requested all, then we select all files and exit the loop
347 // since there is little point to add anything more to "everything"
348 if( token
== wxT("all") ) {
349 for (CECPacket::const_iterator it
= reply_all
->begin(); it
!= reply_all
->end(); ++it
) {
350 const CEC_PartFile_Tag
*tag
= static_cast<const CEC_PartFile_Tag
*>(&*it
);
351 request
->AddTag(CECTag(EC_TAG_PARTFILE
, tag
->FileHash()));
354 } else if ( hash
.Decode(token
.Trim(false).Trim(true)) ) {
355 if ( !hash
.IsEmpty() ) {
356 Show(_("Processing by hash: "+token
+wxT("\n")));
357 request
->AddTag(CECTag(EC_TAG_PARTFILE
, hash
));
360 // Go through the dl queue and look at each filename
361 for (CECPacket::const_iterator it
= reply_all
->begin(); it
!= reply_all
->end(); ++it
) {
362 const CEC_PartFile_Tag
*tag
= static_cast<const CEC_PartFile_Tag
*>(&*it
);
363 wxString partmetname
= tag
->PartMetName();
365 // We check for filename, XXX.pat.met, XXX.part, XXX
366 if( tag
->FileName() == token
||
367 partmetname
== token
||
368 partmetname
.Truncate(partmetname
.Len()-4) == token
||
369 partmetname
.Truncate(partmetname
.Len()-5) == token
) {
370 Show(_("Processing by filename: "+token
+wxT("\n")));
371 request
->AddTag(CECTag(EC_TAG_PARTFILE
, tag
->FileHash()));
374 } // End of filename check else
375 } // End of argument token loop
377 request_list
.push_back(request
);
381 } // End of dl queue processing
383 } // end of command processing
387 case CMD_ID_PRIORITY_LOW
:
388 case CMD_ID_PRIORITY_NORMAL
:
389 case CMD_ID_PRIORITY_HIGH
:
390 case CMD_ID_PRIORITY_AUTO
:
391 if ( args
.IsEmpty() ) {
392 Show(_("This command requires an argument. Valid arguments: a file hash.\n"));
396 if (hash
.Decode(args
.Trim(false).Trim(true))) {
397 if (!hash
.IsEmpty()) {
398 request
= new CECPacket(EC_OP_PARTFILE_PRIO_SET
);
399 CECTag
hashtag(EC_TAG_PARTFILE
, hash
);
401 case CMD_ID_PRIORITY_LOW
:
402 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_LOW
));
404 case CMD_ID_PRIORITY_NORMAL
:
405 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_NORMAL
));
407 case CMD_ID_PRIORITY_HIGH
:
408 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_HIGH
));
410 case CMD_ID_PRIORITY_AUTO
:
411 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_PRIO
, (uint8
)PR_AUTO
));
415 request
->AddTag(hashtag
);
416 request_list
.push_back(request
);
418 Show(_("Not a valid number\n"));
422 Show(_("Not a valid hash (length should be exactly 32 chars)\n"));
429 request_list
.push_back(new CECPacket(EC_OP_GET_ULOAD_QUEUE
));
433 request_list
.push_back(new CECPacket(EC_OP_GET_DLOAD_QUEUE
));
436 case CMD_ID_SHOW_LOG
:
437 request_list
.push_back(new CECPacket(EC_OP_GET_LOG
));
440 case CMD_ID_SHOW_SERVERS
:
441 request_list
.push_back(new CECPacket(EC_OP_GET_SERVER_LIST
, EC_DETAIL_CMD
));
444 case CMD_ID_SHOW_SHARED
:
445 request_list
.push_back(new CECPacket(EC_OP_GET_SHARED_FILES
));
448 case CMD_ID_RESET_LOG
:
449 request_list
.push_back(new CECPacket(EC_OP_RESET_LOG
));
453 if (args
.StartsWith(wxT("ed2k://"))) {
454 //aMule doesn't like AICH links without |/| in front of h=
455 if (args
.Find(wxT("|h=")) > -1 && args
.Find(wxT("|/|h=")) == -1) {
456 args
.Replace(wxT("|h="),wxT("|/|h="));
458 // repair links where | is replaced with %7C (Firefox)
459 if (args
.StartsWith(wxT("ed2k://%7C"))) {
460 args
.Replace(wxT("%7C"),wxT("|"));
463 request
= new CECPacket(EC_OP_ADD_LINK
);
464 request
->AddTag(CECTag(EC_TAG_STRING
, args
));
465 request_list
.push_back(request
);
468 case CMD_ID_SET_BWLIMIT_UP
:
469 tmp_int
= EC_TAG_CONN_MAX_UL
- EC_TAG_CONN_MAX_DL
;
470 case CMD_ID_SET_BWLIMIT_DOWN
:
471 tmp_int
+= EC_TAG_CONN_MAX_DL
;
473 unsigned long int limit
;
474 if (args
.ToULong(&limit
)) {
475 request
= new CECPacket(EC_OP_SET_PREFERENCES
);
476 CECEmptyTag
prefs(EC_TAG_PREFS_CONNECTIONS
);
477 prefs
.AddTag(CECTag(tmp_int
, (uint16
)limit
));
478 request
->AddTag(prefs
);
479 request_list
.push_back(request
);
481 return CMD_ERR_INVALID_ARG
;
484 case CMD_ID_GET_BWLIMITS
:
485 request
= new CECPacket(EC_OP_GET_PREFERENCES
);
486 request
->AddTag(CECTag(EC_TAG_SELECT_PREFS
, (uint32
)EC_PREFS_CONNECTIONS
));
487 request_list
.push_back(request
);
490 case CMD_ID_STATTREE
:
491 request
= new CECPacket(EC_OP_GET_STATSTREE
);
492 if (!args
.IsEmpty()) {
493 unsigned long int max_versions
;
494 if (args
.ToULong(&max_versions
)) {
495 if (max_versions
< 256) {
496 request
->AddTag(CECTag(EC_TAG_STATTREE_CAPPING
, (uint8
)max_versions
));
499 return CMD_ERR_INVALID_ARG
;
503 return CMD_ERR_INVALID_ARG
;
506 request_list
.push_back(request
);
508 case CMD_ID_SEARCH_GLOBAL
:
509 search_type
= EC_SEARCH_GLOBAL
;
510 case CMD_ID_SEARCH_LOCAL
:
511 if (search_type
!= EC_SEARCH_GLOBAL
){
512 search_type
= EC_SEARCH_LOCAL
;
514 case CMD_ID_SEARCH_KAD
:
515 if (search_type
!= EC_SEARCH_GLOBAL
&& search_type
!= EC_SEARCH_LOCAL
){
516 search_type
= EC_SEARCH_KAD
;
520 wxString search
= args
;
527 request
= new CECPacket(EC_OP_SEARCH_START
);
528 request
->AddTag(CEC_Search_Tag (search
, search_type
, type
, extention
, avail
, min_size
, max_size
));
529 request_list
.push_back(request
);
534 'help search' is a command to the program, do not translate it. */
535 Show(_("No search type defined.\nType 'help search' to get more help.\n"));
539 case CMD_ID_SEARCH_RESULTS
:
540 request_list
.push_back(new CECPacket(EC_OP_SEARCH_RESULTS
, EC_DETAIL_FULL
));
543 case CMD_ID_SEARCH_PROGRESS
:
544 request_list
.push_back(new CECPacket(EC_OP_SEARCH_PROGRESS
));
547 case CMD_ID_DOWNLOAD
:
550 unsigned long int id
= 0;
551 if (args
.ToULong(&id
) == true && id
< m_Results_map
.size()) {
553 SearchFile
* file
= m_Results_map
[id
];
554 Show(CFormat(_("Download File: %lu %s\n")) % id
% file
->sFileName
);
555 request
= new CECPacket(EC_OP_DOWNLOAD_SEARCH_RESULT
);
556 // get with id the hash and category=0
558 CECTag
hashtag(EC_TAG_PARTFILE
, file
->nHash
);
559 hashtag
.AddTag(CECTag(EC_TAG_PARTFILE_CAT
, category
));
560 request
->AddTag(hashtag
);
561 request_list
.push_back(request
);
563 return CMD_ERR_INVALID_ARG
;
569 return CMD_ERR_PROCESS_CMD
;
572 m_last_cmd_id
= CmdId
;
574 if ( ! request_list
.empty() ) {
575 std::list
<CECPacket
*>::iterator it
= request_list
.begin();
576 while ( it
!= request_list
.end() ) {
577 CECPacket
*curr
= *it
++;
578 if (curr
->GetOpCode() == EC_OP_SHUTDOWN
) {
583 const CECPacket
*reply
= SendRecvMsg_v2(curr
);
586 Process_Answer_v2(reply
);
590 request_list
.resize(0);
597 * Method to show the results in the console
599 void CamulecmdApp::ShowResults(CResultMap results_map
)
601 unsigned int name_max
= 80;
602 unsigned int mb_max
= 5;
603 unsigned int nr_max
= 5;
604 unsigned long int id
= 0;
605 wxString output
, name
, sources
, mb
, kb
;
607 printf("Nr. Filename: Size(MB): Sources: \n");
608 printf("-----------------------------------------------------------------------------------------------------------\n");
610 for( std::map
<unsigned long int,SearchFile
*>::iterator iter
= results_map
.begin(); iter
!= results_map
.end(); ++iter
) {
612 SearchFile
* file
= (*iter
).second
;
614 output
.Printf(wxT("%i. "), id
);
615 output
= output
.SubString(0, nr_max
).Append(file
->sFileName
).Append(' ', name_max
);
616 mb
.Printf(wxT(" %d"), file
->lFileSize
/1024/1024);
617 kb
.Printf(wxT(".%d"), file
->lFileSize
/1024%1024);
618 output
= output
.SubString(0, nr_max
+ name_max
+ mb_max
- mb
.Length() ).Append(mb
).Append(kb
);
619 printf("%s %ld\n",(const char*)unicode2char(output
), file
->lSourceCount
);
624 // Formats a statistics (sub)tree to text
625 wxString
StatTree2Text(const CEC_StatTree_Node_Tag
*tree
, int depth
)
628 return wxEmptyString
;
630 wxString result
= wxString(wxChar(' '), depth
) + tree
->GetDisplayString() + wxT("\n");
631 for (CECTag::const_iterator it
= tree
->begin(); it
!= tree
->end(); ++it
) {
632 const CEC_StatTree_Node_Tag
*tmp
= static_cast<const CEC_StatTree_Node_Tag
*>(&*it
);
633 if (tmp
->GetTagName() == EC_TAG_STATTREE_NODE
) {
634 result
+= StatTree2Text(tmp
, depth
+ 1);
641 * Format EC packet into text form for output to console
643 void CamulecmdApp::Process_Answer_v2(const CECPacket
*response
)
646 wxString
msgFailedUnknown(_("Request failed with an unknown error."));
648 switch (response
->GetOpCode()) {
650 s
<< _("Operation was successful.");
654 const CECTag
*tag
= response
->GetFirstTagSafe();
655 if (tag
->IsString()) {
656 s
<< CFormat(_("Request failed with the following error: %s")) % wxGetTranslation(tag
->GetStringData());
658 s
<< msgFailedUnknown
;
662 case EC_OP_SET_PREFERENCES
:
664 const CECTag
*tab
= response
->GetTagByNameSafe(EC_TAG_PREFS_SECURITY
);
665 const CECTag
*ipfilterLevel
= tab
->GetTagByName(EC_TAG_IPFILTER_LEVEL
);
667 if (m_last_cmd_id
== CMD_ID_GET_IPFILTER
||
668 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE
||
669 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE_CLIENTS
) {
670 s
+= CFormat(_("IP filtering for clients is %s.\n"))
671 % ((tab
->GetTagByName(EC_TAG_IPFILTER_CLIENTS
) == NULL
) ? _("OFF") : _("ON"));
673 if (m_last_cmd_id
== CMD_ID_GET_IPFILTER
||
674 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE
||
675 m_last_cmd_id
== CMD_ID_GET_IPFILTER_STATE_SERVERS
) {
676 s
+= CFormat(_("IP filtering for servers is %s.\n"))
677 % ((tab
->GetTagByName(EC_TAG_IPFILTER_SERVERS
) == NULL
) ? _("OFF") : _("ON"));
679 if (m_last_cmd_id
== CMD_ID_GET_IPFILTER
||
680 m_last_cmd_id
== CMD_ID_GET_IPFILTER_LEVEL
) {
681 s
<< CFormat(_("Current IPFilter Level is %d.\n")) % ipfilterLevel
->GetInt();
684 tab
= response
->GetTagByNameSafe(EC_TAG_PREFS_CONNECTIONS
);
685 const CECTag
*connMaxUL
= tab
->GetTagByName(EC_TAG_CONN_MAX_UL
);
686 const CECTag
*connMaxDL
= tab
->GetTagByName(EC_TAG_CONN_MAX_DL
);
687 if (connMaxUL
&& connMaxDL
) {
688 s
<< CFormat(_("Bandwidth limits: Up: %u kB/s, Down: %u kB/s.\n"))
689 % connMaxUL
->GetInt() % connMaxDL
->GetInt();
694 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
695 const CECTag
&tag
= *it
;
696 s
<< tag
.GetStringData() << wxT("\n");
700 const CEC_ConnState_Tag
*connState
= static_cast<const CEC_ConnState_Tag
*>(response
->GetTagByName(EC_TAG_CONNSTATE
));
702 s
<< _("eD2k") << wxT(": ");
703 if (connState
->IsConnectedED2K()) {
704 const CECTag
*server
= connState
->GetTagByName(EC_TAG_SERVER
);
705 const CECTag
*serverName
= server
? server
->GetTagByName(EC_TAG_SERVER_NAME
) : NULL
;
706 if (server
&& serverName
) {
707 s
<< CFormat(_("Connected to %s %s %s")) %
708 serverName
->GetStringData() %
709 server
->GetIPv4Data().StringIP() %
710 (connState
->HasLowID() ? _("with LowID") : _("with HighID"));
712 } else if (connState
->IsConnectingED2K()) {
713 s
<< _("Now connecting");
715 s
<< _("Not connected");
717 s
<< wxT('\n') << _("Kad") << wxT(": ");
718 if (connState
->IsKadRunning()) {
719 if (connState
->IsConnectedKademlia()) {
720 s
<< _("Connected") << wxT(" (");
721 if (connState
->IsKadFirewalled()) {
722 s
<< _("firewalled");
728 s
<< _("Not connected");
731 s
<< _("Not running");
735 const CECTag
*tmpTag
;
736 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_DL_SPEED
)) != 0) {
737 s
<< CFormat(_("\nDownload:\t%s")) % CastItoSpeed(tmpTag
->GetInt());
739 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_UL_SPEED
)) != 0) {
740 s
<< CFormat(_("\nUpload:\t%s")) % CastItoSpeed(tmpTag
->GetInt());
742 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_UL_QUEUE_LEN
)) != 0) {
743 s
<< CFormat(_("\nClients in queue:\t%d\n")) % tmpTag
->GetInt();
745 if ((tmpTag
= response
->GetTagByName(EC_TAG_STATS_TOTAL_SRC_COUNT
)) != 0) {
746 s
<< CFormat(_("\nTotal sources:\t%d\n")) % tmpTag
->GetInt();
750 case EC_OP_DLOAD_QUEUE
:
751 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
752 const CEC_PartFile_Tag
*tag
= static_cast<const CEC_PartFile_Tag
*>(&*it
);
753 uint64 filesize
, donesize
;
754 filesize
= tag
->SizeFull();
755 donesize
= tag
->SizeDone();
756 s
<< tag
->FileHashString() << wxT(" ") <<
758 (CFormat(wxT("\n\t [%.1f%%] %4i/%4i "))
759 % ((float)donesize
/ ((float)filesize
)*100.0)
760 % ((int)tag
->SourceCount() - (int)tag
->SourceNotCurrCount())
761 % (int)tag
->SourceCount()) <<
762 ((int)tag
->SourceCountA4AF() ? wxString(CFormat(wxT("+%2.2i ")) % (int)tag
->SourceCountA4AF()) : wxString(wxT(" "))) <<
763 ((int)tag
->SourceXferCount() ? wxString(CFormat(wxT("(%2.2i) - ")) % (int)tag
->SourceXferCount()) : wxString(wxT(" - "))) <<
764 tag
->GetFileStatusString();
765 s
<< wxT(" - ") << tag
->PartMetName();
766 if (tag
->DownPrio() < 10) {
767 s
<< wxT(" - ") << PriorityToStr((int)tag
->DownPrio(), 0);
769 s
<< wxT(" - ") << PriorityToStr((tag
->DownPrio() - 10), 1);
771 if ( tag
->SourceXferCount() > 0) {
772 s
<< wxT(" - ") + CastItoSpeed(tag
->Speed());
777 case EC_OP_ULOAD_QUEUE
:
778 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
779 const CECTag
*tag
= & *it
;
780 const CECTag
*clientName
= tag
->GetTagByName(EC_TAG_CLIENT_NAME
);
781 const CECTag
*partfileName
= tag
->GetTagByName(EC_TAG_PARTFILE_NAME
);
782 const CECTag
*partfileSizeXfer
= tag
->GetTagByName(EC_TAG_PARTFILE_SIZE_XFER
);
783 const CECTag
*partfileSpeed
= tag
->GetTagByName(EC_TAG_CLIENT_UP_SPEED
);
784 if (clientName
&& partfileName
&& partfileSizeXfer
&& partfileSpeed
) {
786 CFormat(wxT("%10u ")) % tag
->GetInt() <<
787 clientName
->GetStringData() << wxT(" ") <<
788 partfileName
->GetStringData() << wxT(" ") <<
789 CastItoXBytes(partfileSizeXfer
->GetInt()) << wxT(" ") <<
790 CastItoSpeed(partfileSpeed
->GetInt());
795 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
796 const CECTag
&tag
= *it
;
797 s
<< tag
.GetStringData() << wxT("\n");
800 case EC_OP_SERVER_LIST
:
801 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
802 const CECTag
&tag
= *it
;
803 const CECTag
*serverName
= tag
.GetTagByName(EC_TAG_SERVER_NAME
);
805 wxString ip
= tag
.GetIPv4Data().StringIP();
806 ip
.Append(' ', 24 - ip
.Length());
807 s
<< ip
<< serverName
->GetStringData() << wxT("\n");
812 case EC_OP_SHARED_FILES
:
813 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
814 const CEC_SharedFile_Tag
*tag
= static_cast<const CEC_SharedFile_Tag
*>(&*it
);
815 s
<< tag
->FileHashString() << wxT(" ");
816 wxString filePath
= tag
->FilePath();
817 bool ispartfile
= true;
818 if (filePath
.EndsWith(wxT(".part"))) {
819 for (unsigned i
= 0; i
< filePath
.Length() - 5; i
++) {
820 if (filePath
[i
] < wxT('0') || filePath
[i
] > wxT('9')) {
829 s
<< _("[PartFile]") << wxT(" ");
839 << wxT("\n\t") << PriorityToStr(tag
->UpPrio() % 10, tag
->UpPrio() >= 10) << wxT(" - ") << CFormat(wxT("%i(%i) / %i(%i) - %s (%s) - %.2f\n"))
840 % tag
->GetRequests() % tag
->GetAllRequests()
841 % tag
->GetAccepts() % tag
->GetAllAccepts()
842 % CastItoXBytes(tag
->GetXferred()) % CastItoXBytes(tag
->GetAllXferred())
843 % (static_cast<float>(tag
->GetAllXferred()) / static_cast<float>(tag
->SizeFull()));
847 case EC_OP_STATSTREE
:
848 s
<< StatTree2Text(static_cast<const CEC_StatTree_Node_Tag
*>(response
->GetTagByName(EC_TAG_STATTREE_NODE
)), 0);
851 case EC_OP_SEARCH_RESULTS
:
854 m_Results_map
.clear();
855 s
+= CFormat(_("Number of search results: %i\n")) % response
->GetTagCount();
856 for (CECPacket::const_iterator it
= response
->begin(); it
!= response
->end(); ++it
) {
857 const CEC_SearchFile_Tag
*tag
= static_cast<const CEC_SearchFile_Tag
*>(&*it
);
858 //printf("Tag FileName: %s \n",(const char*)unicode2char(tag->FileName()));
859 m_Results_map
[i
++] = new SearchFile(tag
);
861 ShowResults(m_Results_map
);
864 case EC_OP_SEARCH_PROGRESS
:
866 const CECTag
*tab
= response
->GetTagByNameSafe(EC_TAG_SEARCH_STATUS
);
867 uint32 progress
= tab
->GetInt();
868 if (progress
<= 100) {
869 s
+= CFormat(_("Search progress: %u %% \n")) % progress
;
871 s
+= _("Search progress not available");
876 s
+= CFormat(_("Received an unknown reply from the server, OpCode = %#x.")) % response
->GetOpCode();
881 void CamulecmdApp::OnInitCommandSet()
887 CaMuleExternalConnector::OnInitCommandSet();
889 m_commands
.AddCommand(wxT("Status"), CMD_ID_STATUS
, wxTRANSLATE("Show short status information."),
890 wxTRANSLATE("Show connection status, current up/download speeds, etc.\n"), CMD_PARAM_NEVER
);
892 m_commands
.AddCommand(wxT("Statistics"), CMD_ID_STATTREE
, wxTRANSLATE("Show full statistics tree."),
893 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"));
895 m_commands
.AddCommand(wxT("Shutdown"), CMD_ID_SHUTDOWN
, wxTRANSLATE("Shut down aMule."),
896 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
);
898 tmp
= m_commands
.AddCommand(wxT("Reload"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Reload the given object."), wxEmptyString
, CMD_PARAM_NEVER
);
899 tmp
->AddCommand(wxT("Shared"), CMD_ID_RELOAD_SHARED
, wxTRANSLATE("Reload shared files list."), wxEmptyString
, CMD_PARAM_NEVER
);
901 tmp2
= tmp
->AddCommand(wxT("IPFilter"), CMD_ID_RELOAD_IPFILTER_LOCAL
, wxTRANSLATE("Reload IP filtering table."), wxEmptyString
, CMD_PARAM_OPTIONAL
);
902 tmp2
->AddCommand(wxT("File"), CMD_ID_RELOAD_IPFILTER_LOCAL
, wxTRANSLATE("Reload current IP filtering table."), wxEmptyString
, CMD_PARAM_NEVER
);
903 tmp2
->AddCommand(wxT("Net"), CMD_ID_RELOAD_IPFILTER_NET
, wxTRANSLATE("Update IP filtering table from URL."),
904 wxTRANSLATE("If URL is omitted the URL from the preferences is used."), CMD_PARAM_OPTIONAL
);
906 tmp
= m_commands
.AddCommand(wxT("Connect"), CMD_ID_CONNECT
, wxTRANSLATE("Connect to the network."),
907 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
);
908 tmp
->AddCommand(wxT("ED2K"), CMD_ID_CONNECT_ED2K
, wxTRANSLATE("Connect to eD2k only."), wxEmptyString
, CMD_PARAM_NEVER
);
909 tmp
->AddCommand(wxT("Kad"), CMD_ID_CONNECT_KAD
, wxTRANSLATE("Connect to Kad only."), wxEmptyString
, CMD_PARAM_NEVER
);
911 tmp
= m_commands
.AddCommand(wxT("Disconnect"), CMD_ID_DISCONNECT
, wxTRANSLATE("Disconnect from the network."),
912 wxTRANSLATE("This will disconnect from all networks that are currently connected.\n"), CMD_PARAM_NEVER
);
913 tmp
->AddCommand(wxT("ED2K"), CMD_ID_DISCONNECT_ED2K
, wxTRANSLATE("Disconnect from eD2k only."), wxEmptyString
, CMD_PARAM_NEVER
);
914 tmp
->AddCommand(wxT("Kad"), CMD_ID_DISCONNECT_KAD
, wxTRANSLATE("Disconnect from Kad only."), wxEmptyString
, CMD_PARAM_NEVER
);
916 m_commands
.AddCommand(wxT("Add"), CMD_ID_ADDLINK
, wxTRANSLATE("Add an eD2k or magnet link to core."),
917 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
);
919 tmp
= m_commands
.AddCommand(wxT("Set"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set a preference value."),
920 wxEmptyString
, CMD_PARAM_NEVER
);
922 tmp2
= tmp
->AddCommand(wxT("IPFilter"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set IP filtering preferences."), wxEmptyString
, CMD_PARAM_NEVER
);
923 tmp2
->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_ON
, wxTRANSLATE("Turn IP filtering on for both clients and servers."), wxEmptyString
, CMD_PARAM_NEVER
);
924 tmp2
->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_OFF
, wxTRANSLATE("Turn IP filtering off for both clients and servers."), wxEmptyString
, CMD_PARAM_NEVER
);
925 tmp3
= tmp2
->AddCommand(wxT("Clients"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Enable/Disable IP filtering for clients."), wxEmptyString
, CMD_PARAM_NEVER
);
926 tmp3
->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_CLIENTS_ON
, wxTRANSLATE("Turn IP filtering on for clients."), wxEmptyString
, CMD_PARAM_NEVER
);
927 tmp3
->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_CLIENTS_OFF
, wxTRANSLATE("Turn IP filtering off for clients."), wxEmptyString
, CMD_PARAM_NEVER
);
928 tmp3
= tmp2
->AddCommand(wxT("Servers"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Enable/Disable IP filtering for servers."), wxEmptyString
, CMD_PARAM_NEVER
);
929 tmp3
->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_SERVERS_ON
, wxTRANSLATE("Turn IP filtering on for servers."), wxEmptyString
, CMD_PARAM_NEVER
);
930 tmp3
->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_SERVERS_OFF
, wxTRANSLATE("Turn IP filtering off for servers."), wxEmptyString
, CMD_PARAM_NEVER
);
931 tmp2
->AddCommand(wxT("Level"), CMD_ID_SET_IPFILTER_LEVEL
, wxTRANSLATE("Select IP filtering level."),
932 wxTRANSLATE("Valid filtering levels are in the range 0-255, and it's default (initial)\nvalue is 127.\n"), CMD_PARAM_ALWAYS
);
934 tmp2
= tmp
->AddCommand(wxT("BwLimit"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set bandwidth limits."),
935 wxTRANSLATE("The value given to these commands has to be in kilobytes/sec.\n"), CMD_PARAM_NEVER
);
936 tmp2
->AddCommand(wxT("Up"), CMD_ID_SET_BWLIMIT_UP
, wxTRANSLATE("Set upload bandwidth limit."),
937 wxTRANSLATE("The given value must be in kilobytes/sec.\n"), CMD_PARAM_ALWAYS
);
938 tmp2
->AddCommand(wxT("Down"), CMD_ID_SET_BWLIMIT_DOWN
, wxTRANSLATE("Set download bandwidth limit."),
939 wxTRANSLATE("The given value must be in kilobytes/sec.\n"), CMD_PARAM_ALWAYS
);
941 tmp
= m_commands
.AddCommand(wxT("Get"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Get and display a preference value."),
942 wxEmptyString
, CMD_PARAM_NEVER
);
944 tmp2
= tmp
->AddCommand(wxT("IPFilter"), CMD_ID_GET_IPFILTER
, wxTRANSLATE("Get IP filtering preferences."), wxEmptyString
, CMD_PARAM_NEVER
);
945 tmp3
= tmp2
->AddCommand(wxT("State"), CMD_ID_GET_IPFILTER_STATE
, wxTRANSLATE("Get IP filtering state for both clients and servers."), wxEmptyString
, CMD_PARAM_NEVER
);
946 tmp3
->AddCommand(wxT("Clients"), CMD_ID_GET_IPFILTER_STATE_CLIENTS
, wxTRANSLATE("Get IP filtering state for clients only."), wxEmptyString
, CMD_PARAM_NEVER
);
947 tmp3
->AddCommand(wxT("Servers"), CMD_ID_GET_IPFILTER_STATE_SERVERS
, wxTRANSLATE("Get IP filtering state for servers only."), wxEmptyString
, CMD_PARAM_NEVER
);
948 tmp2
->AddCommand(wxT("Level"), CMD_ID_GET_IPFILTER_LEVEL
, wxTRANSLATE("Get IP filtering level."), wxEmptyString
, CMD_PARAM_NEVER
);
950 tmp
->AddCommand(wxT("BwLimits"), CMD_ID_GET_BWLIMITS
, wxTRANSLATE("Get bandwidth limits."), wxEmptyString
, CMD_PARAM_NEVER
);
952 tmp
= m_commands
.AddCommand(wxT("Search"), CMD_ID_SEARCH
, wxTRANSLATE("Execute a search."),
953 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
);
954 tmp
->AddCommand(wxT("global"), CMD_ID_SEARCH_GLOBAL
, wxTRANSLATE("Execute a global search."), wxEmptyString
, CMD_PARAM_ALWAYS
);
955 tmp
->AddCommand(wxT("local"), CMD_ID_SEARCH_LOCAL
, wxTRANSLATE("Execute a local search"), wxEmptyString
, CMD_PARAM_ALWAYS
);
956 tmp
->AddCommand(wxT("kad"), CMD_ID_SEARCH_KAD
, wxTRANSLATE("Execute a kad search"), wxEmptyString
, CMD_PARAM_ALWAYS
);
958 m_commands
.AddCommand(wxT("Results"), CMD_ID_SEARCH_RESULTS
, wxTRANSLATE("Show the results of the last search."),
959 wxTRANSLATE("Return the results of the previous search.\n"), CMD_PARAM_NEVER
);
961 m_commands
.AddCommand(wxT("Progress"), CMD_ID_SEARCH_PROGRESS
, wxTRANSLATE("Show the progress of a search."),
962 wxTRANSLATE("Show the progress of a search.\n"), CMD_PARAM_NEVER
);
964 m_commands
.AddCommand(wxT("Download"), CMD_ID_DOWNLOAD
, wxTRANSLATE("Start downloading a file"),
965 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
);
969 // TODO: These commands below need implementation and/or rewrite!
972 m_commands
.AddCommand(wxT("Pause"), CMD_ID_PAUSE
, wxTRANSLATE("Pause download."),
973 wxEmptyString
, CMD_PARAM_ALWAYS
);
975 m_commands
.AddCommand(wxT("Resume"), CMD_ID_RESUME
, wxTRANSLATE("Resume download."),
976 wxEmptyString
, CMD_PARAM_ALWAYS
);
978 m_commands
.AddCommand(wxT("Cancel"), CMD_ID_CANCEL
, wxTRANSLATE("Cancel download."),
979 wxEmptyString
, CMD_PARAM_ALWAYS
);
981 tmp
= m_commands
.AddCommand(wxT("Priority"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Set download priority."),
982 wxTRANSLATE("Set priority of a download to Low, Normal, High or Auto.\n"), CMD_PARAM_ALWAYS
);
983 tmp
->AddCommand(wxT("Low"), CMD_ID_PRIORITY_LOW
, wxTRANSLATE("Set priority to low."), wxEmptyString
, CMD_PARAM_ALWAYS
);
984 tmp
->AddCommand(wxT("Normal"), CMD_ID_PRIORITY_NORMAL
, wxTRANSLATE("Set priority to normal."), wxEmptyString
, CMD_PARAM_ALWAYS
);
985 tmp
->AddCommand(wxT("High"), CMD_ID_PRIORITY_HIGH
, wxTRANSLATE("Set priority to high."), wxEmptyString
, CMD_PARAM_ALWAYS
);
986 tmp
->AddCommand(wxT("Auto"), CMD_ID_PRIORITY_AUTO
, wxTRANSLATE("Set priority to auto."), wxEmptyString
, CMD_PARAM_ALWAYS
);
988 tmp
= m_commands
.AddCommand(wxT("Show"), CMD_ERR_INCOMPLETE
, wxTRANSLATE("Show queues/lists."),
989 wxTRANSLATE("Show upload/download queue, server list or shared files list.\n"), CMD_PARAM_ALWAYS
);
990 tmp
->AddCommand(wxT("UL"), CMD_ID_SHOW_UL
, wxTRANSLATE("Show upload queue."), wxEmptyString
, CMD_PARAM_NEVER
);
991 tmp
->AddCommand(wxT("DL"), CMD_ID_SHOW_DL
, wxTRANSLATE("Show download queue."), wxEmptyString
, CMD_PARAM_NEVER
);
992 tmp
->AddCommand(wxT("Log"), CMD_ID_SHOW_LOG
, wxTRANSLATE("Show log."), wxEmptyString
, CMD_PARAM_NEVER
);
993 tmp
->AddCommand(wxT("Servers"), CMD_ID_SHOW_SERVERS
, wxTRANSLATE("Show servers list."), wxEmptyString
, CMD_PARAM_NEVER
);
994 tmp
->AddCommand(wxT("Shared"), CMD_ID_SHOW_SHARED
, wxTRANSLATE("Show shared files list."), wxEmptyString
, CMD_PARAM_NEVER
);
996 m_commands
.AddCommand(wxT("Reset"), CMD_ID_RESET_LOG
, wxTRANSLATE("Reset log."), wxEmptyString
, CMD_PARAM_NEVER
);
999 // Deprecated commands, kept for backwards compatibility only.
1002 #define DEPRECATED(OLDCMD, ID, NEWCMD, PARAM) \
1003 m_commands.AddCommand(wxT(OLDCMD), CMD_ID_##ID | CMD_DEPRECATED, CFormat(wxTRANSLATE("Deprecated command, use '%s' instead.")) % wxT(NEWCMD), \
1004 CFormat(wxTRANSLATE("This is a deprecated command, and may be removed in the future.\nUse '%s' instead.\n")) % wxT(NEWCMD), CMD_PARAM_##PARAM)
1006 DEPRECATED("Stats", STATUS
, "Status", NEVER
);
1007 DEPRECATED("SetIPFilter", SET_IPFILTER
, "Set IPFilter", OPTIONAL
);
1008 DEPRECATED("GetIPLevel", GET_IPFILTER_LEVEL
, "Get IPFilter Level", NEVER
);
1009 DEPRECATED("SetIPLevel", SET_IPFILTER_LEVEL
, "Set IPFilter Level", ALWAYS
);
1010 DEPRECATED("IPLevel", SET_IPFILTER_LEVEL
, "Get/Set IPFilter Level", OPTIONAL
);
1011 DEPRECATED("Servers", SHOW_SERVERS
, "Show Servers", NEVER
);
1012 DEPRECATED("GetBWLimits", GET_BWLIMITS
, "Get BwLimits", NEVER
);
1013 DEPRECATED("SetUpBWLimit", SET_BWLIMIT_UP
, "Set BwLimit Up", ALWAYS
);
1014 DEPRECATED("SetDownBWLimit", SET_BWLIMIT_DOWN
, "Set BwLimit Down", ALWAYS
);
1017 int CamulecmdApp::OnRun()
1019 ConnectAndRun(wxT("aMulecmd"), wxT(VERSION
));
1023 // Dummy functions for EC logging
1024 bool ECLogIsEnabled()
1029 void DoECLogLine(const wxString
&)
1034 namespace MuleNotify
1036 void HandleNotification(const class CMuleNotiferBase
&) {}
1037 void HandleNotificationAlways(const class CMuleNotiferBase
&) {}
1040 // File_checked_for_headers