summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/testbed/testbedcontact.h
blob: 381926ba9a92e4c764d63345fe3c84526df63322 (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
93
94
95
96
/*
    testbedcontact.h - Kopete Testbed Protocol

    Copyright (c) 2003      by Will Stephenson		 <will@stevello.free-online.co.uk>
    Kopete    (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>

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

#ifndef TESTBEDCONTACT_H
#define TESTBEDCONTACT_H

#include <tqmap.h>
#include "kopetecontact.h"
#include "kopetemessage.h"

class TDEAction;
class TDEActionCollection;
namespace Kopete { class Account; }
namespace Kopete { class ChatSession; }
namespace Kopete { class MetaContact; }

/**
@author Will Stephenson
*/
class TestbedContact : public Kopete::Contact
{
	TQ_OBJECT
  
public:
	/**
	 * The range of possible contact types
	 */
	enum TestbedContactType { Null, Echo };

	TestbedContact( Kopete::Account* _account, const TQString &uniqueName, 
			const TestbedContact::TestbedContactType type, const TQString &displayName, 
			Kopete::MetaContact *parent );

    ~TestbedContact();

    virtual bool isReachable();
	/**
	 * Serialize the contact's data into a key-value map
	 * suitable for writing to a file
	 */
    virtual void serialize(TQMap< TQString, TQString >& serializedData,
			TQMap< TQString, TQString >& addressBookData);
	/**
	 * Return the actions for this contact
	 */
	virtual TQPtrList<TDEAction> *customContextMenuActions();
	/**
	 * Returns a Kopete::ChatSession associated with this contact
	 */
	virtual Kopete::ChatSession *manager( CanCreateFlags canCreate = CannotCreate );

public slots:
	/**
	 * Transmits an outgoing message to the server 
	 * Called when the chat window send button has been pressed
	 * (in response to the relevant Kopete::ChatSession signal)
	 */
	void sendMessage( Kopete::Message &message );
	/**
	 * Called when an incoming message arrived
	 * This displays it in the chatwindow
	 */
	void receivedMessage( const TQString &message );

protected slots:
	/**
	 * Show the settings dialog
	 */
	void showContactSettings();
	/**
	 * Notify the contact that its current Kopete::ChatSession was
	 * destroyed - probably by the chatwindow being closed
	 */
	void slotChatSessionDestroyed();
	
protected:
	Kopete::ChatSession* m_msgManager;
	TDEActionCollection* m_actionCollection;
	TestbedContactType m_type;
	TDEAction* m_actionPrefs;
};

#endif