diff options
| author | 2011-03-27 16:08:18 +0000 | |
|---|---|---|
| committer | 2011-03-27 16:08:18 +0000 | |
| commit | 84ddb189b036993daea795cdb2374005a8adb2fe (patch) | |
| tree | 547ff8350d17786f6f2b85181c48ab5347ba1d11 /src/modules/system | |
| parent | fix for #1119 (diff) | |
| download | KVIrc-84ddb189b036993daea795cdb2374005a8adb2fe.tar.gz KVIrc-84ddb189b036993daea795cdb2374005a8adb2fe.tar.bz2 KVIrc-84ddb189b036993daea795cdb2374005a8adb2fe.zip | |
fix for #1121
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5715 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/system')
| -rw-r--r-- | src/modules/system/libkvisystem.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/modules/system/libkvisystem.cpp b/src/modules/system/libkvisystem.cpp index 3dd02cbb7..9958c1a9f 100644 --- a/src/modules/system/libkvisystem.cpp +++ b/src/modules/system/libkvisystem.cpp @@ -433,7 +433,7 @@ static bool system_kvs_fnc_hostname(KviKvsModuleFunctionCall *c) The returned value is the string rappresentation of the returned data if the return type is known, otherwise it is the name of the data type returned. [br] - If the application name is prefixed with "?" then the call is performed in "remote test" + If the service name is prefixed with "?" then the call is performed in "remote test" mode: no "remote" errors are printed and the function returns 1 if the call executed successfully and 0 if the call failed. This can be used with the very first call to programmaticaly test if the remote application is running. @@ -454,13 +454,14 @@ static bool system_kvs_fnc_dbus(KviKvsModuleFunctionCall *c) { QString szService, szPath, szInterface, szMethod, szBusType; QStringList parms; + bool bRemoteTest=false; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("service",KVS_PT_NONEMPTYSTRING,0,szService) KVSM_PARAMETER("path",KVS_PT_NONEMPTYSTRING,0,szPath) KVSM_PARAMETER("interface",KVS_PT_NONEMPTYSTRING,0,szInterface) KVSM_PARAMETER("method",KVS_PT_NONEMPTYSTRING,0,szMethod) - KVSM_PARAMETER("bus_type",KVS_PT_STRING,0,szBusType) + KVSM_PARAMETER("bus_type",KVS_PT_STRING,KVS_PF_OPTIONAL,szBusType) KVSM_PARAMETER("parameter_list",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,parms) KVSM_PARAMETERS_END(c) @@ -481,11 +482,29 @@ static bool system_kvs_fnc_dbus(KviKvsModuleFunctionCall *c) return false; } + if(szService.left(1).compare("?")==0) + { + szService.remove(0,1); + bRemoteTest=true; + } + QDBusInterface remoteApp(szService, szPath, szInterface, busType); if(!remoteApp.isValid()) { - c->warning(__tr2qs("Invalid DBus interface")); - return false; + if(bRemoteTest) + { + c->returnValue()->setInteger(0); + return true; + } else { + c->warning(__tr2qs("Invalid DBus interface")); + return false; + } + } + + if(bRemoteTest) + { + c->returnValue()->setInteger(1); + return true; } QList<QVariant> ds; |
