~nico-izo-ya/+junk/aaron2

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
/****************************************************************************
 * handlers.h
 *  Copyright © 2011, Vsevolod Velichko.
 *  Licence: GPLv3 or later
 *
 ****************************************************************************
 *                                                                          *
 *   This library 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 3 of the License, or      *
 *   (at your option) any later version.                                    *
 *                                                                          *
 ****************************************************************************/

#ifndef HANDLERS_7DSH42K4
#define HANDLERS_7DSH42K4

#include <jreen/message.h>
#include <QObject>
#include <QHash>
#include <jreen/vcard.h>

class Bot;
class HandlersPrivate;
class Handler;

class Handlers : public QObject
{
	Q_OBJECT
	Q_DECLARE_PRIVATE(Handlers);
	public:
		explicit Handlers(Bot *p);
		void process(Jreen::Message &message);
		void parsePingResult(const QString &nick, qint64 msecs, bool isError);
		void parseVersionResult(QString nick, QString name, QString version, QString os);
		void parseVcardResult(QString nick, Jreen::VCard::Ptr vcard);
	public slots:
		void onConnected();
	protected:
		HandlersPrivate * const d_ptr;
	private:
		Bot *bot;
		QHash<QString, Handler*> handlers;
    private slots:
        void onNewCommit(const QString &repo, const QString &message);
		void onNewBuild(const QString &repo, const QString &message);
};

#endif /* end of include guard: HANDLERS_7DSH42K4 */