9eff38003494f159d959e9401a0443b436a745f7
1 /**
2 * Inkscape::Whiteboard::InkboardDocument - Inkboard document implementation
3 *
4 * Authors:
5 * David Yip <yipdw@rose-hulman.edu>
6 *
7 * Copyright (c) 2005 Authors
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #ifndef __INKSCAPE_WHITEBOARD_INKBOARDDOCUMENT_H__
13 #define __INKSCAPE_WHITEBOARD_INKBOARDDOCUMENT_H__
15 #include <glibmm.h>
17 #include "document.h"
18 #include "xml/document.h"
19 #include "xml/simple-node.h"
20 #include "jabber_whiteboard/defines.h"
21 #include "jabber_whiteboard/keynode.h"
22 #include "jabber_whiteboard/session-manager.h"
24 namespace Inkscape {
26 namespace Whiteboard {
29 class InkboardDocument : public XML::SimpleNode, public XML::Document {
30 public:
32 explicit InkboardDocument(int code, State::SessionType type, Glib::ustring const& to);
34 XML::NodeType type() const
35 {
36 return Inkscape::XML::DOCUMENT_NODE;
37 }
39 void setRecipient(Glib::ustring const& val);
40 Glib::ustring getRecipient() const;
42 void setSessionId(Glib::ustring const& val);
43 Glib::ustring getSessionId() const;
45 void startSessionNegotiation();
46 void terminateSession();
47 void processInkboardEvent(Message::Wrapper &wrapper, Pedro::Element* data);
49 bool sendProtocol(const Glib::ustring &destJid, Message::Wrapper &mwrapper, Message::Message &message);
51 bool handleOutgoingState(Message::Wrapper &wrapper,Glib::ustring const& message);
52 bool handleIncomingState(Message::Wrapper &wrapper,Pedro::Element* data);
54 bool handleState(State::SessionState expectedState, State::SessionState newstate);
56 protected:
57 /**
58 * Copy constructor.
59 *
60 * \param orig Instance to copy.
61 */
62 InkboardDocument(InkboardDocument const& orig) :
63 XML::Node(), XML::SimpleNode(orig), XML::Document(), _recipient(orig._recipient)
64 {
65 _initBindings();
66 }
68 XML::SimpleNode* _duplicate() const
69 {
70 return new InkboardDocument(*this);
71 }
73 private:
75 void _initBindings();
77 SessionManager *_sm;
78 SPDocument *_doc;
79 State::SessionType _type;
80 State::SessionState state;
82 Glib::ustring _session;
83 Glib::ustring _recipient;
85 KeyNodeTable _tracker;
86 };
88 }
90 }
92 #endif
94 /*
95 Local Variables:
96 mode:c++
97 c-file-style:"stroustrup"
98 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
99 indent-tabs-mode:nil
100 fill-column:99
101 End:
102 */
103 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :