summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/yahoo/yahoocontact.h
blob: ee840d160467830fc6c449b435be259eaffa912b (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
/*
    yahoocontact.h - Yahoo Contact

    Copyright (c) 2003-2004 by Matt Rogers <matt.rogers@kdemail.net>
    Copyright (c) 2002 by Duncan Mac-Vicar Prett <duncan@kde.org>

    Portions based on code by Bruno Rodrigues <bruno.rodrigues@litux.org>

    Copyright (c) 2002 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 YAHOOCONTACT_H
#define YAHOOCONTACT_H

/* Kopete Includes */
#include "kopetecontact.h"

class TDEAction;
class KTempFile;

namespace Kopete { class ChatSession; }
namespace Kopete { class MetaContact; }
namespace Kopete { class OnlineStatus; }
namespace Kopete { class Message; }
class YahooProtocol;
class YahooAccount;
class YahooWebcamDialog;
class YahooChatSession;
class YABEntry;
struct KURL;

class YahooContact : public Kopete::Contact
{
	Q_OBJECT
  
public:
	YahooContact( YahooAccount *account, const TQString &userId, const TQString &fullName, Kopete::MetaContact *metaContact );
	~YahooContact();

	/** Base Class Reimplementations **/
	virtual bool isOnline() const;
	virtual bool isReachable();
	virtual TQPtrList<TDEAction> *customContextMenuActions();
	virtual Kopete::ChatSession *manager( Kopete::Contact::CanCreateFlags canCreate= Kopete::Contact::CanCreate );
	virtual void serialize( TQMap<TQString, TQString> &serializedData, TQMap<TQString, TQString> &addressBookData );

	void setOnlineStatus(const Kopete::OnlineStatus &status);
	void setYahooStatus( const Kopete::OnlineStatus& );
	void setStealthed( bool );
	bool stealthed();


	/** The group name getter and setter methods**/
	TQString group() const;
	void setGroup( const TQString& );

	/** The userId getter method**/
	TQString userId() const;

	void receivedWebcamImage( const TQPixmap& );
	void webcamClosed( int );
	void webcamPaused();

	const YABEntry *yabEntry();

	static TQString prepareMessage( const TQString &messageText );

public slots:
	virtual void slotUserInfo();
	virtual void slotSendFile( const KURL &file );
	virtual void deleteContact();
	virtual void sendFile( const KURL &sourceURL = KURL(), const TQString &fileName = TQString(), uint fileSize = 0L );
	void slotUserProfile();
	void stealthContact();
	void requestWebcam();
	void inviteWebcam();
	void buzzContact();
	void setDisplayPicture(const TQByteArray &data, int checksum);
	void sendBuddyIconInfo( const TQString &url, int checksum );
	void sendBuddyIconUpdate( int type );
	void sendBuddyIconChecksum( int checksum );
	void setYABEntry( YABEntry *, bool show = false );

	/**
	 * Must be called after the contact list has been received
	 * or it doesn't work well!
	 */
	void syncToServer();

	void sync(unsigned int flags);

signals:
	void signalReceivedWebcamImage( const TQPixmap &pic );
	void signalWebcamClosed( int reason );
	void signalWebcamPaused();
	void displayPictureChanged();

private slots:
	void slotChatSessionDestroyed();
	void slotSendMessage( Kopete::Message& );
	void slotTyping( bool );
	void slotEmitDisplayPictureChanged();

	void closeWebcamDialog();
	void initWebcamViewer();
	void inviteConference();

	void writeYABEntry();
	void readYABEntry();

private:
	TQString m_userId;
	TQString m_groupName;
	YABEntry *m_YABEntry;
	YahooChatSession *m_manager;
	YahooWebcamDialog* m_webcamDialog;
	YahooAccount* m_account;
	bool m_stealthed;
	bool m_receivingWebcam;
	bool m_sessionActive;

	TDEAction* m_stealthAction;
	TDEAction* m_profileAction;
	TDEAction* m_webcamAction;
	TDEAction* m_inviteWebcamAction;
	TDEAction* m_buzzAction;
	TDEAction* m_inviteConferenceAction;
};

#endif