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 #include <glib.h>
13 #include <glibmm.h>
15 #include "jabber_whiteboard/inkboard-document.h"
17 #include "xml/simple-session.h"
18 #include "jabber_whiteboard/inkboard-session.h"
20 #include "jabber_whiteboard/session-manager.h"
22 namespace Inkscape {
24 namespace Whiteboard {
26 InkboardDocument::InkboardDocument(int code, SessionType type, Glib::ustring const& to) :
27 XML::SimpleNode(code), _type(type), _recipient(to)
28 {
29 _initBindings();
30 }
32 void
33 InkboardDocument::_initBindings()
34 {
35 _bindDocument(*this);
36 _bindLogger(*(new XML::SimpleSession()));
37 }
39 void
40 InkboardDocument::setRecipient(Glib::ustring const& val)
41 {
42 this->_recipient = val;
43 }
45 Glib::ustring
46 InkboardDocument::getRecipient() const
47 {
48 return this->_recipient;
49 }
51 void
52 InkboardDocument::startSessionNegotiation()
53 {
54 SessionManager& sm = SessionManager::instance();
55 switch (_type) {
56 case INKBOARD_MUC:
57 sm.sendGroup(_recipient, CHATROOM_SYNCHRONIZE_REQUEST, " ");
58 break;
59 case INKBOARD_PRIVATE:
60 default:
61 sm.send(_recipient, CONNECT_REQUEST_USER, " ");
62 break;
63 }
64 }
66 void
67 InkboardDocument::terminateSession()
68 {
70 }
72 void
73 InkboardDocument::processInkboardEvent(MessageType mtype, unsigned int seqnum, Glib::ustring const& data)
74 {
75 g_log(NULL, G_LOG_LEVEL_DEBUG, "Processing Inkboard event: mtype=%d seqnum=%d data=%s\n", mtype, seqnum, data.c_str());
76 }
78 }
80 }
82 /*
83 Local Variables:
84 mode:c++
85 c-file-style:"stroustrup"
86 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
87 indent-tabs-mode:nil
88 fill-column:99
89 End:
90 */
91 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :