summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/oscar/icq/icqcontact.h
blob: f811bf81dc485ff0d5caf90701c21d4948f1e22b (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
/*
  icqcontact.h  -  ICQ Contact

  Copyright (c) 2003 by Stefan Gehn  <metz AT gehn.net>
  Copyright (c) 2003 by Olivier Goffart
  Copyright (c) 2004 by Richard Smith               <kde@metafoo.co.uk>
  Kopete    (c) 2002-2004 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 ICQCONTACT_H
#define ICQCONTACT_H

#include "oscarcontact.h"
#include "userdetails.h"

class OscarEncodingSelectionDialog;
class TDEAction;
class TDEToggleAction;
namespace Kopete { class ChatSession; }
namespace Kopete { class OnlineStatus; }
class ICQProtocol;
class ICQAccount;
class OscarAccount;
class ICQUserInfo; // user info dialog
class ICQReadAway;

class ICQGeneralUserInfo;
class ICQWorkUserInfo;
class ICQUserInfoWidget;
class ICQInterestInfoWidget;

/**
 * Contact for ICQ over Oscar protocol
 * @author Stefan Gehn
 * @author Richard Smith
 * @author Matt Rogers
 */
class ICQContact : public OscarContact
{
TQ_OBJECT
  

public:

	/** Normal ICQ constructor */
	ICQContact( ICQAccount *account, const TQString &name, Kopete::MetaContact *parent,
	            const TQString& icon = TQString(), const Oscar::SSI& ssiItem = Oscar::SSI()  );
	virtual ~ICQContact();

	/**
	 * Returns a set of custom menu items for
	 * the context menu
	 */
	virtual TQPtrList<TDEAction> *customContextMenuActions();

	/** Return whether or not this contact is reachable. */
	virtual bool isReachable();


	//virtual const TQString awayMessage();
	//virtual void setAwayMessage(const TQString &message);

public slots:
	virtual void slotUserInfo();
	virtual void updateSSIItem();
	void userInfoUpdated( const TQString& contact, const UserDetails& details );

	void userOnline( const TQString& userId );
	void userOffline( const TQString& userID );
	void loggedIn();

	void requestShortInfo();

signals:
	void haveBasicInfo( const ICQGeneralUserInfo& );
	void haveWorkInfo( const ICQWorkUserInfo& );
	void haveEmailInfo( const ICQEmailInfo& );
	void haveMoreInfo( const ICQMoreUserInfo& );
	void haveInterestInfo( const ICQInterestInfo& );

private:
	bool cachedBuddyIcon( TQByteArray hash );
	bool m_buddyIconDirty;
	
	bool m_requestingNickname;
	ICQProtocol *mProtocol;
	ICQUserInfoWidget* m_infoWidget;
	/*
	ICQReadAway *awayMessageDialog;
	TDEAction *actionReadAwayMessage;
	*/
	TDEAction *actionRequestAuth;
	TDEAction *actionSendAuth;
    TDEAction *m_selectEncoding;
	
	TDEToggleAction *m_actionIgnore;
	TDEToggleAction *m_actionVisibleTo;
	TDEToggleAction *m_actionInvisibleTo;

	/*
	bool mInvisible;
	*/

    OscarEncodingSelectionDialog* m_oesd;

protected slots:
	virtual void slotSendMsg(Kopete::Message& message, Kopete::ChatSession *);
	virtual void updateFeatures();

private slots:
	/** Request authorization from this contact */
	void slotRequestAuth();

	/** Authorize this contact */
	void slotSendAuth();

	void slotAuthReplyDialogOkClicked();

	/** We have received an auth request */
	void slotGotAuthRequest( const TQString& contact, const TQString& reason );

	/** We have received an auth reply */
	void slotGotAuthReply( const TQString& contact, const TQString& reason, bool granted );

	void closeUserInfoDialog();

	void receivedLongInfo( const TQString& contact );
	void receivedShortInfo( const TQString& contact );

    void changeContactEncoding();
    void changeEncodingDialogClosed( int );

	void requestBuddyIcon();
	void haveIcon( const TQString&, TQByteArray );
	void receivedStatusMessage( const TQString &contact, const TQString &message );
	void receivedStatusMessage( const Oscar::Message &message );

//void slotCloseAwayMessageDialog();
	//void slotReadAwayMessage();

	void slotIgnore();
	void slotVisibleTo();
	void slotInvisibleTo();
};

#endif