1
/****************************************************************************
2
** jabsess.h - keeps track of Jabber accounts/sessions
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 program; if not, write to the Free Software
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
19
****************************************************************************/
30
#include"contactview.h"
33
/****************************************************************************
34
JabSession, JabSessionManager
36
JabSession wraps a Jabber instance, as well as any other necessary
37
variables. With the help of JabSessionManager, a bunch of insane
38
signal remapping is done so that each event from Jabber can be associated
39
with the correct JabSession.
41
JabSession now handles much of the functionality that the old jabcon used
42
to. Also, organization-wise, I consider JabSession to be on the same
43
level in the class hierarchy as jabcon, so it need not always go through
44
jabcon to get things done. It can open its own windows, etc.
46
****************************************************************************/
47
class JabSessionManager;
49
class JabSession : public QObject
54
JabSession(JabSessionManager *par);
57
bool isActive() { return v_isActive; }
58
void setActive(bool b) { v_isActive = b; }
60
void setAccount(const UserAccount &);
61
void setContactProfile(ContactProfile *);
63
Jabber *serv() { return &v_serv; }
64
UserAccount *acc() { return &v_acc; }
65
ContactProfile *cp() { return v_cp; }
67
const QString &name() { return v_acc.name; }
70
void disc(bool fast=FALSE);
72
void setStatus(const StatusInfo &);
76
QString localStatusString;
78
bool isDisconnecting; // flag during user-initiated disconnect
86
void statusUpdate(JabUpdate *);
87
void error(JabError *);
89
void messageReceived(const JabMessage &);
91
void resourceAvailable(const Jid &, const JabResource &);
92
void resourceUnavailable(const Jid &);
94
void contactChanged(JabRosterEntry *);
95
void contactNew(JabRosterEntry *);
96
void contactRemove(JabRosterEntry *);
98
void authRequest(const Jid &from);
99
void authGrant(const Jid &from);
100
void authRemove(const Jid &from);
103
void secondsIdle(int);
107
void slotDisconnected();
113
ContactProfile *v_cp;
118
// JabSessionManager - remaps class Jabber signals
121
class JabSessionManager : public QObject
126
JabSessionManager(QObject *par=0);
127
~JabSessionManager();
129
void add(JabSession *);
132
JabSession *find(const QString &);
133
QPtrList<JabSession> getList() { return list; }
134
void childUpdate(JabSession *);
137
void sessionUpdate(JabSession *);
138
void accountSettingsChanged();
140
void jab_connected(JabSession *);
141
void jab_disconnected(JabSession *);
142
void jab_statusUpdate(JabSession *, JabUpdate *);
143
void jab_error(JabSession *, JabError *);
144
void jab_messageReceived(JabSession *, const JabMessage &);
145
void jab_resourceAvailable(JabSession *, const Jid &, const JabResource &);
146
void jab_resourceUnavailable(JabSession *, const Jid &);
147
void jab_contactChanged(JabSession *, JabRosterEntry *);
148
void jab_contactNew(JabSession *, JabRosterEntry *);
149
void jab_contactRemove(JabSession *, JabRosterEntry *);
150
void jab_authRequest(JabSession *, const Jid &);
151
void jab_authGrant(JabSession *, const Jid &);
152
void jab_authRemove(JabSession *, const Jid &);
155
void modify(const QString &);
156
void modify(JabSession *);
159
void slotConnected();
160
void slotDisconnected();
161
void slotStatusUpdate(JabUpdate *);
162
void slotError(JabError *);
163
void slotMessageReceived(const JabMessage &);
164
void slotResourceAvailable(const Jid &, const JabResource &);
165
void slotResourceUnavailable(const Jid &);
166
void slotContactChanged(JabRosterEntry *);
167
void slotContactNew(JabRosterEntry *);
168
void slotContactRemove(JabRosterEntry *);
169
void slotAuthRequest(const Jid &);
170
void slotAuthGrant(const Jid &);
171
void slotAuthRemove(const Jid &);
174
QPtrList<JabSession> list;