Port things from MSN to WLM plugin:
[kdenetwork.git] / kopete / protocols / msn / msnchatsession.h
blob1380ce3329ce3c8ec3d28a9655e82a37712374b9
1 /*
2 msnchatsession.h - MSN Message Manager
4 Copyright (c) 2002-2005 by Olivier Goffart <ogoffart@kde.org>
6 Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
8 *************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 *************************************************************************
18 #ifndef MSNCHATSESSION_H
19 #define MSNCHATSESSION_H
21 #include "kopetechatsession.h"
23 #include <QLabel>
24 #include <QList>
26 class MSNSwitchBoardSocket;
27 class MSNInvitation;
28 class MSNContact;
29 class KActionMenu;
30 class QLabel;
31 class KAction;
34 /**
35 * @author Olivier Goffart
37 class KOPETE_MSN_SHARED_EXPORT MSNChatSession : public Kopete::ChatSession
39 Q_OBJECT
41 public:
42 MSNChatSession( Kopete::Protocol *protocol, const Kopete::Contact *user, Kopete::ContactPtrList others );
43 ~MSNChatSession();
45 void createChat( const QString &handle, const QString &address, const QString &auth, const QString &ID = QString() );
47 MSNSwitchBoardSocket *service() { return m_chatService; }
49 void sendFile( const QString &fileLocation, const QString &fileName,
50 long unsigned int fileSize );
52 /**
53 * append an invitation in the invitation map, and send the first invitation message
55 void initInvitation(MSNInvitation* invitation);
57 virtual void inviteContact(const QString& );
59 public slots:
60 void slotCloseSession();
61 void slotInviteOtherContact();
63 void invitationDone( MSNInvitation* );
65 void slotRequestPicture();
67 /**
68 * this is a reimplementation of ChatSesstion slot.
69 * the original slot is not virtual, but that's not a problem because it's a slot.
71 virtual void receivedTypingMsg( const QString &, bool );
73 void slotConnectionTimeout();
75 private slots:
76 void slotMessageSent( Kopete::Message &message, Kopete::ChatSession *kmm );
77 void slotMessageReceived( Kopete::Message &message );
79 void slotUserJoined( const QString &handle, const QString &publicName, bool IRO );
80 void slotUserLeft( const QString &handle, const QString &reason );
81 void slotSwitchBoardClosed();
82 void slotInviteContact( Kopete::Contact *contact );
83 void slotAcknowledgement( unsigned int id, bool ack );
84 void slotInvitation( const QString &handle, const QString &msg );
86 void slotActionInviteAboutToShow();
88 void slotDisplayPictureChanged();
90 /**
91 * (debug)
93 void slotDebugRawCommand();
95 void slotSendNudge();
96 void slotWebcamReceive();
97 void slotWebcamSend();
98 void slotSendFile();
100 void slotNudgeReceived(const QString& handle);
102 private:
104 MSNSwitchBoardSocket *m_chatService;
105 QString otherString;
106 KActionMenu *m_actionInvite;
107 QList<KAction*> m_inviteactions;
108 KAction *m_actionNudge;
109 KAction *m_actionWebcamReceive;
110 KAction *m_actionWebcamSend;
112 //Messages sent before the ending of the connection are queued
113 QList<Kopete::Message> m_messagesQueue;
114 void sendMessageQueue();
115 void cleanMessageQueue( const QString &reason);
116 void startChatSession();
118 QMap<unsigned int, Kopete::Message> m_messagesSent;
120 QMap<long unsigned int, MSNInvitation*> m_invitations;
124 * weither or not the "has opened a new chat" message need to be sent if the user is typing
126 bool m_newSession;
128 QLabel *m_image;
129 QTimer *m_timeoutTimer;
130 uint m_connectionTry;
133 signals:
135 * This signal is relayed to the protocol and after, to plugins
137 void invitation(MSNInvitation*& invitation, const QString &bodyMSG , unsigned long int cookie , MSNChatSession* msnMM , MSNContact* c );
140 #endif // MSNCHATSESSION_H
142 // vim: set noet ts=4 sts=4 tw=4: