KVIrc  4.9.2
DeveloperAPIs
Macros | Functions | Variables
libkvitorrent.cpp File Reference
#include "TorrentInterface.h"
#include "KTorrentDbusInterface.h"
#include "StatusBarApplet.h"
#include "KviModule.h"
#include "KviOptions.h"
#include "KviMainWindow.h"
#include "KviLocale.h"
#include "kvi_out.h"

Macros

#define TC_KVS_COMMAND(__name)   static bool torrent_kvs_cmd_##__name(KviKvsModuleCommandCall * c)
 
#define TC_KVS_COMMAND_ERROR
 
#define TC_KVS_FAIL_ON_NO_INTERFACE
 
#define TC_KVS_FLOATRET_FUNCTION(__name, __ifacecommand)
 
#define TC_KVS_FUNCTION(__name)   static bool torrent_kvs_fnc_##__name(KviKvsModuleFunctionCall * c)
 
#define TC_KVS_INT_COMMAND(__name, __ifacecommand, __argname)
 
#define TC_KVS_INT_INT_STRING_COMMAND(__name, __ifacecommand, __argname1, __argname2, __argname3)
 
#define TC_KVS_INTRET_FUNCTION(__name, __ifacecommand)
 
#define TC_KVS_INTRET_INT_FUNCTION(__name, __ifacecommand, __argname)
 
#define TC_KVS_INTRET_INT_INT_FUNCTION(__name, __ifacecommand, __argname1, __argname2)
 
#define TC_KVS_REGCMD(__name, __stringname)   KVSM_REGISTER_SIMPLE_COMMAND(m, __stringname, torrent_kvs_cmd_##__name)
 
#define TC_KVS_REGFNC(__name, __stringname)   KVSM_REGISTER_FUNCTION(m, __stringname, torrent_kvs_fnc_##__name)
 
#define TC_KVS_SIMPLE_COMMAND(__name, __ifacecommand)
 
#define TC_KVS_STRINGRET_FUNCTION(__name, __ifacecommand)
 
#define TC_KVS_STRINGRET_INT_FUNCTION(__name, __ifacecommand, __argname)
 
#define TC_KVS_STRINGRET_INT_INT_FUNCTION(__name, __ifacecommand, __argname1, __argname2)
 

Functions

static TorrentInterfaceauto_detect_torrent_client (KviWindow *pOut=nullptr)
 
 TC_KVS_COMMAND (detect)
 
 TC_KVS_COMMAND (setClient)
 
 TC_KVS_FUNCTION (client)
 
 TC_KVS_FUNCTION (clientList)
 
static bool torrent_module_can_unload (KviModule *)
 
static bool torrent_module_cleanup (KviModule *)
 
static bool torrent_module_ctrl (KviModule *, const char *, void *)
 
static bool torrent_module_init (KviModule *m)
 

Variables

static KviPointerList
< TorrentInterfaceDescriptor > * 
g_pDescriptorList = nullptr
 

Macro Definition Documentation

