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
|
/*
gwcontact.h - Kopete GroupWise Protocol
Copyright (c) 2004 SUSE Linux AG http://www.suse.com
Based on Testbed
Copyright (c) 2003 by Will Stephenson <[email protected]>
Blocking status taken from MSN
Copyright (c) 2002 by Duncan Mac-Vicar Prett <[email protected]>
Copyright (c) 2002 by Ryan Cumming <[email protected]>
Copyright (c) 2002-2003 by Martijn Klingens <[email protected]>
Copyright (c) 2002-2004 by Olivier Goffart <ogoffart @ kde.org>
Kopete (c) 2002-2003 by the Kopete developers <[email protected]>
*************************************************************************
* *
* This library 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 GW_CONTACT_H
#define GW_CONTACT_H
#include <tqdict.h>
#include <tqmap.h>
#include "kopetecontact.h"
#include "kopetemessage.h"
#include "gwerror.h"
#include "gwfield.h"
#include "gwmessagemanager.h"
class KAction;
class KActionCollection;
namespace Kopete { class Account; }
class GroupWiseAccount;
class GroupWiseChatSession;
class GroupWiseProtocol;
namespace Kopete { class MetaContact; }
using namespace GroupWise;
/**
@author Will Stephenson
*/
class GroupWiseContact : public Kopete::Contact
{
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructor
* @param account The GroupWiseAccount this belongs to.
* @param uniqueName The userId for this contact. May be a DN, in which case it will be converted to dotted format for the contactId and stored.
* @param tqparent The Kopete::MetaContact this contact is part of.
* @param objectId The contact's numeric object ID.
* @param parentId The ID of this contact's tqparent (folder).
* @param sequence This contact's sequence number (The position it appears in within its tqparent).
*/
GroupWiseContact( Kopete::Account* account, const TQString &uniqueName,
Kopete::MetaContact *tqparent,
const int objectId, const int parentId, const int sequence );
~GroupWiseContact();
/**
* Access this contact's Kopete::Account subclass
*/
GroupWiseAccount * account();
/**
* Access this contact's Kopete::Protocol subclass
*/
GroupWiseProtocol * protocol();
/**
* Get the contact's DN (used for communications with the server, not the contactId )
*/
TQString dn() const;
/**
* Update the contact's status and metadata from the supplied fields
*/
void updateDetails( const GroupWise::ContactDetails & details );
virtual bool isReachable();
/**
* Serialize the contact's data into a key-value map
* suitable for writing to a file
*/
virtual void serialize(TQMap< TQString, TQString >& serializedData,
TQMap< TQString, TQString >& addressBookData);
/**
* Return the actions for this contact
*/
virtual TQPtrList<KAction> *customContextMenuActions();
/**
* Returns a Kopete::ChatSession associated with this contact
*/
virtual Kopete::ChatSession *manager( Kopete::Contact::CanCreateFlags canCreate = Kopete::Contact::CannotCreate );
/**
* Access the contact's server properties
*/
TQMap< TQString, TQString > serverProperties();
/**
* Updates this contact's group membership and display name on the server
*/
void sync( unsigned int);
/**
* Updates this contact's online status, including blocking status
*/
void setOnlineStatus(const Kopete::OnlineStatus& status);
/**
* Are this contact's chats being administratively logged?
*/
bool archiving() const;
/**
* Is this contact in the process of being deleted
*/
bool deleting() const;
/**
* Mark this contact as being deleted
*/
void setDeleting( bool deleting );
/**
* Marks this contact as having sent a message whilst apparently offline
*/
void setMessageReceivedOffline( bool on );
/**
* Has this contact sent a message whilst apparently offline?
*/
bool messageReceivedOffline() const;
public slots:
/**
* Transmits an outgoing message to the server
* Called when the chat window send button has been pressed
* (in response to the relevant Kopete::ChatSession signal)
*/
void sendMessage( Kopete::Message &message );
/**
* Delete this contact on the server
*/
virtual void deleteContact();
/**
* Called when the call to rename the contact on the server has completed
*/
void renamedOnServer();
protected:
// debug function to see what message managers we have on the server
void dumpManagers();
protected slots:
/**
* Show the contact's properties
*/
void slotUserInfo();
/**
* Block or unblock the contact, toggle its current blocking state
*/
void slotBlock();
/**
* Receive notification that this contact's privacy setting changed - update status
*/
void receivePrivacyChanged( const TQString &, bool );
protected:
KActionCollection* m_actionCollection;
int m_objectId;
int m_parentId;
int m_sequence;
TQString m_dn;
TQString m_displayName;
KAction* m_actionPrefs;
KAction *m_actionBlock;
// Novell Messenger Properties, as received by the server.
// Unfortunately we don't the domain of the set of keys, so they are not easily mappable to KopeteContactProperties
TQMap< TQString, TQString > m_serverProperties;
bool m_archiving;
// HACK: flag used to differentiate between 'all contact list instances gone while we are moving on the server'
// and 'all contact list instances gone because we wanted to delete them all'
bool m_deleting;
bool m_messageReceivedOffline;
};
#endif
|