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 sessionType, 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();
48 void recieve(Message::Wrapper &wrapper, Pedro::Element* data);
49 bool send(const Glib::ustring &destJid, Message::Wrapper &mwrapper, Message::Message &message);
51 void sendDocument();
53 bool handleOutgoingState(Message::Wrapper &wrapper,Glib::ustring const& message);
54 bool handleIncomingState(Message::Wrapper &wrapper,Pedro::Element* data);
56 bool handleState(State::SessionState expectedState, State::SessionState newstate);
58 protected:
59 /**
60 * Copy constructor.
61 *
62 * \param orig Instance to copy.
63 */
64 InkboardDocument(InkboardDocument const& orig) :
65 XML::Node(), XML::SimpleNode(orig), XML::Document(), recipient(orig.recipient)
66 {
67 _initBindings();
68 }
70 XML::SimpleNode* _duplicate() const
71 {
72 return new InkboardDocument(*this);
73 }
75 private:
77 void _initBindings();
79 SessionManager *sm;
81 State::SessionType sessionType;
82 State::SessionState state;
84 Glib::ustring sessionId;
85 Glib::ustring recipient;
87 KeyNodeTable *tracker;
88 };
90 }
92 }
94 #endif
96 /*
97 Local Variables:
98 mode:c++
99 c-file-style:"stroustrup"
100 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
101 indent-tabs-mode:nil
102 fill-column:99
103 End:
104 */
105 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :