[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Aki] 351b59a: Added LinksReply class (needs to be parsing sectio
From: Keith Rusler <xzekecomax () gmail ! com>
Date: 2011-01-02 10:45:04
Message-ID: 20110102104504.704D1A6090 () git ! kde ! org
[Download RAW message or body]
A libaki/irc/private/linksreplyprivate.hpp [License: GPL(v2)]
A libaki/irc/private/linksreplyprivate.cxx [License: GPL(v2)]
A libaki/irc/linksreply.hpp [License: GPL(v2)]
A libaki/irc/linksreply.cxx [License: GPL(v2)]
commit 351b59adf472ce15d50b4b1d2b44329d40e5c3f2
Author: Keith Rusler <xzekecomax@gmail.com>
Date: Sun Jan 2 10:43:14 2011 +0000
Added LinksReply class (needs to be parsing section)
Added a fix for Afternet since it doesn't FOLLOW the IRC PROTOCOL for global and \
local users and I think the same for LINKS.
diff --git a/libaki/irc/CMakeLists.txt b/libaki/irc/CMakeLists.txt
index 0103664..a8f3e26 100644
--- a/libaki/irc/CMakeLists.txt
+++ b/libaki/irc/CMakeLists.txt
@@ -14,6 +14,7 @@ set(akicore_irc_SRCS
irc/invitesentreply.cxx
irc/joinreply.cxx
irc/kickreply.cxx
+ irc/linksreply.cxx
irc/localusersreply.cxx
irc/luserreply.cxx
irc/message.cxx
diff --git a/libaki/irc/globalusersreply.cxx b/libaki/irc/globalusersreply.cxx
index aff87b9..cdabec4 100644
--- a/libaki/irc/globalusersreply.cxx
+++ b/libaki/irc/globalusersreply.cxx
@@ -33,9 +33,15 @@ GlobalUsersReply::GlobalUsersReply(const Aki::Irc::ReplyInfo& \
replyInfo) : Aki::Irc::Reply(replyInfo),
_d(new Aki::Irc::GlobalUsersReplyPrivate)
{
- _d->global = replyInfo.params().at(1).toInt();
- _d->max = replyInfo.params().at(2).toInt();
- _d->message = replyInfo.params().at(3);
+ if (replyInfo.params().count() > 2) {
+ _d->global = replyInfo.params().at(1).toInt();
+ _d->max = replyInfo.params().at(2).toInt();
+ _d->message = replyInfo.params().at(3);
+ } else {
+ // This is a fix for afternet
+ // Need to make it so that we get the global/max count.
+ _d->message = replyInfo.params().at(1);
+ }
}
GlobalUsersReply::GlobalUsersReply(const Aki::Irc::GlobalUsersReply& other)
diff --git a/libaki/irc/linksreply.cxx b/libaki/irc/linksreply.cxx
new file mode 100644
index 0000000..4733276
--- /dev/null
+++ b/libaki/irc/linksreply.cxx
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009-2010 Keith Rusler <xzekecomax@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "linksreply.hpp"
+#include "private/linksreplyprivate.hpp"
+using namespace Aki;
+using namespace Irc;
+
+LinksReply::LinksReply()
+ : Aki::Irc::Reply(),
+ _d(new Aki::Irc::LinksReplyPrivate)
+{
+}
+
+LinksReply::LinksReply(const Aki::Irc::ReplyInfo& replyInfo)
+ : Aki::Irc::Reply(replyInfo),
+ _d(new Aki::Irc::LinksReplyPrivate)
+{
+}
+
+LinksReply::LinksReply(const Aki::Irc::LinksReply& other)
+ : Aki::Irc::Reply(other),
+ _d(other._d)
+{
+}
+
+LinksReply::~LinksReply()
+{
+}
+
+Aki::Irc::LinksReply&
+LinksReply::operator=(const Aki::Irc::LinksReply& other)
+{
+ Aki::Irc::Reply::operator=(other);
+ _d = other._d;
+ return *this;
+}
diff --git a/libaki/irc/linksreply.hpp b/libaki/irc/linksreply.hpp
new file mode 100644
index 0000000..00d3ec6
--- /dev/null
+++ b/libaki/irc/linksreply.hpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009-2010 Keith Rusler <xzekecomax@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ */
+
+#ifndef AKI_IRC_LINKSREPLY_HPP
+#define AKI_IRC_LINKSREPLY_HPP
+
+#include "aki.hpp"
+#include "irc/reply.hpp"
+
+namespace Aki
+{
+namespace Irc
+{
+class LinksReplyPrivate;
+class LinksReply
+ : public Aki::Irc::Reply
+{
+public:
+ LinksReply();
+ explicit LinksReply(const Aki::Irc::ReplyInfo& replyInfo);
+ LinksReply(const Aki::Irc::LinksReply& other);
+ ~LinksReply();
+ Aki::Irc::LinksReply& operator=(const Aki::Irc::LinksReply& other);
+private:
+ QSharedDataPointer<Aki::Irc::LinksReplyPrivate> _d;
+}; // End of class LinksReply.
+} // End of namespace Irc.
+} // End of namespace Aki.
+
+#endif // AKI_IRC_LINKSREPLY_HPP
diff --git a/libaki/irc/localusersreply.cxx b/libaki/irc/localusersreply.cxx
index c1ab5bd..2c489da 100644
--- a/libaki/irc/localusersreply.cxx
+++ b/libaki/irc/localusersreply.cxx
@@ -33,9 +33,15 @@ LocalUsersReply::LocalUsersReply(const Aki::Irc::ReplyInfo& \
replyInfo) : Aki::Irc::Reply(replyInfo),
_d(new Aki::Irc::LocalUsersReplyPrivate)
{
- _d->local = replyInfo.params().at(1).toInt();
- _d->max = replyInfo.params().at(2).toInt();
- _d->message = replyInfo.params().at(3);
+ if (replyInfo.params().count() > 2) {
+ _d->local = replyInfo.params().at(1).toInt();
+ _d->max = replyInfo.params().at(2).toInt();
+ _d->message = replyInfo.params().at(3);
+ } else {
+ // This is a fix for afternet
+ // Need to make it so that we get the local/max count.
+ _d->message = replyInfo.params().at(1);
+ }
}
LocalUsersReply::LocalUsersReply(const Aki::Irc::LocalUsersReply& other)
diff --git a/libaki/irc/private/CMakeLists.txt b/libaki/irc/private/CMakeLists.txt
index 0c7af36..836b9a2 100644
--- a/libaki/irc/private/CMakeLists.txt
+++ b/libaki/irc/private/CMakeLists.txt
@@ -12,6 +12,7 @@ set(akicore_ircprivate_SRCS
irc/private/invitesentreply_p.cxx
irc/private/joinreply_p.cxx
irc/private/kickreply_p.cxx
+ irc/private/linksreplyprivate.cxx
irc/private/localusersreply_p.cxx
irc/private/luserreply_p.cxx
irc/private/message_p.cxx
diff --git a/libaki/irc/private/linksreplyprivate.cxx \
b/libaki/irc/private/linksreplyprivate.cxx new file mode 100644
index 0000000..58893cf
--- /dev/null
+++ b/libaki/irc/private/linksreplyprivate.cxx
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009-2010 Keith Rusler <xzekecomax@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "linksreplyprivate.hpp"
+using namespace Aki;
+using namespace Irc;
+
+LinksReplyPrivate::LinksReplyPrivate()
+ : QSharedData()
+{
+}
+
+LinksReplyPrivate::LinksReplyPrivate(const Aki::Irc::LinksReplyPrivate& other)
+ : QSharedData(other)
+{
+}
diff --git a/libaki/irc/private/linksreplyprivate.hpp \
b/libaki/irc/private/linksreplyprivate.hpp new file mode 100644
index 0000000..d3f4038
--- /dev/null
+++ b/libaki/irc/private/linksreplyprivate.hpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009-2010 Keith Rusler <xzekecomax@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ */
+
+#ifndef AKI_IRC_LINKSREPLYPRIVATE_HPP
+#define AKI_IRC_LINKSREPLYPRIVATE_HPP
+
+#include "aki.hpp"
+#include <QtCore/QSharedData>
+
+namespace Aki
+{
+namespace Irc
+{
+class LinksReplyPrivate
+ : public QSharedData
+{
+public:
+ LinksReplyPrivate();
+ LinksReplyPrivate(const Aki::Irc::LinksReplyPrivate& other);
+public:
+
+}; // End of class LinksReplyPrivate.
+} // End of namespace Irc.
+} // End of namespace Aki.
+
+#endif // AKI_IRC_LINKSREPLYPRIVATE_HPP
diff --git a/libaki/irc/private/socket_p.cxx b/libaki/irc/private/socket_p.cxx
index fc919b5..204aea8 100644
--- a/libaki/irc/private/socket_p.cxx
+++ b/libaki/irc/private/socket_p.cxx
@@ -556,6 +556,7 @@ SocketPrivate::commandReceived(const Aki::Irc::ReplyInfo& \
message) break;
}
case RPL_SASLSUCCESS: {
+ _q->sendMessage(Aki::Irc::Rfc2812::raw("CAP END"));
break;
}
case ERR_SASLFAIL: {
@@ -627,13 +628,18 @@ SocketPrivate::messageReceived(const Aki::Irc::ReplyInfo& \
message) emit _q->onNoticeReply(Aki::Irc::NoticeReply(message));
}
} else if (command == "PRIVMSG") {
+ // We need to check if this is a ctcp reply privmsg.
if (message.params().at(1).startsWith('\1') &&
message.params().at(1).endsWith('\1')) {
+ // Get the message which will be for example <ACTION> <message>
QString tmpMessage = message.params().at(1);
+ // Remove the \1 from the beginning.
tmpMessage.remove(0, 1);
+ // Remove the last \1 at the end.
tmpMessage.remove(tmpMessage.count() - 1, 1);
+ // Remove the message from the start
const QString cmd = removeStringToFirstWhitespace(&tmpMessage);
if (cmd.toUpper() == "ACTION") {
emit \
_q->onActionReply(Aki::Irc::ActionReply(Aki::Irc::CtcpReply(message))); @@ -641,8 \
+647,10 @@ SocketPrivate::messageReceived(const Aki::Irc::ReplyInfo& message) emit \
_q->onCtcpReply(Aki::Irc::CtcpReply(message)); }
} else if (message.params().at(1) == _q->currentNick()) {
+ // We gotten a privmsg meant for the user only.
emit _q->onPrivateMessageReply(Aki::Irc::PrivateMessageReply(message));
} else {
+ // We gotten a privmsg meant for the channel.
emit _q->onChannelMessageReply(Aki::Irc::ChannelMessageReply(Aki::Irc::PrivateMessageReply(message)));
}
} else if (command == "KICK") {
@@ -700,6 +708,8 @@ SocketPrivate::messageReceived(const Aki::Irc::ReplyInfo& \
message)
_q->sendMessage(Aki::Irc::Rfc2812::raw(QString("AUTHENTICATE \
%1").arg(QString(base64)))); }
+ } else if (command == "PING") {
+ _q->sendMessage(Aki::Irc::Rfc2812::pong(message.params().at(0)));
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic