Code

separate updating window from updating layers
[inkscape.git] / src / jabber_whiteboard / session-manager.h
1 /**
2  * Whiteboard session manager
3  *
4  * Authors: 
5  * David Yip <yipdw@rose-hulman.edu>
6  * Bob Jamison (Pedro port)
7  *
8  * Copyright (c) 2005 Authors
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #ifndef __INKSCAPE_WHITEBOARD_SESSION_MANAGER_H__
14 #define __INKSCAPE_WHITEBOARD_SESSION_MANAGER_H__
16 #include <glibmm.h>
18 #include <list>
19 #include <bitset>
21 #include "desktop.h"
23 #include "jabber_whiteboard/pedrogui.h"
24 #include "jabber_whiteboard/message-queue.h"
25 #include "jabber_whiteboard/defines.h"
26 #include "jabber_whiteboard/inkboard-session.h"
28 #include "gc-alloc.h"
30 class SPDocument;
31 class SPDesktop;
34 namespace Inkscape {
36 namespace Whiteboard {
38 class InkboardDocument;
40 typedef Glib::ustring from,sessionId;
41 typedef std::pair< Glib::ustring, InkboardDocument* > WhiteboardRecord;
42 typedef std::vector< WhiteboardRecord, GC::Alloc< WhiteboardRecord, GC::MANUAL > > WhiteboardList;
44 typedef std::pair< from, sessionId > Invitation;
45 typedef std::list< Invitation > InvitationList;
47 class SessionManager : public Pedro::XmppEventListener 
48 {
50 public:
52     SessionManager();
54     virtual ~SessionManager();
56     static void             showClient();
57     static SessionManager&  instance();
59     virtual Pedro::XmppClient &getClient()
60         { return gui.client; }
62     /**
63      * Handles all incoming XMPP events associated with this document
64      * apart from CONNECT_REQUEST, which is handled in SessionManager
65      */
66     virtual void processXmppEvent(const Pedro::XmppEvent &event);
69     /**
70      * Initiates a shared session with a user or conference room.
71      * 
72      * \param to The recipient to which this desktop will be linked, specified as a JID.
73      * \param type Type of the session; i.e. private message or group chat.
74      */
75     virtual void initialiseSession(Glib::ustring const& to, State::SessionType type);
77     /**
78      * Terminates an Inkboard session to a given recipient.  If the session to be
79      * terminated does not exist, does nothing.
80      *
81      * \param sessionId The session identifier to be terminated.
82      */
83     virtual void terminateSession(Glib::ustring const& sessionId);
85     /**
86      * Adds a session to whiteboard
87      *
88      * \param sessionId The session identifier to be terminated.
89      */
90     virtual void addSession(WhiteboardRecord whiteboard);
92     /**
93      * Locates an Inkboard session by recipient JID.  
94      *
95      * \param to The recipient JID identifying the session to be located.
96      * \return A pointer to the InkboardDocument associated with the Inkboard session,
97      * or NULL if no such session exists.
98      */
99     InkboardDocument* getInkboardSession(Glib::ustring const& to);
102     void operator=(XmppEventListener const& other) {}
104 private:
106     Pedro::PedroGui     gui;
107     WhiteboardList      whiteboards;
108     InvitationList      invitations;
109     sigc::connection    CheckPendingInvitations;
111     void    processWhiteboardEvent(Pedro::XmppEvent const& event);
113     void    handleIncomingInvitation(Invitation invitation);
115     bool    checkInvitationQueue();
117     char*   createSessionId(int size);
119 };
121 SPDocument* makeInkboardDocument(int code, gchar const* rootname, 
122     State::SessionType type, Glib::ustring const& to);
124 SPDesktop*  makeInkboardDesktop(SPDocument* doc);
126 }  // namespace Whiteboard
128 }  // namespace Inkscape
130 #endif  /* __SESSION_MANAGER_H__ */
132 /*
133   Local Variables:
134   mode:c++
135   c-file-style:"stroustrup"
136   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
137   indent-tabs-mode:nil
138   fill-column:99
139   End:
140 */
141 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :