summaryrefslogtreecommitdiffstats
path: root/src/core/pvsChatClient.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/pvsChatClient.h')
-rw-r--r--src/core/pvsChatClient.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/core/pvsChatClient.h b/src/core/pvsChatClient.h
new file mode 100644
index 0000000..2cb5d9f
--- /dev/null
+++ b/src/core/pvsChatClient.h
@@ -0,0 +1,71 @@
+/*
+# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+*/
+
+// pvsChatClient.h
+
+#ifndef PVSCHATCLIENT_H_
+#define PVSCHATCLIENT_H_
+
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sstream>
+#include <fstream>
+#include <QStringList>
+#include <QHash>
+#include "src/net/pvsMsg.h"
+#include "src/core/pvsChatMsg.h"
+#include "src/net/pvsServerConnection.h"
+#include "src/util/consoleLogger.h"
+#include "src/util/util.h"
+
+class PVS; // forward declaration.
+
+class PVSChatClient
+{
+
+public:
+
+ PVSChatClient();
+ ~PVSChatClient();
+ void setServerConnection(PVSServerConnection* sc);
+ void setSource(QString name);
+ QString getSource();
+ QStringList getClients();
+ QString getIPFromUsername(QString username);
+ void addClient(QString name, QString ip);
+ void removeClient(QString name);
+ void clearClients();
+ void send(QString tar, QString msg);
+ void receive(PVSMsg recv);
+ bool isRegistered();
+ EventDispatcher<PVSChatMsg>& getChatMsgHandler()
+ {
+ return _chatMessageDispatcher;
+ };
+ EventDispatcher<PVSChatMsg>& getChatCommandHandler()
+ {
+ return _chatCommandDispatcher;
+ };
+
+private:
+
+ QString _source;
+ bool _registered;
+ QStringList _clients;
+ QHash<QString, QString> _clientsData;
+ PVSServerConnection *_chatServerConnection;
+ EventDispatcher<PVSChatMsg> _chatMessageDispatcher;
+ EventDispatcher<PVSChatMsg> _chatCommandDispatcher;
+};
+#endif