1
/****************************************************************************
2
** jabcon.h - core control class for Psi
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
****************************************************************************/
29
#include<qvaluelist.h>
37
#include"contactview.h"
39
#include"adduserdlg.h"
52
class EventQueue : public QPtrList<EventItem>
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);
69
class jabcon : public QObject
74
jabcon(QObject *parent=0);
80
JabSessionManager jsm;
90
QString lastStatusString;
94
void queueMessage(const Message &);
95
void logMessage(const Message &);
96
void queueUnread(UserListItem *);
97
void flagAsRead(const Message &);
99
void userRemove(UserListItem *);
100
void userRename(UserListItem *, const QString &);
101
void userGroupChange(UserListItem *, const QString &);
103
void insertMessage(const Message &, bool doLog=TRUE);
104
ChatDlg *ensureChatDlg(const QString &);
106
void doOnEvent(const QString &);
110
void emitContact(UserListItem *);
111
void emitLocalUpdate(const JabRosterEntry &);
112
void emitOptionsUpdate();
113
void emitNewOffer(FileServerItem *);
117
/*void servConnected();
118
void servDisconnected();
119
void statusUpdate(JabUpdate *);
120
void servError(JabError *);
123
void messageReceived(const JabMessage &);
126
void resourceAvailable(const Jid &, const JabResource &);
127
void resourceUnavailable(const Jid &);
130
void contactChanged(JabRosterEntry *);
131
void contactNew(JabRosterEntry *);
132
void contactRemove(JabRosterEntry *);
135
void authRequest(const Jid &);
136
void authGrant(const Jid &);
137
void authRemove(const Jid &);*/
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 &);
156
void userAdd(const QString &);
157
void userAuthorize(const QString &);
158
void userAddAuth(const QString &);
161
void offerFile(const QString &fname, const QString &desc, const QString &jid);
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 &);
185
void agentSetStatus(const QString &, int);
186
void agentRemove(const QString &);
188
void readMessage(UserListItem *);
189
void openChat(UserListItem *);
190
void composeMessage(UserListItem *, bool);
192
void sendMessage(const Message &);
194
void processReadNext(UserListItem *item);
195
void processChats(UserListItem *item);
197
void statusMenuChanged(int);
199
//void delayedAskLogin();
201
void slotAddUser(const AddUserDlg::Info &);
203
void changeProfile();
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();
214
void composeMessage(const QString &);
215
void processReadNext(const QString &);
216
void processChats(const QString &);
218
void slotGetServices(QString *id);
219
void slotGetServicesResponse(JabRoster *);
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);
226
void slotGetVCard(const QString &, QString *id);
227
void slotGetVCardResponse(const QString &, VCard *);
228
void slotSetVCard(const VCard &, QString *id);
229
void slotSetVCardResponse(bool);
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 *);
236
void slotGetIQGateway(const QString &, QString *id);
237
void slotSetIQGateway(const QString &, const QString &, QString *id);
239
void slotCancelTransaction(const QString &);
241
void slotJTDone(JabTask *t);
243
void slotCheckVCard(JabTask *);
245
void enableOnEventOnline();