summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/gadu/gaducontact.h
blob: a96c1dedb9d8865ff1547ad6a6916fedf8c17dce (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// -*- Mode: c++-mode; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
//
// Copyright (C) 2003 Grzegorz Jaskiewicz 	<gj at pointblue.com.pl>
// Copyright (C) 	2002-2003	 Zack Rusin 	<[email protected]>
//
// gaducontact.h
//
// 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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301, USA.

#ifndef GADUCONTACT_H
#define GADUCONTACT_H

#include <tqpoint.h>
#include <tqhostaddress.h>

#include "gaducontactlist.h"

#include "kopeteaccount.h"
#include "kopetecontact.h"
#include "kopetemessage.h"

#include <libgadu.h>

class KAction;
class GaduAccount;
namespace Kopete { class Account; }
namespace Kopete { class ChatSession; }
class KGaduNotify;
class QString;
class QStringList;

class GaduContact : public Kopete::Contact
{
	Q_OBJECT

public:
	GaduContact( unsigned int, const TQString&, Kopete::Account*, Kopete::MetaContact* );

	virtual bool isReachable();
	virtual void serialize( TQMap<TQString, TQString>&, TQMap<TQString, TQString>& );
	virtual TQPtrList<KAction>* customContextMenuActions();
	virtual TQString identityId() const;

	GaduContactsList::ContactLine* contactDetails();

	// this one set's only:
	// email, firstname, surname, phonenr, ignored, nickname
	// uin is const for GaduContact, and displayname needs to be changed through metaContact
	bool setContactDetails( const GaduContactsList::ContactLine* );

	void setParentIdentity( const TQString& );
	void setIgnored( bool );
	bool ignored();

	static TQString findBestContactName( const GaduContactsList::ContactLine* );
	void changedStatus( KGaduNotify* );

	uin_t uin() const;

	TQHostAddress&  contactIp();
	unsigned short contactPort();
	
public slots:
	void slotUserInfo();
	void deleteContact();
	void messageReceived( Kopete::Message& );
	void messageSend( Kopete::Message&, Kopete::ChatSession* );
	void messageAck();
	void slotShowPublicProfile();
	void slotEditContact();
	virtual void sendFile( const KURL &sourceURL = KURL(),
		const TQString &fileName = TQString::null, uint fileSize = 0L );


protected:
	virtual Kopete::ChatSession* manager( Kopete::Contact::CanCreateFlags canCreate = Kopete::Contact::CanCreate );
	void initActions();

private:
	const uin_t		uin_;
	bool 			ignored_;

	Kopete::ChatSession*	msgManager_;
	QString			description_;
	QString			parentIdentity_;
	GaduAccount*		account_;

	KAction*		actionSendMessage_;
	KAction*		actionInfo_;
	KAction*		actionRemove_;

	TQPtrList<Kopete::Contact>	thisContact_;


	TQHostAddress remote_ip;
	unsigned int remote_port;
	unsigned int version;
	unsigned int image_size;


private slots:
	void slotChatSessionDestroyed();

};

#endif