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
196
197
198
199
200
201
202
203
204
|
/*
oscaraccount.h - Oscar Account Class
Copyright (c) 2002 by Tom Linsky <[email protected]>
Copyright (c) 2002 by Chris TenHarmsel <[email protected]>
Kopete (c) 2002-2003 by the Kopete developers <[email protected]>
*************************************************************************
* *
* 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 OSCARACCOUNT_H
#define OSCARACCOUNT_H
#include <qdict.h>
#include <qstring.h>
#include <qwidget.h>
#include "kopetepasswordedaccount.h"
#include "oscartypeclasses.h"
#include "oscarcontact.h"
namespace Kopete
{
class Contact;
class Group;
}
class Client;
class Connection;
class OscarContact;
class OscarAccountPrivate;
class QTextCodec;
class KDE_EXPORT OscarAccount : public Kopete::PasswordedAccount
{
Q_OBJECT
public:
OscarAccount(Kopete::Protocol *parent, const QString &accountID, const char *name=0L, bool isICQ=false);
virtual ~OscarAccount();
/** Provide the derived accounts and contacts with access to the backend */
Client* engine();
/** Disconnects this account */
virtual void disconnect();
/**
* Handle the various ways we can be logged off the oscar service
* and handle the passthrough of the disconnection through the API.
*/
void logOff( Kopete::Account::DisconnectReason );
/**
* Was the password wrong last time we tried to connect?
*/
bool passwordWasWrong();
/**
* Sets the account away
*/
virtual void setAway( bool away, const QString &awayMessage = QString::null ) = 0;
/**
* Accessor method for the action menu
*/
virtual KActionMenu* actionMenu() = 0;
/** Set the server address */
void setServerAddress( const QString& server );
/** Set the server port */
void setServerPort( int port );
/** Returns codec for account's default encoding */
QTextCodec* defaultCodec() const;
/**
* Returns codec for given contact's encoding or default one
* if contact has no encoding
*/
QTextCodec* contactCodec( const OscarContact* contact ) const;
/**
* Returns codec for given contact's encoding or default one
* if contact has no encoding
*/
QTextCodec* contactCodec( const QString& contactName ) const;
/**
* Sets buddy icon
*/
void setBuddyIcon( KURL url );
/**
* Add a contact to the server site list
* \param contactName the screen name of the new contact to add
* \param groupName the group of the new contact
* \param autoAddGroup if the group doesn't exist add that group
* \return true if the contact will be added
*/
bool addContactToSSI( const QString& contactName, const QString& groupName, bool autoAddGroup );
/**
* Change a contact's group on the server
* \param contact the contact to change
* \param newGroup the new group to move the contact to
* \param autoAddGroup if the new group doesn't exist add that group
* \return true if the contact will be added
*/
bool changeContactGroupInSSI( const QString& contact, const QString& newGroupName, bool autoAddGroup );
public slots:
void slotGoOffline();
void slotGoOnline();
protected:
/**
* Setup a connection for a derived account based on the host and port
*/
Connection* setupConnection( const QString& server, uint port );
/**
* Adds a contact to a meta contact
*/
virtual bool createContact(const QString &contactId,
Kopete::MetaContact *parentContact );
/**
* Protocols using Oscar must implement this to perform the instantiation
* of their contact for Kopete. Called by @ref createContact().
* @param contactId theprotocol unique id of the contact
* @param parentContact the parent metacontact
* @return whether the creation succeeded or not
*/
virtual OscarContact *createNewContact( const QString &contactId, Kopete::MetaContact *parentContact, const SSI& ssiItem ) = 0;
virtual QString sanitizedMessage( const QString& message ) = 0;
void updateVersionUpdaterStamp();
protected slots:
//! do stuff on login
virtual void loginActions();
void processSSIList();
void kopeteGroupRemoved( Kopete::Group* g );
void kopeteGroupAdded( Kopete::Group* g );
void kopeteGroupRenamed( Kopete::Group* g, const QString& oldName );
virtual void messageReceived( const Oscar::Message& message );
void ssiGroupAdded( const Oscar::SSI& );
void ssiGroupUpdated( const Oscar::SSI& ) {}
void ssiGroupRemoved( const Oscar::SSI& ) {}
void ssiContactAdded( const Oscar::SSI& );
void ssiContactUpdated( const Oscar::SSI& );
void ssiContactRemoved( const Oscar::SSI& ) {}
/* slots for receiving typing notifications, and notify the appropriate OscarContact */
void userStartedTyping( const QString & contact );
void userStoppedTyping( const QString & contact );
void nonServerAddContactDialogClosed();
signals:
void accountDisconnected( Kopete::Account::DisconnectReason reason );
void buddyIconChanged();
private:
QString getFLAPErrorMessage( int code );
private slots:
/** Handler from socket errors from a connection */
void slotSocketError( int, const QString& );
/** Handle task errors from the client */
void slotTaskError( const Oscar::SNAC& s, int errCode, bool fatal ) ;
/** Sends buddy icon to server */
void slotSendBuddyIcon();
private:
OscarAccountPrivate *d;
};
#endif
//kate: tab-width 4; indent-mode csands;
|