This repository has been archived by the owner on Oct 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
irchandler.h
92 lines (70 loc) · 2.18 KB
/
irchandler.h
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
Copyright 2011 Gene Chen
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef IRCHANDLER_H
#define IRCHANDLER_H
#include <QTabWidget>
#include <QMap>
#include <QStringList>
#include <QUrl>
#include <QDateTime>
#include <Irc>
#include <IrcMessage>
#include <IrcSession>
#include <IrcCommand>
#include <IrcSender>
class ChannelHandler;
class FriendsHandler;
enum MessageType
{
Normal,
Sys,
Err,
Friends
};
class IrcHandler : public QTabWidget
{
Q_OBJECT
public:
IrcHandler(QWidget* parent);
void connectToIrc(QString name);
void part(QString channel) { if(irc) irc->sendCommand(IrcCommand::createPart(channel)); }
public slots:
void connected();
void disconnected();
void messageReceived(IrcMessage *message);
void handleChat(QString&, QString&);
void myCloseTab(int);
void showTextCurrentTab(QString, MessageType=Normal);
void reloadSkin();
void joinedGame(QString, QString);
void handleUrl(QUrl);
signals:
void showMessage(QString, int timeout=3000);
void notifyMessage(QString, QString, int timeout=3000);
void requestGame(QString);
private:
IrcSession *irc;
QMap<QString, ChannelHandler*> m_ChannelMap;
QMap<QString, FriendsHandler*> m_FriendsMap;
QString m_Username;
QStringList m_Friends;
void removeTabName(QString name);
void joinedChannel(IrcSender origin, IrcJoinMessage* joinMsg);
void partedChannel(IrcSender origin, IrcPartMessage* partMsg);
void quitMessage(IrcSender origin, IrcQuitMessage* quitMsg);
void privateMessage(IrcSender origin, IrcPrivateMessage* privMsg);
void noticeMessage(IrcSender origin, IrcNoticeMessage* noticeMsg);
void nickMessage(IrcSender origin, IrcNickMessage* nickMsg);
void numericMessage(IrcNumericMessage* numMsg);
};
#endif