~ubuntu-branches/ubuntu/edgy/psi/edgy

« back to all changes in this revision

Viewing changes to src/jabcon.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2002-04-19 02:28:44 UTC
  • Revision ID: james.westby@ubuntu.com-20020419022844-za7xgai5qyfd9xv6
Tags: upstream-0.8.5
ImportĀ upstreamĀ versionĀ 0.8.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
** jabcon.h - core control class for Psi
 
3
** Copyright (C) 2001, 2002  Justin Karneges
 
4
**
 
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.
 
9
**
 
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.
 
14
**
 
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.
 
18
**
 
19
****************************************************************************/
 
20
 
 
21
#ifndef JABCON_H
 
22
#define JABCON_H
 
23
 
 
24
#include<qstring.h>
 
25
#include<qobject.h>
 
26
#include<qpixmap.h>
 
27
#include<qsettings.h>
 
28
#include<qptrlist.h>
 
29
#include<qvaluelist.h>
 
30
#include<qwidcoll.h>
 
31
 
 
32
#include"jabcommon.h"
 
33
#include"jabber.h"
 
34
#include"mainwin.h"
 
35
#include"userlist.h"
 
36
#include"message.h"
 
37
#include"contactview.h"
 
38
#include"chatdlg.h"
 
39
#include"adduserdlg.h"
 
40
#include"idle.h"
 
41
#include"filetrans.h"
 
42
#include"profiles.h"
 
43
#include"jabsess.h"
 
44
 
 
45
 
 
46
struct EventItem
 
47
{
 
48
        QString jid;
 
49
        Message msg;
 
50
};
 
51
 
 
52
class EventQueue : public QPtrList<EventItem>
 
53
{
 
54
public:
 
55
        EventQueue();
 
56
 
 
57
        int count(const QString &);
 
58
        void enqueue(EventItem *);
 
59
        EventItem *dequeue(const QString &);
 
60
        EventItem *peek(const QString &);
 
61
        EventItem *dequeueNext();
 
62
        EventItem *peekNext();
 
63
        bool hasChats(const QString &);
 
64
        void extractChats(const QString &jid, QPtrList<Message> *list, QValueList<int> *pos);
 
65
        void removeAll(const QString &jid);
 
66
};
 
67
 
 
68
 
 
69
class jabcon : public QObject
 
70
{
 
71
        Q_OBJECT
 
72
 
 
73
public:
 
74
        jabcon(QObject *parent=0);
 
75
        ~jabcon();
 
76
 
 
77
        bool init();
 
78
 
 
79
        UserProfile pro;
 
80
        JabSessionManager jsm;
 
81
        JabSession *s;
 
82
 
 
83
        MainWin *mainwin;
 
84
        ContactProfile *cvp;
 
85
 
 
86
        FileServer *fileserv;
 
87
        Idle idle;
 
88
 
 
89
        QRect mwgeom;
 
90
        QString lastStatusString;
 
91
 
 
92
        EventQueue events;
 
93
 
 
94
        void queueMessage(const Message &);
 
95
        void logMessage(const Message &);
 
96
        void queueUnread(UserListItem *);
 
97
        void flagAsRead(const Message &);
 
98
 
 
99
        void userRemove(UserListItem *);
 
100
        void userRename(UserListItem *, const QString &);
 
101
        void userGroupChange(UserListItem *, const QString &);
 
102
 
 
103
        void insertMessage(const Message &, bool doLog=TRUE);
 
104
        ChatDlg *ensureChatDlg(const QString &);
 
105
 
 
106
        void doOnEvent(const QString &);
 
107
 
 
108
signals:
 
109
        void quit(int);
 
110
        void emitContact(UserListItem *);
 
111
        void emitLocalUpdate(const JabRosterEntry &);
 
112
        void emitOptionsUpdate();
 
113
        void emitNewOffer(FileServerItem *);
 
114
 
 
115
public slots:
 
116
        // backend
 
117
        /*void servConnected();
 
118
        void servDisconnected();
 
119
        void statusUpdate(JabUpdate *);
 
120
        void servError(JabError *);
 
121
 
 
122
        // messages
 
123
        void messageReceived(const JabMessage &);
 
124
 
 
125
        // availability
 
126
        void resourceAvailable(const Jid &, const JabResource &);
 
127
        void resourceUnavailable(const Jid &);
 
128
 
 
129
        // roster management
 
130
        void contactChanged(JabRosterEntry *);
 
131
        void contactNew(JabRosterEntry *);
 
132
        void contactRemove(JabRosterEntry *);
 
133
 
 
134
        // subscription
 
135
        void authRequest(const Jid &);
 
136
        void authGrant(const Jid &);
 
137
        void authRemove(const Jid &);*/
 
138
 
 
139
        // multi-session
 
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 &);
 
