summaryrefslogtreecommitdiffstats
path: root/src/libcommuni/include/IrcUtil
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2015-09-09 19:00:56 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2015-09-09 19:02:23 +0200
commit8a6d4b06f2291c363f3dea17837ed20893852453 (patch)
treec091375499e35eaa1810586454e0834c06e6c9b2 /src/libcommuni/include/IrcUtil
parentf554a27046f203e56a07baaf214d90834942e3f5 (diff)
downloadmanager-8a6d4b06f2291c363f3dea17837ed20893852453.tar.gz
manager-8a6d4b06f2291c363f3dea17837ed20893852453.zip
Cleanup repo with some directories
Diffstat (limited to 'src/libcommuni/include/IrcUtil')
-rw-r--r--src/libcommuni/include/IrcUtil/IrcCommandParser1
-rw-r--r--src/libcommuni/include/IrcUtil/IrcCompleter1
-rw-r--r--src/libcommuni/include/IrcUtil/IrcLagTimer1
-rw-r--r--src/libcommuni/include/IrcUtil/IrcPalette1
-rw-r--r--src/libcommuni/include/IrcUtil/IrcTextFormat1
-rw-r--r--src/libcommuni/include/IrcUtil/IrcUtil1
-rw-r--r--src/libcommuni/include/IrcUtil/irccommandparser.h112
-rw-r--r--src/libcommuni/include/IrcUtil/irccommandparser_p.h96
-rw-r--r--src/libcommuni/include/IrcUtil/irccompleter.h90
-rw-r--r--src/libcommuni/include/IrcUtil/irclagtimer.h78
-rw-r--r--src/libcommuni/include/IrcUtil/irclagtimer_p.h68
-rw-r--r--src/libcommuni/include/IrcUtil/ircpalette.h133
-rw-r--r--src/libcommuni/include/IrcUtil/irctextformat.h90
-rw-r--r--src/libcommuni/include/IrcUtil/irctoken_p.h81
-rw-r--r--src/libcommuni/include/IrcUtil/ircutil.h46
15 files changed, 800 insertions, 0 deletions
diff --git a/src/libcommuni/include/IrcUtil/IrcCommandParser b/src/libcommuni/include/IrcUtil/IrcCommandParser
new file mode 100644
index 0000000..0cac681
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/IrcCommandParser
@@ -0,0 +1 @@
+#include <irccommandparser.h>
diff --git a/src/libcommuni/include/IrcUtil/IrcCompleter b/src/libcommuni/include/IrcUtil/IrcCompleter
new file mode 100644
index 0000000..7f561f4
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/IrcCompleter
@@ -0,0 +1 @@
+#include <irccompleter.h>
diff --git a/src/libcommuni/include/IrcUtil/IrcLagTimer b/src/libcommuni/include/IrcUtil/IrcLagTimer
new file mode 100644
index 0000000..d290939
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/IrcLagTimer
@@ -0,0 +1 @@
+#include <irclagtimer.h>
diff --git a/src/libcommuni/include/IrcUtil/IrcPalette b/src/libcommuni/include/IrcUtil/IrcPalette
new file mode 100644
index 0000000..b82c1c0
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/IrcPalette
@@ -0,0 +1 @@
+#include <ircpalette.h>
diff --git a/src/libcommuni/include/IrcUtil/IrcTextFormat b/src/libcommuni/include/IrcUtil/IrcTextFormat
new file mode 100644
index 0000000..f78fd81
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/IrcTextFormat
@@ -0,0 +1 @@
+#include <irctextformat.h>
diff --git a/src/libcommuni/include/IrcUtil/IrcUtil b/src/libcommuni/include/IrcUtil/IrcUtil
new file mode 100644
index 0000000..64e9f15
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/IrcUtil
@@ -0,0 +1 @@
+#include <ircutil.h>
diff --git a/src/libcommuni/include/IrcUtil/irccommandparser.h b/src/libcommuni/include/IrcUtil/irccommandparser.h
new file mode 100644
index 0000000..c31a6f2
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/irccommandparser.h
@@ -0,0 +1,112 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCCOMMANDPARSER_H
+#define IRCCOMMANDPARSER_H
+
+#include <IrcGlobal>
+#include <IrcCommand>
+#include <QtCore/qobject.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qstringlist.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcCommandParserPrivate;
+
+class IRC_UTIL_EXPORT IrcCommandParser : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList commands READ commands NOTIFY commandsChanged)
+ Q_PROPERTY(QStringList triggers READ triggers WRITE setTriggers NOTIFY triggersChanged)
+ Q_PROPERTY(QStringList channels READ channels WRITE setChannels NOTIFY channelsChanged)
+ Q_PROPERTY(QString target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(bool tolerant READ isTolerant WRITE setTolerant NOTIFY tolerancyChanged)
+ Q_FLAGS(Details)
+
+public:
+ explicit IrcCommandParser(QObject* parent = 0);
+ virtual ~IrcCommandParser();
+
+ QStringList commands() const;
+
+ enum Detail {
+ Full = 0x0,
+ NoTarget = 0x1,
+ NoPrefix = 0x2,
+ NoEllipsis = 0x4,
+ NoParentheses = 0x8,
+ NoBrackets = 0x10,
+ NoAngles = 0x20,
+ Visual = NoTarget | NoPrefix | NoEllipsis
+ };
+ Q_DECLARE_FLAGS(Details, Detail)
+
+ Q_INVOKABLE QString syntax(const QString& command, Details details = Visual) const;
+
+ Q_INVOKABLE void addCommand(IrcCommand::Type type, const QString& syntax);
+ Q_INVOKABLE void removeCommand(IrcCommand::Type type, const QString& syntax = QString());
+
+ QStringList triggers() const;
+
+ QString target() const;
+ QStringList channels() const;
+
+ bool isTolerant() const;
+ void setTolerant(bool tolerant);
+
+ Q_INVOKABLE IrcCommand* parse(const QString& input) const;
+
+public Q_SLOTS:
+ void clear();
+ void reset();
+
+ void setTriggers(const QStringList& triggers);
+ void setChannels(const QStringList& channels);
+ void setTarget(const QString& target);
+
+Q_SIGNALS:
+ void commandsChanged(const QStringList& commands);
+ void triggersChanged(const QStringList& triggers);
+ void channelsChanged(const QStringList& channels);
+ void targetChanged(const QString& target);
+ void tolerancyChanged(bool tolerant);
+
+private:
+ QScopedPointer<IrcCommandParserPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcCommandParser)
+ Q_DISABLE_COPY(IrcCommandParser)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(IrcCommandParser::Details)
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcCommandParser*))
+
+#endif // IRCCOMMANDPARSER_H
diff --git a/src/libcommuni/include/IrcUtil/irccommandparser_p.h b/src/libcommuni/include/IrcUtil/irccommandparser_p.h
new file mode 100644
index 0000000..d22fd6d
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/irccommandparser_p.h
@@ -0,0 +1,96 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCCOMMANDPARSER_P_H
+#define IRCCOMMANDPARSER_P_H
+
+#include "irccommandparser.h"
+#include "irccommand.h"
+
+#include <QList>
+#include <QString>
+#include <QMultiMap>
+#include <QStringList>
+
+IRC_BEGIN_NAMESPACE
+
+struct IrcParameterInfo
+{
+ IrcParameterInfo() : optional(false), channel(false), current(false), multi(false) { }
+ bool optional;
+ bool channel;
+ bool current;
+ bool multi;
+ QString value;
+ QString syntax;
+};
+
+struct IrcCommandInfo
+{
+ IrcCommandInfo() : type(IrcCommand::Custom), min(0), max(0) { }
+
+ QString fullSyntax()
+ {
+ return command + QLatin1Char(' ') + syntax;
+ }
+
+ IrcCommand::Type type;
+ QString command;
+ QString syntax;
+ int min, max;
+ QList<IrcParameterInfo> params;
+};
+
+class IrcCommandParserPrivate
+{
+public:
+ IrcCommandParserPrivate();
+
+ QList<IrcCommandInfo> find(const QString& command) const;
+ static IrcCommandInfo parseSyntax(IrcCommand::Type type, const QString& syntax);
+ IrcCommand* parseCommand(const IrcCommandInfo& command, const QString& input) const;
+ bool processParameters(const IrcCommandInfo& command, const QString& input, QStringList* params) const;
+ bool processCommand(QString* input, int* removed = 0) const;
+ bool processMessage(QString* input, int* removed = 0) const;
+ bool onChannel() const;
+
+ static IrcCommandParserPrivate* get(IrcCommandParser* parser)
+ {
+ return parser->d_func();
+ }
+
+ bool tolerant;
+ QString target;
+ QStringList triggers;
+ QStringList channels;
+ QMultiMap<QString, IrcCommandInfo> commands;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCCOMMANDPARSER_P_H
diff --git a/src/libcommuni/include/IrcUtil/irccompleter.h b/src/libcommuni/include/IrcUtil/irccompleter.h
new file mode 100644
index 0000000..f4c33ab
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/irccompleter.h
@@ -0,0 +1,90 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCCOMPLETER_H
+#define IRCCOMPLETER_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qmetatype.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcBuffer;
+class IrcCommandParser;
+class IrcCompleterPrivate;
+
+class IRC_UTIL_EXPORT IrcCompleter : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString suffix READ suffix WRITE setSuffix NOTIFY suffixChanged)
+ Q_PROPERTY(IrcBuffer* buffer READ buffer WRITE setBuffer NOTIFY bufferChanged)
+ Q_PROPERTY(IrcCommandParser* parser READ parser WRITE setParser NOTIFY parserChanged)
+ Q_ENUMS(Direction)
+
+public:
+ explicit IrcCompleter(QObject* parent = 0);
+ virtual ~IrcCompleter();
+
+ enum Direction {
+ Forward,
+ Backward
+ };
+
+ QString suffix() const;
+ IrcBuffer* buffer() const;
+ IrcCommandParser* parser() const;
+
+public Q_SLOTS:
+ void setSuffix(const QString& suffix);
+ void setBuffer(IrcBuffer* buffer);
+ void setParser(IrcCommandParser* parser);
+
+ void complete(const QString& text, int cursor, Direction direction = Forward);
+ void reset();
+
+Q_SIGNALS:
+ void suffixChanged(const QString& suffix);
+ void bufferChanged(IrcBuffer* buffer);
+ void parserChanged(IrcCommandParser* parser);
+
+ void completed(const QString& text, int cursor);
+
+private:
+ QScopedPointer<IrcCompleterPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcCompleter)
+ Q_DISABLE_COPY(IrcCompleter)
+};
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcCompleter*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcCompleter::Direction))
+
+#endif // IRCCOMPLETER_H
diff --git a/src/libcommuni/include/IrcUtil/irclagtimer.h b/src/libcommuni/include/IrcUtil/irclagtimer.h
new file mode 100644
index 0000000..29816d8
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/irclagtimer.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCLAGTIMER_H
+#define IRCLAGTIMER_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcConnection;
+class IrcLagTimerPrivate;
+
+class IRC_UTIL_EXPORT IrcLagTimer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qint64 lag READ lag NOTIFY lagChanged)
+ Q_PROPERTY(int interval READ interval WRITE setInterval)
+ Q_PROPERTY(IrcConnection* connection READ connection WRITE setConnection)
+
+public:
+ explicit IrcLagTimer(QObject* parent = 0);
+ virtual ~IrcLagTimer();
+
+ IrcConnection* connection() const;
+ void setConnection(IrcConnection* connection);
+
+ qint64 lag() const;
+
+ int interval() const;
+ void setInterval(int seconds);
+
+Q_SIGNALS:
+ void lagChanged(qint64 lag);
+
+private:
+ QScopedPointer<IrcLagTimerPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcLagTimer)
+ Q_DISABLE_COPY(IrcLagTimer)
+
+ Q_PRIVATE_SLOT(d_func(), void _irc_connected())
+ Q_PRIVATE_SLOT(d_func(), void _irc_pingServer())
+ Q_PRIVATE_SLOT(d_func(), void _irc_disconnected())
+};
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcLagTimer*))
+
+#endif // IRCLAGTIMER_H
diff --git a/src/libcommuni/include/IrcUtil/irclagtimer_p.h b/src/libcommuni/include/IrcUtil/irclagtimer_p.h
new file mode 100644
index 0000000..712f4a9
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/irclagtimer_p.h
@@ -0,0 +1,68 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCLAGTIMER_P_H
+#define IRCLAGTIMER_P_H
+
+#include "irclagtimer.h"
+#include "ircfilter.h"
+#include <QTimer>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcPongMessage;
+
+class IrcLagTimerPrivate : public QObject, public IrcMessageFilter
+{
+ Q_OBJECT
+ Q_INTERFACES(IrcMessageFilter)
+ Q_DECLARE_PUBLIC(IrcLagTimer)
+
+public:
+ IrcLagTimerPrivate();
+
+ bool messageFilter(IrcMessage* msg);
+ bool processPongReply(IrcPongMessage* msg);
+
+ void _irc_connected();
+ void _irc_pingServer();
+ void _irc_disconnected();
+
+ void updateTimer();
+ void updateLag(qint64 value);
+
+ IrcLagTimer* q_ptr;
+ IrcConnection* connection;
+ QTimer timer;
+ int interval;
+ qint64 lag;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCLAGTIMER_P_H
diff --git a/src/libcommuni/include/IrcUtil/ircpalette.h b/src/libcommuni/include/IrcUtil/ircpalette.h
new file mode 100644
index 0000000..735ff17
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/ircpalette.h
@@ -0,0 +1,133 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCPALETTE_H
+#define IRCPALETTE_H
+
+#include <IrcGlobal>
+#include <QtCore/qmap.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcPalettePrivate;
+
+class IRC_UTIL_EXPORT IrcPalette : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString white READ white WRITE setWhite)
+ Q_PROPERTY(QString black READ black WRITE setBlack)
+ Q_PROPERTY(QString blue READ blue WRITE setBlue)
+ Q_PROPERTY(QString green READ green WRITE setGreen)
+ Q_PROPERTY(QString red READ red WRITE setRed)
+ Q_PROPERTY(QString brown READ brown WRITE setBrown)
+ Q_PROPERTY(QString purple READ purple WRITE setPurple)
+ Q_PROPERTY(QString orange READ orange WRITE setOrange)
+ Q_PROPERTY(QString yellow READ yellow WRITE setYellow)
+ Q_PROPERTY(QString lightGreen READ lightGreen WRITE setLightGreen)
+ Q_PROPERTY(QString cyan READ cyan WRITE setCyan)
+ Q_PROPERTY(QString lightCyan READ lightCyan WRITE setLightCyan)
+ Q_PROPERTY(QString lightBlue READ lightBlue WRITE setLightBlue)
+ Q_PROPERTY(QString pink READ pink WRITE setPink)
+ Q_PROPERTY(QString gray READ gray WRITE setGray)
+ Q_PROPERTY(QString lightGray READ lightGray WRITE setLightGray)
+
+public:
+ ~IrcPalette();
+
+ QMap<int, QString> colorNames() const;
+ void setColorNames(const QMap<int, QString>& names);
+
+ QString colorName(int color, const QString& fallback = QLatin1String("black")) const;
+ void setColorName(int color, const QString& name);
+
+ QString white() const;
+ void setWhite(const QString& color);
+
+ QString black() const;
+ void setBlack(const QString& color);
+
+ QString blue() const;
+ void setBlue(const QString& color);
+
+ QString green() const;
+ void setGreen(const QString& color);
+
+ QString red() const;
+ void setRed(const QString& color);
+
+ QString brown() const;
+ void setBrown(const QString& color);
+
+ QString purple() const;
+ void setPurple(const QString& color);
+
+ QString orange() const;
+ void setOrange(const QString& color);
+
+ QString yellow() const;
+ void setYellow(const QString& color);
+
+ QString lightGreen() const;
+ void setLightGreen(const QString& color);
+
+ QString cyan() const;
+ void setCyan(const QString& color);
+
+ QString lightCyan() const;
+ void setLightCyan(const QString& color);
+
+ QString lightBlue() const;
+ void setLightBlue(const QString& color);
+
+ QString pink() const;
+ void setPink(const QString& color);
+
+ QString gray() const;
+ void setGray(const QString& color);
+
+ QString lightGray() const;
+ void setLightGray(const QString& color);
+
+private:
+ friend class IrcTextFormat;
+ explicit IrcPalette(QObject* parent);
+
+ QScopedPointer<IrcPalettePrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcPalette)
+ Q_DISABLE_COPY(IrcPalette)
+};
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcPalette*))
+
+#endif // IRCPALETTE_H
diff --git a/src/libcommuni/include/IrcUtil/irctextformat.h b/src/libcommuni/include/IrcUtil/irctextformat.h
new file mode 100644
index 0000000..5056b79
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/irctextformat.h
@@ -0,0 +1,90 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCTEXTFORMAT_H
+#define IRCTEXTFORMAT_H
+
+#include <IrcGlobal>
+#include <QtCore/qurl.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcPalette;
+class IrcTextFormatPrivate;
+
+class IRC_UTIL_EXPORT IrcTextFormat : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(IrcPalette* palette READ palette CONSTANT)
+ Q_PROPERTY(QString urlPattern READ urlPattern WRITE setUrlPattern)
+ Q_PROPERTY(QString plainText READ plainText)
+ Q_PROPERTY(QString html READ html)
+ Q_PROPERTY(QList<QUrl> urls READ urls)
+ Q_ENUMS(SpanFormat)
+
+public:
+ explicit IrcTextFormat(QObject* parent = 0);
+ virtual ~IrcTextFormat();
+
+ IrcPalette* palette() const;
+
+ QString urlPattern() const;
+ void setUrlPattern(const QString& pattern);
+
+ enum SpanFormat { SpanStyle, SpanClass };
+
+ SpanFormat spanFormat() const;
+ void setSpanFormat(SpanFormat format);
+
+ Q_INVOKABLE QString toHtml(const QString& text) const;
+ Q_INVOKABLE QString toPlainText(const QString& text) const;
+
+ QString plainText() const;
+ QString html() const;
+ QList<QUrl> urls() const;
+
+public Q_SLOTS:
+ void parse(const QString& text);
+
+private:
+ QScopedPointer<IrcTextFormatPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcTextFormat)
+ Q_DISABLE_COPY(IrcTextFormat)
+};
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcTextFormat*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcTextFormat::SpanFormat))
+
+#endif // IRCTEXTFORMAT_H
diff --git a/src/libcommuni/include/IrcUtil/irctoken_p.h b/src/libcommuni/include/IrcUtil/irctoken_p.h
new file mode 100644
index 0000000..0e1b707
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/irctoken_p.h
@@ -0,0 +1,81 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCTOKEN_P_H
+#define IRCTOKEN_P_H
+
+#include "ircglobal.h"
+#include <QtCore/qlist.h>
+#include <QtCore/qstring.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcToken
+{
+public:
+ IrcToken() : idx(-1), pos(-1) { }
+ IrcToken(int index, int position, const QString& text)
+ : idx(index), pos(position), str(text) { }
+
+ bool isValid() const { return idx != -1; }
+ int index() const { return idx; }
+ int position() const { return pos; }
+ int length() const { return str.length(); }
+ QString text() const { return str; }
+
+private:
+ int idx;
+ int pos;
+ QString str;
+ friend class IrcTokenizer;
+};
+
+class IrcTokenizer
+{
+public:
+ IrcTokenizer(const QString& str = QString());
+
+ int count() const;
+ bool isEmpty() const;
+ QList<IrcToken> tokens() const;
+ IrcToken at(int index) const;
+ IrcTokenizer mid(int index) const;
+
+ void clear();
+ void replace(int index, const QString& text);
+ IrcToken find(int pos) const;
+ QString toString() const;
+
+private:
+ int len;
+ QList<IrcToken> t;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCTOKEN_P_H
diff --git a/src/libcommuni/include/IrcUtil/ircutil.h b/src/libcommuni/include/IrcUtil/ircutil.h
new file mode 100644
index 0000000..6e39f18
--- /dev/null
+++ b/src/libcommuni/include/IrcUtil/ircutil.h
@@ -0,0 +1,46 @@
+/*
+ Copyright (C) 2008-2014 The Communi Project
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef IRCUTIL_H
+#define IRCUTIL_H
+
+#include "irccommandparser.h"
+#include "irccompleter.h"
+#include "irclagtimer.h"
+#include "ircpalette.h"
+#include "irctextformat.h"
+
+IRC_BEGIN_NAMESPACE
+
+namespace IrcUtil {
+ void registerMetaTypes();
+}
+
+IRC_END_NAMESPACE
+
+#endif // IRCUTIL_H