-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotocolhandler.h
More file actions
46 lines (37 loc) · 914 Bytes
/
protocolhandler.h
File metadata and controls
46 lines (37 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef PROTOCOLHANDLER_H
#define PROTOCOLHANDLER_H
#include <QObject>
#include <QTcpSocket>
#include <QString>
#include <QTimer>
#include "packet.h"
class ProtocolHandler : public QObject
{
Q_OBJECT
private:
QTcpSocket sock_;
QString host_;
QString port_;
QString nickname_;
QString currentChan_;
QTimer timer_;
QByteArray inBuf_;
bool registered_;
public:
explicit ProtocolHandler(QObject *parent = 0);
void setHostAndPort(const QString& host, const QString& Port);
void connectToServer();
void disconnectFromServer();
void sendMessage(const QString& mess);
QString getTextMsg();
private:
void sendPacket(Packet& packet);
signals:
void connected();
void NewMessage(const QString& mess);
public slots:
void slotConnected();
void slotRead();
void slotError(QAbstractSocket::SocketError e);
};
#endif // PROTOCOLHANDLER_H