153
 
 
154
 
 
155
        // user related
 
156
        void userAdd(const QString &);
 
157
        void userAuthorize(const QString &);
 
158
        void userAddAuth(const QString &);
 
159
 
 
160
        // offer a file
 
161
        void offerFile(const QString &fname, const QString &desc, const QString &jid);
 
162
 
 
163
 
 
164
        // actions
 
165
        void actionDefault(ContactViewItem *);
 
166
        void actionRecvEvent(ContactViewItem *);
 
167
        void actionSendMessage(ContactViewItem *);
 
168
        void actionSendMessage(const QStringList &);
 
169
        void actionSendUrl(const QString &);
 
170
        void actionRemove(const QString &jid);
 
171
        void actionAuthorize(ContactViewItem *);
 
172
        void actionAdd(ContactViewItem *);
 
173
        void actionRename(ContactViewItem *, const QString &);
 
174
        void actionGroupChange(const QString &jid, const QString &);
 
175
        void actionGroupRename(const QString &, const QString &);
 
176
        void actionHistory(const QString &);
 
177
        void actionHistoryBox(const Message &);
 
178
        void actionStatusShow(const QString &);
 
179
        void actionOpenChat(const QString &jid);
 
180
        void actionInfo(const QString &);
 
181
        void actionAdd(const QString &jid, const QString &nick, const QString &group);
 
182
        void actionOfferFile(const QString &jid);
 
183
        void actionOpenURL(const QString &);
 
184
 
 
185
        void agentSetStatus(const QString &, int);
 
186
        void agentRemove(const QString &);
 
187
 
 
188
        void readMessage(UserListItem *);
 
189
        void openChat(UserListItem *);
 
190
        void composeMessage(UserListItem *, bool);
 
191
 
 
192
        void sendMessage(const Message &);
 
193
 
 
194
        void processReadNext(UserListItem *item);
 
195
        void processChats(UserListItem *item);
 
196
 
 
197
        void statusMenuChanged(int);
 
198
        //void askLogin();
 
199
        //void delayedAskLogin();
 
200
        void askAddUser();
 
201
        void slotAddUser(const AddUserDlg::Info &);
 
202
        void closeProgram();
 
203
        void changeProfile();
 
204
        void doOptions();
 
205
        void slotApplyOptions(const Options &);
 
206
        void slotApplyAccounts();
 
207
        void doManageServices();
 
208
        void doManageAccounts();
 
209
        void doFileSharing();
 
210
        void composeBlankMessage();
 
211
        void openAccountInfo();
 
212
        void recvNextEvent();
 
213
 
 
214
        void composeMessage(const QString &);
 
215
        void processReadNext(const QString &);
 
216
        void processChats(const QString &);
 
217
 
 
218
        void slotGetServices(QString *id);
 
219
        void slotGetServicesResponse(JabRoster *);
 
220
 
 
221
        void slotGetRegForm(const QString &service, QString *id);
 
222
        void slotGetRegFormResponse(const JabForm &);
 
223
        void slotPutRegForm(const JabForm &, QString *id);
 
224
        void slotPutRegFormResponse(const QString &, bool, const QString &err);
 
225
 
 
226
        void slotGetVCard(const QString &, QString *id);
 
227
        void slotGetVCardResponse(const QString &, VCard *);
 
228
        void slotSetVCard(const VCard &, QString *id);
 
229
        void slotSetVCardResponse(bool);
 
230
 
 
231
        void slotGetSearchForm(const QString &, QString *id);
 
232
        void slotGetSearchFormResponse(const QString &, JabForm *);
 
233
        void slotPutSearchForm(const JabForm &, QString *id);
 
234
        void slotPutSearchFormResponse(const QString &, JabRoster *);
 
235
 
 
236
        void slotGetIQGateway(const QString &, QString *id);
 
237
        void slotSetIQGateway(const QString &, const QString &, QString *id);
 
238
 
 
239
        void slotCancelTransaction(const QString &);
 
240
 
 
241
        void slotJTDone(JabTask *t);
 
242
 
 
243
        void slotCheckVCard(JabTask *);
 
244
 
 
245
        void enableOnEventOnline();
 
246
};
 
247
 
 
248
#endif