summaryrefslogtreecommitdiffstats
path: root/src/libcommuni/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcommuni/include')
-rw-r--r--src/libcommuni/include/IrcCore/Irc1
-rw-r--r--src/libcommuni/include/IrcCore/IrcCommand1
-rw-r--r--src/libcommuni/include/IrcCore/IrcCommandFilter1
-rw-r--r--src/libcommuni/include/IrcCore/IrcConnection1
-rw-r--r--src/libcommuni/include/IrcCore/IrcCore1
-rw-r--r--src/libcommuni/include/IrcCore/IrcFilter1
-rw-r--r--src/libcommuni/include/IrcCore/IrcGlobal1
-rw-r--r--src/libcommuni/include/IrcCore/IrcMessage1
-rw-r--r--src/libcommuni/include/IrcCore/IrcMessageFilter1
-rw-r--r--src/libcommuni/include/IrcCore/IrcNetwork1
-rw-r--r--src/libcommuni/include/IrcCore/IrcProtocol1
-rw-r--r--src/libcommuni/include/IrcCore/irc.h557
-rw-r--r--src/libcommuni/include/IrcCore/irccommand.h158
-rw-r--r--src/libcommuni/include/IrcCore/irccommandfilter.h1
-rw-r--r--src/libcommuni/include/IrcCore/ircconnection.h240
-rw-r--r--src/libcommuni/include/IrcCore/ircconnection_p.h105
-rw-r--r--src/libcommuni/include/IrcCore/irccore.h49
-rw-r--r--src/libcommuni/include/IrcCore/ircfilter.h65
-rw-r--r--src/libcommuni/include/IrcCore/ircglobal.h117
-rw-r--r--src/libcommuni/include/IrcCore/ircmessage.h519
-rw-r--r--src/libcommuni/include/IrcCore/ircmessage_p.h124
-rw-r--r--src/libcommuni/include/IrcCore/ircmessagebuilder_p.h63
-rw-r--r--src/libcommuni/include/IrcCore/ircmessagedecoder_p.h58
-rw-r--r--src/libcommuni/include/IrcCore/ircmessagefilter.h1
-rw-r--r--src/libcommuni/include/IrcCore/ircnetwork.h147
-rw-r--r--src/libcommuni/include/IrcCore/ircnetwork_p.h78
-rw-r--r--src/libcommuni/include/IrcCore/ircprotocol.h85
-rw-r--r--src/libcommuni/include/IrcModel/IrcBuffer1
-rw-r--r--src/libcommuni/include/IrcModel/IrcBufferModel1
-rw-r--r--src/libcommuni/include/IrcModel/IrcChannel1
-rw-r--r--src/libcommuni/include/IrcModel/IrcModel1
-rw-r--r--src/libcommuni/include/IrcModel/IrcUser1
-rw-r--r--src/libcommuni/include/IrcModel/IrcUserModel1
-rw-r--r--src/libcommuni/include/IrcModel/ircbuffer.h126
-rw-r--r--src/libcommuni/include/IrcModel/ircbuffer_p.h90
-rw-r--r--src/libcommuni/include/IrcModel/ircbuffermodel.h158
-rw-r--r--src/libcommuni/include/IrcModel/ircbuffermodel_p.h89
-rw-r--r--src/libcommuni/include/IrcModel/ircchannel.h81
-rw-r--r--src/libcommuni/include/IrcModel/ircchannel_p.h99
-rw-r--r--src/libcommuni/include/IrcModel/ircmodel.h46
-rw-r--r--src/libcommuni/include/IrcModel/ircuser.h89
-rw-r--r--src/libcommuni/include/IrcModel/ircuser_p.h63
-rw-r--r--src/libcommuni/include/IrcModel/ircusermodel.h119
-rw-r--r--src/libcommuni/include/IrcModel/ircusermodel_p.h69
-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
59 files changed, 4213 insertions, 0 deletions
diff --git a/src/libcommuni/include/IrcCore/Irc b/src/libcommuni/include/IrcCore/Irc
new file mode 100644
index 0000000..c7f8af4
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/Irc
@@ -0,0 +1 @@
+#include <irc.h>
diff --git a/src/libcommuni/include/IrcCore/IrcCommand b/src/libcommuni/include/IrcCore/IrcCommand
new file mode 100644
index 0000000..a9b4889
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcCommand
@@ -0,0 +1 @@
+#include <irccommand.h>
diff --git a/src/libcommuni/include/IrcCore/IrcCommandFilter b/src/libcommuni/include/IrcCore/IrcCommandFilter
new file mode 100644
index 0000000..1edae38
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcCommandFilter
@@ -0,0 +1 @@
+#include <ircfilter.h>
diff --git a/src/libcommuni/include/IrcCore/IrcConnection b/src/libcommuni/include/IrcCore/IrcConnection
new file mode 100644
index 0000000..75c878e
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcConnection
@@ -0,0 +1 @@
+#include <ircconnection.h>
diff --git a/src/libcommuni/include/IrcCore/IrcCore b/src/libcommuni/include/IrcCore/IrcCore
new file mode 100644
index 0000000..918016d
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcCore
@@ -0,0 +1 @@
+#include <irccore.h>
diff --git a/src/libcommuni/include/IrcCore/IrcFilter b/src/libcommuni/include/IrcCore/IrcFilter
new file mode 100644
index 0000000..1edae38
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcFilter
@@ -0,0 +1 @@
+#include <ircfilter.h>
diff --git a/src/libcommuni/include/IrcCore/IrcGlobal b/src/libcommuni/include/IrcCore/IrcGlobal
new file mode 100644
index 0000000..af36086
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcGlobal
@@ -0,0 +1 @@
+#include <ircglobal.h>
diff --git a/src/libcommuni/include/IrcCore/IrcMessage b/src/libcommuni/include/IrcCore/IrcMessage
new file mode 100644
index 0000000..4c767f6
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcMessage
@@ -0,0 +1 @@
+#include <ircmessage.h>
diff --git a/src/libcommuni/include/IrcCore/IrcMessageFilter b/src/libcommuni/include/IrcCore/IrcMessageFilter
new file mode 100644
index 0000000..1edae38
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcMessageFilter
@@ -0,0 +1 @@
+#include <ircfilter.h>
diff --git a/src/libcommuni/include/IrcCore/IrcNetwork b/src/libcommuni/include/IrcCore/IrcNetwork
new file mode 100644
index 0000000..c298490
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcNetwork
@@ -0,0 +1 @@
+#include <ircnetwork.h>
diff --git a/src/libcommuni/include/IrcCore/IrcProtocol b/src/libcommuni/include/IrcCore/IrcProtocol
new file mode 100644
index 0000000..5ec3d80
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/IrcProtocol
@@ -0,0 +1 @@
+#include <ircprotocol.h>
diff --git a/src/libcommuni/include/IrcCore/irc.h b/src/libcommuni/include/IrcCore/irc.h
new file mode 100644
index 0000000..911528a
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/irc.h
@@ -0,0 +1,557 @@
+/*
+ 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 IRC_H
+#define IRC_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qmetatype.h>
+
+IRC_BEGIN_NAMESPACE
+
+#ifdef IRC_DOXYGEN
+namespace Irc
+{
+ Q_INVOKABLE QString version();
+ Q_INVOKABLE QString codeToString(int code);
+ Q_INVOKABLE QString nickFromPrefix(const QString& prefix);
+ Q_INVOKABLE QString identFromPrefix(const QString& prefix);
+ Q_INVOKABLE QString hostFromPrefix(const QString& prefix);
+ Q_INVOKABLE void registerMetaTypes();
+#else
+class IRC_CORE_EXPORT Irc : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(Color DataRole SortMethod Code)
+
+public:
+ Q_INVOKABLE static QString version();
+ Q_INVOKABLE static QString codeToString(int code);
+ Q_INVOKABLE static QString nickFromPrefix(const QString& prefix);
+ Q_INVOKABLE static QString identFromPrefix(const QString& prefix);
+ Q_INVOKABLE static QString hostFromPrefix(const QString& prefix);
+ Q_INVOKABLE static void registerMetaTypes();
+#endif
+
+ enum Color {
+ White = 0,
+ Black = 1,
+ Blue = 2,
+ Green = 3,
+ Red = 4,
+ Brown = 5,
+ Purple = 6,
+ Orange = 7,
+ Yellow = 8,
+ LightGreen = 9,
+ Cyan = 10,
+ LightCyan = 11,
+ LightBlue = 12,
+ Pink = 13,
+ Gray = 14,
+ LightGray = 15
+ };
+
+ enum DataRole {
+ UserRole = Qt::UserRole,
+ BufferRole,
+ ChannelRole,
+ NameRole,
+ PrefixRole,
+ ModeRole,
+ TitleRole
+ };
+
+ enum SortMethod {
+ SortByHand,
+ SortByName,
+ SortByTitle,
+ SortByActivity
+ };
+
+ enum Code {
+ RPL_WELCOME = 1,
+ RPL_YOURHOST = 2,
+ RPL_CREATED = 3,
+ RPL_MYINFO = 4,
+ RPL_ISUPPORT = 5,
+ RPL_SNOMASK = 8,
+ RPL_STATMEMTOT = 9,
+ RPL_BOUNCE = 10,
+ RPL_STATMEM = 10,
+ RPL_YOURCOOKIE = 14,
+ RPL_YOURID = 42,
+ RPL_SAVENICK = 43,
+ RPL_ATTEMPTINGJUNC = 50,
+ RPL_ATTEMPTINGREROUTE = 51,
+ RPL_TRACELINK = 200,
+ RPL_TRACECONNECTING = 201,
+ RPL_TRACEHANDSHAKE = 202,
+ RPL_TRACEUNKNOWN = 203,
+ RPL_TRACEOPERATOR = 204,
+ RPL_TRACEUSER = 205,
+ RPL_TRACESERVER = 206,
+ RPL_TRACESERVICE = 207,
+ RPL_TRACENEWTYPE = 208,
+ RPL_TRACECLASS = 209,
+ RPL_TRACERECONNECT = 210,
+ RPL_STATS = 210,
+ RPL_STATSLINKINFO = 211,
+ RPL_STATSCOMMANDS = 212,
+ RPL_STATSCLINE = 213,
+ RPL_STATSNLINE = 214,
+ RPL_STATSILINE = 215,
+ RPL_STATSKLINE = 216,
+ RPL_STATSQLINE = 217,
+ RPL_STATSYLINE = 218,
+ RPL_ENDOFSTATS = 219,
+ RPL_UMODEIS = 221,
+ RPL_MODLIST = 222,
+ RPL_SQLINE_NICK = 222,
+ RPL_STATSZLINE = 225,
+ RPL_STATSCOUNT = 226,
+ RPL_SERVICEINFO = 231,
+ RPL_ENDOFSERVICES = 232,
+ RPL_SERVICE = 233,
+ RPL_SERVLIST = 234,
+ RPL_SERVLISTEND = 235,
+ RPL_STATSVERBOSE = 236,
+ RPL_STATSENGINE = 237,
+ RPL_STATSIAUTH = 239,
+ RPL_STATSVLINE = 240,
+ RPL_STATSLLINE = 241,
+ RPL_STATSUPTIME = 242,
+ RPL_STATSOLINE = 243,
+ RPL_STATSHLINE = 244,
+ RPL_STATSSLINE = 245,
+ RPL_STATSPING = 246,
+ RPL_STATSBLINE = 247,
+ RPL_STATSDEFINE = 248,
+ RPL_STATSDEBUG = 249,
+ RPL_STATSDLINE = 250,
+ RPL_STATSCONN = 250,
+ RPL_LUSERCLIENT = 251,
+ RPL_LUSEROP = 252,
+ RPL_LUSERUNKNOWN = 253,
+ RPL_LUSERCHANNELS = 254,
+ RPL_LUSERME = 255,
+ RPL_ADMINME = 256,
+ RPL_ADMINLOC1 = 257,
+ RPL_ADMINLOC2 = 258,
+ RPL_ADMINEMAIL = 259,
+ RPL_TRACELOG = 261,
+ RPL_TRACEPING = 262,
+ RPL_TRACEEND = 262,
+ RPL_TRYAGAIN = 263,
+ RPL_LOCALUSERS = 265,
+ RPL_GLOBALUSERS = 266,
+ RPL_START_NETSTAT = 267,
+ RPL_NETSTAT = 268,
+ RPL_END_NETSTAT = 269,
+ RPL_PRIVS = 270,
+ RPL_SILELIST = 271,
+ RPL_ENDOFSILELIST = 272,
+ RPL_NOTIFY = 273,
+ RPL_ENDNOTIFY = 274,
+ RPL_STATSDELTA = 274,
+ RPL_VCHANEXIST = 276,
+ RPL_VCHANLIST = 277,
+ RPL_VCHANHELP = 278,
+ RPL_GLIST = 280,
+ RPL_ENDOFGLIST = 281,
+ RPL_ACCEPTLIST = 281,
+ RPL_ENDOFACCEPT = 282,
+ RPL_JUPELIST = 282,
+ RPL_ENDOFJUPELIST = 283,
+ RPL_FEATURE = 284,
+ RPL_GLIST_HASH = 285,
+ RPL_CHANINFO_HANDLE = 285,
+ RPL_NEWHOSTIS = 285,
+ RPL_CHANINFO_USERS = 286,
+ RPL_CHKHEAD = 286,
+ RPL_CHANINFO_CHOPS = 287,
+ RPL_CHANUSER = 287,
+ RPL_CHANINFO_VOICES = 288,
+ RPL_PATCHHEAD = 288,
+ RPL_CHANINFO_AWAY = 289,
+ RPL_PATCHCON = 289,
+ RPL_CHANINFO_OPERS = 290,
+ RPL_HELPHDR = 290,
+ RPL_DATASTR = 290,
+ RPL_CHANINFO_BANNED = 291,
+ RPL_HELPOP = 291,
+ RPL_ENDOFCHECK = 291,
+ RPL_CHANINFO_BANS = 292,
+ RPL_HELPTLR = 292,
+ RPL_CHANINFO_INVITE = 293,
+ RPL_HELPHLP = 293,
+ RPL_CHANINFO_INVITES = 294,
+ RPL_HELPFWD = 294,
+ RPL_CHANINFO_KICK = 295,
+ RPL_HELPIGN = 295,
+ RPL_CHANINFO_KICKS = 296,
+ RPL_END_CHANINFO = 299,
+ RPL_NONE = 300,
+ RPL_AWAY = 301,
+ RPL_USERHOST = 302,
+ RPL_ISON = 303,
+ RPL_TEXT = 304,
+ RPL_UNAWAY = 305,
+ RPL_NOWAWAY = 306,
+ RPL_WHOISREGNICK = 307,
+ RPL_SUSERHOST = 307,
+ RPL_NOTIFYACTION = 308,
+ RPL_WHOISADMIN = 308,
+ RPL_NICKTRACE = 309,
+ RPL_WHOISSADMIN = 309,
+ RPL_WHOISHELPER = 309,
+ RPL_WHOISSVCMSG = 310,
+ RPL_WHOISHELPOP = 310,
+ RPL_WHOISSERVICE = 310,
+ RPL_WHOISUSER = 311,
+ RPL_WHOISSERVER = 312,
+ RPL_WHOISOPERATOR = 313,
+ RPL_WHOWASUSER = 314,
+ RPL_ENDOFWHO = 315,
+ RPL_WHOISCHANOP = 316,
+ RPL_WHOISIDLE = 317,
+ RPL_ENDOFWHOIS = 318,
+ RPL_WHOISCHANNELS = 319,
+ RPL_WHOISVIRT = 320,
+ RPL_WHOIS_HIDDEN = 320,
+ RPL_WHOISSPECIAL = 320,
+ RPL_LISTSTART = 321,
+ RPL_LIST = 322,
+ RPL_LISTEND = 323,
+ RPL_CHANNELMODEIS = 324,
+ RPL_UNIQOPIS = 325,
+ RPL_CHANNELPASSIS = 325,
+ RPL_NOCHANPASS = 326,
+ RPL_CHPASSUNKNOWN = 327,
+ RPL_CHANNEL_URL = 328,
+ RPL_CREATIONTIME = 329,
+ RPL_WHOWAS_TIME = 330,
+ RPL_WHOISACCOUNT = 330,
+ RPL_NOTOPIC = 331,
+ RPL_TOPIC = 332,
+ RPL_TOPICWHOTIME = 333,
+ RPL_LISTUSAGE = 334,
+ RPL_COMMANDSYNTAX = 334,
+ RPL_LISTSYNTAX = 334,
+ RPL_CHANPASSOK = 338,
+ RPL_WHOISACTUALLY = 338,
+ RPL_BADCHANPASS = 339,
+ RPL_INVITING = 341,
+ RPL_SUMMONING = 342,
+ RPL_INVITED = 345,
+ RPL_INVITELIST = 346,
+ RPL_ENDOFINVITELIST = 347,
+ RPL_EXCEPTLIST = 348,
+ RPL_ENDOFEXCEPTLIST = 349,
+ RPL_VERSION = 351,
+ RPL_WHOREPLY = 352,
+ RPL_NAMREPLY = 353,
+ RPL_WHOSPCRPL = 354,
+ RPL_NAMREPLY_ = 355,
+ RPL_KILLDONE = 361,
+ RPL_CLOSING = 362,
+ RPL_CLOSEEND = 363,
+ RPL_LINKS = 364,
+ RPL_ENDOFLINKS = 365,
+ RPL_ENDOFNAMES = 366,
+ RPL_BANLIST = 367,
+ RPL_ENDOFBANLIST = 368,
+ RPL_ENDOFWHOWAS = 369,
+ RPL_INFO = 371,
+ RPL_MOTD = 372,
+ RPL_INFOSTART = 373,
+ RPL_ENDOFINFO = 374,
+ RPL_MOTDSTART = 375,
+ RPL_ENDOFMOTD = 376,
+ RPL_KICKEXPIRED = 377,
+ RPL_SPAM = 377,
+ RPL_BANEXPIRED = 378,
+ RPL_WHOISHOST = 378,
+ RPL_KICKLINKED = 379,
+ RPL_WHOISMODES = 379,
+ RPL_BANLINKED = 380,
+ RPL_YOURHELPER = 380,
+ RPL_YOUREOPER = 381,
+ RPL_REHASHING = 382,
+ RPL_YOURESERVICE = 383,
+ RPL_MYPORTIS = 384,
+ RPL_NOTOPERANYMORE = 385,
+ RPL_QLIST = 386,
+ RPL_IRCOPS = 386,
+ RPL_ENDOFQLIST = 387,
+ RPL_ENDOFIRCOPS = 387,
+ RPL_ALIST = 388,
+ RPL_ENDOFALIST = 389,
+ RPL_TIME = 391,
+ RPL_USERSSTART = 392,
+ RPL_USERS = 393,
+ RPL_ENDOFUSERS = 394,
+ RPL_NOUSERS = 395,
+ RPL_HOSTHIDDEN = 396,
+ ERR_UNKNOWNERROR = 400,
+ ERR_NOSUCHNICK = 401,
+ ERR_NOSUCHSERVER = 402,
+ ERR_NOSUCHCHANNEL = 403,
+ ERR_CANNOTSENDTOCHAN = 404,
+ ERR_TOOMANYCHANNELS = 405,
+ ERR_WASNOSUCHNICK = 406,
+ ERR_TOOMANYTARGETS = 407,
+ ERR_NOSUCHSERVICE = 408,
+ ERR_NOCOLORSONCHAN = 408,
+ ERR_NOORIGIN = 409,
+ ERR_NORECIPIENT = 411,
+ ERR_NOTEXTTOSEND = 412,
+ ERR_NOTOPLEVEL = 413,
+ ERR_WILDTOPLEVEL = 414,
+ ERR_BADMASK = 415,
+ ERR_TOOMANYMATCHES = 416,
+ ERR_QUERYTOOLONG = 416,
+ ERR_LENGTHTRUNCATED = 419,
+ ERR_UNKNOWNCOMMAND = 421,
+ ERR_NOMOTD = 422,
+ ERR_NOADMININFO = 423,
+ ERR_FILEERROR = 424,
+ ERR_NOOPERMOTD = 425,
+ ERR_TOOMANYAWAY = 429,
+ ERR_EVENTNICKCHANGE = 430,
+ ERR_NONICKNAMEGIVEN = 431,
+ ERR_ERRONEUSNICKNAME = 432,
+ ERR_NICKNAMEINUSE = 433,
+ ERR_SERVICENAMEINUSE = 434,
+ ERR_NORULES = 434,
+ ERR_SERVICECONFUSED = 435,
+ ERR_BANONCHAN = 435,
+ ERR_NICKCOLLISION = 436,
+ ERR_UNAVAILRESOURCE = 437,
+ ERR_BANNICKCHANGE = 437,
+ ERR_NICKTOOFAST = 438,
+ ERR_DEAD = 438,
+ ERR_TARGETTOOFAST = 439,
+ ERR_SERVICESDOWN = 440,
+ ERR_USERNOTINCHANNEL = 441,
+ ERR_NOTONCHANNEL = 442,
+ ERR_USERONCHANNEL = 443,
+ ERR_NOLOGIN = 444,
+ ERR_SUMMONDISABLED = 445,
+ ERR_USERSDISABLED = 446,
+ ERR_NONICKCHANGE = 447,
+ ERR_NOTIMPLEMENTED = 449,
+ ERR_NOTREGISTERED = 451,
+ ERR_IDCOLLISION = 452,
+ ERR_NICKLOST = 453,
+ ERR_HOSTILENAME = 455,
+ ERR_ACCEPTFULL = 456,
+ ERR_ACCEPTEXIST = 457,
+ ERR_ACCEPTNOT = 458,
+ ERR_NOHIDING = 459,
+ ERR_NOTFORHALFOPS = 460,
+ ERR_NEEDMOREPARAMS = 461,
+ ERR_ALREADYREGISTERED = 462,
+ ERR_NOPERMFORHOST = 463,
+ ERR_PASSWDMISMATCH = 464,
+ ERR_YOUREBANNEDCREEP = 465,
+ ERR_YOUWILLBEBANNED = 466,
+ ERR_KEYSET = 467,
+ ERR_INVALIDUSERNAME = 468,
+ ERR_ONLYSERVERSCANCHANGE = 468,
+ ERR_LINKSET = 469,
+ ERR_LINKCHANNEL = 470,
+ ERR_KICKEDFROMCHAN = 470,
+ ERR_CHANNELISFULL = 471,
+ ERR_UNKNOWNMODE = 472,
+ ERR_INVITEONLYCHAN = 473,
+ ERR_BANNEDFROMCHAN = 474,
+ ERR_BADCHANNELKEY = 475,
+ ERR_BADCHANMASK = 476,
+ ERR_NOCHANMODES = 477,
+ ERR_NEEDREGGEDNICK = 477,
+ ERR_BANLISTFULL = 478,
+ ERR_BADCHANNAME = 479,
+ ERR_LINKFAIL = 479,
+ ERR_NOULINE = 480,
+ ERR_CANNOTKNOCK = 480,
+ ERR_NOPRIVILEGES = 481,
+ ERR_CHANOPRIVSNEEDED = 482,
+ ERR_CANTKILLSERVER = 483,
+ ERR_RESTRICTED = 484,
+ ERR_ISCHANSERVICE = 484,
+ ERR_DESYNC = 484,
+ ERR_ATTACKDENY = 484,
+ ERR_UNIQOPRIVSNEEDED = 485,
+ ERR_KILLDENY = 485,
+ ERR_CANTKICKADMIN = 485,
+ ERR_ISREALSERVICE = 485,
+ ERR_NONONREG = 486,
+ ERR_HTMDISABLED = 486,
+ ERR_ACCOUNTONLY = 486,
+ ERR_CHANTOORECENT = 487,
+ ERR_MSGSERVICES = 487,
+ ERR_TSLESSCHAN = 488,
+ ERR_VOICENEEDED = 489,
+ ERR_SECUREONLYCHAN = 489,
+ ERR_NOOPERHOST = 491,
+ ERR_NOSERVICEHOST = 492,
+ ERR_NOFEATURE = 493,
+ ERR_BADFEATURE = 494,
+ ERR_BADLOGTYPE = 495,
+ ERR_BADLOGSYS = 496,
+ ERR_BADLOGVALUE = 497,
+ ERR_ISOPERLCHAN = 498,
+ ERR_CHANOWNPRIVNEEDED = 499,
+ ERR_UMODEUNKNOWNFLAG = 501,
+ ERR_USERSDONTMATCH = 502,
+ ERR_GHOSTEDCLIENT = 503,
+ ERR_VWORLDWARN = 503,
+ ERR_USERNOTONSERV = 504,
+ ERR_SILELISTFULL = 511,
+ ERR_TOOMANYWATCH = 512,
+ ERR_BADPING = 513,
+ ERR_INVALID_ERROR = 514,
+ ERR_TOOMANYDCC = 514,
+ ERR_BADEXPIRE = 515,
+ ERR_DONTCHEAT = 516,
+ ERR_DISABLED = 517,
+ ERR_NOINVITE = 518,
+ ERR_LONGMASK = 518,
+ ERR_ADMONLY = 519,
+ ERR_TOOMANYUSERS = 519,
+ ERR_OPERONLY = 520,
+ ERR_MASKTOOWIDE = 520,
+ ERR_WHOTRUNC = 520,
+ ERR_LISTSYNTAX = 521,
+ ERR_WHOSYNTAX = 522,
+ ERR_WHOLIMEXCEED = 523,
+ ERR_QUARANTINED = 524,
+ ERR_OPERSPVERIFY = 524,
+ ERR_REMOTEPFX = 525,
+ ERR_PFXUNROUTABLE = 526,
+ ERR_BADHOSTMASK = 550,
+ ERR_HOSTUNAVAIL = 551,
+ ERR_USINGSLINE = 552,
+ ERR_STATSSLINE = 553,
+ RPL_LOGON = 600,
+ RPL_LOGOFF = 601,
+ RPL_WATCHOFF = 602,
+ RPL_WATCHSTAT = 603,
+ RPL_NOWON = 604,
+ RPL_NOWOFF = 605,
+ RPL_WATCHLIST = 606,
+ RPL_ENDOFWATCHLIST = 607,
+ RPL_WATCHCLEAR = 608,
+ RPL_ISOPER = 610,
+ RPL_ISLOCOP = 611,
+ RPL_ISNOTOPER = 612,
+ RPL_ENDOFISOPER = 613,
+ RPL_DCCSTATUS = 617,
+ RPL_DCCLIST = 618,
+ RPL_ENDOFDCCLIST = 619,
+ RPL_WHOWASHOST = 619,
+ RPL_DCCINFO = 620,
+ RPL_ENDOFO = 626,
+ RPL_SETTINGS = 630,
+ RPL_ENDOFSETTINGS = 631,
+ RPL_DUMPING = 640,
+ RPL_DUMPRPL = 641,
+ RPL_EODUMP = 642,
+ RPL_TRACEROUTE_HOP = 660,
+ RPL_TRACEROUTE_START = 661,
+ RPL_MODECHANGEWARN = 662,
+ RPL_CHANREDIR = 663,
+ RPL_SERVMODEIS = 664,
+ RPL_OTHERUMODEIS = 665,
+ RPL_ENDOF_GENERIC = 666,
+ RPL_WHOWASDETAILS = 670,
+ RPL_WHOISSECURE = 671,
+ RPL_UNKNOWNMODES = 672,
+ RPL_CANNOTSETMODES = 673,
+ RPL_LUSERSTAFF = 678,
+ RPL_TIMEONSERVERIS = 679,
+ RPL_NETWORKS = 682,
+ RPL_YOURLANGUAGEIS = 687,
+ RPL_LANGUAGE = 688,
+ RPL_WHOISSTAFF = 689,
+ RPL_WHOISLANGUAGE = 690,
+ RPL_HELPSTART = 704,
+ RPL_HELPTXT = 705,
+ RPL_ENDOFHELP = 706,
+ RPL_ETRACEFULL = 708,
+ RPL_ETRACE = 709,
+ RPL_KNOCK = 710,
+ RPL_KNOCKDLVR = 711,
+ ERR_TOOMANYKNOCK = 712,
+ ERR_CHANOPEN = 713,
+ ERR_KNOCKONCHAN = 714,
+ ERR_KNOCKDISABLED = 715,
+ RPL_TARGUMODEG = 716,
+ RPL_TARGNOTIFY = 717,
+ RPL_UMODEGMSG = 718,
+ RPL_ENDOFOMOTD = 722,
+ ERR_NOPRIVS = 723,
+ RPL_TESTMARK = 724,
+ RPL_TESTLINE = 725,
+ RPL_NOTESTLINE = 726,
+ RPL_XINFO = 771,
+ RPL_XINFOSTART = 773,
+ RPL_XINFOEND = 774,
+ ERR_CANNOTDOCOMMAND = 972,
+ ERR_CANNOTCHANGEUMODE = 973,
+ ERR_CANNOTCHANGECHANMODE = 974,
+ ERR_CANNOTCHANGESERVERMODE = 975,
+ ERR_CANNOTSENDTONICK = 976,
+ ERR_UNKNOWNSERVERMODE = 977,
+ ERR_SERVERMODELOCK = 979,
+ ERR_BADCHARENCODING = 980,
+ ERR_TOOMANYLANGUAGES = 981,
+ ERR_NOLANGUAGE = 982,
+ ERR_TEXTTOOSHORT = 983,
+ ERR_NUMERIC_ERR = 999
+ };
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::Code code);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::DataRole role);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::Color color);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, Irc::SortMethod method);
+#endif // QT_NO_DEBUG_STREAM
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::Code))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::DataRole))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::Color))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(Irc::SortMethod))
+
+#endif // IRC_H
diff --git a/src/libcommuni/include/IrcCore/irccommand.h b/src/libcommuni/include/IrcCore/irccommand.h
new file mode 100644
index 0000000..e532755
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/irccommand.h
@@ -0,0 +1,158 @@
+/*
+ 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 IRCCOMMAND_H
+#define IRCCOMMAND_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qstringlist.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcMessage;
+class IrcConnection;
+class IrcCommandPrivate;
+
+class IRC_CORE_EXPORT IrcCommand : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList parameters READ parameters WRITE setParameters)
+ Q_PROPERTY(QByteArray encoding READ encoding WRITE setEncoding)
+ Q_PROPERTY(Type type READ type WRITE setType)
+ Q_ENUMS(Type)
+
+public:
+ enum Type {
+ Admin,
+ Away,
+ Capability,
+ CtcpAction,
+ CtcpReply,
+ CtcpRequest,
+ Custom,
+ Info,
+ Invite,
+ Join,
+ Kick,
+ Knock,
+ List,
+ Message,
+ Mode,
+ Motd,
+ Names,
+ Nick,
+ Notice,
+ Part,
+ Ping,
+ Pong,
+ Quit,
+ Quote,
+ Stats,
+ Time,
+ Topic,
+ Trace,
+ Users,
+ Version,
+ Who,
+ Whois,
+ Whowas
+ };
+
+ explicit IrcCommand(QObject* parent = 0);
+ virtual ~IrcCommand();
+
+ Type type() const;
+ void setType(Type type);
+
+ QStringList parameters() const;
+ void setParameters(const QStringList& parameters);
+
+ QByteArray encoding() const;
+ void setEncoding(const QByteArray& encoding);
+
+ virtual QString toString() const;
+
+ Q_INVOKABLE IrcMessage* toMessage(const QString& prefix, IrcConnection* connection) const;
+
+ Q_INVOKABLE static IrcCommand* createAdmin(const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createAway(const QString& reason = QString());
+ Q_INVOKABLE static IrcCommand* createCapability(const QString& subCommand, const QString& capability);
+ Q_INVOKABLE static IrcCommand* createCapability(const QString& subCommand, const QStringList& capabilities = QStringList());
+ Q_INVOKABLE static IrcCommand* createCtcpAction(const QString& target, const QString& action);
+ Q_INVOKABLE static IrcCommand* createCtcpReply(const QString& target, const QString& reply);
+ Q_INVOKABLE static IrcCommand* createCtcpRequest(const QString& target, const QString& request);
+ Q_INVOKABLE static IrcCommand* createInfo(const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createInvite(const QString& user, const QString& channel);
+ Q_INVOKABLE static IrcCommand* createJoin(const QString& channel, const QString& key = QString());
+ Q_INVOKABLE static IrcCommand* createJoin(const QStringList& channels, const QStringList& keys = QStringList());
+ Q_INVOKABLE static IrcCommand* createKick(const QString& channel, const QString& user, const QString& reason = QString());
+ Q_INVOKABLE static IrcCommand* createKnock(const QString& channel, const QString& message = QString());
+ Q_INVOKABLE static IrcCommand* createList(const QStringList& channels = QStringList(), const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createMessage(const QString& target, const QString& message);
+ Q_INVOKABLE static IrcCommand* createMode(const QString& target, const QString& mode = QString(), const QString& arg = QString());
+ Q_INVOKABLE static IrcCommand* createMotd(const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createNames(const QString& channel = QString(), const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createNames(const QStringList& channels, const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createNick(const QString& nick);
+ Q_INVOKABLE static IrcCommand* createNotice(const QString& target, const QString& notice);
+ Q_INVOKABLE static IrcCommand* createPart(const QString& channel, const QString& reason = QString());
+ Q_INVOKABLE static IrcCommand* createPart(const QStringList& channels, const QString& reason = QString());
+ Q_INVOKABLE static IrcCommand* createPing(const QString& argument);
+ Q_INVOKABLE static IrcCommand* createPong(const QString& argument);
+ Q_INVOKABLE static IrcCommand* createQuit(const QString& reason = QString());
+ Q_INVOKABLE static IrcCommand* createQuote(const QString& raw);
+ Q_INVOKABLE static IrcCommand* createQuote(const QStringList& parameters);
+ Q_INVOKABLE static IrcCommand* createStats(const QString& query, const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createTime(const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createTopic(const QString& channel, const QString& topic = QString());
+ Q_INVOKABLE static IrcCommand* createTrace(const QString& target = QString());
+ Q_INVOKABLE static IrcCommand* createUsers(const QString& server = QString());
+ Q_INVOKABLE static IrcCommand* createVersion(const QString& user = QString());
+ Q_INVOKABLE static IrcCommand* createWho(const QString& mask, bool operators = false);
+ Q_INVOKABLE static IrcCommand* createWhois(const QString& user);
+ Q_INVOKABLE static IrcCommand* createWhowas(const QString& user, int count = 1);
+
+private:
+ QScopedPointer<IrcCommandPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcCommand)
+ Q_DISABLE_COPY(IrcCommand)
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcCommand::Type type);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, const IrcCommand* command);
+#endif // QT_NO_DEBUG_STREAM
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcCommand*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcCommand::Type))
+
+#endif // IRCCOMMAND_H
diff --git a/src/libcommuni/include/IrcCore/irccommandfilter.h b/src/libcommuni/include/IrcCore/irccommandfilter.h
new file mode 100644
index 0000000..1edae38
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/irccommandfilter.h
@@ -0,0 +1 @@
+#include <ircfilter.h>
diff --git a/src/libcommuni/include/IrcCore/ircconnection.h b/src/libcommuni/include/IrcCore/ircconnection.h
new file mode 100644
index 0000000..5ce26a5
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircconnection.h
@@ -0,0 +1,240 @@
+/*
+ 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 IRCCONNECTION_H
+#define IRCCONNECTION_H
+
+#include <IrcGlobal>
+#include <IrcMessage>
+#include <IrcNetwork>
+#include <QtCore/qobject.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtNetwork/qabstractsocket.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcCommand;
+class IrcProtocol;
+class IrcConnectionPrivate;
+
+class IRC_CORE_EXPORT IrcConnection : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged)
+ Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged)
+ Q_PROPERTY(QString userName READ userName WRITE setUserName NOTIFY userNameChanged)
+ Q_PROPERTY(QString nickName READ nickName WRITE setNickName NOTIFY nickNameChanged)
+ Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged)
+ Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
+ Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged)
+ Q_PROPERTY(QVariantMap userData READ userData WRITE setUserData NOTIFY userDataChanged)
+ Q_PROPERTY(QByteArray encoding READ encoding WRITE setEncoding)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
+ Q_PROPERTY(bool active READ isActive NOTIFY statusChanged)
+ Q_PROPERTY(bool connected READ isConnected NOTIFY statusChanged)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
+ Q_PROPERTY(int reconnectDelay READ reconnectDelay WRITE setReconnectDelay NOTIFY reconnectDelayChanged)
+ Q_PROPERTY(QAbstractSocket* socket READ socket WRITE setSocket)
+ Q_PROPERTY(bool secure READ isSecure WRITE setSecure NOTIFY secureChanged)
+ Q_PROPERTY(bool secureSupported READ isSecureSupported)
+ Q_PROPERTY(QString saslMechanism READ saslMechanism WRITE setSaslMechanism NOTIFY saslMechanismChanged)
+ Q_PROPERTY(QStringList supportedSaslMechanisms READ supportedSaslMechanisms CONSTANT)
+ Q_PROPERTY(IrcNetwork* network READ network CONSTANT)
+ Q_PROPERTY(IrcProtocol* protocol READ protocol WRITE setProtocol)
+ Q_ENUMS(Status)
+
+public:
+ explicit IrcConnection(QObject* parent = 0);
+ explicit IrcConnection(const QString& host, QObject* parent = 0);
+ virtual ~IrcConnection();
+
+ QString host() const;
+ void setHost(const QString& host);
+
+ int port() const;
+ void setPort(int port);
+
+ QString userName() const;
+ void setUserName(const QString& name);
+
+ QString nickName() const;
+ void setNickName(const QString& name);
+
+ QString realName() const;
+ void setRealName(const QString& name);
+
+ QString password() const;
+ void setPassword(const QString& password);
+
+ QString displayName() const;
+ void setDisplayName(const QString& name);
+
+ QVariantMap userData() const;
+ void setUserData(const QVariantMap& data);
+
+ QByteArray encoding() const;
+ void setEncoding(const QByteArray& encoding);
+
+ enum Status {
+ Inactive,
+ Waiting,
+ Connecting,
+ Connected,
+ Closing,
+ Closed,
+ Error
+ };
+ Status status() const;
+ bool isActive() const;
+ bool isConnected() const;
+ bool isEnabled() const;
+
+ int reconnectDelay() const;
+ void setReconnectDelay(int seconds);
+
+ QAbstractSocket* socket() const;
+ void setSocket(QAbstractSocket* socket);
+
+ bool isSecure() const;
+ void setSecure(bool secure);
+ static bool isSecureSupported();
+
+ QString saslMechanism() const;
+ void setSaslMechanism(const QString& mechanism);
+
+ static QStringList supportedSaslMechanisms();
+
+ IrcNetwork* network() const;
+
+ IrcProtocol* protocol() const;
+ void setProtocol(IrcProtocol* protocol);
+
+ void installMessageFilter(QObject* filter);
+ void removeMessageFilter(QObject* filter);
+
+ void installCommandFilter(QObject* filter);
+ void removeCommandFilter(QObject* filter);
+
+ Q_INVOKABLE QByteArray saveState(int version = 0) const;
+ Q_INVOKABLE bool restoreState(const QByteArray& state, int version = 0);
+
+public Q_SLOTS:
+ void open();
+ void close();
+ void quit(const QString& reason = QString());
+ void setEnabled(bool enabled = true);
+ void setDisabled(bool disabled = true);
+
+ bool sendCommand(IrcCommand* command);
+ bool sendData(const QByteArray& data);
+ bool sendRaw(const QString& message);
+
+Q_SIGNALS:
+ void connecting();
+ void connected();
+ void disconnected();
+ void statusChanged(IrcConnection::Status status);
+ void socketError(QAbstractSocket::SocketError error);
+ void socketStateChanged(QAbstractSocket::SocketState state);
+ void secureError();
+
+ void nickNameReserved(QString* alternate); // deprecated
+ void nickNameRequired(const QString& reserved, QString* alternate);
+ void channelKeyRequired(const QString& channel, QString* key);
+
+ void messageReceived(IrcMessage* message);
+
+ void capabilityMessageReceived(IrcCapabilityMessage* message);
+ void errorMessageReceived(IrcErrorMessage* message);
+ void inviteMessageReceived(IrcInviteMessage* message);
+ void joinMessageReceived(IrcJoinMessage* message);
+ void kickMessageReceived(IrcKickMessage* message);
+ void modeMessageReceived(IrcModeMessage* message);
+ void namesMessageReceived(IrcNamesMessage* message);
+ void nickMessageReceived(IrcNickMessage* message);
+ void noticeMessageReceived(IrcNoticeMessage* message);
+ void numericMessageReceived(IrcNumericMessage* message);
+ void motdMessageReceived(IrcMotdMessage* message);
+ void partMessageReceived(IrcPartMessage* message);
+ void pingMessageReceived(IrcPingMessage* message);
+ void pongMessageReceived(IrcPongMessage* message);
+ void privateMessageReceived(IrcPrivateMessage* message);
+ void quitMessageReceived(IrcQuitMessage* message);
+ void topicMessageReceived(IrcTopicMessage* message);
+ void whoReplyMessageReceived(IrcWhoReplyMessage* message);
+
+ void hostChanged(const QString& host);
+ void portChanged(int port);
+ void userNameChanged(const QString& name);
+ void nickNameChanged(const QString& name);
+ void realNameChanged(const QString& name);
+ void passwordChanged(const QString& password);
+ void displayNameChanged(const QString& name);
+ void userDataChanged(const QVariantMap& data);
+
+ void reconnectDelayChanged(int seconds);
+ void enabledChanged(bool enabled);
+ void secureChanged(bool secure);
+ void saslMechanismChanged(const QString& mechanism);
+
+ void destroyed(IrcConnection* connection);
+
+protected Q_SLOTS:
+ virtual IrcCommand* createCtcpReply(IrcPrivateMessage* request) const;
+
+private:
+ friend class IrcProtocol;
+ friend class IrcProtocolPrivate;
+ QScopedPointer<IrcConnectionPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcConnection)
+ Q_DISABLE_COPY(IrcConnection)
+
+ Q_PRIVATE_SLOT(d_func(), void _irc_connected())
+ Q_PRIVATE_SLOT(d_func(), void _irc_disconnected())
+ Q_PRIVATE_SLOT(d_func(), void _irc_error(QAbstractSocket::SocketError))
+ Q_PRIVATE_SLOT(d_func(), void _irc_state(QAbstractSocket::SocketState))
+ Q_PRIVATE_SLOT(d_func(), void _irc_sslErrors())
+ Q_PRIVATE_SLOT(d_func(), void _irc_reconnect())
+ Q_PRIVATE_SLOT(d_func(), void _irc_readData())
+ Q_PRIVATE_SLOT(d_func(), void _irc_filterDestroyed(QObject*))
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcConnection::Status status);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, const IrcConnection* connection);
+#endif // QT_NO_DEBUG_STREAM
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcConnection*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcConnection::Status))
+
+#endif // IRCCONNECTION_H
diff --git a/src/libcommuni/include/IrcCore/ircconnection_p.h b/src/libcommuni/include/IrcCore/ircconnection_p.h
new file mode 100644
index 0000000..f9e91ab
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircconnection_p.h
@@ -0,0 +1,105 @@
+/*
+ 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 IRCCONNECTION_P_H
+#define IRCCONNECTION_P_H
+
+#include "ircconnection.h"
+
+#include <QList>
+#include <QHash>
+#include <QStack>
+#include <QTimer>
+#include <QString>
+#include <QByteArray>
+#include <QAbstractSocket>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcMessageFilter;
+class IrcCommandFilter;
+
+class IrcConnectionPrivate
+{
+ Q_DECLARE_PUBLIC(IrcConnection)
+
+public:
+ IrcConnectionPrivate();
+
+ void init(IrcConnection* connection);
+
+ void _irc_connected();
+ void _irc_disconnected();
+ void _irc_error(QAbstractSocket::SocketError error);
+ void _irc_state(QAbstractSocket::SocketState state);
+ void _irc_sslErrors();
+ void _irc_reconnect();
+ void _irc_readData();
+
+ void _irc_filterDestroyed(QObject* filter);
+
+ void setNick(const QString& nick);
+ void setStatus(IrcConnection::Status status);
+ void setInfo(const QHash<QString, QString>& info);
+
+ void receiveMessage(IrcMessage* msg);
+ IrcCommand* createCtcpReply(IrcPrivateMessage* request);
+
+ static IrcConnectionPrivate* get(const IrcConnection* connection)
+ {
+ return connection->d_ptr.data();
+ }
+
+ IrcConnection* q_ptr;
+ QByteArray encoding;
+ IrcNetwork* network;
+ IrcProtocol* protocol;
+ QAbstractSocket* socket;
+ QString host;
+ int port;
+ QString userName;
+ QString nickName;
+ QString realName;
+ QString password;
+ QString displayName;
+ QVariantMap userData;
+ QTimer reconnecter;
+ QString saslMechanism;
+ bool enabled;
+ IrcConnection::Status status;
+ QList<IrcCommand*> pendingCommands;
+ QList<QObject*> commandFilters;
+ QList<QObject*> messageFilters;
+ QStack<QObject*> activeCommandFilters;
+ bool sslErrors;
+ bool closed;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCCONNECTION_P_H
diff --git a/src/libcommuni/include/IrcCore/irccore.h b/src/libcommuni/include/IrcCore/irccore.h
new file mode 100644
index 0000000..b5ca266
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/irccore.h
@@ -0,0 +1,49 @@
+/*
+ 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 IRCCORE_H
+#define IRCCORE_H
+
+#include "irc.h"
+#include "irccommand.h"
+#include "ircconnection.h"
+#include "ircglobal.h"
+#include "ircmessage.h"
+#include "ircfilter.h"
+#include "ircnetwork.h"
+#include "ircprotocol.h"
+
+IRC_BEGIN_NAMESPACE
+
+namespace IrcCore {
+ void registerMetaTypes();
+}
+
+IRC_END_NAMESPACE
+
+#endif // IRCCORE_H
diff --git a/src/libcommuni/include/IrcCore/ircfilter.h b/src/libcommuni/include/IrcCore/ircfilter.h
new file mode 100644
index 0000000..a2536fc
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircfilter.h
@@ -0,0 +1,65 @@
+/*
+ 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 IRCFILTER_H
+#define IRCFILTER_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcMessage;
+class IrcCommand;
+
+class IRC_CORE_EXPORT IrcMessageFilter
+{
+public:
+ virtual ~IrcMessageFilter() { }
+ virtual bool messageFilter(IrcMessage* message) = 0;
+};
+
+class IRC_CORE_EXPORT IrcCommandFilter
+{
+public:
+ virtual ~IrcCommandFilter() { }
+ virtual bool commandFilter(IrcCommand* command) = 0;
+};
+
+IRC_END_NAMESPACE
+
+// TODO: fixme
+#ifdef IRC_NAMESPACE
+using IRC_NAMESPACE::IrcMessageFilter;
+using IRC_NAMESPACE::IrcCommandFilter;
+#endif
+
+Q_DECLARE_INTERFACE(IrcMessageFilter, "Communi.IrcMessageFilter")
+Q_DECLARE_INTERFACE(IrcCommandFilter, "Communi.IrcCommandFilter")
+
+#endif // IRCFILTER_H
diff --git a/src/libcommuni/include/IrcCore/ircglobal.h b/src/libcommuni/include/IrcCore/ircglobal.h
new file mode 100644
index 0000000..d088dba
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircglobal.h
@@ -0,0 +1,117 @@
+/*
+ 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 IRCGLOBAL_H
+#define IRCGLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+/*!
+ \file ircglobal.h
+ \brief \#include &lt;\ref ircglobal.h "IrcGlobal"&gt;
+ */
+
+#if defined(IRC_SHARED)
+#
+# if defined(BUILD_IRC_CORE)
+# define IRC_CORE_EXPORT Q_DECL_EXPORT
+# else
+# define IRC_CORE_EXPORT Q_DECL_IMPORT
+# endif
+#
+# if defined(BUILD_IRC_MODEL)
+# define IRC_MODEL_EXPORT Q_DECL_EXPORT
+# else
+# define IRC_MODEL_EXPORT Q_DECL_IMPORT
+# endif
+#
+# if defined(BUILD_IRC_UTIL)
+# define IRC_UTIL_EXPORT Q_DECL_EXPORT
+# else
+# define IRC_UTIL_EXPORT Q_DECL_IMPORT
+# endif
+#
+#elif defined(IRC_STATIC) || defined(BUILD_IRC_CORE) || defined(BUILD_IRC_MODEL) || defined(BUILD_IRC_UTIL)
+#
+# define IRC_CORE_EXPORT
+# define IRC_MODEL_EXPORT
+# define IRC_UTIL_EXPORT
+#
+#else
+# error Installation problem: either IRC_SHARED or IRC_STATIC must be defined!
+#endif
+
+/*!
+ \def IRC_VERSION
+
+ This macro expands a numeric value of the form 0xMMNNPP (MM = major, NN = minor, PP = patch) that specifies Communi's version number.
+ For example, if you compile your application against Communi 1.2.3, the IRC_VERSION macro will expand to 0x010203.
+
+ You can use IRC_VERSION to use the latest Communi features where available. For example:
+ \code
+ #if IRC_VERSION >= 0x000300
+ // SSL support since version 0.3.0
+ connection->setSocket(new QSslSocket(connection));
+ #endif
+ \endcode
+
+ \sa Irc::version()
+ */
+#define IRC_VERSION 0x030200
+
+/*!
+ \def IRC_VERSION_STR
+
+ This macro expands to a string that specifies Communi's version number (for example, "1.2.3").
+ This is the version against which the application is compiled.
+
+ \sa Irc::version()
+ */
+#define IRC_VERSION_STR "3.2.0"
+
+#ifdef IRC_NAMESPACE
+
+# define IRC_PREPEND_NAMESPACE(name) ::IRC_NAMESPACE::name
+# define IRC_USE_NAMESPACE using namespace ::IRC_NAMESPACE;
+# define IRC_BEGIN_NAMESPACE namespace IRC_NAMESPACE {
+# define IRC_END_NAMESPACE }
+# define IRC_FORWARD_DECLARE_CLASS(name) \
+ IRC_BEGIN_NAMESPACE class name; IRC_END_NAMESPACE \
+ using IRC_PREPEND_NAMESPACE(name);
+
+#else
+
+# define IRC_PREPEND_NAMESPACE(name) ::name
+# define IRC_USE_NAMESPACE
+# define IRC_BEGIN_NAMESPACE
+# define IRC_END_NAMESPACE
+# define IRC_FORWARD_DECLARE_CLASS(name) class name;
+
+#endif // IRC_NAMESPACE
+
+#endif // IRCGLOBAL_H
diff --git a/src/libcommuni/include/IrcCore/ircmessage.h b/src/libcommuni/include/IrcCore/ircmessage.h
new file mode 100644
index 0000000..02b8c86
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircmessage.h
@@ -0,0 +1,519 @@
+/*
+ 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 IRCMESSAGE_H
+#define IRCMESSAGE_H
+
+#include <Irc>
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qstringlist.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcCommand;
+class IrcNetwork;
+class IrcConnection;
+class IrcMessagePrivate;
+
+class IRC_CORE_EXPORT IrcMessage : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(IrcConnection* connection READ connection)
+ Q_PROPERTY(IrcNetwork* network READ network)
+ Q_PROPERTY(Type type READ type)
+ Q_PROPERTY(bool own READ isOwn)
+ Q_PROPERTY(Flags flags READ flags)
+ Q_PROPERTY(bool valid READ isValid)
+ Q_PROPERTY(QString command READ command)
+ Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
+ Q_PROPERTY(QString nick READ nick)
+ Q_PROPERTY(QString ident READ ident)
+ Q_PROPERTY(QString host READ host)
+ Q_PROPERTY(QStringList parameters READ parameters WRITE setParameters)
+ Q_PROPERTY(QDateTime timeStamp READ timeStamp WRITE setTimeStamp)
+ Q_PROPERTY(QVariantMap tags READ tags WRITE setTags)
+ Q_ENUMS(Type Flag)
+ Q_FLAGS(Flags)
+
+public:
+ enum Type {
+ Unknown,
+ Capability,
+ Error,
+ Invite,
+ Join,
+ Kick,
+ Mode,
+ Motd,
+ Names,
+ Nick,
+ Notice,
+ Numeric,
+ Part,
+ Ping,
+ Pong,
+ Private,
+ Quit,
+ Topic,
+ WhoReply
+ };
+
+ enum Flag {
+ None = 0x0,
+ Own = 0x1,
+ Identified = 0x2,
+ Unidentified = 0x4,
+ Playback = 0x8
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ Q_INVOKABLE explicit IrcMessage(IrcConnection* connection);
+ virtual ~IrcMessage();
+
+ IrcConnection* connection() const;
+ IrcNetwork* network() const;
+
+ Type type() const;
+ bool isOwn() const;
+
+ Flags flags() const;
+ void setFlags(Flags flags);
+
+ QString command() const;
+ void setCommand(const QString& command);
+
+ QString prefix() const;
+ void setPrefix(const QString& prefix);
+
+ QString nick() const;
+ QString ident() const;
+ QString host() const;
+
+ QStringList parameters() const;
+ void setParameters(const QStringList& parameters);
+
+ virtual bool isValid() const;
+
+ QDateTime timeStamp() const;
+ void setTimeStamp(const QDateTime& timeStamp);
+
+ QByteArray encoding() const;
+ void setEncoding(const QByteArray& encoding);
+
+ QVariantMap tags() const;
+ void setTags(const QVariantMap& tags);
+
+ Q_INVOKABLE QByteArray toData() const;
+ Q_INVOKABLE static IrcMessage* fromData(const QByteArray& data, IrcConnection* connection);
+ Q_INVOKABLE static IrcMessage* fromParameters(const QString& prefix, const QString& command, const QStringList& parameters, IrcConnection* connection);
+
+protected:
+ QScopedPointer<IrcMessagePrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcMessage)
+ Q_DISABLE_COPY(IrcMessage)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(IrcMessage::Flags)
+
+class IRC_CORE_EXPORT IrcCapabilityMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString subCommand READ subCommand)
+ Q_PROPERTY(QStringList capabilities READ capabilities)
+
+public:
+ Q_INVOKABLE explicit IrcCapabilityMessage(IrcConnection* connection);
+
+ QString subCommand() const;
+ QStringList capabilities() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcCapabilityMessage)
+};
+
+class IRC_CORE_EXPORT IrcErrorMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString error READ error)
+
+public:
+ Q_INVOKABLE explicit IrcErrorMessage(IrcConnection* connection);
+
+ QString error() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcErrorMessage)
+};
+
+class IRC_CORE_EXPORT IrcInviteMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString user READ user)
+ Q_PROPERTY(QString channel READ channel)
+
+public:
+ Q_INVOKABLE explicit IrcInviteMessage(IrcConnection* connection);
+
+ QString user() const;
+ QString channel() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcInviteMessage)
+};
+
+class IRC_CORE_EXPORT IrcJoinMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString channel READ channel)
+
+public:
+ Q_INVOKABLE explicit IrcJoinMessage(IrcConnection* connection);
+
+ QString channel() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcJoinMessage)
+};
+
+class IRC_CORE_EXPORT IrcKickMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString channel READ channel)
+ Q_PROPERTY(QString user READ user)
+ Q_PROPERTY(QString reason READ reason)
+
+public:
+ Q_INVOKABLE explicit IrcKickMessage(IrcConnection* connection);
+
+ QString channel() const;
+ QString user() const;
+ QString reason() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcKickMessage)
+};
+
+class IRC_CORE_EXPORT IrcModeMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString target READ target)
+ Q_PROPERTY(QString mode READ mode)
+ Q_PROPERTY(QString argument READ argument)
+ Q_PROPERTY(QStringList arguments READ arguments)
+ Q_PROPERTY(bool reply READ isReply)
+ Q_PROPERTY(Kind kind READ kind)
+ Q_ENUMS(Kind)
+
+public:
+ Q_INVOKABLE explicit IrcModeMessage(IrcConnection* connection);
+
+ QString target() const;
+ QString mode() const;
+ QString argument() const;
+ QStringList arguments() const;
+ bool isReply() const;
+
+ enum Kind { Channel, User };
+ Kind kind() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcModeMessage)
+};
+
+class IRC_CORE_EXPORT IrcMotdMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList lines READ lines)
+
+public:
+ Q_INVOKABLE explicit IrcMotdMessage(IrcConnection* connection);
+
+ QStringList lines() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcMotdMessage)
+};
+
+class IRC_CORE_EXPORT IrcNamesMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString channel READ channel)
+ Q_PROPERTY(QStringList names READ names)
+
+public:
+ Q_INVOKABLE explicit IrcNamesMessage(IrcConnection* connection);
+
+ QString channel() const;
+ QStringList names() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcNamesMessage)
+};
+
+class IRC_CORE_EXPORT IrcNickMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString oldNick READ oldNick)
+ Q_PROPERTY(QString newNick READ newNick)
+
+public:
+ Q_INVOKABLE explicit IrcNickMessage(IrcConnection* connection);
+
+ QString oldNick() const;
+ QString newNick() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcNickMessage)
+};
+
+class IRC_CORE_EXPORT IrcNoticeMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString target READ target)
+ Q_PROPERTY(QString content READ content)
+ Q_PROPERTY(bool private READ isPrivate)
+ Q_PROPERTY(bool reply READ isReply)
+
+public:
+ Q_INVOKABLE explicit IrcNoticeMessage(IrcConnection* connection);
+
+ QString target() const;
+ QString content() const;
+ bool isPrivate() const;
+ bool isReply() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcNoticeMessage)
+};
+
+class IRC_CORE_EXPORT IrcNumericMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(int code READ code)
+
+public:
+ Q_INVOKABLE explicit IrcNumericMessage(IrcConnection* connection);
+
+ int code() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcNumericMessage)
+};
+
+class IRC_CORE_EXPORT IrcPartMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString channel READ channel)
+ Q_PROPERTY(QString reason READ reason)
+
+public:
+ Q_INVOKABLE explicit IrcPartMessage(IrcConnection* connection);
+
+ QString channel() const;
+ QString reason() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcPartMessage)
+};
+
+class IRC_CORE_EXPORT IrcPingMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString argument READ argument)
+
+public:
+ Q_INVOKABLE explicit IrcPingMessage(IrcConnection* connection);
+
+ QString argument() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcPingMessage)
+};
+
+class IRC_CORE_EXPORT IrcPongMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString argument READ argument)
+
+public:
+ Q_INVOKABLE explicit IrcPongMessage(IrcConnection* connection);
+
+ QString argument() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcPongMessage)
+};
+
+class IRC_CORE_EXPORT IrcPrivateMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString target READ target)
+ Q_PROPERTY(QString content READ content)
+ Q_PROPERTY(bool private READ isPrivate)
+ Q_PROPERTY(bool action READ isAction)
+ Q_PROPERTY(bool request READ isRequest)
+
+public:
+ Q_INVOKABLE explicit IrcPrivateMessage(IrcConnection* connection);
+
+ QString target() const;
+ QString content() const;
+ bool isPrivate() const;
+ bool isAction() const;
+ bool isRequest() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcPrivateMessage)
+};
+
+class IRC_CORE_EXPORT IrcQuitMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString reason READ reason)
+
+public:
+ Q_INVOKABLE explicit IrcQuitMessage(IrcConnection* connection);
+
+ QString reason() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcQuitMessage)
+};
+
+class IRC_CORE_EXPORT IrcTopicMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString channel READ channel)
+ Q_PROPERTY(QString topic READ topic)
+ Q_PROPERTY(bool reply READ isReply)
+
+public:
+ Q_INVOKABLE explicit IrcTopicMessage(IrcConnection* connection);
+
+ QString channel() const;
+ QString topic() const;
+ bool isReply() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcTopicMessage)
+};
+
+class IRC_CORE_EXPORT IrcWhoReplyMessage : public IrcMessage
+{
+ Q_OBJECT
+ Q_PROPERTY(QString mask READ mask)
+ Q_PROPERTY(QString server READ server)
+ Q_PROPERTY(bool away READ isAway)
+ Q_PROPERTY(bool servOp READ isServOp)
+ Q_PROPERTY(QString realName READ realName)
+
+public:
+ Q_INVOKABLE explicit IrcWhoReplyMessage(IrcConnection* connection);
+
+ QString mask() const;
+ QString server() const;
+ bool isAway() const;
+ bool isServOp() const;
+ QString realName() const;
+
+ bool isValid() const;
+
+private:
+ Q_DISABLE_COPY(IrcWhoReplyMessage)
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcMessage::Type type);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcMessage::Flag flag);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcMessage::Flags flags);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcModeMessage::Kind kind);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, const IrcMessage* message);
+#endif // QT_NO_DEBUG_STREAM
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcMessage::Type))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcCapabilityMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcErrorMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcInviteMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcJoinMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcKickMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcModeMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcMotdMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcNamesMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcNickMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcNoticeMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcNumericMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcPartMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcPingMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcPongMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcPrivateMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcQuitMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcTopicMessage*))
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcWhoReplyMessage*))
+
+#endif // IRCMESSAGE_H
diff --git a/src/libcommuni/include/IrcCore/ircmessage_p.h b/src/libcommuni/include/IrcCore/ircmessage_p.h
new file mode 100644
index 0000000..b2b50e1
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircmessage_p.h
@@ -0,0 +1,124 @@
+/*
+ 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 IRCMESSAGE_P_H
+#define IRCMESSAGE_P_H
+
+#include <QtCore/qmap.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qstringlist.h>
+
+#include "ircmessage.h"
+
+IRC_BEGIN_NAMESPACE
+
+class IrcConnection;
+
+template <class T>
+class IrcExplicitValue
+{
+public:
+ IrcExplicitValue() : exp(false), null(true) { }
+ IrcExplicitValue(const T& value) : v(value), exp(false), null(false) { }
+
+ bool isNull() const { return null; }
+ bool isExplicit() const { return exp; }
+
+ const T& value() const { return v; }
+ void setValue(const T& value) { v = value; exp = true; null = false; }
+
+ void clear() { v = T(); exp = false; null = true; }
+
+private:
+ T v;
+ bool exp;
+ bool null;
+};
+
+class IrcMessageData
+{
+public:
+ static IrcMessageData fromData(const QByteArray& data);
+
+ QByteArray content;
+ QByteArray prefix;
+ QByteArray command;
+ QList<QByteArray> params;
+ QMap<QByteArray, QByteArray> tags;
+};
+
+class IrcMessagePrivate
+{
+public:
+ IrcMessagePrivate();
+
+ QString prefix() const;
+ void setPrefix(const QString& prefix);
+
+ QString nick() const;
+ QString ident() const;
+ QString host() const;
+
+ QString command() const;
+ void setCommand(const QString& command);
+
+ QStringList params() const;
+ QString param(int index) const;
+ void setParams(const QStringList& params);
+
+ QVariantMap tags() const;
+ void setTags(const QVariantMap& tags);
+
+ QByteArray content() const;
+
+ void invalidate();
+
+ static QString decode(const QByteArray& data, const QByteArray& encoding);
+ static bool parsePrefix(const QString& prefix, QString* nick, QString* ident, QString* host);
+
+ IrcConnection* connection;
+ IrcMessage::Type type;
+ QDateTime timeStamp;
+ QByteArray encoding;
+ mutable int flags;
+ IrcMessageData data;
+
+private:
+ mutable QString m_nick, m_ident, m_host;
+ mutable IrcExplicitValue<QString> m_prefix;
+ mutable IrcExplicitValue<QString> m_command;
+ mutable IrcExplicitValue<QStringList> m_params;
+ mutable IrcExplicitValue<QVariantMap> m_tags;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCMESSAGE_P_H
diff --git a/src/libcommuni/include/IrcCore/ircmessagebuilder_p.h b/src/libcommuni/include/IrcCore/ircmessagebuilder_p.h
new file mode 100644
index 0000000..3047eda
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircmessagebuilder_p.h
@@ -0,0 +1,63 @@
+/*
+ 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 IRCMESSAGEBUILDER_P_H
+#define IRCMESSAGEBUILDER_P_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qstringlist.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcConnection;
+class IrcMessage;
+class IrcNumericMessage;
+
+class IrcMessageBuilder : public QObject
+{
+ Q_OBJECT
+
+public:
+ IrcMessageBuilder(IrcConnection* connection);
+
+ void processMessage(IrcNumericMessage* message);
+
+Q_SIGNALS:
+ void messageReceived(IrcMessage* message);
+
+private:
+ struct Data {
+ IrcConnection* connection;
+ IrcMessage* message;
+ } d;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCMESSAGEBUILDER_P_H
diff --git a/src/libcommuni/include/IrcCore/ircmessagedecoder_p.h b/src/libcommuni/include/IrcCore/ircmessagedecoder_p.h
new file mode 100644
index 0000000..005053e
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircmessagedecoder_p.h
@@ -0,0 +1,58 @@
+/*
+ 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 IRCMESSAGEDECODER_P_H
+#define IRCMESSAGEDECODER_P_H
+
+#include <IrcGlobal>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qtextcodec.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcMessageDecoder
+{
+public:
+ IrcMessageDecoder();
+ ~IrcMessageDecoder();
+
+ QString decode(const QByteArray& data, const QByteArray& encoding) const;
+
+private:
+ void initialize();
+ void uninitialize();
+ QByteArray codecForData(const QByteArray& data) const;
+
+ struct Data {
+ void* detector;
+ } d;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCMESSAGEDECODER_P_H
diff --git a/src/libcommuni/include/IrcCore/ircmessagefilter.h b/src/libcommuni/include/IrcCore/ircmessagefilter.h
new file mode 100644
index 0000000..1edae38
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircmessagefilter.h
@@ -0,0 +1 @@
+#include <ircfilter.h>
diff --git a/src/libcommuni/include/IrcCore/ircnetwork.h b/src/libcommuni/include/IrcCore/ircnetwork.h
new file mode 100644
index 0000000..6b2a5d2
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircnetwork.h
@@ -0,0 +1,147 @@
+/*
+ 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 IRCNETWORK_H
+#define IRCNETWORK_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qscopedpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcConnection;
+class IrcNetworkPrivate;
+
+class IRC_CORE_EXPORT IrcNetwork : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool initialized READ isInitialized NOTIFY initialized)
+ Q_PROPERTY(QString name READ name NOTIFY nameChanged)
+ Q_PROPERTY(QStringList modes READ modes NOTIFY modesChanged)
+ Q_PROPERTY(QStringList prefixes READ prefixes NOTIFY prefixesChanged)
+ Q_PROPERTY(QStringList channelTypes READ channelTypes NOTIFY channelTypesChanged)
+ Q_PROPERTY(QStringList availableCapabilities READ availableCapabilities NOTIFY availableCapabilitiesChanged)
+ Q_PROPERTY(QStringList requestedCapabilities READ requestedCapabilities WRITE setRequestedCapabilities NOTIFY requestedCapabilitiesChanged)
+ Q_PROPERTY(QStringList activeCapabilities READ activeCapabilities NOTIFY activeCapabilitiesChanged)
+ Q_ENUMS(Limit ModeType)
+ Q_FLAGS(ModeTypes)
+
+public:
+ virtual ~IrcNetwork();
+
+ bool isInitialized();
+
+ QString name() const;
+
+ QStringList modes() const;
+ QStringList prefixes() const;
+
+ Q_INVOKABLE QString modeToPrefix(const QString& mode) const;
+ Q_INVOKABLE QString prefixToMode(const QString& prefix) const;
+
+ QStringList channelTypes() const;
+
+ Q_INVOKABLE bool isChannel(const QString& name) const;
+
+ enum ModeType {
+ TypeA = 0x1,
+ TypeB = 0x2,
+ TypeC = 0x4,
+ TypeD = 0x8,
+ AllTypes = 0xf
+ };
+ Q_DECLARE_FLAGS(ModeTypes, ModeType)
+
+ Q_INVOKABLE QStringList channelModes(IrcNetwork::ModeTypes types) const;
+
+ enum Limit {
+ NickLength,
+ ChannelLength,
+ TopicLength,
+ MessageLength,
+ KickReasonLength,
+ AwayReasonLength,
+ ModeCount
+ };
+
+ Q_INVOKABLE int numericLimit(IrcNetwork::Limit limit) const;
+
+ Q_INVOKABLE int modeLimit(const QString& mode) const;
+ Q_INVOKABLE int channelLimit(const QString& type) const;
+ Q_INVOKABLE int targetLimit(const QString& command) const;
+
+ QStringList availableCapabilities() const;
+ QStringList requestedCapabilities() const;
+ QStringList activeCapabilities() const;
+
+ Q_INVOKABLE bool hasCapability(const QString& capability) const;
+ Q_INVOKABLE bool isCapable(const QString& capability) const;
+
+public Q_SLOTS:
+ bool requestCapability(const QString& capability);
+ bool requestCapabilities(const QStringList& capabilities);
+ void setRequestedCapabilities(const QStringList& capabilities);
+
+Q_SIGNALS:
+ void initialized();
+ void nameChanged(const QString& name);
+ void modesChanged(const QStringList& modes);
+ void prefixesChanged(const QStringList& prefixes);
+ void channelTypesChanged(const QStringList& types);
+ void availableCapabilitiesChanged(const QStringList& capabilities);
+ void requestedCapabilitiesChanged(const QStringList& capabilities);
+ void activeCapabilitiesChanged(const QStringList& capabilities);
+ void requestingCapabilities();
+
+private:
+ friend class IrcProtocol;
+ friend class IrcConnection;
+ explicit IrcNetwork(IrcConnection* connection);
+
+ QScopedPointer<IrcNetworkPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcNetwork)
+ Q_DISABLE_COPY(IrcNetwork)
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcNetwork::Limit limit);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcNetwork::ModeType type);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, IrcNetwork::ModeTypes types);
+IRC_CORE_EXPORT QDebug operator<<(QDebug debug, const IrcNetwork* network);
+#endif // QT_NO_DEBUG_STREAM
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(IrcNetwork::ModeTypes)
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcNetwork*))
+
+#endif // IRCNETWORK_H
diff --git a/src/libcommuni/include/IrcCore/ircnetwork_p.h b/src/libcommuni/include/IrcCore/ircnetwork_p.h
new file mode 100644
index 0000000..22e6435
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircnetwork_p.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 IRCNETWORK_P_H
+#define IRCNETWORK_P_H
+
+#include "ircnetwork.h"
+
+#include <QSet>
+#include <QHash>
+#include <QString>
+#include <QPointer>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcNetworkPrivate
+{
+ Q_DECLARE_PUBLIC(IrcNetwork)
+
+public:
+ IrcNetworkPrivate();
+
+ void setInfo(const QHash<QString, QString>& info);
+ void setAvailableCapabilities(const QSet<QString>& capabilities);
+ void setActiveCapabilities(const QSet<QString>& capabilities);
+
+ void setName(const QString& name);
+ void setModes(const QStringList& modes);
+ void setPrefixes(const QStringList& prefixes);
+ void setChannelTypes(const QStringList& types);
+
+ static IrcNetwork* create(IrcConnection* connection)
+ {
+ return new IrcNetwork(connection);
+ }
+
+ static IrcNetworkPrivate* get(const IrcNetwork* network)
+ {
+ return network->d_ptr.data();
+ }
+
+ IrcNetwork* q_ptr;
+ QPointer<IrcConnection> connection;
+ bool initialized;
+ QString name;
+ QStringList modes, prefixes, channelTypes, channelModes;
+ QHash<QString, int> numericLimits, modeLimits, channelLimits, targetLimits;
+ QSet<QString> availableCaps, requestedCaps, activeCaps;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCNETWORK_P_H
diff --git a/src/libcommuni/include/IrcCore/ircprotocol.h b/src/libcommuni/include/IrcCore/ircprotocol.h
new file mode 100644
index 0000000..ae600c4
--- /dev/null
+++ b/src/libcommuni/include/IrcCore/ircprotocol.h
@@ -0,0 +1,85 @@
+/*
+ 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 IRCPROTOCOL_H
+#define IRCPROTOCOL_H
+
+#include <IrcGlobal>
+#include <IrcConnection>
+#include <QtCore/qset.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtNetwork/qabstractsocket.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcMessage;
+class IrcProtocolPrivate;
+
+class IRC_CORE_EXPORT IrcProtocol : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(IrcConnection* connection READ connection)
+ Q_PROPERTY(QAbstractSocket* socket READ socket)
+
+public:
+ explicit IrcProtocol(IrcConnection* connection);
+ virtual ~IrcProtocol();
+
+ IrcConnection* connection() const;
+ QAbstractSocket* socket() const;
+
+ virtual void open();
+ virtual void close();
+
+ virtual void read();
+ virtual bool write(const QByteArray& data);
+
+public Q_SLOTS:
+ void receiveMessage(IrcMessage* message);
+
+protected Q_SLOTS:
+ void setNickName(const QString& name);
+ void setStatus(IrcConnection::Status status);
+ void setInfo(const QHash<QString, QString>& info);
+ void setAvailableCapabilities(const QSet<QString>& capabilities);
+ void setActiveCapabilities(const QSet<QString>& capabilities);
+
+private:
+ QScopedPointer<IrcProtocolPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcProtocol)
+ Q_DISABLE_COPY(IrcProtocol)
+
+ Q_PRIVATE_SLOT(d_func(), void _irc_pauseHandshake())
+ Q_PRIVATE_SLOT(d_func(), void _irc_resumeHandshake())
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCPROTOCOL_H
diff --git a/src/libcommuni/include/IrcModel/IrcBuffer b/src/libcommuni/include/IrcModel/IrcBuffer
new file mode 100644
index 0000000..4c88f75
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/IrcBuffer
@@ -0,0 +1 @@
+#include <ircbuffer.h>
diff --git a/src/libcommuni/include/IrcModel/IrcBufferModel b/src/libcommuni/include/IrcModel/IrcBufferModel
new file mode 100644
index 0000000..149310e
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/IrcBufferModel
@@ -0,0 +1 @@
+#include <ircbuffermodel.h>
diff --git a/src/libcommuni/include/IrcModel/IrcChannel b/src/libcommuni/include/IrcModel/IrcChannel
new file mode 100644
index 0000000..9392686
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/IrcChannel
@@ -0,0 +1 @@
+#include <ircchannel.h>
diff --git a/src/libcommuni/include/IrcModel/IrcModel b/src/libcommuni/include/IrcModel/IrcModel
new file mode 100644
index 0000000..0ca546f
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/IrcModel
@@ -0,0 +1 @@
+#include <ircmodel.h>
diff --git a/src/libcommuni/include/IrcModel/IrcUser b/src/libcommuni/include/IrcModel/IrcUser
new file mode 100644
index 0000000..7b7b69e
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/IrcUser
@@ -0,0 +1 @@
+#include <ircuser.h>
diff --git a/src/libcommuni/include/IrcModel/IrcUserModel b/src/libcommuni/include/IrcModel/IrcUserModel
new file mode 100644
index 0000000..90a67b7
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/IrcUserModel
@@ -0,0 +1 @@
+#include <ircusermodel.h>
diff --git a/src/libcommuni/include/IrcModel/ircbuffer.h b/src/libcommuni/include/IrcModel/ircbuffer.h
new file mode 100644
index 0000000..69cc69f
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircbuffer.h
@@ -0,0 +1,126 @@
+/*
+ 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 IRCBUFFER_H
+#define IRCBUFFER_H
+
+#include <Irc>
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcChannel;
+class IrcCommand;
+class IrcMessage;
+class IrcNetwork;
+class IrcConnection;
+class IrcBufferModel;
+class IrcBufferPrivate;
+
+class IRC_MODEL_EXPORT IrcBuffer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QString prefix READ prefix WRITE setPrefix NOTIFY prefixChanged)
+ Q_PROPERTY(IrcConnection* connection READ connection CONSTANT)
+ Q_PROPERTY(IrcNetwork* network READ network CONSTANT)
+ Q_PROPERTY(IrcBufferModel* model READ model CONSTANT)
+ Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
+ Q_PROPERTY(bool channel READ isChannel CONSTANT)
+ Q_PROPERTY(bool sticky READ isSticky WRITE setSticky NOTIFY stickyChanged)
+ Q_PROPERTY(bool persistent READ isPersistent WRITE setPersistent NOTIFY persistentChanged)
+ Q_PROPERTY(QVariantMap userData READ userData WRITE setUserData NOTIFY userDataChanged)
+
+public:
+ Q_INVOKABLE explicit IrcBuffer(QObject* parent = 0);
+ virtual ~IrcBuffer();
+
+ QString title() const;
+ QString name() const;
+ QString prefix() const;
+
+ bool isChannel() const;
+ Q_INVOKABLE IrcChannel* toChannel();
+
+ IrcConnection* connection() const;
+ IrcNetwork* network() const;
+ IrcBufferModel* model() const;
+
+ virtual bool isActive() const;
+
+ bool isSticky() const;
+ void setSticky(bool sticky);
+
+ bool isPersistent() const;
+ void setPersistent(bool persistent);
+
+ QVariantMap userData() const;
+ void setUserData(const QVariantMap& data);
+
+ Q_INVOKABLE bool sendCommand(IrcCommand* command);
+
+public Q_SLOTS:
+ void setName(const QString& name);
+ void setPrefix(const QString& prefix);
+ void receiveMessage(IrcMessage* message);
+ virtual void close(const QString& reason = QString());
+
+Q_SIGNALS:
+ void titleChanged(const QString& title);
+ void nameChanged(const QString& name);
+ void prefixChanged(const QString& name);
+ void messageReceived(IrcMessage* message);
+ void destroyed(IrcBuffer* buffer);
+ void activeChanged(bool active);
+ void stickyChanged(bool sticky);
+ void persistentChanged(bool persistent);
+ void userDataChanged(const QVariantMap& data);
+
+protected:
+ IrcBuffer(IrcBufferPrivate& dd, QObject* parent);
+
+ QScopedPointer<IrcBufferPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcBuffer)
+ Q_DISABLE_COPY(IrcBuffer)
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_MODEL_EXPORT QDebug operator<<(QDebug debug, const IrcBuffer* buffer);
+#endif // QT_NO_DEBUG_STREAM
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcBuffer*))
+Q_DECLARE_METATYPE(QList<IRC_PREPEND_NAMESPACE(IrcBuffer*)>)
+
+#endif // IRCBUFFER_H
diff --git a/src/libcommuni/include/IrcModel/ircbuffer_p.h b/src/libcommuni/include/IrcModel/ircbuffer_p.h
new file mode 100644
index 0000000..cadc043
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircbuffer_p.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 IRCBUFFER_P_H
+#define IRCBUFFER_P_H
+
+#include "ircbuffer.h"
+#include "ircmessage.h"
+#include <qstringlist.h>
+#include <qlist.h>
+#include <qmap.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcUser;
+class IrcUserModel;
+
+class IrcBufferPrivate
+{
+ Q_DECLARE_PUBLIC(IrcBuffer)
+
+public:
+ IrcBufferPrivate();
+ virtual ~IrcBufferPrivate();
+
+ virtual void init(const QString& title, IrcBufferModel* model);
+ virtual void connected();
+ virtual void disconnected();
+
+ void setName(const QString& name);
+ void setPrefix(const QString& prefix);
+ void setModel(IrcBufferModel* model);
+
+ bool processMessage(IrcMessage* message);
+
+ virtual bool processJoinMessage(IrcJoinMessage* message);
+ virtual bool processKickMessage(IrcKickMessage* message);
+ virtual bool processModeMessage(IrcModeMessage* message);
+ virtual bool processNamesMessage(IrcNamesMessage* message);
+ virtual bool processNickMessage(IrcNickMessage* message);
+ virtual bool processNoticeMessage(IrcNoticeMessage* message);
+ virtual bool processNumericMessage(IrcNumericMessage* message);
+ virtual bool processPartMessage(IrcPartMessage* message);
+ virtual bool processPrivateMessage(IrcPrivateMessage* message);
+ virtual bool processQuitMessage(IrcQuitMessage* message);
+ virtual bool processTopicMessage(IrcTopicMessage* message);
+ virtual bool processWhoReplyMessage(IrcWhoReplyMessage* message);
+
+ static IrcBufferPrivate* get(IrcBuffer* buffer)
+ {
+ return buffer->d_func();
+ }
+
+ IrcBuffer* q_ptr;
+ IrcBufferModel* model;
+ QString name;
+ QString prefix;
+ bool persistent;
+ bool sticky;
+ QVariantMap userData;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCBUFFER_P_H
diff --git a/src/libcommuni/include/IrcModel/ircbuffermodel.h b/src/libcommuni/include/IrcModel/ircbuffermodel.h
new file mode 100644
index 0000000..ef23fc4
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircbuffermodel.h
@@ -0,0 +1,158 @@
+/*
+ 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 IRCBUFFERMODEL_H
+#define IRCBUFFERMODEL_H
+
+#include <Irc>
+#include <IrcGlobal>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qabstractitemmodel.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcBuffer;
+class IrcChannel;
+class IrcMessage;
+class IrcNetwork;
+class IrcConnection;
+class IrcBufferModelPrivate;
+
+class IRC_MODEL_EXPORT IrcBufferModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged)
+ Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder)
+ Q_PROPERTY(Irc::SortMethod sortMethod READ sortMethod WRITE setSortMethod)
+ Q_PROPERTY(QStringList channels READ channels NOTIFY channelsChanged)
+ Q_PROPERTY(Irc::DataRole displayRole READ displayRole WRITE setDisplayRole)
+ Q_PROPERTY(bool persistent READ isPersistent WRITE setPersistent NOTIFY persistentChanged)
+ Q_PROPERTY(QList<IrcBuffer*> buffers READ buffers NOTIFY buffersChanged)
+ Q_PROPERTY(IrcConnection* connection READ connection WRITE setConnection NOTIFY connectionChanged)
+ Q_PROPERTY(IrcNetwork* network READ network NOTIFY networkChanged)
+ Q_PROPERTY(IrcBuffer* bufferPrototype READ bufferPrototype WRITE setBufferPrototype NOTIFY bufferPrototypeChanged)
+ Q_PROPERTY(IrcChannel* channelPrototype READ channelPrototype WRITE setChannelPrototype NOTIFY channelPrototypeChanged)
+
+public:
+ explicit IrcBufferModel(QObject* parent = 0);
+ virtual ~IrcBufferModel();
+
+ IrcConnection* connection() const;
+ void setConnection(IrcConnection* connection);
+
+ IrcNetwork* network() const;
+
+ int count() const;
+ bool isEmpty() const;
+ QStringList channels() const;
+ QList<IrcBuffer*> buffers() const;
+ Q_INVOKABLE IrcBuffer* get(int index) const;
+ Q_INVOKABLE IrcBuffer* find(const QString& title) const;
+ Q_INVOKABLE bool contains(const QString& title) const;
+ Q_INVOKABLE int indexOf(IrcBuffer* buffer) const;
+
+ Q_INVOKABLE IrcBuffer* add(const QString& title);
+ Q_INVOKABLE void add(IrcBuffer* buffer);
+ Q_INVOKABLE void remove(const QString& title);
+ Q_INVOKABLE void remove(IrcBuffer* buffer);
+
+ Qt::SortOrder sortOrder() const;
+ void setSortOrder(Qt::SortOrder order);
+
+ Irc::SortMethod sortMethod() const;
+ void setSortMethod(Irc::SortMethod method);
+
+ Irc::DataRole displayRole() const;
+ void setDisplayRole(Irc::DataRole role);
+
+ bool isPersistent() const;
+ void setPersistent(bool persistent);
+
+ QModelIndex index(IrcBuffer* buffer) const;
+ IrcBuffer* buffer(const QModelIndex& index) const;
+
+ QHash<int, QByteArray> roleNames() const;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const;
+
+ IrcBuffer* bufferPrototype() const;
+ void setBufferPrototype(IrcBuffer* prototype);
+
+ IrcChannel* channelPrototype() const;
+ void setChannelPrototype(IrcChannel* prototype);
+
+ Q_INVOKABLE QByteArray saveState(int version = 0) const;
+ Q_INVOKABLE bool restoreState(const QByteArray& state, int version = 0);
+
+public Q_SLOTS:
+ void clear();
+ void receiveMessage(IrcMessage* message);
+ void sort(int column = 0, Qt::SortOrder order = Qt::AscendingOrder);
+ void sort(Irc::SortMethod method, Qt::SortOrder order = Qt::AscendingOrder);
+
+Q_SIGNALS:
+ void countChanged(int count);
+ void emptyChanged(bool empty);
+ void added(IrcBuffer* buffer);
+ void removed(IrcBuffer* buffer);
+ void aboutToBeAdded(IrcBuffer* buffer);
+ void aboutToBeRemoved(IrcBuffer* buffer);
+ void persistentChanged(bool persistent);
+ void buffersChanged(const QList<IrcBuffer*>& buffers);
+ void channelsChanged(const QStringList& channels);
+ void connectionChanged(IrcConnection* connection);
+ void networkChanged(IrcNetwork* network);
+ void messageIgnored(IrcMessage* message);
+ void bufferPrototypeChanged(IrcBuffer* prototype);
+ void channelPrototypeChanged(IrcChannel* prototype);
+ void destroyed(IrcBufferModel* model);
+
+protected Q_SLOTS:
+ virtual IrcBuffer* createBuffer(const QString& title);
+ virtual IrcChannel* createChannel(const QString& title);
+
+protected:
+ virtual bool lessThan(IrcBuffer* one, IrcBuffer* another, Irc::SortMethod method) const;
+
+private:
+ friend class IrcBufferLessThan;
+ friend class IrcBufferGreaterThan;
+ QScopedPointer<IrcBufferModelPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcBufferModel)
+ Q_DISABLE_COPY(IrcBufferModel)
+
+ Q_PRIVATE_SLOT(d_func(), void _irc_connected())
+ Q_PRIVATE_SLOT(d_func(), void _irc_disconnected())
+ Q_PRIVATE_SLOT(d_func(), void _irc_bufferDestroyed(IrcBuffer*))
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCBUFFERMODEL_H
diff --git a/src/libcommuni/include/IrcModel/ircbuffermodel_p.h b/src/libcommuni/include/IrcModel/ircbuffermodel_p.h
new file mode 100644
index 0000000..c7446b0
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircbuffermodel_p.h
@@ -0,0 +1,89 @@
+/*
+ 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 IRCBUFFERMODEL_P_H
+#define IRCBUFFERMODEL_P_H
+
+#include "ircbuffer.h"
+#include "ircfilter.h"
+#include "ircbuffermodel.h"
+#include <qpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcBufferModelPrivate : public QObject, public IrcMessageFilter, public IrcCommandFilter
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(IrcBufferModel)
+ Q_INTERFACES(IrcMessageFilter IrcCommandFilter)
+
+public:
+ IrcBufferModelPrivate();
+
+ bool messageFilter(IrcMessage* message);
+ bool commandFilter(IrcCommand* command);
+
+ IrcBuffer* createBufferHelper(const QString& title);
+ IrcChannel* createChannelHelper(const QString& title);
+
+ IrcBuffer* createBuffer(const QString& title);
+ void destroyBuffer(const QString& title, bool force = false);
+
+ void addBuffer(IrcBuffer* buffer, bool notify = true);
+ void insertBuffer(int index, IrcBuffer* buffer, bool notify = true);
+ void removeBuffer(IrcBuffer* buffer, bool notify = true);
+ bool renameBuffer(const QString& from, const QString& to);
+
+ bool processMessage(const QString& title, IrcMessage* message, bool create = false);
+
+ void _irc_connected();
+ void _irc_disconnected();
+ void _irc_bufferDestroyed(IrcBuffer* buffer);
+
+ static IrcBufferModelPrivate* get(IrcBufferModel* model)
+ {
+ return model->d_func();
+ }
+
+ IrcBufferModel* q_ptr;
+ Irc::DataRole role;
+ QPointer<IrcConnection> connection;
+ QList<IrcBuffer*> bufferList;
+ QMap<QString, IrcBuffer*> bufferMap;
+ QHash<QString, QString> keys;
+ QStringList channels;
+ Irc::SortMethod sortMethod;
+ Qt::SortOrder sortOrder;
+ IrcBuffer* bufferProto;
+ IrcChannel* channelProto;
+ bool persistent;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCBUFFERMODEL_P_H
diff --git a/src/libcommuni/include/IrcModel/ircchannel.h b/src/libcommuni/include/IrcModel/ircchannel.h
new file mode 100644
index 0000000..e16de90
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircchannel.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 IRCCHANNEL_H
+#define IRCCHANNEL_H
+
+#include <IrcGlobal>
+#include <IrcBuffer>
+#include <QtCore/qmetatype.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcChannelPrivate;
+
+class IRC_MODEL_EXPORT IrcChannel : public IrcBuffer
+{
+ Q_OBJECT
+ Q_PROPERTY(QString key READ key NOTIFY keyChanged)
+ Q_PROPERTY(QString mode READ mode NOTIFY modeChanged)
+ Q_PROPERTY(QString topic READ topic NOTIFY topicChanged)
+
+public:
+ Q_INVOKABLE explicit IrcChannel(QObject* parent = 0);
+ virtual ~IrcChannel();
+
+ QString key() const;
+ QString mode() const;
+ QString topic() const;
+
+ virtual bool isActive() const;
+
+public Q_SLOTS:
+ void join(const QString& key = QString());
+ void part(const QString& reason = QString());
+ void close(const QString& reason = QString());
+
+Q_SIGNALS:
+ void keyChanged(const QString& key);
+ void modeChanged(const QString& mode);
+ void topicChanged(const QString& topic);
+ void destroyed(IrcChannel* channel);
+private:
+ Q_DECLARE_PRIVATE(IrcChannel)
+ Q_DISABLE_COPY(IrcChannel)
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_MODEL_EXPORT QDebug operator<<(QDebug debug, const IrcChannel* channel);
+#endif // QT_NO_DEBUG_STREAM
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcChannel*))
+Q_DECLARE_METATYPE(QList<IRC_PREPEND_NAMESPACE(IrcChannel*)>)
+
+#endif // IRCCHANNEL
diff --git a/src/libcommuni/include/IrcModel/ircchannel_p.h b/src/libcommuni/include/IrcModel/ircchannel_p.h
new file mode 100644
index 0000000..9da375b
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircchannel_p.h
@@ -0,0 +1,99 @@
+/*
+ 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 IRCCHANNEL_P_H
+#define IRCCHANNEL_P_H
+
+#include "ircchannel.h"
+#include "ircnetwork.h"
+#include "ircbuffer_p.h"
+#include <qstringlist.h>
+#include <qlist.h>
+#include <qmap.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcChannelPrivate : public IrcBufferPrivate
+{
+ Q_DECLARE_PUBLIC(IrcChannel)
+
+public:
+ IrcChannelPrivate();
+ virtual ~IrcChannelPrivate();
+
+ virtual void init(const QString& title, IrcBufferModel* model);
+ virtual void connected();
+ virtual void disconnected();
+
+ void setActive(bool active);
+
+ void changeModes(const QString& value, const QStringList& arguments);
+ void setModes(const QString& value, const QStringList& arguments);
+ void setTopic(const QString& value);
+ void setKey(const QString& value);
+
+ void addUser(const QString& user);
+ bool removeUser(const QString& user);
+ void setUsers(const QStringList& users);
+ bool renameUser(const QString& from, const QString& to);
+ void setUserMode(const QString& user, const QString& mode);
+ void promoteUser(const QString& user);
+ void setUserAway(const QString &name, const bool& away);
+ void setUserServOp(const QString &name, const bool& servOp);
+
+ virtual bool processJoinMessage(IrcJoinMessage* message);
+ virtual bool processKickMessage(IrcKickMessage* message);
+ virtual bool processModeMessage(IrcModeMessage* message);
+ virtual bool processNamesMessage(IrcNamesMessage* message);
+ virtual bool processNickMessage(IrcNickMessage* message);
+ virtual bool processNoticeMessage(IrcNoticeMessage* message);
+ virtual bool processNumericMessage(IrcNumericMessage* message);
+ virtual bool processPartMessage(IrcPartMessage* message);
+ virtual bool processPrivateMessage(IrcPrivateMessage* message);
+ virtual bool processQuitMessage(IrcQuitMessage* message);
+ virtual bool processTopicMessage(IrcTopicMessage* message);
+ virtual bool processWhoReplyMessage(IrcWhoReplyMessage* message);
+
+ static IrcChannelPrivate* get(IrcChannel* channel)
+ {
+ return channel->d_func();
+ }
+
+ QMap<QString, QString> modes;
+ QString topic;
+ bool active;
+ QStringList names;
+ QList<IrcUser*> userList;
+ QList<IrcUser*> activeUsers;
+ QMap<QString, IrcUser*> userMap;
+ QList<IrcUserModel*> userModels;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCCHANNEL_P_H
diff --git a/src/libcommuni/include/IrcModel/ircmodel.h b/src/libcommuni/include/IrcModel/ircmodel.h
new file mode 100644
index 0000000..45ac4bd
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircmodel.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 IRCMODEL_H
+#define IRCMODEL_H
+
+#include "ircbuffer.h"
+#include "ircbuffermodel.h"
+#include "ircchannel.h"
+#include "ircuser.h"
+#include "ircusermodel.h"
+
+IRC_BEGIN_NAMESPACE
+
+namespace IrcModel {
+ void registerMetaTypes();
+}
+
+IRC_END_NAMESPACE
+
+#endif // IRCMODEL_H
diff --git a/src/libcommuni/include/IrcModel/ircuser.h b/src/libcommuni/include/IrcModel/ircuser.h
new file mode 100644
index 0000000..9e59a9f
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircuser.h
@@ -0,0 +1,89 @@
+/*
+ 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 IRCUSER_H
+#define IRCUSER_H
+
+#include <IrcGlobal>
+#include <QtCore/qobject.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcChannel;
+class IrcUserPrivate;
+
+class IRC_MODEL_EXPORT IrcUser : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QString name READ name NOTIFY nameChanged)
+ Q_PROPERTY(QString prefix READ prefix NOTIFY prefixChanged)
+ Q_PROPERTY(QString mode READ mode NOTIFY modeChanged)
+ Q_PROPERTY(bool servOp READ isServOp NOTIFY servOpChanged)
+ Q_PROPERTY(bool away READ isAway NOTIFY awayChanged)
+ Q_PROPERTY(IrcChannel* channel READ channel CONSTANT)
+
+public:
+ explicit IrcUser(QObject* parent = 0);
+ virtual ~IrcUser();
+
+ QString title() const;
+ QString name() const;
+ QString prefix() const;
+ QString mode() const;
+ bool isServOp() const;
+ bool isAway() const;
+
+ IrcChannel* channel() const;
+
+Q_SIGNALS:
+ void titleChanged(const QString& title);
+ void nameChanged(const QString& name);
+ void prefixChanged(const QString& prefix);
+ void modeChanged(const QString& mode);
+ void servOpChanged(bool servOp);
+ void awayChanged(bool away);
+
+private:
+ QScopedPointer<IrcUserPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcUser)
+ Q_DISABLE_COPY(IrcUser)
+};
+
+#ifndef QT_NO_DEBUG_STREAM
+IRC_MODEL_EXPORT QDebug operator<<(QDebug debug, const IrcUser* user);
+#endif // QT_NO_DEBUG_STREAM
+
+IRC_END_NAMESPACE
+
+Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcUser*))
+Q_DECLARE_METATYPE(QList<IRC_PREPEND_NAMESPACE(IrcUser*)>)
+
+#endif // IRCUSER_H
diff --git a/src/libcommuni/include/IrcModel/ircuser_p.h b/src/libcommuni/include/IrcModel/ircuser_p.h
new file mode 100644
index 0000000..0e88e6b
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircuser_p.h
@@ -0,0 +1,63 @@
+/*
+ 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 IRCUSER_P_H
+#define IRCUSER_P_H
+
+#include "ircuser.h"
+
+IRC_BEGIN_NAMESPACE
+
+class IrcUserPrivate
+{
+ Q_DECLARE_PUBLIC(IrcUser)
+
+public:
+ void setName(const QString& n);
+ void setPrefix(const QString& p);
+ void setMode(const QString& m);
+ void setServOp(const bool& o);
+ void setAway(const bool& a);
+
+ static IrcUserPrivate* get(IrcUser* user)
+ {
+ return user->d_func();
+ }
+
+ IrcUser* q_ptr;
+ IrcChannel* channel;
+ QString name;
+ QString prefix;
+ QString mode;
+ bool servOp;
+ bool away;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCUSER_P_H
diff --git a/src/libcommuni/include/IrcModel/ircusermodel.h b/src/libcommuni/include/IrcModel/ircusermodel.h
new file mode 100644
index 0000000..331af37
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircusermodel.h
@@ -0,0 +1,119 @@
+/*
+ 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 IRCUSERMODEL_H
+#define IRCUSERMODEL_H
+
+#include <Irc>
+#include <IrcGlobal>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qabstractitemmodel.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcUser;
+class IrcChannel;
+class IrcMessage;
+class IrcUserModelPrivate;
+
+class IRC_MODEL_EXPORT IrcUserModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged)
+ Q_PROPERTY(QStringList names READ names NOTIFY namesChanged)
+ Q_PROPERTY(QList<IrcUser*> users READ users NOTIFY usersChanged)
+ Q_PROPERTY(Irc::DataRole displayRole READ displayRole WRITE setDisplayRole)
+ Q_PROPERTY(IrcChannel* channel READ channel WRITE setChannel NOTIFY channelChanged)
+ Q_PROPERTY(Irc::SortMethod sortMethod READ sortMethod WRITE setSortMethod)
+ Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder)
+
+public:
+ explicit IrcUserModel(QObject* parent = 0);
+ virtual ~IrcUserModel();
+
+ IrcChannel* channel() const;
+ void setChannel(IrcChannel* channel);
+
+ int count() const;
+ bool isEmpty() const;
+ QStringList names() const;
+ QList<IrcUser*> users() const;
+ Q_INVOKABLE IrcUser* get(int index) const;
+ Q_INVOKABLE IrcUser* find(const QString& name) const;
+ Q_INVOKABLE bool contains(const QString& name) const;
+ Q_INVOKABLE int indexOf(IrcUser* user) const;
+
+ Irc::DataRole displayRole() const;
+ void setDisplayRole(Irc::DataRole role);
+
+ Irc::SortMethod sortMethod() const;
+ void setSortMethod(Irc::SortMethod method);
+
+ Qt::SortOrder sortOrder() const;
+ void setSortOrder(Qt::SortOrder order);
+
+ QModelIndex index(IrcUser* user) const;
+ IrcUser* user(const QModelIndex& index) const;
+
+ QHash<int, QByteArray> roleNames() const;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const;
+
+public Q_SLOTS:
+ void clear();
+ void sort(int column = 0, Qt::SortOrder order = Qt::AscendingOrder);
+ void sort(Irc::SortMethod method, Qt::SortOrder order = Qt::AscendingOrder);
+
+Q_SIGNALS:
+ void added(IrcUser* user);
+ void removed(IrcUser* user);
+ void aboutToBeAdded(IrcUser* user);
+ void aboutToBeRemoved(IrcUser* user);
+ void countChanged(int count);
+ void emptyChanged(bool empty);
+ void namesChanged(const QStringList& names);
+ void usersChanged(const QList<IrcUser*>& users);
+ void channelChanged(IrcChannel* channel);
+
+protected:
+ virtual bool lessThan(IrcUser* one, IrcUser* another, Irc::SortMethod method) const;
+
+private:
+ friend class IrcUserLessThan;
+ friend class IrcChannelPrivate;
+ friend class IrcUserGreaterThan;
+ QScopedPointer<IrcUserModelPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(IrcUserModel)
+ Q_DISABLE_COPY(IrcUserModel)
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCUSERMODEL_H
diff --git a/src/libcommuni/include/IrcModel/ircusermodel_p.h b/src/libcommuni/include/IrcModel/ircusermodel_p.h
new file mode 100644
index 0000000..45c00bb
--- /dev/null
+++ b/src/libcommuni/include/IrcModel/ircusermodel_p.h
@@ -0,0 +1,69 @@
+/*
+ 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 IRCUSERMODEL_P_H
+#define IRCUSERMODEL_P_H
+
+#include "ircuser.h"
+#include "ircchannel_p.h"
+#include "ircusermodel.h"
+#include <qpointer.h>
+
+IRC_BEGIN_NAMESPACE
+
+class IrcUserModelPrivate
+{
+ Q_DECLARE_PUBLIC(IrcUserModel)
+
+public:
+ IrcUserModelPrivate();
+
+ void addUser(IrcUser* user, bool notify = true);
+ void insertUser(int index, IrcUser* user, bool notify = true);
+ void removeUser(IrcUser* user, bool notify = true);
+ void setUsers(const QList<IrcUser*>& users, bool reset = true);
+ void renameUser(IrcUser* user);
+ void setUserMode(IrcUser* user);
+ void promoteUser(IrcUser* user);
+
+ static IrcUserModelPrivate* get(IrcUserModel* model)
+ {
+ return model->d_func();
+ }
+
+ IrcUserModel* q_ptr;
+ Irc::DataRole role;
+ QList<IrcUser*> userList;
+ QPointer<IrcChannel> channel;
+ Irc::SortMethod sortMethod;
+ Qt::SortOrder sortOrder;
+};
+
+IRC_END_NAMESPACE
+
+#endif // IRCUSERMODEL_P_H
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