2
* psiaccount.h - handles a Psi account
3
* Copyright (C) 2001, 2002 Justin Karneges
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
#include"contactview.h"
59
//class AvatarFactory;
61
class PGPKeyDlg : public PGPKeyUI
65
PGPKeyDlg(const OpenPGP::KeyList &, const QString &choose, QWidget *parent=0, const char *name=0);
68
QString keyID() const;
69
QString userID() const;
72
void qlv_doubleClicked(QListViewItem *);
80
class AccountLabel : public QLabel
84
AccountLabel(PsiAccount *, QWidget *parent=0, bool simpleMode=false);
96
class PGPTransaction : public OpenPGP::Request
100
PGPTransaction(OpenPGP::Engine *);
104
const Message & message() const;
105
void setMessage(const Message &);
106
const QDomElement & xml() const;
107
void setXml(const QDomElement &);
110
void setJid(const Jid &);
117
// sick sick remove this someday please!
125
class PsiAccount : public QObject
129
PsiAccount(const UserAccount &acc, PsiCon *parent);
132
bool enabled() const;
133
void setEnabled(bool e = TRUE);
135
bool isActive() const;
136
bool isConnected() const;
137
const QString &name() const;
139
const UserAccount & userAccount() const;
140
void setUserAccount(const UserAccount &);
141
const Jid & jid() const;
142
QString nameWithJid() const;
144
XMPP::Client *client() const;
145
ContactProfile *contactProfile() const;
146
EventQueue *eventQueue() const;
151
//AvatarFactory *avatarFactory() const;
153
Status status() const;
154
void setStatusDirect(const Status &);
155
void setStatusActual(const Status &);
157
void logout(bool fast=false, const Status &s = Status("", "Logged out", 0, false));
158
bool loggedIn() const;
159
void setNick(const QString &);
160
QString nick() const;
161
QString pgpKey() const;
162
QHostAddress *localAddress() const;
164
QWidget *dialogFind(const char *className, const Jid &jid="");
165
void dialogRegister(QWidget *w, const Jid &jid="");
166
void dialogUnregister(QWidget *w);
171
void changeStatus(int);
174
void showXmlConsole();
175
void openAddUserDlg();
176
void openGroupChat(const Jid &);
177
bool groupChatJoin(const QString &host, const QString &room, const QString &nick);
178
void groupChatSetStatus(const QString &host, const QString &room, const Status &);
179
void groupChatChangeNick(const QString &host, const QString &room, const QString& nick, const Status &);
180
void groupChatLeave(const QString &host, const QString &room);
182
UserListItem *find(const Jid &) const;
183
QPtrList<UserListItem> findRelavent(const Jid &) const;
184
UserListItem *findFirstRelavent(const Jid &) const;
185
UserList *userList() const;
187
bool checkConnected(QWidget *parent=0);
188
void playSound(const QString &);
190
QLabel *accountLabel(QWidget *parent=0, bool simpleMode=false);
191
QStringList hiddenChats(const Jid &) const;
193
int sendMessageEncrypted(const Message &);
195
// sucks sucks sucks sucks sucks sucks sucks
196
GCContact *findGCContact(const Jid &j);
197
QStringList groupchats() const;
199
void toggleSecurity(const Jid &, bool);
200
bool ensureKey(const Jid &);
201
void tryVerify(UserListItem *, UserResource *);
203
static QString resultToString(int result);
204
static void getErrorInfo(int err, AdvancedConnector *conn, Stream *stream, QCATLSHandler *tlsHandler, QString *_str, bool *_reconn);
206
void deleteQueueFile();
210
void updatedActivity();
211
void updatedAccount();
213
void updateContact(const UserListItem &);
214
void updateContact(const Jid &);
215
void updateContact(const Jid &, bool);
217
void pgpKeyChanged();
218
void encryptedMessageSent(int, bool);
221
void setStatus(const Status &);
223
void secondsIdle(int);
224
void openNextEvent();
226
void dj_sendMessage(const Message &, bool log=true);
227
void dj_composeMessage(const Jid &jid, const QString &body);
228
void dj_composeMessage(const Jid &jid, const QString &body, const QString &subject, const QString &thread);
229
void dj_addAuth(const Jid &);
230
void dj_add(const Jid &, const QString &, const QStringList &, bool authReq);
231
void dj_authReq(const Jid &);
232
void dj_auth(const Jid &);
233
void dj_deny(const Jid &);
234
void dj_rename(const Jid &, const QString &);
235
void dj_remove(const Jid &);
237
void actionDefault(const Jid &);
238
void actionRecvEvent(const Jid &);
239
void actionSendMessage(const Jid &);
240
void actionSendMessage(const JidList &);
241
void actionSendUrl(const Jid &);
242
void actionRemove(const Jid &);
243
void actionRename(const Jid &, const QString &);
244
void actionGroupRename(const QString &, const QString &);
245
void actionHistory(const Jid &);
246
void actionStatusShow(const Jid &);
247
void actionOpenChat(const Jid &);
248
void actionOpenChatSpecific(const Jid &);
249
void actionAgentSetStatus(const Jid &, int);
250
void actionInfo(const Jid &);
251
void actionAuth(const Jid &);
252
void actionAuthRequest(const Jid &);
253
void actionAuthRemove(const Jid &);
254
void actionAdd(const Jid &);
255
void actionGroupAdd(const Jid &, const QString &);
256
void actionGroupRemove(const Jid &, const QString &);
257
void actionHistoryBox(PsiEvent *);
258
void actionTest(const Jid &);
259
void actionRegister(const Jid &);
260
void actionSearch(const Jid &);
261
void actionJoin(const Jid &);
262
void actionDisco(const Jid &, const QString &);
263
void actionInvite(const Jid &, const QString &);
264
void actionSendFile(const Jid &);
265
void actionSendFiles(const Jid &, const QStringList&);
266
void featureActivated(QString feature, Jid jid, QString node);
268
void actionAssignKey(const Jid &);
269
void actionUnassignKey(const Jid &);
271
void invokeGCMessage(const Jid &);
272
void invokeGCChat(const Jid &);
273
void invokeGCInfo(const Jid &);
274
void invokeGCFile(const Jid &);
277
void tls_handshaken();
279
void cs_securityLayerActivated();
280
void cs_needAuthParams(bool, bool, bool);
281
void cs_authenticated();
282
void cs_connectionClosed();
283
void cs_delayedCloseFinished();
284
void cs_warning(int);
286
void client_rosterRequestFinished(bool, int, const QString &);
287
void client_rosterItemUpdated(const RosterItem &);
288
void client_rosterItemRemoved(const RosterItem &);
289
void client_resourceAvailable(const Jid &, const Resource &);
290
void client_resourceUnavailable(const Jid &, const Resource &);
291
void client_presenceError(const Jid &, int, const QString &);
292
void client_messageReceived(const Message &);
293
void client_subscription(const Jid &, const QString &);
294
void client_debugText(const QString &);
295
void client_groupChatJoined(const Jid &);
296
void client_groupChatLeft(const Jid &);
297
void client_groupChatPresence(const Jid &, const Status &);
298
void client_groupChatError(const Jid &, int, const QString &);
299
void client_incomingJidLink();
300
void client_incomingFileTransfer();
304
void enableNotifyOnline();
306
void slotClientVersionFinished();
308
void chatMessagesRead(const Jid &);
310
void slotCheckVCard();
312
void pgpToggled(bool);
313
void pgpKeysUpdated();
315
void trySignPresence();
316
void pgp_needPassphrase();
317
void pgp_signFinished(bool);
318
void pgp_verifyFinished(bool);
319
void pgp_finished(bool);
320
void pgp_decryptFinished(bool);
322
void submitPassphrase(const QString &);
323
void rejectPassphrase();
325
void optionsUpdate();
327
void processReadNext(const UserListItem &);
328
void processReadNext(const Jid &);
331
void handleEvent(PsiEvent *);
338
void deleteAllDialogs();
340
void simulateContactOffline(UserListItem *);
341
void simulateRosterOffline();
342
void cpUpdate(const UserListItem &, const QString &rname="", bool fromPresence=false);
343
void logEvent(const Jid &, PsiEvent *);
344
void queueEvent(PsiEvent *);
345
void openNextEvent(const UserListItem &);
346
void updateReadNext(const Jid &);
347
ChatDlg *ensureChatDlg(const Jid &);
348
void lastStepLogin();
349
void processIncomingMessage(const Message &);
350
void processEncryptedMessage(const Message &);
351
void processMessageQueue();
352
void processEncryptedMessageNext();
353
void processEncryptedMessageDone();
354
void verifyStatus(const Jid &j, const Status &s);
356
void promptPassphrase();
357
void processChats(const Jid &);
358
void openChat(const Jid &);
359
EventDlg *ensureEventDlg(const Jid &);
362
bool isDisconnecting, notifyOnlineOk, doReconnect, usingAutoStatus, rosterDone, presenceSent, v_isActive;
363
void cleanupStream();