identity.cpp
ignorelistmanager.cpp
ircchannel.cpp
+ ircevent.cpp
irclisthelper.cpp
ircuser.cpp
logger.cpp
message.cpp
+ messageevent.cpp
network.cpp
networkconfig.cpp
networkevent.cpp
bufferinfo.h
cliparser.h
event.h
+ ircevent.h
networkevent.h
+ messageevent.h
logger.h
message.h
types.h
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2010 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "ircevent.h"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2010 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef IRCEVENT_H
+#define IRCEVENT_H
+
+#include "networkevent.h"
+
+class IrcEvent : public NetworkEvent {
+public:
+ explicit IrcEvent(EventManager::EventType type, Network *network, const QString &prefix, const QStringList ¶ms = QStringList())
+ : NetworkEvent(type, network),
+ _prefix(prefix),
+ _params(params)
+ {}
+
+ inline QString prefix() const { return _prefix; }
+ inline void setPrefix(const QString &prefix) { _prefix = prefix; }
+
+ inline QStringList params() const { return _params; }
+ inline void setParams(const QStringList ¶ms) { _params = params; }
+
+private:
+ QString _prefix;
+ QStringList _params;
+
+};
+
+class IrcEventNumeric : public IrcEvent {
+public:
+ explicit IrcEventNumeric(uint number, Network *network, const QString &prefix, const QString &target, const QStringList ¶ms = QStringList())
+ : IrcEvent(EventManager::IrcEventNumeric, network, prefix, params),
+ _number(number),
+ _target(target)
+ {}
+
+ inline uint number() const { return _number; }
+
+ inline QString target() const { return _target; }
+ inline void setTarget(const QString &target) { _target = target; }
+
+private:
+ uint _number;
+ QString _target;
+
+};
+
+class IrcEventRawMessage : public IrcEvent {
+public:
+ explicit IrcEventRawMessage(EventManager::EventType type, Network *network, const QString &prefix, const QString &target, const QByteArray &rawMessage)
+ : IrcEvent(type, network, prefix, QStringList() << target),
+ _rawMessage(rawMessage)
+ {}
+
+ inline QString target() const { return params().at(0); }
+ inline void setTarget(const QString &target) { setParams(QStringList() << target); }
+
+ inline QByteArray rawMessage() const { return _rawMessage; }
+ inline void setRawMessage(const QByteArray &rawMessage) { _rawMessage = rawMessage; }
+
+private:
+ QByteArray _rawMessage;
+};
+
+#endif
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2010 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "messageevent.h"
+
+
+MessageEvent::MessageEvent(Message::Type msgType, Network *net, const QString &msg, const QString &target, const QString &sender, Message::Flags flags)
+ : NetworkEvent(EventManager::MessageEvent, net),
+ _msgType(msgType),
+ _text(msg),
+ _target(target),
+ _sender(sender),
+ _msgFlags(flags)
+{
+ IrcChannel *channel = network()->ircChannel(_target);
+ if(!channel) {
+ if(!_target.isEmpty() && network()->prefixes().contains(_target.at(0)))
+ _target = _target.mid(1);
+
+ if(_target.startsWith('$') || _target.startsWith('#'))
+ _target = nickFromMask(sender);
+ }
+
+ _bufferType = bufferTypeByTarget(_target);
+}
+
+BufferInfo::Type MessageEvent::bufferTypeByTarget(const QString &target) const {
+ if(target.isEmpty())
+ return BufferInfo::StatusBuffer;
+
+ if(network()->isChannelName(target))
+ return BufferInfo::ChannelBuffer;
+
+ return BufferInfo::QueryBuffer;
+}
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2010 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef MESSAGEEVENT_H
+#define MESSAGEEVENT_H
+
+#include "message.h"
+#include "networkevent.h"
+
+// this corresponds to CoreSession::RawMessage for now and should contain the information we need to convert events
+// into messages for the legacy code to work with
+
+class MessageEvent : public NetworkEvent {
+
+public:
+ explicit MessageEvent(Message::Type msgType,
+ Network *network,
+ const QString &msg,
+ const QString &target = QString(),
+ const QString &sender = QString(),
+ Message::Flags msgFlags = Message::None
+ );
+
+ inline Message::Type msgType() const { return _msgType; }
+ inline void setMsgType(Message::Type type) { _msgType = type; }
+
+ inline BufferInfo::Type bufferType() const { return _bufferType; }
+ inline void setBufferType(BufferInfo::Type type) { _bufferType = type; }
+
+ inline QString target() const { return _target; }
+ inline QString text() const { return _text; }
+ inline QString sender() const { return _sender; }
+
+ inline Message::Flags msgFlags() const { return _msgFlags; }
+ inline void setMsgFlag(Message::Flag flag) { _msgFlags |= flag; }
+ inline void setMsgFlags(Message::Flags flags) { _msgFlags = flags; }
+
+private:
+ BufferInfo::Type bufferTypeByTarget(const QString &target) const;
+
+ Message::Type _msgType;
+ BufferInfo::Type _bufferType;
+ QString _text, _target, _sender;
+ Message::Flags _msgFlags;
+};
+
+#endif