MCPcopy Create free account
hub / github.com/amule-project/amule / ExecuteCommand

Function ExecuteCommand

src/UserEvents.cpp:133–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131#define USEREVENTS_EVENT(ID, NAME, VARS) case CUserEvents::ID: { VARS break; }
132#define USEREVENTS_REPLACE_VAR(VAR, DESC, CODE) command.Replace("%" VAR, CODE);
133static void ExecuteCommand(
134 enum CUserEvents::EventType event,
135 const void* object,
136 const wxString& cmd)
137{
138 // This variable is needed by the USEREVENTS_EVENTLIST macro.
139 wxString command = cmd;
140 switch (event) {
141 USEREVENTS_EVENTLIST()
142 /* This macro expands to handle all user event types. Example:
143 case CUserEvents::NewChatSession: {
144 command.Replace( "%SENDER", *((wxString*)object) );
145 break;
146 } */
147 }
148 if (!command.empty()) {
149 CTerminationProcess *p = new CTerminationProcess(cmd);
150 if (!wxExecute(command, wxEXEC_ASYNC, p)) {
151 // If wxExecute fails, we need to delete the CTerminationProcess
152 // otherwise it will leak.
153 delete p;
154 AddLogLineC(CFormat(_("Failed to execute command `%s' on `%s' event.")) %
155 command % s_EventList[event].name);
156 }
157 }
158}
159
160void CUserEvents::ProcessEvent(enum EventType event, const void* object)
161{

Callers 1

ProcessEventMethod · 0.85

Calls 2

CFormatClass · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected