compile
[kdenetwork.git] / kopete / protocols / jabber / jabberbasecontact.h
blob4e5fd5ee58cbffbda80f82e8ac06c928dc1ac537
1 /*
2 * jabbercontact.h - Base class for the Kopete Jabber protocol contact
4 * Copyright (c) 2002-2004 by Till Gerken <till@tantalo.net>
5 * Copyright (c) 2002 by Daniel Stone <dstone@kde.org>
7 * Kopete (c) by the Kopete developers <kopete-devel@kde.org>
9 * *************************************************************************
10 * * *
11 * * This program is free software; you can redistribute it and/or modify *
12 * * it under the terms of the GNU General Public License as published by *
13 * * the Free Software Foundation; either version 2 of the License, or *
14 * * (at your option) any later version. *
15 * * *
16 * *************************************************************************
19 #ifndef JABBERBASECONTACT_H
20 #define JABBERBASECONTACT_H
22 #include "kopetecontact.h"
23 #include "xmpp.h"
24 #include "im.h"
25 //Added by qt3to4:
26 #include <Q3PtrList>
28 class dlgJabberVCard;
29 class JabberProtocol;
30 class JabberAccount;
31 class JabberResource;
32 namespace Kopete { class MetaContact; }
34 class JabberBaseContact : public Kopete::Contact
37 Q_OBJECT
38 friend class JabberAccount; /* Friends can touch each other's private parts. */
40 public:
42 JabberBaseContact (const XMPP::RosterItem &rosterItem,
43 JabberAccount *account, Kopete::MetaContact * mc);
45 /********************************************************************
47 * Kopete::Contact reimplementation start
49 ********************************************************************/
51 /**
52 * Return the protocol instance associated with this contact
54 JabberProtocol *protocol ();
56 /**
57 * Return the account instance associated with this contact
59 JabberAccount *account ();
61 /**
62 * Return if the contact is reachable (this is true if the account
63 * is online)
65 virtual bool isReachable ();
67 /**
68 * Create custom context menu items for the contact
69 * FIXME: implement manager version here?
71 virtual QList<KAction*> *customContextMenuActions () = 0;
73 /**
74 * Serialize contact
76 virtual void serialize (QMap < QString, QString > &serializedData, QMap < QString, QString > &addressBookData);
78 /**
79 * Update contact if a roster item has been
80 * received for it. (used during login)
82 void updateContact ( const XMPP::RosterItem &item );
84 /**
85 * Deal with an incoming message for this contact.
87 virtual void handleIncomingMessage ( const XMPP::Message &message ) = 0;
89 /**
90 * Update the resource property of the
91 * contact, listing all available resources.
93 void updateResourceList ();
95 /**
96 * Re-evaluate online status. Gets called
97 * whenever a resource is added, removed, or
98 * changed in the resource pool.
100 void reevaluateStatus ();
103 * Return current full address.
104 * Uses bestResource() if no presubscribed
105 * address exists.
107 QString fullAddress ();
110 * Set the dontSync flag for this contact.
111 * If this flag is set, calls to @ref sync will
112 * be ignored. This is required if the contact
113 * has been moved between groups on the server
114 * after we logged in and we try to update our
115 * local contact list. Since libkopete can only
116 * handle one group update at a time, moving
117 * between groups requires to operations which
118 * each in turn would cause a call to sync(),
119 * overwriting the change that is being carried
120 * out. (besides causing unnecessary traffic)
121 * This is avoided by setting the dontSync flag
122 * while synchronizing the local copy.
124 void setDontSync ( bool flag );
127 * Return the status of the dontSync flag.
128 * See @ref setDontSync for a full description.
130 bool dontSync ();
132 public slots:
135 * Retrieve a vCard for the contact
137 virtual void slotUserInfo () = 0;
139 protected:
141 * Construct best address out of
142 * eventually preselected resource
143 * (due to subscription) and best
144 * available resource.
146 XMPP::Jid bestAddress ();
149 * This will simply cache all
150 * relevant data for this contact.
152 XMPP::RosterItem mRosterItem;
154 private:
155 bool mDontSync;
159 #endif
161 // vim: set noet ts=4 sts=4 sw=4: