Code

Export. Fix PS/EPS export (Bug #698340, PS Level Restriction reversed.
[inkscape.git] / src / jabber_whiteboard / message-node.h
1 /**
2  * Whiteboard message queue and queue handler functions
3  * Node for storing messages in message queues
4  * 
5  * Authors:
6  * David Yip <yipdw@rose-hulman.edu>
7  *
8  * Copyright (c) 2005 Authors
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #ifndef __WHITEBOARD_MESSAGE_NODE_H__
14 #define __WHITEBOARD_MESSAGE_NODE_H__
16 #include <string>
17 #include <glibmm.h>
19 #include "gc-managed.h"
20 #include "gc-anchored.h"
21 #include "gc-finalized.h"
22 #include "message.h"
24 namespace Inkscape {
26 namespace Whiteboard {
28 /**
29  * Encapsulates a document change message received by or sent to an Inkboard client.
30  *
31  * Received messages that end up in a MessageNode are of the following types:
32  * <ol>
33  *      <li>CHANGE_REPEATABLE</li>
34  *      <li>CHANGE_NOT_REPEATABLE</li>
35  *      <li>CHANGE_COMMIT</li>
36  *      <li>DOCUMENT_BEGIN</li>
37  *      <li>DOCUMENT_END</li>
38  *      <li>DUMMY_CHANGE</li>
39  * </ol>
40  *
41  * This class is intended for use in MessageQueues, although it could potentially
42  * see use outside of that context.
43  *
44  * \see Inkscape::Whiteboard::MessageQueue
45  */
46 class MessageNode : public GC::Managed<>, public GC::Anchored, public GC::Finalized {
47 public:
48         /**
49          * Constructor.
50          *
51          * \param seq The sequence number of the message being encapsulated.
52          * \param sender The sender of the message.
53          * \param recip The intended recipient. 
54          * \param message_body The body of the message.
55          * \param type The type of the message.
56          * \param chatroom Whether or not this message is to be sent to / was received from a chatroom.
57          */
58         MessageNode(unsigned int seq, std::string sender, std::string recip, Glib::ustring const& message_body, MessageType type, bool document, bool chatroom) :
59                 _seq(seq), _type(type), _message(message_body), _document(document), _chatroom(chatroom)
60         {
61                 this->_sender = sender;
62                 this->_recipient = recip;
63         }
65     virtual ~MessageNode() 
66         {
67 //              g_log(NULL, G_LOG_LEVEL_DEBUG, "MessageNode destructor");
68                 /*
69                 if (this->_message) {
70                         delete this->_message;
71                 }
72                 */
73         }
75         unsigned int sequence()
76         {
77                 return this->_seq;
78         }
80         MessageType type()
81         {
82                 return this->_type;
83         }
85         bool chatroom()
86         {
87                 return this->_chatroom;
88         }
90         bool document()
91         {
92                 return this->_document;
93         }
95         std::string recipient()
96         {
97                 return this->_recipient;
98         }
100         std::string sender()
101         {
102                 return this->_sender;
103         }
105         Glib::ustring const& message()
106         {
107                 return this->_message;
108         }
110 private:
111         unsigned int _seq;
112         std::string _sender;
113         std::string _recipient;
114         MessageType _type;
115         Glib::ustring _message;
116         bool _document;
117         bool _chatroom;
118 };
124 #endif
126 /*
127   Local Variables:
128   mode:c++
129   c-file-style:"stroustrup"
130   c-file-offsets:((innamespace . 0)(inline-open . 0))
131   indent-tabs-mode:nil
132   fill-column:99
133   End:
134 */
135 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :