aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp2
-rw-r--r--src/kvirc/kernel/kvi_ircconnectionserverinfo.h14
-rw-r--r--src/modules/context/libkvicontext.cpp47
3 files changed, 63 insertions, 0 deletions
diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp b/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp
index 040d309a6..466d80073 100644
--- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp
+++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp
@@ -223,6 +223,8 @@ void KviIrcConnectionServerInfo::setServerVersion(const QString & version)
m_pServInfo = new KviBahamutIrcServerInfo(version);
else if(version.contains("hyperion",Qt::CaseInsensitive))
m_pServInfo = new KviHyperionIrcServerInfo(version);
+ else if(version.contains("ircd-seven",Qt::CaseInsensitive))
+ m_pServInfo = new KviIrcdSevenIrcServerInfo(version);
else
m_pServInfo = new KviBasicIrcServerInfo(version);
}
diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
index 293564940..0e32bfa13 100644
--- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
+++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
@@ -47,6 +47,7 @@ public:
const QString & getChannelModeDescription(QChar mode);
const QString & getUserModeDescription(QChar mode);
virtual char getRegisterModeChar() { return 0; };
+ virtual const char * getSoftware() { return "Ircd"; };
};
class KVIRC_API KviUnrealIrcServerInfo : public KviBasicIrcServerInfo
@@ -55,6 +56,7 @@ public:
KviUnrealIrcServerInfo(const QString & version = KviQString::Empty)
:KviBasicIrcServerInfo(version) {;};
virtual char getRegisterModeChar() { return 'r'; };
+ virtual const char * getSoftware() { return "Unreal"; };
};
class KVIRC_API KviBahamutIrcServerInfo : public KviBasicIrcServerInfo
@@ -63,6 +65,7 @@ public:
KviBahamutIrcServerInfo(const QString & version = KviQString::Empty)
:KviBasicIrcServerInfo(version) {;};
virtual char getRegisterModeChar() { return 'r'; };
+ virtual const char * getSoftware() { return "Bahamut"; };
};
class KVIRC_API KviHyperionIrcServerInfo : public KviBasicIrcServerInfo
@@ -71,6 +74,16 @@ public:
KviHyperionIrcServerInfo(const QString & version = KviQString::Empty)
:KviBasicIrcServerInfo(version) {;};
virtual char getRegisterModeChar() { return 'e'; };
+ virtual const char * getSoftware() { return "Hyperion"; };
+};
+
+class KVIRC_API KviIrcdSevenIrcServerInfo : public KviBasicIrcServerInfo
+{
+public:
+ KviIrcdSevenIrcServerInfo(const QString & version = KviQString::Empty)
+ :KviBasicIrcServerInfo(version) {;};
+ virtual char getRegisterModeChar() { return 0; };
+ virtual const char * getSoftware() { return "Ircd-seven"; };
};
class KVIRC_API KviIrcConnectionServerInfo
@@ -104,6 +117,7 @@ private:
QStringList m_szaEnabledCaps;
public:
char registerModeChar() { return m_pServInfo ? m_pServInfo->getRegisterModeChar() : 0; };
+ const char * software(){ return m_pServInfo ? m_pServInfo->getSoftware() : 0; };
const QString & name(){ return m_szName; };
const QString & supportedUserModes(){ return m_szSupportedUserModes; };
const QString & supportedChannelModes(){ return m_szSupportedChannelModes; };
diff --git a/src/modules/context/libkvicontext.cpp b/src/modules/context/libkvicontext.cpp
index 5be368633..eae3af7d7 100644
--- a/src/modules/context/libkvicontext.cpp
+++ b/src/modules/context/libkvicontext.cpp
@@ -72,6 +72,22 @@
return true; \
}
+#define STANDARD_SERVERINFO_TARGET_PARAMETER(_fncName,_setCall) \
+ static bool _fncName(KviKvsModuleFunctionCall * c) \
+ { \
+ GET_CONNECTION_FROM_STANDARD_PARAMS \
+ if(pConnection) \
+ { \
+ if(pConnection->serverInfo()) \
+ { \
+ _setCall; \
+ return true; \
+ } \
+ } \
+ c->returnValue()->setNothing(); \
+ return true; \
+ }
+
/*
@doc: context.networkName
@type:
@@ -219,6 +235,36 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER(
)
/*
+ @doc: context.serverSoftware
+ @type:
+ function
+ @title:
+ $context.serverSoftware
+ @short:
+ Returns the software running on the irc server, if recognized
+ @syntax:
+ <string> $context.serverSoftware
+ <string> $context.serverSoftware(<irc_context_id:uint>)
+ @description:
+ Returns the software running on the irc server, if it has been
+ recognized at connection time.
+ 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 (that evaluates to false). If the specified IRC context
+ is not currently connected then this function returns nothing (that
+ evaluates to false).
+ @seealso:
+ [fnc]$context.serverPort[/fnc],
+ [fnc]$context.serverHostName[/fnc],
+ [fnc]$context.serverPassword[/fnc]
+*/
+
+STANDARD_SERVERINFO_TARGET_PARAMETER(
+ context_kvs_fnc_serverSoftware,
+ c->returnValue()->setString(pConnection->serverInfo()->software())
+ )
+
+/*
@doc: context.serverPassword
@type:
function
@@ -380,6 +426,7 @@ static bool context_module_init(KviModule * m)
KVSM_REGISTER_FUNCTION(m,"networkName",context_kvs_fnc_networkName);
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);
return true;
}