#define TC_KVS_COMMAND (   __name)    static bool torrent_kvs_cmd_##__name(KviKvsModuleCommandCall * c)
#define TC_KVS_COMMAND_ERROR
Value:
if(!c->hasSwitch('q', "quiet")) \
{ \
c->warning(__tr2qs_ctx("The selected torrent client interface failed to execute the requested function", "torrent")); \
QString tmp = __tr2qs_ctx("Last interface error: ", "torrent"); \
c->warning(tmp); \
}
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
audacious __tr2qs_ctx("An interface for the UNIX Audacious media player.\n""Download it from http://audacious-media-player.org\n","mediaplayer")) static const char *xmms_lib_names[]
QString lastError()
Definition: TorrentInterface.h:96
#define TC_KVS_FAIL_ON_NO_INTERFACE
Value:
{ \
c->warning(__tr2qs_ctx("No torrent client interface selected. Try /torrent.detect", "torrent")); \
return true; \
}
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
audacious __tr2qs_ctx("An interface for the UNIX Audacious media player.\n""Download it from http://audacious-media-player.org\n","mediaplayer")) static const char *xmms_lib_names[]
#define TC_KVS_FLOATRET_FUNCTION (   __name,
  __ifacecommand 
)
Value:
TC_KVS_FUNCTION(__name) \
{ \
kvs_real_t ret = TorrentInterface::selected()->__ifacecommand(); \
c->returnValue()->setReal(ret); \
return true; \
}
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
double kvs_real_t
Definition: KviKvsTypes.h:35
#define TC_KVS_FUNCTION(__name)
Definition: libkvitorrent.cpp:94
#define TC_KVS_FUNCTION (   __name)    static bool torrent_kvs_fnc_##__name(KviKvsModuleFunctionCall * c)
#define TC_KVS_INT_COMMAND (   __name,
  __ifacecommand,
  __argname 
)
Value:
TC_KVS_COMMAND(__name) \
{ \
KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \
if(!TorrentInterface::selected()->__ifacecommand(arg)) \
{ \
} \
return true; \
}
Definition: KviKvsParameterProcessor.h:50
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
#define KVSM_PARAMETERS_BEGIN(pCall)
Definition: KviKvsModuleInterface.h:236
#define TC_KVS_COMMAND(__name)
Definition: libkvitorrent.cpp:93
if(m_pFile) delete m_pFile
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define KVSM_PARAMETERS_END(pCall)
Definition: KviKvsModuleInterface.h:239
#define TC_KVS_COMMAND_ERROR
Definition: libkvitorrent.cpp:96
#define KVSM_PARAMETER(a, b, c, d)
Definition: KviKvsModuleInterface.h:233
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33
#define TC_KVS_INT_INT_STRING_COMMAND (   __name,
  __ifacecommand,
  __argname1,
  __argname2,
  __argname3 
)
Value:
TC_KVS_COMMAND(__name) \
{ \
kvs_int_t arg2; \
QString arg3; \
KVSM_PARAMETER(__argname1, KVS_PT_INT, 0, arg1) \
KVSM_PARAMETER(__argname2, KVS_PT_INT, 0, arg2) \
KVSM_PARAMETER(__argname3, KVS_PT_STRING, 0, arg3) \
if(!TorrentInterface::selected()->__ifacecommand(arg1, arg2, arg3)) \
{ \
} \
return true; \
}
Definition: KviKvsParameterProcessor.h:50
Definition: KviKvsParameterProcessor.h:42
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
#define KVSM_PARAMETERS_BEGIN(pCall)
Definition: KviKvsModuleInterface.h:236
#define TC_KVS_COMMAND(__name)
Definition: libkvitorrent.cpp:93
if(m_pFile) delete m_pFile
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define KVSM_PARAMETERS_END(pCall)
Definition: KviKvsModuleInterface.h:239
#define TC_KVS_COMMAND_ERROR
Definition: libkvitorrent.cpp:96
#define KVSM_PARAMETER(a, b, c, d)
Definition: KviKvsModuleInterface.h:233
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33
#define TC_KVS_INTRET_FUNCTION (   __name,
  __ifacecommand 
)
Value:
TC_KVS_FUNCTION(__name) \
{ \
kvs_int_t ret = TorrentInterface::selected()->__ifacecommand(); \
c->returnValue()->setInteger(ret); \
return true; \
}
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define TC_KVS_FUNCTION(__name)
Definition: libkvitorrent.cpp:94
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33
#define TC_KVS_INTRET_INT_FUNCTION (   __name,
  __ifacecommand,
  __argname 
)
Value:
TC_KVS_FUNCTION(__name) \
{ \
KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \
kvs_int_t ret = TorrentInterface::selected()->__ifacecommand(arg); \
c->returnValue()->setInteger(ret); \
return true; \
}
Definition: KviKvsParameterProcessor.h:50
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
#define KVSM_PARAMETERS_BEGIN(pCall)
Definition: KviKvsModuleInterface.h:236
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define KVSM_PARAMETERS_END(pCall)
Definition: KviKvsModuleInterface.h:239
#define KVSM_PARAMETER(a, b, c, d)
Definition: KviKvsModuleInterface.h:233
#define TC_KVS_FUNCTION(__name)
Definition: libkvitorrent.cpp:94
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33
#define TC_KVS_INTRET_INT_INT_FUNCTION (   __name,
  __ifacecommand,
  __argname1,
  __argname2 
)
Value:
TC_KVS_FUNCTION(__name) \
{ \
KVSM_PARAMETER(__argname1, KVS_PT_INT, 0, arg1) \
KVSM_PARAMETER(__argname2, KVS_PT_INT, 0, arg2) \
kvs_int_t ret = TorrentInterface::selected()->__ifacecommand(arg1, arg2); \
c->returnValue()->setInteger(ret); \
return true; \
}
Definition: KviKvsParameterProcessor.h:50
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
#define KVSM_PARAMETERS_BEGIN(pCall)
Definition: KviKvsModuleInterface.h:236
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define KVSM_PARAMETERS_END(pCall)
Definition: KviKvsModuleInterface.h:239
#define KVSM_PARAMETER(a, b, c, d)
Definition: KviKvsModuleInterface.h:233
#define TC_KVS_FUNCTION(__name)
Definition: libkvitorrent.cpp:94
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33
#define TC_KVS_REGCMD (   __name,
  __stringname 
)    KVSM_REGISTER_SIMPLE_COMMAND(m, __stringname, torrent_kvs_cmd_##__name)

Referenced by torrent_module_init().

#define TC_KVS_REGFNC (   __name,
  __stringname 
)    KVSM_REGISTER_FUNCTION(m, __stringname, torrent_kvs_fnc_##__name)

Referenced by torrent_module_init().

#define TC_KVS_SIMPLE_COMMAND (   __name,
  __ifacecommand 
)
Value:
TC_KVS_COMMAND(__name) \
{ \
if(!TorrentInterface::selected()->__ifacecommand()) \
{ \
} \
return true; \
}
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
#define KVSM_PARAMETERS_BEGIN(pCall)
Definition: KviKvsModuleInterface.h:236
#define TC_KVS_COMMAND(__name)
Definition: libkvitorrent.cpp:93
if(m_pFile) delete m_pFile
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define KVSM_PARAMETERS_END(pCall)
Definition: KviKvsModuleInterface.h:239
#define TC_KVS_COMMAND_ERROR
Definition: libkvitorrent.cpp:96
#define TC_KVS_STRINGRET_FUNCTION (   __name,
  __ifacecommand 
)
Value:
TC_KVS_FUNCTION(__name) \
{ \
TC_KVS_FAIL_ON_NO_INTERFACE \
QString szRet = TorrentInterface::selected()->__ifacecommand(); \
c->returnValue()->setString(szRet); \
return true; \
}
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define TC_KVS_FUNCTION(__name)
Definition: libkvitorrent.cpp:94
#define TC_KVS_STRINGRET_INT_FUNCTION (   __name,
  __ifacecommand,
  __argname 
)
Value:
TC_KVS_FUNCTION(__name) \
{ \
KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \
TC_KVS_FAIL_ON_NO_INTERFACE \
QString szRet = TorrentInterface::selected()->__ifacecommand(arg); \
c->returnValue()->setString(szRet); \
return true; \
}
Definition: KviKvsParameterProcessor.h:50
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
#define KVSM_PARAMETERS_BEGIN(pCall)
Definition: KviKvsModuleInterface.h:236
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define KVSM_PARAMETERS_END(pCall)
Definition: KviKvsModuleInterface.h:239
#define KVSM_PARAMETER(a, b, c, d)
Definition: KviKvsModuleInterface.h:233
#define TC_KVS_FUNCTION(__name)
Definition: libkvitorrent.cpp:94
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33
#define TC_KVS_STRINGRET_INT_INT_FUNCTION (   __name,
  __ifacecommand,
  __argname1,
  __argname2 
)
Value:
TC_KVS_FUNCTION(__name) \
{ \
KVSM_PARAMETER(__argname1, KVS_PT_INT, 0, arg1) \
KVSM_PARAMETER(__argname2, KVS_PT_INT, 0, arg2) \
TC_KVS_FAIL_ON_NO_INTERFACE \
QString szRet = TorrentInterface::selected()->__ifacecommand(arg1, arg2); \
c->returnValue()->setString(szRet); \
return true; \
}
Definition: KviKvsParameterProcessor.h:50
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
#define KVSM_PARAMETERS_BEGIN(pCall)
Definition: KviKvsModuleInterface.h:236
static TorrentInterface * selected()
Definition: TorrentInterface.h:99
#define KVSM_PARAMETERS_END(pCall)
Definition: KviKvsModuleInterface.h:239
#define KVSM_PARAMETER(a, b, c, d)
Definition: KviKvsModuleInterface.h:233
#define TC_KVS_FUNCTION(__name)
Definition: libkvitorrent.cpp:94
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33

Function Documentation

static TorrentInterface* auto_detect_torrent_client ( KviWindow pOut = nullptr)
static
TC_KVS_COMMAND ( detect  )
TC_KVS_COMMAND ( setClient  )
TC_KVS_FUNCTION ( client  )
TC_KVS_FUNCTION ( clientList  )
static bool torrent_module_can_unload ( KviModule )
static
static bool torrent_module_cleanup ( KviModule )
static

References g_pDescriptorList.

static bool torrent_module_ctrl ( KviModule ,
const char *  ,
void *   
)
static
static bool torrent_module_init ( KviModule m)
static

Variable Documentation

KviPointerList<TorrentInterfaceDescriptor>* g_pDescriptorList = nullptr
static

Referenced by torrent_module_cleanup().