summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/winpopup/wpprotocol.h
blob: 6082c8fbb9217bfeccbc86b67e0e144b3632da04 (plain)
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
/***************************************************************************
     wpprotocol.h  -  Base class for the Kopete WP protocol
                             -------------------
    begin                : Fri Apr 26 2002
    copyright            : (C) 2002 by Gav Wood
    email                : gav@kde.org

    Based on code from   : (C) 2002 by Duncan Mac-Vicar Prett
    email                : duncan@kde.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef WPPROTOCOL_H
#define WPPROTOCOL_H

// QT Includes
#include <tqpixmap.h>
#include <tqptrlist.h>
#include <tqdatetime.h>

// Kopete Includes
#include "kopetemetacontact.h"
#include "kopeteprotocol.h"
#include "kopeteonlinestatus.h"

// Local Includes
#include "libwinpopup.h"
#include "wpaddcontact.h"

namespace Kopete { class Account; }
class TDEPopupMenu;
class TDEActionMenu;
class TDEAction;
class WPContact;
class WPAccount;

/**
 * The actual Protocol class used by Kopete.
 */
class WPProtocol : public Kopete::Protocol
{
	TQ_OBJECT
  

// Kopete::Protocol overloading
public:
	WPProtocol( TQObject *parent, const char *name, const TQStringList &args );
	~WPProtocol();

	virtual AddContactPage *createAddContactWidget(TQWidget *parent, Kopete::Account *theAccount);
	virtual KopeteEditAccountWidget *createEditAccountWidget(Kopete::Account *account, TQWidget *parent);
	virtual Kopete::Account *createNewAccount(const TQString &accountId);

	const TQStringList getGroups() {return popupClient->getGroups(); }
	const TQStringList getHosts(const TQString &Group) { return popupClient->getHosts(Group); }
	bool checkHost(const TQString &Name) { return popupClient->checkHost(Name); }

// Kopete::Plugin overloading
public:
	virtual Kopete::Contact *deserializeContact(Kopete::MetaContact *metaContact, const TQMap<TQString, TQString> &serializedData, const TQMap<TQString, TQString> &addressBookData);

// Stuff used internally & by colleague classes
public:
	static WPProtocol *protocol() { return sProtocol; }

	const Kopete::OnlineStatus WPOnline;
	const Kopete::OnlineStatus WPAway;
	const Kopete::OnlineStatus WPOffline;
	void sendMessage(const TQString &Body, const TQString &Destination);
	void settingsChanged(void);			// Callback when settings changed

public slots:
	void installSamba();				// Modify smb.conf to use winpopup-send.sh script
	void slotReceivedMessage(const TQString &Body, const TQDateTime &Time, const TQString &From);

private:
	TQString smbClientBin;
	int groupCheckFreq;
	void readConfig();
	WinPopupLib *popupClient;
	static WPProtocol *sProtocol;			// Singleton
};

#endif