diff options
| author | 2010-12-25 03:14:10 +0000 | |
|---|---|---|
| committer | 2010-12-25 03:14:10 +0000 | |
| commit | fc30c3ea279b53b2c0e2a3b71f9811ff1033076c (patch) | |
| tree | 8da709e2160e50abd2e4b355f3b795fdbbd5aa56 /src/modules | |
| parent | Update str.grep short doc: avoid mentioning GNU regexp as we don't emulate it (diff) | |
| download | KVIrc-fc30c3ea279b53b2c0e2a3b71f9811ff1033076c.tar.gz KVIrc-fc30c3ea279b53b2c0e2a3b71f9811ff1033076c.tar.bz2 KVIrc-fc30c3ea279b53b2c0e2a3b71f9811ff1033076c.zip | |
Added the very first shy 'auto-join this channel' feature to the window popup. .serverJoinChannels and .networkJoinChannels now return arrays. Reworked a bit the 'network name' mess in the IrcConnection... possibly needs more reorganizing. Some small tweaks in the server dialog.
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5226 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/context/libkvicontext.cpp | 84 | ||||
| -rw-r--r-- | src/modules/list/listwindow.cpp | 2 | ||||
| -rw-r--r-- | src/modules/my/libkvimy.cpp | 10 | ||||
| -rw-r--r-- | src/modules/options/optw_servers.cpp | 25 | ||||
| -rw-r--r-- | src/modules/options/optw_servers.h | 1 | ||||
| -rw-r--r-- | src/modules/serverdb/libkviserverdb.cpp | 206 |
6 files changed, 229 insertions, 99 deletions
diff --git a/src/modules/context/libkvicontext.cpp b/src/modules/context/libkvicontext.cpp index acd5d66ed..bd3118be8 100644 --- a/src/modules/context/libkvicontext.cpp +++ b/src/modules/context/libkvicontext.cpp @@ -105,15 +105,50 @@ If the irc_context_id specification is not valid then this function returns nothing. If the specified IRC context is not currently connected then this function returns nothing. + The network name is the one that the server reports or + the one stored in the server database if the server reports no + network name. This is equivalent to [fnc]$my.network[/fnc]. @seealso: [fnc]$context.serverHostName[/fnc] + [fnc]$context.serverdbNetworkName[/fnc] */ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( context_kvs_fnc_networkName, - c->returnValue()->setString(pConnection->target()->network()->name()) + c->returnValue()->setString(pConnection->currentNetworkName()) ) +/* + @doc: context.serverdbNetworkName + @type: + function + @title: + $context.serverdbNetworkName + @short: + Returns the original IRC network name of an IRC context + @syntax: + <string> $context.serverdbNetworkName + <string> $context.serverdbNetworkName(<irc_context_id:uint>) + @description: + Returns the name of the network for the specified IRC context. + If no irc_context_id is specified then the current irc_context is used. + If the irc_context_id specification is not valid then this function + returns nothing. If the specified IRC context is not currently connected + then this function returns nothing. + The returned network name is the one that has been specified + in the server database and may not correspond to the real network + name. However, this is the network name you want to use if + you want to manipulate the serverdb entries related to the current + connection. + @seealso: + [fnc]$context.serverHostName[/fnc] + [fnc]$context.networkName[/fnc] +*/ + +STANDARD_IRC_CONNECTION_TARGET_PARAMETER( + context_kvs_fnc_serverdbNetworkName, + c->returnValue()->setString(pConnection->target()->network()->name()) + ) /* @doc: context.serverHostName @@ -133,11 +168,14 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( If the irc_context_id specification is not valid then this function returns nothing. If the specified IRC context is not currently connected then this function returns nothing. - If the returned value is non empty then it will always be a valid - DNS hostname that can be used to perform a real connection. - Please note that this is different from $my.server() which might - return an invalid DNS entry. + Please note that this function returns the name of the server as reported + by the server itself. Some servers report a bogus value for this field. + You should take a look at [fnc]$context.serverIpAddress[/fnc] if you want a value that + can be used to really reconnect to this server. If you want a value + to manipulate the server entry via the serverdb functions then + you probably need [fnc]$context.serverdbServerHostName[/fnc]. @seealso: + [fnc]$context.serverdbServerHostName[/fnc] [fnc]$context.serverPort[/fnc], [fnc]$context.serverIpAddress[/fnc], [fnc]$context.serverPassword[/fnc] @@ -145,6 +183,40 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( STANDARD_IRC_CONNECTION_TARGET_PARAMETER( context_kvs_fnc_serverHostName, + c->returnValue()->setString(pConnection->currentServerName()) + ) + +/* + @doc: context.serverdbServerHostName + @type: + function + @title: + $context.serverdbServerHostName + @short: + Returns the original IRC server name of an IRC context + @syntax: + <string> $context.serverdbServerHostName + <string> $context.serverdbServerHostName(<irc_context_id:uint>) + @description: + Returns the host name of the IRC server that was used to perform + the connection in the specified irc context. + If no irc_context_id is specified then the current irc_context is used. + If the irc_context_id specification is not valid then this function + returns nothing. If the specified IRC context is not currently connected + then this function returns nothing. + The returned server name is the one that has been specified + in the server database and may refer to a round-robin dns entry. + However, this is the server name you want to use if you want to manipulate + the serverdb entries related to the current connection. + @seealso: + [fnc]$context.serverHostName[/fnc], + [fnc]$context.serverPort[/fnc], + [fnc]$context.serverIpAddress[/fnc], + [fnc]$context.serverPassword[/fnc] +*/ + +STANDARD_IRC_CONNECTION_TARGET_PARAMETER( + context_kvs_fnc_serverdbServerHostName, c->returnValue()->setString(pConnection->target()->server()->hostName()) ) @@ -457,6 +529,8 @@ static bool context_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"serverIsSSL",context_kvs_fnc_serverIsSSL); KVSM_REGISTER_FUNCTION(m,"serverPassword",context_kvs_fnc_serverPassword); KVSM_REGISTER_FUNCTION(m,"networkName",context_kvs_fnc_networkName); + KVSM_REGISTER_FUNCTION(m,"serverdbNetworkName",context_kvs_fnc_serverdbNetworkName); + KVSM_REGISTER_FUNCTION(m,"serverdbServerHostName",context_kvs_fnc_serverdbServerHostName); KVSM_REGISTER_FUNCTION(m,"state",context_kvs_fnc_state); KVSM_REGISTER_FUNCTION(m,"list",context_kvs_fnc_list); KVSM_REGISTER_FUNCTION(m,"serverSoftware",context_kvs_fnc_serverSoftware); diff --git a/src/modules/list/listwindow.cpp b/src/modules/list/listwindow.cpp index 6961548a6..c949bb307 100644 --- a/src/modules/list/listwindow.cpp +++ b/src/modules/list/listwindow.cpp @@ -358,7 +358,7 @@ void KviListWindow::exportList() break; } KviQString::sprintf(szFile,__tr2qs("Channel list for %Q - %Q"), - &(connection()->networkName()),&(szDate)); + &(connection()->currentNetworkName()),&(szDate)); } else { szFile = __tr2qs("Channel list"); } diff --git a/src/modules/my/libkvimy.cpp b/src/modules/my/libkvimy.cpp index 5196fa01b..3ccbb6a04 100644 --- a/src/modules/my/libkvimy.cpp +++ b/src/modules/my/libkvimy.cpp @@ -343,8 +343,10 @@ static bool my_kvs_fnc_serverIsSSL(KviKvsModuleFunctionCall * c) in that irc_context.[br] Please note that this function returns the name of the server as reported by the server itself. Some servers report a bogus value for this field. - You should take a look at $context.serverIpAddress or $context.serverHostName - if you want a value that can be used to really reconnect to this server. + You should take a look at [fnc]$context.serverIpAddress[/fnc] if you want a value that + can be used to really reconnect to this server. If you want a value + to manipulate the server entry via the serverdb functions then + you probably need [fnc]$context.serverdbServerHostName[/fnc]. */ static bool my_kvs_fnc_server(KviKvsModuleFunctionCall * c) @@ -353,7 +355,7 @@ static bool my_kvs_fnc_server(KviKvsModuleFunctionCall * c) if(wnd) { if(wnd->connection()) - c->returnValue()->setString(wnd->connection()->serverInfo()->name()); + c->returnValue()->setString(wnd->connection()->currentServerName()); } return true; } @@ -381,7 +383,7 @@ static bool my_kvs_fnc_network(KviKvsModuleFunctionCall * c) if(wnd) { if(wnd->connection()) - c->returnValue()->setString(wnd->currentNetworkName().toUtf8().data()); + c->returnValue()->setString(wnd->currentNetworkName()); } return true; } diff --git a/src/modules/options/optw_servers.cpp b/src/modules/options/optw_servers.cpp index cda2e9545..67156b5bc 100644 --- a/src/modules/options/optw_servers.cpp +++ b/src/modules/options/optw_servers.cpp @@ -1321,6 +1321,7 @@ KviServerOptionsWidget::KviServerOptionsWidget(QWidget * parent) m_pSrvNetLabel = new QLabel(__tr2qs_ctx("Server:","options"),gbox); m_pSrvNetEdit = new QLineEdit(gbox); + connect(m_pSrvNetEdit,SIGNAL(textEdited(const QString &)),this,SLOT(serverNetworkEditTextEdited(const QString &))); KviTalToolTip::add(m_pSrvNetEdit,__tr2qs_ctx("<center>This is the name of the currently selected server or network</center>","options")); m_pDetailsButton = new QPushButton(__tr2qs_ctx("Advanced...","options"),gbox); @@ -1513,7 +1514,6 @@ void KviServerOptionsWidget::selectBestServerByUrl(const QString &szUrl) } - void KviServerOptionsWidget::connectCurrentClicked() { saveLastItem(); @@ -1604,19 +1604,36 @@ void KviServerOptionsWidget::currentItemChanged(QTreeWidgetItem *it,QTreeWidgetI } } +void KviServerOptionsWidget::serverNetworkEditTextEdited(const QString &) +{ + if(!m_pLastEditedItem) + return; + + saveLastItem(); + + // make sure the current item is currently visible (if it still exists) + if(m_pLastEditedItem) + m_pTreeWidget->scrollToItem(m_pLastEditedItem,QTreeWidget::EnsureVisible); +} + + void KviServerOptionsWidget::saveLastItem() { - if(!m_pLastEditedItem)return; + if(!m_pLastEditedItem) + return; + if(m_pLastEditedItem->m_pServerData) { KviStr tmp = m_pSrvNetEdit->text(); - if(tmp.isEmpty())tmp = "irc.unknown.net"; + if(tmp.isEmpty()) + tmp = "irc.unknown.net"; m_pLastEditedItem->m_pServerData->m_szHostname = tmp; m_pLastEditedItem->updateVisibleStrings(); } else if(m_pLastEditedItem->m_pNetworkData) { QString tmp = m_pSrvNetEdit->text(); - if(tmp.isEmpty())tmp = __tr2qs_ctx("UnknownNet","options"); + if(tmp.isEmpty()) + tmp = __tr2qs_ctx("UnknownNet","options"); m_pLastEditedItem->m_pNetworkData->setName(tmp); m_pLastEditedItem->updateVisibleStrings(); } diff --git a/src/modules/options/optw_servers.h b/src/modules/options/optw_servers.h index 0568bc563..496e377c9 100644 --- a/src/modules/options/optw_servers.h +++ b/src/modules/options/optw_servers.h @@ -221,6 +221,7 @@ protected slots: void recentServersPopupAboutToShow(); void recentServersPopupClicked(int id); void importPopupActivated(int id); + void serverNetworkEditTextEdited(const QString &szNewText); public: virtual void commit(); }; diff --git a/src/modules/serverdb/libkviserverdb.cpp b/src/modules/serverdb/libkviserverdb.cpp index 9a91c06d9..6a73b11cd 100644 --- a/src/modules/serverdb/libkviserverdb.cpp +++ b/src/modules/serverdb/libkviserverdb.cpp @@ -105,10 +105,10 @@ extern KVIRC_API KviServerDataBase * g_pServerDataBase; @short: Checks if the network already exists in the DB @syntax: - <bool> $serverdb.networkExists + <bool> $serverdb.networkExists(<network_name:string>) @description: Checks if the network already exists in the DB.[br] - It returns 1 if the network exixts, 0 otherwise + It returns 1 if the network exixts, 0 otherwise. @seealso: [module:serverdb]ServerDB module documentation[/module] */ @@ -146,7 +146,7 @@ static bool serverdb_kvs_fnc_networkExists(KviKvsModuleFunctionCall * c) @short: Checks if the network already exists in the DB @syntax: - <bool> $serverdb.serverExists(<string:servername>[,<string:networkname>]) + <bool> $serverdb.serverExists(<servername:string>[,<networkname:string>]) @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] @@ -212,7 +212,7 @@ static bool serverdb_kvs_fnc_serverExists(KviKvsModuleFunctionCall * c) return true; } -#define SERVERDB_GET_NETWORK_PROPERTY(__functionName,__callName) \ +#define BEGIN_SERVERDB_GET_NETWORK_PROPERTY(__functionName) \ static bool __functionName(KviKvsModuleFunctionCall * c) \ { \ QString szName; \ @@ -232,14 +232,21 @@ static bool serverdb_kvs_fnc_serverExists(KviKvsModuleFunctionCall * c) { \ c->error(__tr2qs_ctx("The specified network does not exist","serverdb")); \ return false; \ - } \ + } + + +#define END_SERVERDB_GET_NETWORK_PROPERTY \ + return true; \ + } + +#define SERVERDB_GET_NETWORK_PROPERTY(__functionName,__callName) \ + BEGIN_SERVERDB_GET_NETWORK_PROPERTY(__functionName) \ \ c->returnValue()->setString(pNetwork->__callName()); \ \ - return true; \ - } + END_SERVERDB_GET_NETWORK_PROPERTY -#define SERVERDB_GET_SERVER_PROPERTY(__functionName,__callName,__variantSetCallName) \ +#define BEGIN_SERVERDB_GET_SERVER_PROPERTY(__functionName) \ static bool __functionName(KviKvsModuleFunctionCall * c) \ { \ QString szNetName, szServName; \ @@ -273,13 +280,19 @@ static bool serverdb_kvs_fnc_serverExists(KviKvsModuleFunctionCall * c) { \ c->error(__tr2qs_ctx("The specified server does not exist","serverdb")); \ return false; \ - } \ - \ - c->returnValue()->__variantSetCallName(pServer->__callName()); \ - \ + } + + +#define END_SERVERDB_GET_SERVER_PROPERTY \ return true; \ } +#define SERVERDB_GET_SERVER_PROPERTY(__functionName,__callName,__variantSetCallName) \ + BEGIN_SERVERDB_GET_SERVER_PROPERTY(__functionName) \ + c->returnValue()->__variantSetCallName(pServer->__callName()); \ + END_SERVERDB_GET_SERVER_PROPERTY + + /* @doc: serverdb.networkNickName @type: @@ -289,7 +302,7 @@ static bool serverdb_kvs_fnc_serverExists(KviKvsModuleFunctionCall * c) @short: Returns the nickname @syntax: - <string> $serverdb.networkNickName(<string:network>) + <string> $serverdb.networkNickName(<network:string>) @description: Returns the nickname set for the network <network> if set @seealso: @@ -306,9 +319,9 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkNickName,nickName) @short: Returns the username @syntax: - <string> $serverdb.networkUserName(<string:network>) + <string> $serverdb.networkUserName(<network:string>) @description: - Returns the username set for the network <network> if set + Returns the username set for the network <network> if set. @seealso: [module:serverdb]ServerDB module documentation[/module] */ @@ -323,7 +336,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkUserName,userName) @short: Returns the realname @syntax: - <string> $serverdb.networkRealName(<string:network>) + <string> $serverdb.networkRealName(<network:string>) @description: Returns the realname set for the network <network> if set @seealso: @@ -340,7 +353,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkRealName,realName) @short: Returns the encoding @syntax: - <string> $serverdb.networkEncoding(<string:network>) + <string> $serverdb.networkEncoding(<network:string>) @description: Returns the encoding used for the network <network> for server specific messages, like channel and nick names, if set @seealso: @@ -357,7 +370,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkEncoding,encoding) @short: Returns the encoding @syntax: - <string> $serverdb.networkTextEncoding(<string:network>) + <string> $serverdb.networkTextEncoding(<network:string>) @description: Returns the encoding used for the network <network> for text messages, if set @seealso: @@ -374,7 +387,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkTextEncoding,textEncoding) @short: Returns the description @syntax: - <string> $serverdb.networkDescription(<string:network>) + <string> $serverdb.networkDescription(<network:string>) @description: Returns the description set for the network <network> if set @seealso: @@ -391,7 +404,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkDescription,description) @short: Returns the connect command @syntax: - <string> $serverdb.networkConnectCommand(<string:network>) + <string> $serverdb.networkConnectCommand(<network:string>) @description: Returns the connect command set for the network <network> if set @seealso: @@ -408,7 +421,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkConnectCommand,onConnectCo @short: Returns the login command @syntax: - <string> $serverdb.networkLoginCommand(<string:network>) + <string> $serverdb.networkLoginCommand(<network:string>) @description: Returns the login command set for the network <network> if set @seealso: @@ -425,7 +438,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkLoginCommand,onLoginComman @short: Returns the name @syntax: - <string> $serverdb.networkName(<string:network>) + <string> $serverdb.networkName(<network:string>) @description: Returns the name of the network <network> @seealso: @@ -442,14 +455,31 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkName,name) @short: Returns the list of autojoin channels @syntax: - <string> $serverdb.networkJoinChannels(<string:network>) + <string> $serverdb.networkJoinChannels(<network:string>) @description: - Returns a comma-separated list of autojoin channels and their relative passwords set for the network <network>[br] - Each item in the list is in the format <string:channel>:<string:password> + Returns an array of autojoin channels and their relative passwords set for the network <network>[br] + Each item in the array is in the format <channel:string>:<password:string> @seealso: [module:serverdb]ServerDB module documentation[/module] */ -SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkJoinChannels,autoJoinChannelListAsString) +BEGIN_SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkJoinChannels) + + KviKvsArray * pArray = new KviKvsArray(); + + QStringList * pAutoJoinChannels = pNetwork->autoJoinChannelList(); + if(pAutoJoinChannels) + { + kvs_uint_t idx = 0; + foreach(QString szEntry,*pAutoJoinChannels) + { + pArray->set(idx,new KviKvsVariant(szEntry)); + idx++; + } + } + + c->returnValue()->setArray(pArray); + +END_SERVERDB_GET_NETWORK_PROPERTY /* @doc: serverdb.serverNickName @@ -460,7 +490,7 @@ SERVERDB_GET_NETWORK_PROPERTY(serverdb_kvs_fnc_networkJoinChannels,autoJoinChann @short: Returns the nickname @syntax: - <string> $serverdb.serverNickName(<string:network>,<string:server>) + <string> $serverdb.serverNickName(<network:string>,<server:string>) @description: Returns the nickname set for the server <server> of the network <network> if set @seealso: @@ -477,7 +507,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverNickName,nickName,setString) @short: Returns the username @syntax: - <string> $serverdb.serverUserName(<string:network>,<string:server>) + <string> $serverdb.serverUserName(<network:string>,<server:string>) @description: Returns the username set for the server <server> of the network <network> if set @seealso: @@ -494,7 +524,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverUserName,userName,setString) @short: Returns the realname @syntax: - <string> $serverdb.serverRealName(<string:network>,<string:server>) + <string> $serverdb.serverRealName(<network:string>,<server:string>) @description: Returns the realname set for the server <server> of the network <network> if set @seealso: @@ -511,7 +541,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverRealName,realName,setString) @short: Returns the encoding @syntax: - <string> $serverdb.serverEncoding(<string:network>,<string:server>) + <string> $serverdb.serverEncoding(<network:string>,<server:string>) @description: Returns the encoding used for the server <server> of the network <network> for server specific messages, like channel and nick names, if set @seealso: @@ -528,7 +558,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverEncoding,encoding,setString) @short: Returns the encoding @syntax: - <string> $serverdb.serverTextEncoding(<string:network>,<string:server>) + <string> $serverdb.serverTextEncoding(<network:string>,<server:string>) @description: Returns the encoding used for the server <server> of the network <network> for server specific messages, like channel and nick names, if set @seealso: @@ -545,7 +575,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverTextEncoding,textEncoding,se @short: Returns the description @syntax: - <string> $serverdb.serverDescription(<string:network>,<string:server>) + <string> $serverdb.serverDescription(<network:string>,<server:string>) @description: Returns the description set for the server <server> of the network <network> if set @seealso: @@ -562,7 +592,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverDescription,description,setS @short: Returns the connect command @syntax: - <string> $serverdb.serverConnectCommand(<string:network>,<string:server>) + <string> $serverdb.serverConnectCommand(<network:string>,<server:string>) @description: Returns the connect command set for the server <server> of the network <network> if set @seealso: @@ -579,7 +609,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverConnectCommand,onConnectComm @short: Returns the login command @syntax: - <string> $serverdb.serverLoginCommand(<string:network>,<string:server>) + <string> $serverdb.serverLoginCommand(<network:string>,<server:string>) @description: Returns the login command set for the server <server> of the network <network> if set @seealso: @@ -596,7 +626,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverLoginCommand,onLoginCommand, @short: Returns the IP address @syntax: - <string> $serverdb.serverIp(<string:network>,<string:server>) + <string> $serverdb.serverIp(<network:string>,<server:string>) @description: Returns the IP address of the server <server> of the network <network> @seealso: @@ -613,7 +643,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverIp,ip,setString) @short: Returns the ID @syntax: - <string> $serverdb.serverId(<string:network>,<string:server>) + <string> $serverdb.serverId(<network:string>,<server:string>) @description: Returns the ID of the server <server> of the network <network> @seealso: @@ -630,7 +660,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverId,id,setString) @short: Returns the password @syntax: - <string> $serverdb.serverPassword(<string:network>,<string:server>) + <string> $serverdb.serverPassword(<network:string>,<server:string>) @description: Returns the password of the server <server> of the network <network> if set @seealso: @@ -647,7 +677,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverPassword,password,setString) @short: Returns the port @syntax: - <int> $serverdb.serverPort(<string:network>,<string:server>) + <int> $serverdb.serverPort(<network:string>,<server:string>) @description: Returns the port of the server <server> of the network <network> if set @seealso: @@ -664,7 +694,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverPort,port,setInteger) @short: Returns the autoconnect status @syntax: - <bool> $serverdb.isAutoConnect(<string:network>,<string:server>) + <bool> $serverdb.isAutoConnect(<network:string>,<server:string>) @description: Returns true if the server <server> of the network <network> if set to autoconnect, false otherwise @seealso: @@ -681,7 +711,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverAutoConnect,autoConnect,setB @short: Returns the IPv6 status @syntax: - <bool> $serverdb.isIPv6(<string:network>,<string:server>) + <bool> $serverdb.isIPv6(<network:string>,<server:string>) @description: Returns true if the server <server> of the network <network> if set to connect using IPv6 sockets, false otherwise @seealso: @@ -698,7 +728,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverIPv6,isIPv6,setBoolean) @short: Returns the SSL status @syntax: - <bool> $serverdb.isSSL(<string:network>,<string:server>) + <bool> $serverdb.isSSL(<network:string>,<server:string>) @description: Returns true if the server <server> of the network <network> if set to connect using SSL (Secure Socket Layer) sockets, false otherwise @seealso: @@ -715,7 +745,7 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverSSL,useSSL,setBoolean) @short: Returns the cache-ip status @syntax: - <bool> $serverdb.cacheIp(<string:network>,<string:server>) + <bool> $serverdb.cacheIp(<network:string>,<server:string>) @description: Returns true if KVIrc is set to cache the ip of the server <server> of the network <network>, false otherwise @seealso: @@ -732,14 +762,32 @@ SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverCacheIp,cacheIp,setBoolean) @short: Returns the list of autojoin channels @syntax: - <string> $serverdb.serverJoinChannels(<string:network>,<string:server>) + <array> $serverdb.serverJoinChannels(<network:string>,<server:string>) @description: - Returns a comma-separated list of autojoin channels and their relative passwords set for the server <server> of the network <network>[br] - Each item in the array is in the format <string:channel>:<string:password> + Returns an array containing the autojoin channels and their relative passwords set for the server <server> of the network <network>[br] + Each item in the array is in the format channel_name:password @seealso: [module:serverdb]ServerDB module documentation[/module] */ -SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverJoinChannels,autoJoinChannelListAsString,setString) +BEGIN_SERVERDB_GET_SERVER_PROPERTY(serverdb_kvs_fnc_serverJoinChannels) + + KviKvsArray * pArray = new KviKvsArray(); + + QStringList * pAutoJoinChannels = pServer->autoJoinChannelList(); + if(pAutoJoinChannels) + { + kvs_uint_t idx = 0; + foreach(QString szEntry,*pAutoJoinChannels) + { + pArray->set(idx,new KviKvsVariant(szEntry)); + idx++; + } + } + + c->returnValue()->setArray(pArray); + +END_SERVERDB_GET_SERVER_PROPERTY + /* @doc: serverdb.addNetwork @@ -802,7 +850,7 @@ static bool serverdb_kvs_cmd_addNetwork(KviKvsModuleCommandCall * c) @short: Adds a server @syntax: - serverdb.addServer [switches] <string:network> <string:server> + serverdb.addServer [switches] <network:string> <server:string> @description: Adds the server <server> to the network <network>. @switches: @@ -899,11 +947,11 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c) #define SERVERDB_SET_NETWORK_PROPERTY(__functionName,__callName) \ static bool __functionName(KviKvsModuleCommandCall * c) \ { \ - QString szName, szPropertyName; \ + QString szName, szPropertyValue; \ \ KVSM_PARAMETERS_BEGIN(c) \ KVSM_PARAMETER("name",KVS_PT_STRING,0,szName) \ - KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyName) \ + KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyValue) \ KVSM_PARAMETERS_END(c) \ \ if(szName.isEmpty()) \ @@ -912,12 +960,6 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c) 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) \ { \ @@ -926,7 +968,7 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c) return false; \ } \ \ - pNetwork->__callName(szPropertyName); \ + pNetwork->__callName(szPropertyValue); \ \ return true; \ } @@ -934,12 +976,12 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c) #define SERVERDB_SET_SERVER_PROPERTY(__functionName,__callName) \ static bool __functionName(KviKvsModuleCommandCall * c) \ { \ - QString szNetName, szServName, szPropertyName; \ + QString szNetName, szServName, szPropertyValue; \ \ KVSM_PARAMETERS_BEGIN(c) \ KVSM_PARAMETER("network_name",KVS_PT_STRING,0,szNetName) \ KVSM_PARAMETER("server_name",KVS_PT_STRING,0,szServName) \ - KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyName) \ + KVSM_PARAMETER("property",KVS_PT_STRING,KVS_PF_APPENDREMAINING,szPropertyValue) \ KVSM_PARAMETERS_END(c) \ \ if(szNetName.isEmpty()) \ @@ -954,12 +996,6 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c) return false; \ } \ \ - if(szPropertyName.isEmpty()) \ - { \ - c->error(__tr2qs_ctx("You must provide the value as parameter","serverdb")); \ - return false; \ - } \ - \ KviNetwork * pRecord = g_pServerDataBase->findNetwork(szNetName); \ if(!pRecord) \ { \ @@ -976,7 +1012,7 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c) return false; \ } \ \ - pServer->__callName(szPropertyName); \ + pServer->__callName(szPropertyValue); \ \ return true; \ } @@ -990,7 +1026,7 @@ static bool serverdb_kvs_cmd_addServer(KviKvsModuleCommandCall * c) @short: Sets the nickname @syntax: - serverdb.setNetworkNickName [switches] <string:name> <string:nick> + serverdb.setNetworkNickName [switches] <name:string> <nick:string> @description: Sets the nickname <nick> for the specified network <name>. @switches: @@ -1015,7 +1051,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkNickName,setNickName) @short: Sets the username @syntax: - serverdb.setNetworkUserName [switches] <string:name> <string:username> + serverdb.setNetworkUserName [switches] <name:string> <username:string> @description: Sets the username <username> for the specified network <name>. @switches: @@ -1040,7 +1076,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkUserName,setUserName) @short: Sets the realname @syntax: - serverdb.setNetworkRealName [switches] <string:name> <string:realname> + serverdb.setNetworkRealName [switches] <name:string> <realname:string> @description: Sets the realname <realname> for the specified network <name>. @switches: @@ -1065,7 +1101,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkRealName,setRealName) @short: Sets the encoding @syntax: - serverdb.setNetworkEncoding [switches] <string:name> <string:encoding> + serverdb.setNetworkEncoding [switches] <name:string> <encoding:string> @description: Sets the encoding <encoding> for the specified network <name>. This encoding will be used for server-specific text, like channel names and nicknames. @@ -1091,7 +1127,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkEncoding,setEncoding) @short: Sets the encoding @syntax: - serverdb.setNetworkTextEncoding [switches] <string:name> <string:encoding> + serverdb.setNetworkTextEncoding [switches] <name:string> <encoding:string> @description: Sets the encoding <encoding> for the specified network <name>. This encoding will be used for text messages. @switches: @@ -1116,7 +1152,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkTextEncoding,setTextEnc @short: Sets the description @syntax: - serverdb.setNetworkDescription [switches] <string:name> <string:description> + serverdb.setNetworkDescription [switches] <name:string> <description:string> @description: Sets the description <description> for the specified network <name>. @switches: @@ -1141,7 +1177,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkDescription,setDescript @short: Sets the connect command @syntax: - serverdb.setNetworkConnectCommand [switches] <string:name> <string:command> + serverdb.setNetworkConnectCommand [switches] <name:string> <command:string> @description: Sets the command <command> to run on connect for the specified network <name>. @switches: @@ -1166,7 +1202,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkConnectCommand,setOnCon @short: Sets the login command @syntax: - serverdb.setNetworkLoginCommand [switches] <string:name> <string:command> + serverdb.setNetworkLoginCommand [switches] <name:string> <command:string> @description: Sets the command <command> to run on login for the specified network <name>. @switches: @@ -1191,10 +1227,10 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkLoginCommand,setOnLogin @short: Sets the autojoin channels list @syntax: - serverdb.setNetworkJoinChannels <string:name> <string:channel_list> + serverdb.setNetworkJoinChannels <name:string> <channel_list:string> @description: Sets the autojoin channels list for the specified network <name>.[br] - Items in the list have to be separated by a comma, and each item has to be in the form <string:channel>:<string:password> + Items in the list have to be separated by a comma, and each item has to be in the form <channel:string>:<password:string> @examples: [example] [comment]Set two autojoin channels for freenode[/comment][br] @@ -1214,7 +1250,7 @@ SERVERDB_SET_NETWORK_PROPERTY(serverdb_kvs_cmd_setNetworkJoinChannels,setAutoJoi @short: Sets the nickname @syntax: - serverdb.setServerNickName [switches] <string:network> <string:server> <string:nick> + serverdb.setServerNickName [switches] <network:string> <server:string> <nick:string> @description: Sets the nickname <nick> for the specified server <server> in the network <network>. @switches: @@ -1239,7 +1275,7 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerNickName,setNickName) @short: Sets the username @syntax: - serverdb.setServerUserName [switches] <string:network> <string:server> <string:username> + serverdb.setServerUserName [switches] <network:string> <server:string> <username:string> @description: Sets the username <username> for the specified server <server> in the network <network>. @switches: @@ -1264,7 +1300,7 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerUserName,setUserName) @short: Sets the realname @syntax: - serverdb.setServerRealName [switches] <string:network> <string:server> <string:realname> + serverdb.setServerRealName [switches] <network:string> <server:string> <realname:string> @description: Sets the realname <realname> for the specified server <server> in the network <network>. @switches: @@ -1289,7 +1325,7 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerRealName,setRealName) @short: Sets the encoding @syntax: - serverdb.setServerEncoding [switches] <string:network> <string:server> <string:encoding> + serverdb.setServerEncoding [switches] <network:string> <server:string> <encoding:string> @description: Sets the encoding <encoding> for the specified server <server> in the network <network>. This encoding will be used for server-specific text, like channel names and nicknames. @@ -1315,7 +1351,7 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerEncoding,setEncoding) @short: Sets the text encoding @syntax: - serverdb.setServerTextEncoding [switches] <string:network> <string:server> <string:encoding> + serverdb.setServerTextEncoding [switches] <network:string> <server:string> <encoding:string> @description: Sets the encoding <encoding> for the specified server <server> in the network <network>. This encoding will be used for text messages. @switches: @@ -1340,7 +1376,7 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerTextEncoding,setTextEncod @short: Sets the description @syntax: - serverdb.setServerDescription [switches] <string:network> <string:server> <string:description> + serverdb.setServerDescription [switches] <network:string> <server:string> <description:string> @description: Sets the description <description> for the specified server <server> in the network <network>. @switches: @@ -1365,7 +1401,7 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerDescription,setDescriptio @short: Sets the connect command @syntax: - serverdb.setServerConnectCommand [switches] <string:network> <string:server> <string:command> + serverdb.setServerConnectCommand [switches] <network:string> <server:string> <command:string> @description: Sets the command <command> to run on connect for the specified server <server> in the network <network>. @switches: @@ -1390,7 +1426,7 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerConnectCommand,setOnConne @short: Sets the login command @syntax: - serverdb.setServerLoginCommand [switches] <string:network> <string:server> <string:command> + serverdb.setServerLoginCommand [switches] <network:string> <server:string> <command:string> @description: Sets the command <command> to run on login for the specified server <server> in the network <network>. @switches: @@ -1415,10 +1451,10 @@ SERVERDB_SET_SERVER_PROPERTY(serverdb_kvs_cmd_setServerLoginCommand,setOnLoginCo @short: Sets the autojoin channels list @syntax: - serverdb.setServerJoinChannels <string:network> <string:server> <string:channel_list> + serverdb.setServerJoinChannels <network:string> <server:string> <channel_list:string> @description: Sets the autojoin channels list for the specified server <server> in the network <network>.[br] - Items in the list have to be separated by a comma, and each item has to be in the form <string:channel>:<string:password> + Items in the list have to be separated by a comma, and each item has to be in the form <channel:string>:<password:string> @examples: [example] [comment]Set two autojoin channels for irc.freenode.net[/comment][br] |
