1// -*- Mode: c++-mode; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
2//
3// Copyright (C) 2003 Grzegorz Jaskiewicz <gj at pointblue.com.pl>
4// Copyright (C) 2002-2003 Zack Rusin <zack@kde.org>
5//
6// gaducontact.h
7//
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License
10// as published by the Free Software Foundation; either version 2
11// of the License, or (at your option) any later version.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21// 02110-1301, USA.
22
23#ifndef GADUCONTACT_H
24#define GADUCONTACT_H
25
26#include <qpoint.h>
27#include <qhostaddress.h>
28#include <qlist.h>
29
30#include "gaducontactlist.h"
31
32#include "kopeteaccount.h"
33#include "kopetecontact.h"
34#include "kopetemessage.h"
35
36#include <libgadu.h>
37
38class KAction;
39class GaduAccount;
40namespace Kopete { class Account; }
41namespace Kopete { class ChatSession; }
42class KGaduNotify;
43class QString;
44
45class GaduContact : public Kopete::Contact
46{
47 Q_OBJECT
48
49public:
50 GaduContact( unsigned int, Kopete::Account*, Kopete::MetaContact* );
51
52 virtual bool isReachable();
53 virtual void serialize( QMap<QString, QString>&, QMap<QString, QString>& );
54 virtual QList<KAction*>* customContextMenuActions();
55 using Kopete::Contact::customContextMenuActions;
56 virtual QString identityId() const;
57
58 GaduContactsList::ContactLine* contactDetails();
59
60 // this one set's only:
61 // email, firstname, surname, phonenr, ignored, nickname
62 // uin is const for GaduContact, and displayname needs to be changed through metaContact
63 bool setContactDetails( const GaduContactsList::ContactLine* );
64
65 void setParentIdentity( const QString& );
66 void setIgnored( bool );
67 bool ignored();
68
69 static QString findBestContactName( const GaduContactsList::ContactLine* );
70 void changedStatus( KGaduNotify* );
71
72 uin_t uin() const;
73
74 QHostAddress& contactIp();
75 unsigned short contactPort();
76
77public slots:
78 void slotUserInfo();
79 void deleteContact();
80 void messageReceived( Kopete::Message& );
81 void messageSend( Kopete::Message&, Kopete::ChatSession* );
82 void messageAck();
83 void slotShowPublicProfile();
84 void slotEditContact();
85 virtual void sendFile( const KUrl &sourceURL = KUrl(),
86 const QString &fileName = QString(), uint fileSize = 0L );
87
88
89protected:
90 virtual Kopete::ChatSession* manager( Kopete::Contact::CanCreateFlags canCreate = Kopete::Contact::CanCreate );
91 void initActions();
92
93private:
94 const uin_t uin_;
95 bool ignored_;
96
97 Kopete::ChatSession* msgManager_;
98 QString description_;
99 QString parentIdentity_;
100 GaduAccount* account_;
101
102 QList<Contact*> thisContact_;
103
104 QHostAddress remote_ip;
105 unsigned int remote_port;
106 unsigned int version;
107 unsigned int image_size;
108
109
110private slots:
111 void slotChatSessionDestroyed();
112
113};
114
115#endif
116