SET(quassel_mono_SRCS main/main_mono.cpp)
SET(quassel_core_SRCS main/main_core.cpp)
SET(quassel_RCCS images/icons.qrc)
-SET(quassel_DIRS gui core)
+SET(quassel_DIRS gui core network)
# Build correct absolute paths for subdirs to include
SET(SDIRS "")
SET(QT_DONT_USE_QTGUI true) # This is added later if GUI is requested
INCLUDE(${QT_USE_FILE})
+ADD_SUBDIRECTORY(network)
ADD_SUBDIRECTORY(core)
QT4_ADD_RESOURCES(_RCCS ${quassel_RCCS})
IF(BUILD_CORE)
ADD_EXECUTABLE(quasselcore ${quassel_core_SRCS} ${_RCCS})
- TARGET_LINK_LIBRARIES(quasselcore core ${QT_LIBRARIES})
+ TARGET_LINK_LIBRARIES(quasselcore core network ${QT_LIBRARIES})
ENDIF(BUILD_CORE)
IF(BUILD_GUI OR BUILD_MONO) # OK, now we need QtGui!
IF(BUILD_MONO)
ADD_SUBDIRECTORY(gui)
ADD_EXECUTABLE(quassel ${quassel_mono_SRCS} ${_RCCS})
- TARGET_LINK_LIBRARIES(quassel gui core ${QT_LIBRARIES})
+ TARGET_LINK_LIBRARIES(quassel gui core network ${QT_LIBRARIES})
ENDIF(BUILD_MONO)
IF(BUILD_GUI)
#include "quassel.h"
#include "logger.h"
#include "proxy.h"
+#include "messages.h"
#include <QString>
#include <QDomDocument>
void Quassel::init() {
//initIconMap();
+ Message::init();
}
void Quassel::setLogger(Logger *) {
#include "proxy.h"
#include "mainwin.h"
+#include "messages.h"
int main(int argc, char **argv) {
Logger *logger = new Logger();
Quassel::setLogger(logger);
+ Message *m = new Message("admin");
+ //m->*(m->getCmdHandler())(QStringList(""));
+ (m->*(m->getCmdHandler()))(QStringList());
+ exit(0);
+
QApplication app(argc, argv);
QApplication::setOrganizationDomain("quassel-irc.org");
--- /dev/null
+SET(network_SRCS messages.cpp builtin_cmds.cpp builtin_handlers.cpp server.cpp)
+SET(network_HDRS messages.h server.h)
+SET(network_MOCS )
+
+QT4_WRAP_CPP(_MOC ${network_MOCS})
+ADD_LIBRARY(network ${_MOC} ${network_SRCS} ${network_HDRS})
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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 <QtGlobal>
+#include "messages.h"
+
+
+#define _(str) QT_TR_NOOP(str)
+
+/** Defines the message codes according to RFCs 1495/281x.
+ * Named commands have a negative enum value.
+ */
+
+BuiltinCmd builtins[] = {
+ { _("admin"), _("Get information about the administrator of a server."),
+ _("[server]"), _("server: Server"),
+ &Message::test1 },
+
+
+ { 0, 0, 0, 0, 0 }
+};
+
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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 "messages.h"
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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 "messages.h"
+#include <QtDebug>
+
+extern BuiltinCmd builtins[];
+
+QHash<QString, CmdType> Message::cmdTypes;
+
+Message::Message(QString _cmd, QStringList args) {
+ cmd = _cmd; qDebug() << "cmd: " << cmd;
+ params = args;
+}
+
+void Message::init() {
+ // Register builtin commands
+ for(int i = 0; ; i++) {
+ if(!builtins[i].handler) break;
+ CmdType c;
+ c.cmd = builtins[i].cmd.toLower();
+ c.cmdDescr = builtins[i].cmdDescr;
+ c.args = builtins[i].args;
+ c.argsDescr = builtins[i].argsDescr;
+ c.handler = builtins[i].handler;
+ cmdTypes.insert(c.cmd, c);
+ }
+
+}
+
+cmdhandler Message::getCmdHandler() {
+ CmdType c = cmdTypes[cmd];
+ if(c.handler) return c.handler;
+ qDebug() << "No handler defined for " << cmd << "!";
+ return 0;
+}
+
+/*
+void Message::parseParams(QString str) {
+ QString left = str.section(':', 0, 0);
+ QString trailing = str.section(':', 1);
+ if(left.size()) {
+ params << left.split(' ', QString::SkipEmptyParts);
+ }
+ if(trailing.size()) {
+ params << trailing;
+ }
+ qDebug() << params;
+
+}
+*/
+void Message::test1(QStringList foo) { qDebug() << "Test 1! " << cmd; };
+
+void Message::test2(QStringList bar) { qDebug() << "Test 2!"; };
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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 _MESSAGES_H_
+#define _MESSAGES_H_
+
+#include <QHash>
+#include <QString>
+#include <QStringList>
+
+class Message;
+
+typedef void (Message::* cmdhandler)(QStringList);
+
+/**
+ * This contains information that depends (solely) on the message type, such as the handler function and help texts.
+ * Most of these are defined at compile time, but more may be added at runtime.
+ */
+struct CmdType {
+ QString cmd;
+ QString cmdDescr;
+ QString args;
+ QString argsDescr;
+ cmdhandler handler;
+
+};
+
+/**
+ *
+*/
+class Message {
+ public:
+ uint type;
+ QString prefix;
+ QString cmd;
+ QStringList params;
+
+ Message(QString cmd, QStringList args = 0);
+
+ virtual ~Message() {};
+
+ static void init();
+ //static registerCmd();
+ //static unregisterCmd();
+
+ cmdhandler getCmdHandler();
+
+ void test1(QStringList);
+ void test2(QStringList);
+
+ protected:
+ static QHash<QString, CmdType> cmdTypes;
+};
+
+
+/** This is only used to have a nice way for defining builtin commands.
+ * We create an array of these in builtin_cmds.cpp and read this to fill our
+ * command hash.
+ */
+struct BuiltinCmd {
+ QString cmd;
+ QString cmdDescr;
+ QString args;
+ QString argsDescr;
+ cmdhandler handler;
+};
+
+#endif
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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 _MSGCODES_H_
+#define _MSGCODES_H_
+
+
+
+
+
+
+#endif
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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. *
+ ***************************************************************************/
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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 _SERVER_H_
+#define _SERVER_H_
+
+#include <QtCore>
+#include <QtNetwork>
+
+class Server {
+ Q_OBJECT
+
+
+
+ private:
+
+};
+
+class Connection : public QThread {
+
+
+
+};
+
+
+#endif
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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. *
+ ***************************************************************************/
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by The Quassel Team *
+ * 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) any later version. *
+ * *
+ * 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. *
+ ***************************************************************************/
+