2
oscaraccount.h - Oscar Account Class
4
Copyright (c) 2002 by Tom Linsky <twl6@po.cwru.edu>
5
Copyright (c) 2002 by Chris TenHarmsel <tenharmsel@staticmethod.net>
6
Kopete (c) 2002-2008 by the Kopete developers <kopete-devel@kde.org>
8
*************************************************************************
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
15
*************************************************************************
18
#ifndef OSCARACCOUNT_H
19
#define OSCARACCOUNT_H
24
#include "kopetepasswordedaccount.h"
25
#include "oscartypeclasses.h"
26
#include "oscarcontact.h"
28
#include "kopete_export.h"
36
class FileTransferInfo;
44
class OscarAccountPrivate;
48
class OSCAR_EXPORT OscarAccount : public Kopete::PasswordedAccount
53
OscarAccount(Kopete::Protocol *parent, const QString &accountID, bool isICQ=false);
54
virtual ~OscarAccount();
56
/** Provide the derived accounts and contacts with access to the backend */
57
Oscar::Client* engine();
59
/** Disconnects this account */
60
virtual void disconnect();
63
* Handle the various ways we can be logged off the oscar service
64
* and handle the passthrough of the disconnection through the API.
66
void logOff( Kopete::Account::DisconnectReason );
69
* Was the password wrong last time we tried to connect?
71
bool passwordWasWrong();
74
* Fill the menu for this account
76
virtual void fillActionMenu( KActionMenu *actionMenu ) = 0;
79
* Sets the identity this account belongs to
81
virtual bool setIdentity( Kopete::Identity *ident );
83
/** Set the server address */
84
void setServerAddress( const QString& server );
86
/** Set the server port */
87
void setServerPort( int port );
89
/** Set the server encryption */
90
void setServerEncrypted( bool encrypted );
92
/** Set the proxy server address */
93
void setProxyServerAddress( const QString& server );
95
/** Set the proxy server port */
96
void setProxyServerPort( int port );
98
/** Set the proxy server encryption */
99
void setProxyServerEncrypted( bool encrypted );
101
void setProxyServerEnabled(bool);
103
/** Returns codec for account's default encoding */
104
QTextCodec* defaultCodec() const;
107
* Returns codec for given contact's encoding or default one
108
* if contact has no encoding
110
QTextCodec* contactCodec( const OscarContact* contact ) const;
113
* Returns codec for given contact's encoding or default one
114
* if contact has no encoding
116
QTextCodec* contactCodec( const QString& contactName ) const;
121
void updateBuddyIcon( const QString &path );
124
* Add a contact to the server site list
125
* \param contactName the screen name of the new contact to add
126
* \param groupName the group of the new contact
127
* \param autoAddGroup if the group doesn't exist add that group
128
* \return true if the contact will be added
130
bool addContactToSSI( const QString& contactName, const QString& groupName, bool autoAddGroup );
133
* Change a contact's group on the server
134
* \param contact the contact to change
135
* \param newGroup the new group to move the contact to
136
* \param autoAddGroup if the new group doesn't exist add that group
137
* \return true if the contact will be added
139
bool changeContactGroupInSSI( const QString& contact, const QString& newGroupName, bool autoAddGroup );
142
void slotGoOffline();
148
* Adds a contact to a meta contact
150
friend class OscarProtocol;
151
virtual bool createContact(const QString &contactId,
152
Kopete::MetaContact *parentContact );
155
* Protocols using Oscar must implement this to perform the instantiation
156
* of their contact for Kopete. Called by @ref createContact().
157
* @param contactId theprotocol unique id of the contact
158
* @param parentContact the parent metacontact
159
* @return whether the creation succeeded or not
161
virtual OscarContact *createNewContact( const QString &contactId, Kopete::MetaContact *parentContact, const OContact& ssiItem ) = 0;
163
void updateVersionUpdaterStamp();
165
virtual QString sanitizedMessage( const QString& message ) const;
169
//! do stuff on login
170
virtual void loginActions();
172
void processSSIList();
174
void kopeteGroupRemoved( Kopete::Group* g );
175
void kopeteGroupAdded( Kopete::Group* g );
176
void kopeteGroupRenamed( Kopete::Group* g, const QString& oldName );
178
virtual void messageReceived( const Oscar::Message& message );
180
void ssiGroupAdded( const OContact& );
181
void ssiGroupUpdated( const OContact& ) {}
182
void ssiGroupRemoved( const OContact& ) {}
183
void ssiContactAdded( const OContact& );
184
void ssiContactUpdated( const OContact& );
185
void ssiContactRemoved( const OContact& ) {}
187
/* slots for receiving typing notifications, and notify the appropriate OscarContact */
188
void userStartedTyping( const QString & contact );
189
void userStoppedTyping( const QString & contact );
191
void nonServerAddContactDialogClosed();
193
/** incoming filetransfer */
194
void incomingFileTransfer( FileTransferHandler* handler );
196
void fileTransferDestroyed( QObject* handler );
197
void fileTransferCancelled();
198
void fileTransferRefused( const Kopete::FileTransferInfo& info );
199
void fileTransferAccept( Kopete::Transfer* t , const QString& fileName );
201
void chatroomRequest( ChatRoomHandler* handler );
205
void accountDisconnected( Kopete::Account::DisconnectReason reason );
208
QString getFLAPErrorMessage( int code );
210
/** Updates buddy icon item in ssi */
211
void updateBuddyIconInSSI();
213
QString makeWellFormedXML( const QString& message ) const;
215
QString addQuotesAroundAttributes( QString message ) const;
217
QString sanitizedPlainMessage( const QString& message ) const;
219
QList<QDomNode> getElementsByTagNameCI( const QDomNode& node, const QString& tagName ) const;
222
/** Handler from socket errors from a connection */
223
void slotSocketError( int, const QString& );
225
/** Handle task errors from the client */
226
void slotTaskError( const Oscar::SNAC& s, int errCode, bool fatal ) ;
228
/** Sends buddy icon to server */
229
void slotSendBuddyIcon();
231
/** Identity's property changed */
232
void slotIdentityPropertyChanged( Kopete::PropertyContainer *container, const QString &key,
233
const QVariant &oldValue, const QVariant &newValue );
236
* Setup a ClientStream for engine
238
void createClientStream( ClientStream **clientStream );
241
OscarAccountPrivate *d;
247
//kate: tab-width 4; indent-mode csands;