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
|
/*
kopetechatsessionmanager.h - Creates chat sessions
Copyright (c) 2002-2003 by Duncan Mac-Vicar Prett <duncan@kde.org>
Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#ifndef KOPETEMESSAGEMANAGERFACTORY_H
#define KOPETEMESSAGEMANAGERFACTORY_H
#include <tqobject.h>
#include <tqptrlist.h>
#include <tqintdict.h>
#include <tqvaluelist.h>
#include "kopetechatsession.h"
#include "kopetemessage.h"
#include "kopete_export.h"
class KopeteView;
namespace Kopete
{
class Contact;
class Protocol;
class MessageEvent;
typedef TQPtrList<Contact> ContactPtrList;
typedef TQValueList<Message> MessageList;
/**
* @author Duncan Mac-Vicar Prett <duncan@kde.org>
*
* Kopete::ChatSessionManager is responsible for creating and tracking Kopete::ChatSession
* instances for each chat.
*/
class KOPETE_EXPORT ChatSessionManager : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
static ChatSessionManager* self();
~ChatSessionManager();
/**
* Create a new chat session. Provided is the initial list of contacts in
* the session. If a session with exactly these contacts already exists,
* it will be reused. Otherwise a new session is created.
* @param user The local user in the session.
* @param chatContacts The list of contacts taking part in the chat.
* @param protocol The protocol that the chat is using.
* @return A pointer to a new or reused Kopete::ChatSession.
*/
Kopete::ChatSession* create( const Kopete::Contact *user,
Kopete::ContactPtrList chatContacts, Kopete::Protocol *protocol);
/**
* Find a chat session, if one exists, that matches the given list of contacts.
* @param user The local user in the session.
* @param chatContacts The list of contacts taking part in the chat.
* @param protocol The protocol that the chat is using.
* @return A pointer to an existing Kopete::ChatSession, or 0L if none was found.
*/
Kopete::ChatSession* findChatSession( const Kopete::Contact *user,
Kopete::ContactPtrList chatContacts, Kopete::Protocol *protocol);
/**
* Registers a Kopete::ChatSession (or subclass thereof) with the Kopete::ChatSessionManager
*/
void registerChatSession(Kopete::ChatSession *);
/**
* Get a list of all open sessions.
*/
TQValueList<ChatSession*> sessions();
/**
* @internal
* called by the kmm itself when it gets deleted
*/
void removeSession( Kopete::ChatSession *session );
/**
* create a new view for the manager.
* only the manager should call this function
*/
KopeteView *createView( Kopete::ChatSession * , const TQString &requestedPlugin = TQString() );
/**
* Post a new event. this will emit the @ref newEvent signal
*/
void postNewEvent(Kopete::MessageEvent*);
/**
* Returns the current active Kopete view
*/
KopeteView *activeView();
signals:
/**
* This signal is emitted whenever a message
* is about to be displayed by the KopeteChatWindow.
* Please remember that both messages sent and
* messages received will emit this signal!
* Plugins may connect to this signal to change
* the message contents before it's going to be displayed.
*/
void aboutToDisplay( Kopete::Message& message );
/**
* Plugins may connect to this signal
* to manipulate the contents of the
* message that is being sent.
*/
void aboutToSend( Kopete::Message& message );
/**
* Plugins may connect to this signal
* to manipulate the contents of the
* message that is being received.
*
* This signal is emitted before @ref aboutToDisplay()
*/
void aboutToReceive( Kopete::Message& message );
/**
* A new view has been created
*/
void viewCreated( KopeteView * );
/**
* A view as been activated(manually only?).
*/
void viewActivated( KopeteView *view );
/*
* A view is about to close.
*/
void viewClosing( KopeteView *view );
/**
* a new KMM has been created
*/
void chatSessionCreated( Kopete::ChatSession *);
/**
* the message is ready to be displayed
*/
void display( Kopete::Message& message, Kopete::ChatSession * );
/**
* A new event has been posted.
*/
void newEvent(Kopete::MessageEvent *);
/**
* The global shortcut for sending message has been used
*/
void readMessage();
public slots:
void slotReadMessage();
private:
ChatSessionManager( TQObject* parent = 0, const char* name = 0 );
class Private;
Private *d;
static ChatSessionManager *s_self;
};
}
#endif
// vim: set noet ts=4 sts=4 sw=4:
|