aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2010-12-25 03:14:10 +0000
committerGravatar Szymon Tomasz Stefanek2010-12-25 03:14:10 +0000
commitfc30c3ea279b53b2c0e2a3b71f9811ff1033076c (patch)
tree8da709e2160e50abd2e4b355f3b795fdbbd5aa56
parentUpdate str.grep short doc: avoid mentioning GNU regexp as we don't emulate it (diff)
downloadKVIrc-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
-rw-r--r--data/defscript/default.kvc4
-rw-r--r--data/defscript/popups.kvs117
-rw-r--r--src/kvirc/kernel/kvi_ircconnection.cpp10
-rw-r--r--src/kvirc/kernel/kvi_ircconnection.h4
-rw-r--r--src/kvirc/kernel/kvi_ircconnectionserverinfo.h3
-rw-r--r--src/kvirc/kernel/kvi_ircconnectiontarget.cpp17
-rw-r--r--src/kvirc/kernel/kvi_ircconnectiontarget.h57
-rw-r--r--src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp2
-rw-r--r--src/kvirc/kvs/kvi_kvs_treenode_operation.cpp4
-rw-r--r--src/kvirc/sparser/kvi_sp_numeric.cpp7
-rw-r--r--src/kvirc/ui/kvi_channel.cpp4
-rw-r--r--src/kvirc/ui/kvi_console.h2
-rw-r--r--src/kvirc/ui/kvi_statusbar.cpp2
-rw-r--r--src/kvirc/ui/kvi_windowlist.cpp2
-rw-r--r--src/modules/context/libkvicontext.cpp84
-rw-r--r--src/modules/list/listwindow.cpp2
-rw-r--r--src/modules/my/libkvimy.cpp10
-rw-r--r--src/modules/options/optw_servers.cpp25
-rw-r--r--src/modules/options/optw_servers.h1
-rw-r--r--src/modules/serverdb/libkviserverdb.cpp206
20 files changed, 418 insertions, 145 deletions
diff --git a/data/defscript/default.kvc b/data/defscript/default.kvc
index c31adc40f..9ea89ba62 100644
--- a/data/defscript/default.kvc
+++ b/data/defscript/default.kvc
@@ -1,12 +1,12 @@
# KVIrc configuration file
[KVIrc]
Version=4.1.1
-Date=2010-12-22
+Date=2010-12-25
ActionVersion=4.1.1
AddonVersion=4.1.1
AliasVersion=4.1.1.5184
EventVersion=4.1.1.5219
-PopupVersion=4.1.1
+PopupVersion=4.1.1.5223
ClassVersion=4.1.1
RawVersion=4.1.1
PopupVersion=4.1.1.5159
diff --git a/data/defscript/popups.kvs b/data/defscript/popups.kvs
index a6d883964..e2c924ff7 100644
--- a/data/defscript/popups.kvs
+++ b/data/defscript/popups.kvs
@@ -1329,6 +1329,55 @@ file.addimagepath %mypath/pics/
defpopup(windowpopup)
{
+ prologue
+ {
+ %:bIsConnectedConsole = $(($window.type == "console") && ($context.state == "connected"));
+
+ if($window.type == "channel")
+ {
+ %:bIsChannel = $true;
+ %:szNetwork = $context.serverdbNetworkName()
+ %:szServer = $context.serverdbServerHostName()
+ %:bIsAutoJoinedOnNetwork = $false;
+ %:bIsAutoJoinedOnServer = $false;
+
+ if($serverdb.networkExists(%:szNetwork))
+ {
+ foreach(%szChanAndPass,$serverdb.networkJoinChannels(%:szNetwork))
+ {
+ %aChanAndPass = $str.split(":",%szChanAndPass)
+
+ if(%aChanAndPass[0] == $chan.name)
+ {
+ %:bIsAutoJoinedOnNetwork = $true;
+ break;
+ }
+ }
+ if($serverdb.serverExists(%:szServer,%:szNetwork))
+ {
+ foreach(%szChanAndPass,$serverdb.serverJoinChannels(%:szNetwork,%:szServer))
+ {
+ %aChanAndPass = $str.split(":",%szChanAndPass)
+
+ if(%aChanAndPass[0] == $chan.name)
+ {
+ %:bIsAutoJoinedOnServer = $true;
+ break;
+ }
+ }
+ } else {
+ %:szServer = ""
+ }
+ } else {
+ %:szNetwork = ""
+ }
+ %:bIsAutoJoined = $(%:bIsAutoJoinedOnNetwork || %:bIsAutoJoinedOnServer)
+ } else {
+ %:bIsChannel = $false;
+ }
+ }
+
+
item($tr("Dock","defscript"), 6) (!$window.isDocked()) window.dock
item($tr("Undock","defscript"), 7) ($window.isDocked()) window.undock
@@ -1348,49 +1397,97 @@ defpopup(windowpopup)
item($tr("Set window props as default","defscript"), 10) window.savePropertiesAsDefault
- separator
+ # channel-specific items
+
+ separator(%:bIsChannel)
+
+ popup($tr("Automatically Join Channel","defscript"),$icon("join"))(%:bIsChannel && (!%:bIsAutoJoined) && ((%:szServer != "") || (%:szNetwork != "")))
+ {
-# start: console-specific items
+ item($str.printf($tr("When Connecting to Server '?s'","defscript"),%:szServer),$icon("server"))(%:szServer != "")
+ {
+ %aChans = $serverdb.serverJoinChannels(%:szNetwork,%:szServer)
+ %aChans <+ $chan.name
+ serverdb.setServerJoinChannels %:szNetwork %:szServer %aChans
+ }
+
+ item($str.printf($tr("When Connecting to Network '?s'","defscript"),%:szNetwork),$icon("world"))(%:szNetwork != "")
+ {
+ %aChans = $serverdb.networkJoinChannels(%:szNetwork)
+ %aChans <+ $chan.name
+ serverdb.setNetworkJoinChannels %:szNetwork %aChans
+ }
+ }
- item($tr("Part All Channels","defscript"), 31) ($window.type=="console" && $context.state=="connected")
+ item($str.printf($tr("Stop Joining Channel on Server '?s'","defscript"),%:szServer),$icon("part"))(%:bIsChannel && %:bIsAutoJoinedOnServer)
+ {
+ %aChans = $array()
+ foreach(%szChanAndPass,$serverdb.serverJoinChannels(%:szNetwork,%:szServer))
+ {
+ %aChanAndPass = $str.split(":",%szChanAndPass)
+
+ if(%aChanAndPass[0] != $chan.name)
+ %aChans <+ %szChanAndPass;
+ }
+ serverdb.setServerJoinChannels %:szNetwork %:szServer %aChans
+ }
+
+ item($str.printf($tr("Stop Joining Channel on Network '?s'","defscript"),%:szNetwork),$icon("part"))(%:bIsChannel && %:bIsAutoJoinedOnNetwork)
+ {
+ %aChans = $array()
+ foreach(%szChanAndPass,$serverdb.networkJoinChannels(%:szNetwork))
+ {
+ %aChanAndPass = $str.split(":",%szChanAndPass)
+
+ if(%aChanAndPass[0] != $chan.name)
+ %aChans <+ %szChanAndPass;
+ }
+ serverdb.setNetworkJoinChannels %:szNetwork %aChans
+ }
+
+ # console-specific items
+
+ separator(%:bIsConnectedConsole)
+
+ item($tr("Part All Channels","defscript"), 31) (%:bIsConnectedConsole)
{
foreach(%x,$window.list(channel))
window.close %x
}
- item($tr("Close All Queries","defscript"), 47) ($window.type=="console" && $context.state=="connected")
+ item($tr("Close All Queries","defscript"), 47) (%:bIsConnectedConsole)
{
foreach(%x,$window.list(query))
window.close %x
}
- item($tr("Close All Dead Channels" ,"defscript"), 232) ($window.type=="console" && $context.state=="connected")
+ item($tr("Close All Dead Channels" ,"defscript"), 232) (%:bIsConnectedConsole)
{
foreach(%x,$window.list(deadchannel))
window.close %x
}
- item($tr("Close All Dead Queries" ,"defscript"), 233) ($window.type=="console" && $context.state=="connected")
+ item($tr("Close All Dead Queries" ,"defscript"), 233) (%:bIsConnectedConsole)
{
foreach(%x,$window.list(deadquery))
window.close %x
}
- separator
+ separator(%:bIsConnectedConsole)
- item($tr("Unhighlight All Windows" ,"defscript")) ($window.type=="console" && $context.state=="connected")
+ item($tr("Unhighlight All Windows" ,"defscript")) (%:bIsConnectedConsole)
{
foreach(%x,$window.list(all))
window.highlight 0 %x
}
- item($tr("Unhighlight All Channels" ,"defscript")) ($window.type=="console" && $context.state=="connected")
+ item($tr("Unhighlight All Channels" ,"defscript")) (%:bIsConnectedConsole)
{
foreach(%x,$window.list(channel))
window.highlight 0 %x
}
- item($tr("Unhighlight All Queries" ,"defscript")) ($window.type=="console" && $context.state=="connected")
+ item($tr("Unhighlight All Queries" ,"defscript")) (%:bIsConnectedConsole)
{
foreach(%x,$window.list(query))
window.highlight 0 %x
diff --git a/src/kvirc/kernel/kvi_ircconnection.cpp b/src/kvirc/kernel/kvi_ircconnection.cpp
index c18579c97..21cf68b5c 100644
--- a/src/kvirc/kernel/kvi_ircconnection.cpp
+++ b/src/kvirc/kernel/kvi_ircconnection.cpp
@@ -282,9 +282,10 @@ void KviIrcConnection::serverInfoReceived(const QString & szServerName, const QS
m_pConsole->frame()->childConnectionServerInfoChange(this);
}
-const QString & KviIrcConnection::networkName()
+const QString & KviIrcConnection::currentNetworkName()
{
- return m_pTarget->networkName();
+ //return m_pTarget->networkName();
+ return m_pServerInfo->networkName();
}
void KviIrcConnection::abort()
@@ -311,7 +312,8 @@ void KviIrcConnection::linkEstabilished()
// setup reasonable defaults before notifying anyone
m_pStatistics->setConnectionStartTime(kvi_unixTime());
m_pStatistics->setLastMessageTime(kvi_unixTime());
- m_pServerInfo->setName(target()->server()->m_szHostname);
+ m_pServerInfo->setName(target()->server()->hostName());
+ m_pServerInfo->setNetworkName(target()->network()->name());
// FIXME: With STARTTLS this is called TWICE!
if(KviPointerList<KviIrcDataStreamMonitor> * l = context()->monitorList())
@@ -661,7 +663,7 @@ void KviIrcConnection::registerChannel(KviChannel * c)
{
m_pChannelList->append(c);
if(KVI_OPTION_BOOL(KviOption_boolLogChannelHistory))
- g_pApp->addRecentChannel(c->windowName(),m_pTarget->networkName());
+ g_pApp->addRecentChannel(c->windowName(),m_pServerInfo->networkName());
emit(channelRegistered(c));
emit(chanListChanged());
}
diff --git a/src/kvirc/kernel/kvi_ircconnection.h b/src/kvirc/kernel/kvi_ircconnection.h
index a21c8a990..e0836d38b 100644
--- a/src/kvirc/kernel/kvi_ircconnection.h
+++ b/src/kvirc/kernel/kvi_ircconnection.h
@@ -353,10 +353,10 @@ public:
inline KviPointerList<KviChannel> * channelList(){ return m_pChannelList; };
/**
- * \brief Forwarder from KviIrcConnectionTarget, always non-empty string
+ * \brief Helper that provides a shortcut for really common access to serverInfo()->networkName()
* \return const QString &
*/
- const QString & networkName();
+ const QString & currentNetworkName();
/**
* \brief Helper that provides a shortcut for really common access to userInfo()->nickName()
diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
index 205dcefd5..31ef4d79a 100644
--- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
+++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
@@ -165,6 +165,7 @@ protected:
~KviIrcConnectionServerInfo();
private:
KviBasicIrcServerInfo * m_pServInfo;
+ QString m_szNetworkName; // the most actual network name (may be the one we specify or the one that the server reports)
QString m_szName; // the most actual server name (may be the one we specify or the one that the server wants to be known as)
QString m_szSupportedUserModes; // the supported user modes
QString m_szSupportedChannelModes; // the supported channel modes (all of them)
@@ -192,6 +193,7 @@ public:
const char * software() { return m_pServInfo ? m_pServInfo->getSoftware() : 0; };
bool getNeedsOpToListModeseI() { return m_pServInfo ? m_pServInfo->getNeedsOpToListModeseI() : false; };
const QString & name() { return m_szName; };
+ const QString & networkName() { return m_szNetworkName; };
const QString & supportedUserModes() { return m_szSupportedUserModes; };
const QString & supportedChannelModes() { return m_szSupportedChannelModes; };
const QString & supportedChannelTypes() { return m_szSupportedChannelTypes; };
@@ -221,6 +223,7 @@ public:
kvi_u32_t modeFlagFromPrefixChar(QChar c);
kvi_u32_t modeFlagFromModeChar(QChar c);
protected:
+ void setNetworkName(const QString &szName){ m_szNetworkName = szName; };
void setName(const QString &szName) { m_szName = szName; };
void setSupportedUserModes(const QString &szSupportedUserModes) { m_szSupportedUserModes = szSupportedUserModes; };
void setSupportedChannelModes(const QString &szSupportedChannelModes);
diff --git a/src/kvirc/kernel/kvi_ircconnectiontarget.cpp b/src/kvirc/kernel/kvi_ircconnectiontarget.cpp
index 1ddbe1ad0..2bd1bb10b 100644
--- a/src/kvirc/kernel/kvi_ircconnectiontarget.cpp
+++ b/src/kvirc/kernel/kvi_ircconnectiontarget.cpp
@@ -29,14 +29,16 @@
#include "kvi_network.h"
#include "kvi_proxydb.h"
-KviIrcConnectionTarget::KviIrcConnectionTarget(const KviNetwork * pNetwork,
- const KviServer * pServer,
- const KviProxy * pProxy,
- const QString &szBindAddress)
+KviIrcConnectionTarget::KviIrcConnectionTarget(
+ const KviNetwork * pNetwork,
+ const KviServer * pServer,
+ const KviProxy * pProxy,
+ const QString &szBindAddress
+ )
{
m_pNetwork = new KviNetwork(*pNetwork);
m_pServer = new KviServer(*pServer);
- m_pProxy = pProxy ? new KviProxy(*pProxy) : 0;
+ m_pProxy = pProxy ? new KviProxy(*pProxy) : NULL;
m_szBindAddress = szBindAddress;
}
@@ -44,9 +46,11 @@ KviIrcConnectionTarget::~KviIrcConnectionTarget()
{
delete m_pNetwork;
delete m_pServer;
- if(m_pProxy)delete m_pProxy;
+ if(m_pProxy)
+ delete m_pProxy;
}
+#if 0
const QString & KviIrcConnectionTarget::networkName()
{
return m_pNetwork->name();
@@ -56,6 +60,7 @@ void KviIrcConnectionTarget::setNetworkName(const QString &szNetName)
{
m_pNetwork->setName(szNetName);
}
+#endif
void KviIrcConnectionTarget::clearProxy()
diff --git a/src/kvirc/kernel/kvi_ircconnectiontarget.h b/src/kvirc/kernel/kvi_ircconnectiontarget.h
index d67ba5ef3..258d5a5e3 100644
--- a/src/kvirc/kernel/kvi_ircconnectiontarget.h
+++ b/src/kvirc/kernel/kvi_ircconnectiontarget.h
@@ -38,32 +38,63 @@ class KVIRC_API KviIrcConnectionTarget : public KviHeapObject
public:
// pServer is a shallow pointer: this class makes a copy of it internally, must NOT be null
// pProxy may be null if a proxy is not desired. this class makes a copy of it internally
- KviIrcConnectionTarget(const KviNetwork * pNetwork,
- const KviServer * pServer,
- const KviProxy * pProxy = 0,
- const QString &szBindAddress = QString());
+ KviIrcConnectionTarget(
+ const KviNetwork * pNetwork,
+ const KviServer * pServer,
+ const KviProxy * pProxy = 0,
+ const QString &szBindAddress = QString()
+ );
~KviIrcConnectionTarget();
private:
- KviNetwork * m_pNetwork; // owned, never null
- KviServer * m_pServer; // owned, never null
- KviProxy * m_pProxy; // owned, may be null
+ KviNetwork * m_pNetwork; // owned, never null, it's a COPY of the entry in the db
+ KviServer * m_pServer; // owned, never null, it's a COPY of the entry in the db
+ KviProxy * m_pProxy; // owned, may be null, it's a COPY of the entry in the db
QString m_szBindAddress; // forced bind address
+
public:
- KviServer * server(){ return m_pServer; };
- KviNetwork * network(){ return m_pNetwork; };
- KviProxy * proxy(){ return m_pProxy; };
- const QString & bindAddress(){ return m_szBindAddress; };
- bool hasBindAddress(){ return (!m_szBindAddress.isEmpty()); };
+
+ KviServer * server()
+ {
+ return m_pServer;
+ }
+
+ KviNetwork * network()
+ {
+ return m_pNetwork;
+ }
+
+ KviProxy * proxy()
+ {
+ return m_pProxy;
+ }
+
+ const QString & bindAddress()
+ {
+ return m_szBindAddress;
+ }
+
+ bool hasBindAddress()
+ {
+ return (!m_szBindAddress.isEmpty());
+ }
+
+#if 0
const QString & networkName();
+
// this allows to force the network name: it should be used only by KviConsole
// but it's KviServerParser (kvi_sp_numeric.cpp) that first
// gets the new network name... thus we make it public
// to remove one level of indirection.
void setNetworkName(const QString &szNetName);
+#endif
+
protected:
// this is for KviIrcConnectionTargetResolver only
void clearProxy();
- void setBindAddress(const QString &szBindAddress){ m_szBindAddress = szBindAddress; };
+ void setBindAddress(const QString &szBindAddress)
+ {
+ m_szBindAddress = szBindAddress;
+ }
};
#endif //!_KVI_IRCCONNECTIONTARGET_H_
diff --git a/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp b/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp
index 65a9adf86..f49910661 100644
--- a/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp
+++ b/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp
@@ -158,7 +158,7 @@ void KviIrcConnectionTargetResolver::asyncStartResolve()
__tr2qs("Attempting %Q to %Q (%Q) on port %u"),
m_pTarget->server()->useSSL() ? &(__tr2qs("secure connection")) : &(__tr2qs("connection")),
&(m_pTarget->server()->m_szHostname),
- &(m_pTarget->networkName()),
+ &(m_pTarget->network()->name()),
m_pTarget->server()->m_uPort);
if(m_pTarget->proxy())
diff --git a/src/kvirc/kvs/kvi_kvs_treenode_operation.cpp b/src/kvirc/kvs/kvi_kvs_treenode_operation.cpp
index 7e15c46b4..53a409cc0 100644
--- a/src/kvirc/kvs/kvi_kvs_treenode_operation.cpp
+++ b/src/kvirc/kvs/kvi_kvs_treenode_operation.cpp
@@ -779,7 +779,9 @@ void KviKvsTreeNodeOperationSelfSum::dump(const char * prefix)
bool KviKvsTreeNodeOperationSelfSum::execute(KviKvsRunTimeContext * c)
{
KviKvsVariant v;
- if(!m_pRightSide->evaluateReadOnly(c,&v))return false;
+ if(!m_pRightSide->evaluateReadOnly(c,&v))
+ return false;
+
KviKvsNumber rnum;
if(!v.asNumber(rnum))
diff --git a/src/kvirc/sparser/kvi_sp_numeric.cpp b/src/kvirc/sparser/kvi_sp_numeric.cpp
index a45acc65e..b50f4fcc3 100644
--- a/src/kvirc/sparser/kvi_sp_numeric.cpp
+++ b/src/kvirc/sparser/kvi_sp_numeric.cpp
@@ -296,7 +296,10 @@ void KviServerParser::parseNumeric005(KviIrcMessage *msg)
{
p += 8;
QString tmp = p;
- if(!tmp.isEmpty())msg->console()->connection()->target()->setNetworkName(tmp);
+
+ if(!tmp.isEmpty())
+ msg->console()->connection()->serverInfo()->setNetworkName(tmp);
+
if((!_OUTPUT_MUTE) && (!msg->haltOutput()) && KVI_OPTION_BOOL(KviOption_boolShowExtendedServerInfo))
{
msg->console()->output(KVI_OUT_SERVERINFO,__tr2qs("The current network is %Q"),&tmp);
@@ -961,7 +964,7 @@ void KviServerParser::parseLoginNicknameProblem(KviIrcMessage *msg)
KviIdentityProfile * pProfile = 0;
if(bProfilesEnabled)
{
- pProfile = pSet->findNetwork(msg->connection()->networkName());
+ pProfile = pSet->findNetwork(msg->connection()->currentNetworkName());
if(pProfile)
{
szNextNick = pProfile->altNick();
diff --git a/src/kvirc/ui/kvi_channel.cpp b/src/kvirc/ui/kvi_channel.cpp
index 7ca800883..62506fd21 100644
--- a/src/kvirc/ui/kvi_channel.cpp
+++ b/src/kvirc/ui/kvi_channel.cpp
@@ -305,7 +305,7 @@ void KviChannel::getBaseLogFileName(QString & szBuffer)
{
szBuffer = szChan;
szBuffer.append(".");
- szBuffer.append(connection()->networkName());
+ szBuffer.append(connection()->currentNetworkName());
} else {
szBuffer = szChan;
szBuffer.append(".");
@@ -338,7 +338,7 @@ void KviChannel::getConfigGroupName(QString & szBuffer)
// if(connection())
// {
// szBuffer.append("@");
-// szBuffer.append(connection()->networkName());
+// szBuffer.append(connection()->currentNetworkName());
// }
}
diff --git a/src/kvirc/ui/kvi_console.h b/src/kvirc/ui/kvi_console.h
index 1e8a43be4..92407e7e8 100644
--- a/src/kvirc/ui/kvi_console.h
+++ b/src/kvirc/ui/kvi_console.h
@@ -239,7 +239,7 @@ inline bool KviConsole::isNotConnected()
inline QString KviConsole::currentNetworkName()
{
- return (connection() ? connection()->networkName() : QString());
+ return (connection() ? connection()->currentNetworkName() : QString());
}
#endif //_KVI_CONSOLE_H_
diff --git a/src/kvirc/ui/kvi_statusbar.cpp b/src/kvirc/ui/kvi_statusbar.cpp
index 512fda21f..3f53a7883 100644
--- a/src/kvirc/ui/kvi_statusbar.cpp
+++ b/src/kvirc/ui/kvi_statusbar.cpp
@@ -555,7 +555,7 @@ void KviStatusBar::mouseDoubleClickEvent(QMouseEvent *)
szText += __tr2qs("Network");
szText += ": ";
- szText += c->connection()->networkName();
+ szText += c->connection()->currentNetworkName();
szText += "<br>";
szText += __tr2qs("Server");
szText += ": ";
diff --git a/src/kvirc/ui/kvi_windowlist.cpp b/src/kvirc/ui/kvi_windowlist.cpp
index 21b5f86b8..f1163aa27 100644
--- a/src/kvirc/ui/kvi_windowlist.cpp
+++ b/src/kvirc/ui/kvi_windowlist.cpp
@@ -101,7 +101,7 @@ void KviWindowListBase::getTextForConsole(QString &szText,KviConsole * pConsole)
// FIXME: Should never show "Standalone Servers" or "orphan_servers".
// It would also be nice to have a number appended to
// multiple entries with the same server name...but this costs too much.
- szText = pConsole->connection()->networkName();
+ szText = pConsole->connection()->currentNetworkName();
if(szText.isEmpty())
szText = pConsole->connection()->currentServerName();
} else {
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]