aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/serverdb/libkviserverdb.cpp
diff options
context:
space:
mode:
authorGravatar Elvio Basello2008-07-05 19:09:46 +0000
committerGravatar Elvio Basello2008-07-05 19:09:46 +0000
commit5ef09ceceb492fdc88d31bfc1f3f6b946ffb675d (patch)
tree002f7e8e8700c1c6ca01c3635571943dcd4997f2 /src/modules/serverdb/libkviserverdb.cpp
parentfixed compilation for qt < 4.4 (diff)
downloadKVIrc-5ef09ceceb492fdc88d31bfc1f3f6b946ffb675d.tar.gz
KVIrc-5ef09ceceb492fdc88d31bfc1f3f6b946ffb675d.tar.bz2
KVIrc-5ef09ceceb492fdc88d31bfc1f3f6b946ffb675d.zip
more work on serverdb
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2010 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/serverdb/libkviserverdb.cpp')
-rw-r--r--src/modules/serverdb/libkviserverdb.cpp630
1 files changed, 471 insertions, 159 deletions
diff --git a/src/modules/serverdb/libkviserverdb.cpp b/src/modules/serverdb/libkviserverdb.cpp
index 42d11b7b4..2fc975c81 100644
--- a/src/modules/serverdb/libkviserverdb.cpp
+++ b/src/modules/serverdb/libkviserverdb.cpp
@@ -29,7 +29,7 @@
#include <QString>
-extern KVIRC_API KviServerDataBase * g_pIrcServerDataBase;
+extern KVIRC_API KviServerDataBase * g_pServerDataBase;
/*
@doc: serverdb.networkExists
@@ -49,19 +49,19 @@ extern KVIRC_API KviServerDataBase * g_pIrcServerDataBase;
*/
static bool serverdb_kvs_fnc_networkExists(KviKvsModuleFunctionCall * c)
{
- QString szNetName, szNetwork;
+ QString szNetwork;
KVSM_PARAMETERS_BEGIN(c)
- KVSM_PARAMETER("network_name",KVS_PT_STRING,0,szNetName)
+ KVSM_PARAMETER("network_name",KVS_PT_STRING,0,szNetwork)
KVSM_PARAMETERS_END(c)
- if(szNetName.isEmpty())
+ if(szNetwork.isEmpty())
{
c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb"));
return false;
}
- KviNetwork * pNetwork = g_pIrcServerDataBase->findNetwork(szNetName);
+ KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szNetwork);
if(!pNetwork)
{
c->returnValue()->setBoolean(false);
@@ -69,10 +69,162 @@ static bool serverdb_kvs_fnc_networkExists(KviKvsModuleFunctionCall * c)
}
c->returnValue()->setBoolean(true);
+ return true;
+}
+
+/*
+ @doc: serverdb.serverExists
+ @type:
+ function
+ @title:
+ $serverdb.serverExists
+ @short:
+ Checks if the network already exists in the DB
+ @synthax:
+ <bool> $serverdb.serverExists(<string:servername>[,<networkname>])
+ @description:
+ Checks if the server already exists for a network in the DB.[br]
+ If no network name is provided, the check is made globally.[br]
+ It returns 1 if the server exixts, 0 otherwise
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+static bool serverdb_kvs_fnc_serverExists(KviKvsModuleFunctionCall * c)
+{
+ QString szServer, szNetwork;
+ bool bCheckAllNets = true;
+
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("server_name",KVS_PT_STRING,0,szServer)
+ KVSM_PARAMETER("network_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szNetwork)
+ KVSM_PARAMETERS_END(c)
+
+ if(szServer.isEmpty())
+ {
+ c->error(__tr2qs_ctx("You must provide the server name as parameter","serverdb"));
+ return false;
+ }
+
+ if(!szNetwork.isEmpty())
+ {
+ // Check in the given network
+ KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szNetwork);
+ if(!pRecord)
+ {
+ debug("pRecord");
+ c->returnValue()->setBoolean(false);
+ return true;
+ }
+
+ KviServer * pServer = new KviServer();
+ pServer->setHostName(szServer);
+ debug("Server: %s",pServer->hostName().toUtf8().data());
+
+ KviServer * pCheckServer = pRecord->findServer(pServer,true);
+ if(!pCheckServer)
+ {
+ debug("pCheckServer");
+ c->returnValue()->setBoolean(false);
+ return true;
+ }
+
+ debug("Check server: %s",pCheckServer->hostName().toUtf8().data());
+ c->returnValue()->setBoolean(true);
+ } else {
+ // FIXME: Check through all networks
+ /*
+ KviPointerHashTableIterator<QString,KviServerDataBaseRecord> it(*(g_pServerDataBase->recordDict()));
+
+ while(KviServerDataBaseRecord * r = it.current())
+ {
+ net = new KviServerOptionsTreeWidgetItem(m_pTreeWidget,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_WORLD)),r->network());
+ KviPointerList<KviServer> * sl = r->serverList();
+ bool bCurrent = r->network()->name() == g_pServerDataBase->currentNetworkName().toUtf8().data();
+ net->setExpanded(bCurrent);
+ for(KviServer * s = sl->first();s;s = sl->next())
+ {
+ srv = new KviServerOptionsTreeWidgetItem(net,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_SERVER)),s);
+
+ if((s == r->currentServer()) && bCurrent)
+ {
+ srv->setSelected(true);
+ cur = srv;
+ }
+ }
+ ++it;
+ }
+ */
+ }
+ //c->returnValue()->setBoolean(true);
return true;
}
+#if 0
+#define SERVERDB_GET_PROPERTY(__functionName,__callName) \
+ static bool __functionName(KviKvsModuleFunctionCall * c) \
+ { \
+ QString szName; \
+ bool bServer = false; \
+ \
+ KVSM_PARAMETERS_BEGIN(c) \
+ KVSM_PARAMETER("name",KVS_PT_STRING,0,szName) \
+ KVSM_PARAMETERS_END(c) \
+ \
+ if(c->switches()->find('s',"server")) bServer = true; \
+ \
+ if(szName.isEmpty()) \
+ { \
+ c->error(__tr2qs_ctx("You must provide the network/server name as parameter","serverdb")); \
+ return false; \
+ } \
+ \
+ if(!bServer) \
+ { \
+ /* We want to get the property for the network*/ \
+ KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szName); \
+ if(!pNetwork) \
+ { \
+ if(c->switches()->find('q',"quiet")) return true; \
+ c->error(__tr2qs_ctx("The specified network does not exist","serverdb")); \
+ return false; \
+ } \
+ \
+ c->returnValue()->setString(pNetwork->__callName()); \
+ } else { \
+ /* We want to get the property for the server*/ \
+ KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szName); \
+ if(!pRecord) \
+ { \
+ if(c->switches()->find('q',"quiet")) return true; \
+ c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
+ return false; \
+ } \
+ \
+ /* Ensure we are manipulating a server*/ \
+ KviServer * pServer = pRecord->currentServer(); \
+ if(!pServer) \
+ { \
+ if(c->switches()->find('q',"quiet")) return true; \
+ c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
+ return false; \
+ } \
+ \
+ c->returnValue()->setString(pServer->__callName()); \
+ } \
+ \
+ return true; \
+ }
+
+
+SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getNickName,nickName)
+SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getUserName,userName)
+SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getRealName,realName)
+SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getEncoding,encoding)
+SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getDescription,description)
+SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getConnectCommand,onConnectCommand)
+SERVERDB_GET_PROPERTY(serverdb_kvs_fnc_getLoginCommand,onLoginCommand)
+#endif
/*
@doc: serverdb.addNetwork
@@ -111,7 +263,7 @@ static bool serverdb_kvs_cmd_addNetwork(KviKvsModuleCommandCall * c)
return false;
}
- KviNetwork * pNetwork = g_pIrcServerDataBase->findNetwork(szNetName);
+ KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szNetName);
if(pNetwork)
{
if(c->switches()->find('q',"quiet")) return true;
@@ -122,7 +274,7 @@ static bool serverdb_kvs_cmd_addNetwork(KviKvsModuleCommandCall * c)
pNetwork = new KviNetwork(szNetName);
if(c->switches()->find('a',"autoconnect")) pNetwork->setAutoConnect(true);
- KviServerDataBaseRecord * pRecord = g_pIrcServerDataBase->insertNetwork(pNetwork);
+ KviServerDataBaseRecord * pRecord = g_pServerDataBase->insertNetwork(pNetwork);
if(!pRecord)
{
c->error("Internal error: KVIrc author screwed up","serverdb");
@@ -154,9 +306,6 @@ static bool serverdb_kvs_cmd_addNetwork(KviKvsModuleCommandCall * c)
!sw: -i | --ipv6
Use IPv6 socket to connect to the server.[br]
- !sw: -s | --ssl
- Use SSL (Secure Socket Layer) socket to connect to the server.[br]
-
!sw: -p=<port> | --port=<port>
Use the port <port> to connect to the server.[br]
@@ -164,8 +313,10 @@ static bool serverdb_kvs_cmd_addNetwork(KviKvsModuleCommandCall * c)
Do not print errors if the server already exist.[br]
!sw: -s | --ssl
- Use SSL (Secure Socket Layer) socket to connect to the server.
+ Use SSL (Secure Socket Layer) socket to connect to the server.[br]
+ !sw: -w=<password> | --password=<password>
+ Use password <password> to connect to the server.
@examples:
[example]
[comment]Sets the nickname HelLViS69 for the server irc.freenode.net[/comment][br]
@@ -195,7 +346,7 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c)
return false;
}
- KviServerDataBaseRecord * pRecord = g_pIrcServerDataBase->findRecord(szNetwork);
+ KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szNetwork);
if(!pRecord)
{
// FIXME: default to orphan servers
@@ -220,325 +371,486 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c)
if(c->switches()->find('s',"ssl")) pServer->setUseSSL(true);
QString tmp;
- int iPort;
+
+ unsigned int uPort;
if(c->switches()->getAsStringIfExisting('p',"port",tmp))
{
bool bOk;
- iPort = tmp.toInt(&bOk);
- if(!bOk) iPort = 6667;
- pServer->setPort(iPort);
+ uPort = tmp.toInt(&bOk);
+ if(!bOk) uPort = 6667;
+ pServer->setPort(uPort);
}
- debug("Network: %s\nServer: %s\nPort: %d",szNetwork.toUtf8().data(),szServer.toUtf8().data(),iPort);
+ if(c->switches()->getAsStringIfExisting('w',"password",tmp)) pServer->setPassword(tmp);
+
+ debug("Network: %s\nServer: %s\nPort: %d",szNetwork.toUtf8().data(),szServer.toUtf8().data(),uPort);
pRecord->insertServer(pServer);
return true;
}
-#define SERVERDB_SET_PROPERTY(__functionName,__callName) \
+#define SERVERDB_SET_NETWORK_PROPERTY(__functionName,__callName) \
static bool __functionName(KviKvsModuleCommandCall * c) \
{ \
QString szName, szPropertyName; \
- bool bServer = false; \
\
KVSM_PARAMETERS_BEGIN(c) \
KVSM_PARAMETER("name",KVS_PT_STRING,0,szName) \
KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyName) \
KVSM_PARAMETERS_END(c) \
\
- if(c->switches()->find('s',"server")) bServer = true; \
+ if(szName.isEmpty()) \
+ { \
+ c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb")); \
+ return false; \
+ } \
+ \
+ if(szPropertyName.isEmpty()) \
+ { \
+ c->error(__tr2qs_ctx("You must provide the value as parameter","serverdb")); \
+ return false; \
+ } \
+ \
+ KviNetwork * pNetwork = g_pServerDataBase->findNetwork(szName); \
+ if(!pNetwork) \
+ { \
+ if(c->switches()->find('q',"quiet")) return true; \
+ c->error(__tr2qs_ctx("The specified network does not exist","serverdb")); \
+ return false; \
+ } \
+ \
+ pNetwork->__callName(szPropertyName); \
+ \
+ return true; \
+ }
+
+#define SERVERDB_SET_SERVER_PROPERTY(__functionName,__callName) \
+ static bool __functionName(KviKvsModuleCommandCall * c) \
+ { \
+ QString szName, szPropertyName; \
+ \
+ KVSM_PARAMETERS_BEGIN(c) \
+ KVSM_PARAMETER("name",KVS_PT_STRING,0,szName) \
+ KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyName) \
+ KVSM_PARAMETERS_END(c) \
\
if(szName.isEmpty()) \
{ \
- c->error(__tr2qs_ctx("You must provide the network/server name as parameter","serverdb")); \
+ c->error(__tr2qs_ctx("You must provide the network name as parameter","serverdb")); \
return false; \
} \
\
if(szPropertyName.isEmpty()) \
{ \
- c->error(__tr2qs_ctx("You must provide the nickname as parameter","serverdb")); \
+ c->error(__tr2qs_ctx("You must provide the value as parameter","serverdb")); \
return false; \
} \
\
- if(!bServer) \
+ KviServerDataBaseRecord * pRecord = g_pServerDataBase->findRecord(szName); \
+ if(!pRecord) \
{ \
- /* We want to set the nickname for the network*/ \
- KviNetwork * pNetwork = g_pIrcServerDataBase->findNetwork(szName); \
- if(!pNetwork) \
- { \
- if(c->switches()->find('q',"quiet")) return true; \
- c->error(__tr2qs_ctx("The specified network does not exist","serverdb")); \
- return false; \
- } \
- \
- pNetwork->__callName(szPropertyName); \
- } else { \
- /* We want to set the nickname for the server*/ \
- KviServerDataBaseRecord * pRecord = g_pIrcServerDataBase->findRecord(szName); \
- if(!pRecord) \
- { \
- if(c->switches()->find('q',"quiet")) return true; \
- c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
- return false; \
- } \
- \
- /* Ensure we are manipulating a server*/ \
- KviServer * pServer = pRecord->currentServer(); \
- if(!pServer) \
- { \
- if(c->switches()->find('q',"quiet")) return true; \
- c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
- return false; \
- } \
- \
- pServer->__callName(szPropertyName); \
+ if(c->switches()->find('q',"quiet")) return true; \
+ c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
+ return false; \
} \
\
+ KviServer * pServer = pRecord->currentServer(); \
+ if(!pServer) \
+ { \
+ if(c->switches()->find('q',"quiet")) return true; \
+ c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \
+ return false; \
+ } \
+ \
+ pServer->__callName(szPropertyName); \
+ \
return true; \
}
/*
- @doc: serverdb.setNickName
+ @doc: serverdb.setNetworkNickName
@type:
command
@title:
- serverdb.setNickName
+ serverdb.setNetworkNickName
@short:
Sets the nickname
@syntax:
- serverdb.setNickName [switches] <string:name> <string:nick>
+ serverdb.setNetworkNickName [switches] <string:name> <string:nick>
@description:
- Sets the nickname <nick> for the specified network/server <name>.
+ Sets the nickname <nick> for the specified network <name>.
@switches:
- !sw: -s | --server
- Sets the nickname for the server.[br]
- If this switch is not passed, the command will set the nickname for the network.[br]
-
!sw: -q | --quiet
- Do not print errors if the network/server already exist.
+ Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the nickname HelLViS69 for the Freenode network[/comment][br]
- serverdb.setNickName -q Freenode HelLViS69[br]
- [comment]Sets the nickname HelLViS69 for the server irc.freenode.net[/comment][br]
- serverdb.setNickName -s irc.freenode.net HelLViS69
+ serverdb.setNetworkNickName -q Freenode HelLViS69
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
-SERVERDB_SET_PROPERTY(serverdb_kvs_cmd_setNickName,setNickName)
+SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkNickName,setNickName)
/*
- @doc: serverdb.setUserName
+ @doc: serverdb.setNetworkUserName
@type:
command
@title:
- serverdb.setUserName
+ serverdb.setNetworkUserName
@short:
Sets the username
@syntax:
- serverdb.setUserName [switches] <string:name> <string:username>
+ serverdb.setNetworkUserName [switches] <string:name> <string:username>
@description:
- Sets the username <username> for the specified network/server <name>.
+ Sets the username <username> for the specified network <name>.
@switches:
- !sw: -s | --server
- Sets the username for the server.[br]
- If this switch is not passed, the command will set the username for the network.[br]
-
!sw: -q | --quiet
- Do not print errors if the network/server already exist.
+ Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the username kvirc for the Freenode network[/comment][br]
- serverdb.setUserName -q Freenode kvirc[br]
- [comment]Sets the username kvirc for the server irc.freenode.net[/comment][br]
- serverdb.setUserName -s irc.freenode.net kvirc
+ serverdb.setNetworkUserName -q Freenode kvirc
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
-SERVERDB_SET_PROPERTY(serverdb_kvs_cmd_setUserName,setUserName)
+SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkUserName,setUserName)
/*
- @doc: serverdb.setRealName
+ @doc: serverdb.setNetworkRealName
@type:
command
@title:
- serverdb.setRealName
+ serverdb.setNetworkRealName
@short:
Sets the realname
@syntax:
- serverdb.setRealName [switches] <string:name> <string:realname>
+ serverdb.setNetworkRealName [switches] <string:name> <string:realname>
@description:
- Sets the realname <realname> for the specified network/server <name>.
+ Sets the realname <realname> for the specified network <name>.
@switches:
- !sw: -s | --server
- Sets the realname for the server.[br]
- If this switch is not passed, the command will set the realname for the network.[br]
-
!sw: -q | --quiet
- Do not print errors if the network/server already exist.
+ Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the realname KVIrc 4.0 for the Freenode network[/comment][br]
- serverdb.setRealName -q Freenode KVIrc 4.0[br]
- [comment]Sets the realname KVIrc 4.0 for the server irc.freenode.net[/comment][br]
- serverdb.setRealName -s irc.freenode.net KVIrc 4.0
+ serverdb.setNetworkRealName -q Freenode KVIrc 4.0
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
-SERVERDB_SET_PROPERTY(serverdb_kvs_cmd_setRealName,setRealName)
+SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkRealName,setRealName)
/*
- @doc: serverdb.setEncoding
+ @doc: serverdb.setNetworkEncoding
@type:
command
@title:
- serverdb.setEncoding
+ serverdb.setNetworkEncoding
@short:
Sets the encoding
@syntax:
- serverdb.setEncoding [switches] <string:name> <string:encoding>
+ serverdb.setNetworkEncoding [switches] <string:name> <string:encoding>
@description:
- Sets the encoding <encoding> for the specified network/server <name>.
+ Sets the encoding <encoding> for the specified network <name>.
@switches:
- !sw: -s | --server
- Sets the encoding for the server.[br]
- If this switch is not passed, the command will set the encoding for the network.[br]
-
!sw: -q | --quiet
- Do not print errors if the network/server already exist.
+ Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the encoding UTF-8 for the Freenode network[/comment][br]
- serverdb.setEncoding -q Freenode UTF-8[br]
- [comment]Sets the realname UTF-8 for the server irc.freenode.net[/comment][br]
- serverdb.setEncoding -s irc.freenode.net UTF-8
+ serverdb.setNetworkEncoding -q Freenode UTF-8
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
-SERVERDB_SET_PROPERTY(serverdb_kvs_cmd_setEncoding,setEncoding)
+SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkEncoding,setEncoding)
/*
- @doc: serverdb.setDescription
+ @doc: serverdb.setNetworkDescription
@type:
command
@title:
- serverdb.setDescription
+ serverdb.setNetworkDescription
@short:
Sets the description
@syntax:
- serverdb.setDescription [switches] <string:name> <string:description>
+ serverdb.setNetworkDescription [switches] <string:name> <string:description>
@description:
- Sets the description <description> for the specified network/server <name>.
+ Sets the description <description> for the specified network <name>.
@switches:
- !sw: -s | --server
- Sets the description for the server.[br]
- If this switch is not passed, the command will set the description for the network.[br]
-
!sw: -q | --quiet
- Do not print errors if the network/server already exist.
+ Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the description for the Freenode network[/comment][br]
- serverdb.setDescription -q Freenode The FOSS Network[br]
- [comment]Sets the description for the server irc.freenode.net[/comment][br]
- serverdb.setDescription -s irc.freenode.net Main network router
+ serverdb.setNetworkDescription -q Freenode The FOSS Network
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
-SERVERDB_SET_PROPERTY(serverdb_kvs_cmd_setDescription,setDescription)
+SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkDescription,setDescription)
/*
- @doc: serverdb.setConnectCommand
+ @doc: serverdb.setNetworkConnectCommand
@type:
command
@title:
- serverdb.setConnectCommand
+ serverdb.setNetworkConnectCommand
@short:
Sets the connect command
@syntax:
- serverdb.setConnectCommand [switches] <string:name> <string:command>
+ serverdb.setNetworkConnectCommand [switches] <string:name> <string:command>
@description:
- Sets the command <command> to run on connect for the specified network/server <name>.
+ Sets the command <command> to run on connect for the specified network <name>.
@switches:
- !sw: -s | --server
- Sets the connect command for the server.[br]
- If this switch is not passed, the command will set the connect command for the network.[br]
-
!sw: -q | --quiet
- Do not print errors if the network/server already exist.
+ Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the connect command for the Freenode network[/comment][br]
- serverdb.setConnectCommand -q Freenode ns identify HelLViS69 foobar[br]
- [comment]Sets the connect command for the server irc.freenode.net[/comment][br]
- serverdb.setConnectCommand -s irc.freenode.net ns identify HelLViS69 foobar
+ serverdb.setNetworkConnectCommand -q Freenode ns identify HelLViS69 foobar
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
-SERVERDB_SET_PROPERTY(serverdb_kvs_cmd_setConnectCommand,setOnConnectCommand)
+SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkConnectCommand,setOnConnectCommand)
/*
- @doc: serverdb.setLoginCommand
+ @doc: serverdb.setNetworkLoginCommand
@type:
command
@title:
- serverdb.setLoginCommand
+ serverdb.setNetworkLoginCommand
@short:
Sets the login command
@syntax:
- serverdb.setLoginCommand [switches] <string:name> <string:command>
+ serverdb.setNetworkLoginCommand [switches] <string:name> <string:command>
@description:
- Sets the command <command> to run on login for the specified network/server <name>.
+ Sets the command <command> to run on login for the specified network <name>.
@switches:
- !sw: -s | --server
- Sets the login command for the server.[br]
- If this switch is not passed, the command will set the login command for the network.[br]
-
!sw: -q | --quiet
- Do not print errors if the network/server already exist.
+ Do not print errors if the network already exists.
@examples:
[example]
[comment]Quietly sets the login command for the Freenode network[/comment][br]
- serverdb.setLoginCommand -q Freenode join #KVIrc[br]
- [comment]Sets the login command for the server irc.freenode.net[/comment][br]
- serverdb.setLoginCommand -s irc.freenode.net join #KVIrc
+ serverdb.setNetworkLoginCommand -q Freenode join #KVIrc
+ [/example]
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkLoginCommand,setOnLoginCommand)
+
+/*
+ @doc: serverdb.setServerNickName
+ @type:
+ command
+ @title:
+ serverdb.setServerNickName
+ @short:
+ Sets the nickname
+ @syntax:
+ serverdb.setServerNickName [switches] <string:name> <string:nick>
+ @description:
+ Sets the nickname <nick> for the specified server <name>.
+ @switches:
+ !sw: -q | --quiet
+ Do not print errors if the server already exists.
+ @examples:
+ [example]
+ [comment]Quietly sets the nickname HelLViS69 for the Freenode network[/comment][br]
+ serverdb.setServerNickName -q irc.freenode.net HelLViS69
[/example]
@seealso:
[module:serverdb]ServerDB module documentation[/module]
*/
-SERVERDB_SET_PROPERTY(serverdb_kvs_cmd_setLoginCommand,setOnLoginCommand)
+SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerNickName,setNickName)
+
+/*
+ @doc: serverdb.setServerUserName
+ @type:
+ command
+ @title:
+ serverdb.setServerUserName
+ @short:
+ Sets the username
+ @syntax:
+ serverdb.setServerUserName [switches] <string:name> <string:username>
+ @description:
+ Sets the username <username> for the specified server <name>.
+ @switches:
+ !sw: -q | --quiet
+ Do not print errors if the server already exists.
+ @examples:
+ [example]
+ [comment]Quietly sets the username kvirc for the Freenode server[/comment][br]
+ serverdb.setServerUserName -q irc.freenode.net kvirc
+ [/example]
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerUserName,setUserName)
+
+/*
+ @doc: serverdb.setServerRealName
+ @type:
+ command
+ @title:
+ serverdb.setServerRealName
+ @short:
+ Sets the realname
+ @syntax:
+ serverdb.setServerRealName [switches] <string:name> <string:realname>
+ @description:
+ Sets the realname <realname> for the specified server <name>.
+ @switches:
+ !sw: -q | --quiet
+ Do not print errors if the server already exists.
+ @examples:
+ [example]
+ [comment]Quietly sets the realname KVIrc 4.0 for the Freenode server[/comment][br]
+ serverdb.setServerRealName -q irc.freenode.net KVIrc 4.0
+ [/example]
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerRealName,setRealName)
+
+/*
+ @doc: serverdb.setServerEncoding
+ @type:
+ command
+ @title:
+ serverdb.setServerEncoding
+ @short:
+ Sets the encoding
+ @syntax:
+ serverdb.setServerEncoding [switches] <string:name> <string:encoding>
+ @description:
+ Sets the encoding <encoding> for the specified server <name>.
+ @switches:
+ !sw: -q | --quiet
+ Do not print errors if the server already exists.
+ @examples:
+ [example]
+ [comment]Quietly sets the encoding UTF-8 for the irc.freenode.net server[/comment][br]
+ serverdb.setServerEncoding -q Freenode UTF-8
+ [/example]
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerEncoding,setEncoding)
+
+/*
+ @doc: serverdb.setServerDescription
+ @type:
+ command
+ @title:
+ serverdb.setServerDescription
+ @short:
+ Sets the description
+ @syntax:
+ serverdb.setServerDescription [switches] <string:name> <string:description>
+ @description:
+ Sets the description <description> for the specified server <name>.
+ @switches:
+ !sw: -q | --quiet
+ Do not print errors if the server already exists.
+ @examples:
+ [example]
+ [comment]Quietly sets the description for the Freenode server[/comment][br]
+ serverdb.setServerDescription -q irc.freenode.net The FOSS Network
+ [/example]
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerDescription,setDescription)
+
+/*
+ @doc: serverdb.setServerConnectCommand
+ @type:
+ command
+ @title:
+ serverdb.setServerConnectCommand
+ @short:
+ Sets the connect command
+ @syntax:
+ serverdb.setServerConnectCommand [switches] <string:name> <string:command>
+ @description:
+ Sets the command <command> to run on connect for the specified server <name>.
+ @switches:
+ !sw: -q | --quiet
+ Do not print errors if the server already exists.
+ @examples:
+ [example]
+ [comment]Quietly sets the connect command for the Freenode server[/comment][br]
+ serverdb.setServerConnectCommand -q irc.freenode.net ns identify HelLViS69 foobar
+ [/example]
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerConnectCommand,setOnConnectCommand)
+
+/*
+ @doc: serverdb.setServerLoginCommand
+ @type:
+ command
+ @title:
+ serverdb.setServerLoginCommand
+ @short:
+ Sets the login command
+ @syntax:
+ serverdb.setServerLoginCommand [switches] <string:name> <string:command>
+ @description:
+ Sets the command <command> to run on login for the specified server <name>.
+ @switches:
+ !sw: -q | --quiet
+ Do not print errors if the server already exists.
+ @examples:
+ [example]
+ [comment]Quietly sets the login command for the Freenode server[/comment][br]
+ serverdb.setServerLoginCommand -q irc.freenode.net join #KVIrc
+ [/example]
+ @seealso:
+ [module:serverdb]ServerDB module documentation[/module]
+*/
+SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerLoginCommand,setOnLoginCommand)
static bool serverdb_module_init(KviModule * m)
{
/*
- KVSM_REGISTER_FUNCTION(m,"findByName",serverdb_kvs_fnc_findByName);
KVSM_REGISTER_SIMPLE_COMMAND(m,"updateList",serverdb_kvs_cmd_updateList);
*/
-
+#if 0
+ KVSM_REGISTER_FUNCTION(m,"getNickName",serverdb_kvs_fnc_getNickName);
+ KVSM_REGISTER_FUNCTION(m,"getRealName",serverdb_kvs_fnc_getRealName);
+ KVSM_REGISTER_FUNCTION(m,"getUserName",serverdb_kvs_fnc_getUserName);
+ KVSM_REGISTER_FUNCTION(m,"getConnectCommand",serverdb_kvs_fnc_getConnectCommand);
+ KVSM_REGISTER_FUNCTION(m,"getDescription",serverdb_kvs_fnc_getDescription);
+ KVSM_REGISTER_FUNCTION(m,"getEncoding",serverdb_kvs_fnc_getEncoding);
+ KVSM_REGISTER_FUNCTION(m,"getLoginCommand",serverdb_kvs_fnc_getLoginCommand);
+#endif
KVSM_REGISTER_FUNCTION(m,"networkExists",serverdb_kvs_fnc_networkExists);
+ KVSM_REGISTER_FUNCTION(m,"serverExists",serverdb_kvs_fnc_serverExists);
KVSM_REGISTER_SIMPLE_COMMAND(m,"addNetwork",serverdb_kvs_cmd_addNetwork);
KVSM_REGISTER_SIMPLE_COMMAND(m,"addServer",serverdb_kvs_cmd_addServer);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkConnectCommand",serverdb_kvs_cmd_setNetworkConnectCommand);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkEncoding",serverdb_kvs_cmd_setNetworkEncoding);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkDescription",serverdb_kvs_cmd_setNetworkDescription);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkLoginCommand",serverdb_kvs_cmd_setNetworkLoginCommand);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkNickName",serverdb_kvs_cmd_setNetworkNickName);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkRealName",serverdb_kvs_cmd_setNetworkRealName);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setNetworkUserName",serverdb_kvs_cmd_setNetworkUserName);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerConnectCommand",serverdb_kvs_cmd_setServerConnectCommand);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerEncoding",serverdb_kvs_cmd_setServerEncoding);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerDescription",serverdb_kvs_cmd_setServerDescription);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerLoginCommand",serverdb_kvs_cmd_setServerLoginCommand);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerNickName",serverdb_kvs_cmd_setServerNickName);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerRealName",serverdb_kvs_cmd_setServerRealName);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setServerUserName",serverdb_kvs_cmd_setServerUserName);
- KVSM_REGISTER_SIMPLE_COMMAND(m,"setConnectCommand",serverdb_kvs_cmd_setConnectCommand);
- KVSM_REGISTER_SIMPLE_COMMAND(m,"setEncoding",serverdb_kvs_cmd_setEncoding);
- KVSM_REGISTER_SIMPLE_COMMAND(m,"setDescription",serverdb_kvs_cmd_setDescription);
- KVSM_REGISTER_SIMPLE_COMMAND(m,"setLoginCommand",serverdb_kvs_cmd_setLoginCommand);
- KVSM_REGISTER_SIMPLE_COMMAND(m,"setNickName",serverdb_kvs_cmd_setNickName);
- KVSM_REGISTER_SIMPLE_COMMAND(m,"setRealName",serverdb_kvs_cmd_setRealName);
- KVSM_REGISTER_SIMPLE_COMMAND(m,"setUserName",serverdb_kvs_cmd_setUserName);
-
-/*
-<Pragma[Off2]> addNetwork "nome"
-<Pragma[Off2]> addServer "nomenetwork" "nomeserver" "altriparametri"....
-<Pragma[Off2]> setQualcosa "nomenetwork" "nomeserver" "qualcosa"
-*/
return true;
}