2 gwmessagemanager.h - Kopete GroupWise Protocol
4 Copyright (c) 2006 Novell, Inc http://www.opensuse.org
5 Copyright (c) 2004 SUSE Linux AG http://www.suse.com
8 Copyright (c) 2003 by Will Stephenson <will@stevello.free-online.co.uk>
10 Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
12 *************************************************************************
14 * This library is free software; you can redistribute it and/or *
15 * modify it under the terms of the GNU General Public *
16 * License as published by the Free Software Foundation; either *
17 * version 2 of the License, or (at your option) any later version. *
19 *************************************************************************
22 #ifndef GWMESSAGEMANAGER_H
23 #define GWMESSAGEMANAGER_H
27 #include <kopetemessage.h>
28 #include <kopetechatsession.h>
36 class GroupWiseAccount
;
37 class GroupWiseContact
;
38 class GroupWiseContactSearch
;
40 * Specialized message manager, which tracks the GUID used by GroupWise to uniquely identify a given chat, and provides invite actions and logging and security indicators. To instantiate call @ref GroupWiseAccount::chatSession().
44 using namespace GroupWise
;
46 class GroupWiseChatSession
: public Kopete::ChatSession
50 friend class GroupWiseAccount
;
54 * The destructor emits leavingConference so that the account can tell the server that the user has left the chat
56 ~GroupWiseChatSession();
58 * The conference's globally unique identifier, which is given to it by the server
60 ConferenceGuid
guid() const { return m_guid
; }
64 void setGuid( const ConferenceGuid
& guid
);
66 * Utility account access
68 GroupWiseAccount
* account();
70 * Accessors and mutators for secure chat, logged chat, and closed conference flags
72 void setSecure( bool secure
);
73 void setLogging( bool logged
);
79 * Add invitees to the conference
81 void addInvitee( const Kopete::Contact
* );
83 * Add members to the conference
85 void joined( GroupWiseContact
* );
87 * Remove members from conference
89 void left( GroupWiseContact
* );
91 * An invitation was declined
93 void inviteDeclined( GroupWiseContact
* );
95 * Check whether the conversation being administratively logged and update the UI to indicate this
97 void updateArchiving();
99 * Reimplemented from Kopete::ChatSession - invites contacts via DND
101 virtual void inviteContact(const QString
& );
104 * Tell the contact we got a GUID so it can route incoming messages here.
106 void conferenceCreated();
108 * Tell the account that the GroupWiseChatSession is closing so it can tell the server that the user has left the conference
110 void leavingConference( GroupWiseChatSession
* );
113 * Start the process of creating a conference for this GWMM on the server.
115 void createConference();
117 * Sends any messages and invitations that were queued while waiting for the conference to be created
119 void dequeueMessagesAndInvites();
122 * Receive the GUID returned by the server when we start a chat.
123 * @param mmId Message Manager ID, used to determine if this GUID is meant for this message manager
124 * @param guid The GUID allotted us by the server.
126 void receiveGuid( const int mmId
, const GroupWise::ConferenceGuid
& guid
);
128 * An attempt to create a conference on the server failed.
129 * @param mmId Message Manager ID to see if the failure refers to this message manager
131 void slotCreationFailed( const int mmId
,const int statusCode
);
133 void slotSendTypingNotification ( bool typing
);
134 void slotMessageSent( Kopete::Message
&message
, Kopete::ChatSession
* );
135 // TODO: slots for us leaving conference, us inviting someone, someone joining, someone leaving, someone sending an invitation, getting typing?
136 void slotGotTypingNotification( const ConferenceEvent
& );
137 void slotGotNotTypingNotification( const ConferenceEvent
& );
139 * Popupulate the menu of invitable contacts
141 void slotActionInviteAboutToShow();
143 * Invite a contact to join this chat
145 void slotInviteContact( Kopete::Contact
* );
147 * Show the search dialog to invite another contact to the chat
149 void slotInviteOtherContact();
151 * Process the response from the search dialog; send the actual invitation
153 void slotSearchedForUsers();
155 void slotShowSecurity();
156 void slotShowArchiving();
159 GroupWiseChatSession(const Kopete::Contact
* user
, Kopete::ContactPtrList others
, Kopete::Protocol
* protocol
, const ConferenceGuid
& guid
, int id
= 0 );
161 ConferenceGuid m_guid
; // The conference's globally unique identifier, which is given to it by the server
162 int m_flags
; // flags for secure connections, central logging and "conference closed" as given by the server
164 QList
< Kopete::Message
> m_pendingOutgoingMessages
; // messages queued while we wait for the server to tell us the conference is created.
165 Kopete::ContactPtrList m_pendingInvites
; // people we wanted to invite to the conference, queued while waiting for the conference to be created.
166 KActionMenu
*m_actionInvite
;
167 QList
<KAction
*> m_inviteActions
;
168 // labels showing secure and logging status
171 // search widget and dialog used for inviting contacts
172 GroupWiseContactSearch
* m_search
;
173 KDialog
* m_searchDlg
;
174 // contacts who have been invited to join but have not yet joined the chat
175 Kopete::ContactPtrList m_invitees
;
176 // track the number of members actually in the chat
180 * return an unique identifier for that kmm