0adc53cafc2ae4607d2ea0d497d3139413bd5235
[profile/ivi/automotive-message-broker.git] / plugins / bluemonkey / irccoms.h
1 #ifndef COMMUNICATION_H
2 #define COMMUNICATION_H
3 #include <QObject>
4 #include <QVariant>
5 #include <QStringList>
6 #include <QSslError>
7 #include <map>
8 #include <QAbstractSocket>
9
10 #include <IrcSession>
11 #include <IrcMessage>
12
13 class IrcCommunication: public IrcSession
14 {
15         Q_OBJECT
16         Q_PROPERTY(QStringList channels READ channels WRITE setChannels)
17         Q_PROPERTY(bool ssl WRITE setSsl)
18 public:
19         IrcCommunication(std::map<std::string, std::string> config, QObject* parent=0);
20         QStringList channels() { return mChannels; }
21         void setChannels(QStringList c) { mChannels = c; }
22
23         void announceDequeue();
24
25 public Q_SLOTS:
26         void respond(QString target, QString msg);
27         void announce(QString);
28         void connect(QString host,int port, QString proxy, QString user, QString nick, QString pass);
29         void setSsl(bool use);
30         void setIgnoreInvalidCert(bool ignore);
31         void join(QString channel);
32
33         void debugMessage(QString v) { qDebug()<<v; }
34
35         void reconnect();
36
37 private Q_SLOTS:
38         void onMessageReceived(IrcMessage*);
39         void sslError(QList<QSslError>);
40         void socketError(QAbstractSocket::SocketError);
41
42 Q_SIGNALS:
43         void message(QString sender, QString prefix, QString codes);
44
45 private:
46         QStringList announceQueue;
47         QStringList mChannels;
48 };
49
50 #endif // COMMUNICATION_H