summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/msn/msncontact.h
blob: 42667682dc10fbebd5b18bad95beca9e5d729e68 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
    msncontact.h - MSN Contact

    Copyright (c) 2002      by Duncan Mac-Vicar Prett <duncan@kde.org>
    Copyright (c) 2002      by Ryan Cumming           <bodnar42@phalynx.dhs.org>
    Copyright (c) 2002      by Martijn Klingens       <klingens@kde.org>
    Copyright (c) 2002-2005 by Olivier Goffart        <ogoffart at kde.org>
    Copyright (c) 2005      by Michaƫl Larouche       <michael.larouche@kdemail.net>

    Kopete    (c) 2002-2005 by the Kopete developers  <kopete-devel@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 MSNCONTACT_H
#define MSNCONTACT_H

#include "kopetecontact.h"
#include "kopeteonlinestatus.h"

#include <kurl.h>

class TQListView;
class TQListViewItem;
class TQPixmap;
class TQTimer;

class MSNChatSession;
class KAction;
class KActionCollection;
class KTempFile;

namespace Kopete { class Protocol; }
namespace Kopete { class OnlineStatus; }

class MSNContact : public Kopete::Contact
{
	Q_OBJECT
  TQ_OBJECT

public:
	MSNContact( Kopete::Account *account, const TQString &id, Kopete::MetaContact *parent );
	~MSNContact();

	/**
	 * Indicate whether this contact is blocked
	 */
	bool isBlocked() const;
	void setBlocked( bool b );

	/**
	 * Indicate whether this contact is deleted
	 *   (not on the serverside list)
	 */
	bool isDeleted() const;
	void setDeleted( bool d );

	/**
	 * Indicate whether this contact is allowed
	 */
	bool isAllowed() const;
	void setAllowed( bool d );

	/**
	 * Indicate whether this contact is on the reversed list
	 */
	bool isReversed() const;
	void setReversed( bool d );
	
	/**
	 * set one phone number
	 */
	void setInfo(const TQString &type, const TQString &data);

	/**
	 * The groups in which the user is located on the server.
	 */
	const TQMap<TQString, Kopete::Group *>  serverGroups() const;
	/**
	 * clear that map
	 */
	void clearServerGroups();
	
	/**
	 * client flags  (say what version of msn messenger the contact is using)
	 */
	uint clientFlags() const;
	void setClientFlags( uint );

	virtual bool isReachable();

	virtual TQPtrList<KAction> *customContextMenuActions();

	/**
	 * update the server group map
	 */
	void contactRemovedFromGroup( const TQString& groupId );
	void contactAddedToGroup(const TQString& groupId, Kopete::Group *group );

	virtual void serialize( TQMap<TQString, TQString> &serializedData, TQMap<TQString, TQString> &addressBookData );

	/**
	 * Rename contact on server
	 */
	virtual void rename( const TQString &newName ) KDE_DEPRECATED;

	/**
	 * Returns the MSN Message Manager associated with this contact
	 */
	virtual Kopete::ChatSession *manager( Kopete::Contact::CanCreateFlags = Kopete::Contact::CannotCreate );


	/**
	 * Because blocked contact have a small auto-modified status
	 */
	void setOnlineStatus(const Kopete::OnlineStatus&);

	TQString guid();
	TQString phoneHome();
	TQString phoneWork();
	TQString phoneMobile();

	void setObject(const TQString &obj);
	TQString object() const { return m_obj; }

public slots:
	virtual void slotUserInfo();
	virtual void deleteContact();
	virtual void sendFile( const KURL &sourceURL = KURL(),
						   const TQString &fileName = TQString(), uint fileSize = 0L );

	/**
	 * Every time the kopete's contactlist is modified, we sync the serverlist with it
	 */
	virtual void sync( unsigned int cvhanged= 0xff);


	void setDisplayPicture(KTempFile *f) ;

signals:
	void displayPictureChanged();

private slots:
	void slotBlockUser();
	void slotShowProfile();
	void slotSendMail();
	void slotEmitDisplayPictureChanged();

	/**
	 * Workaround to make this checkboxe readonly
	 */
	void slotUserInfoDialogReversedToggled();

private:
	TQMap<TQString, Kopete::Group *> m_serverGroups;

	bool m_blocked;
	bool m_allowed;
	bool m_deleted;
	bool m_reversed;
	bool m_moving;
	bool m_phone_mob;
	
	uint m_clientFlags;

	TQString m_phoneHome;
	TQString m_phoneWork;
	TQString m_phoneMobile;


	KAction *actionBlock;
	KAction *actionShowProfile;
	KAction *actionSendMail;
	KAction *actionWebcamReceive;
	KAction *actionWebcamSend;

	TQString m_obj; //the MSNObject

	/**
	 * keep the current status here.  (it's normally already in Kopete::Contact::d->onlineStatus)
	 * This is a workaround to prevent problems with the account offline status.
	 */
	Kopete::OnlineStatus m_currentStatus;

	//MSNProtocol::deserializeContact need to acess some contact insternals
	friend class MSNProtocol;
};

#endif

// vim: set noet ts=4 sts=4 sw=4: