~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/jabber_whiteboard/message-node.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
12
 
 
13
#ifndef __WHITEBOARD_MESSAGE_NODE_H__
 
14
#define __WHITEBOARD_MESSAGE_NODE_H__
 
15
 
 
16
#include <string>
 
17
#include <glibmm.h>
 
18
 
 
19
#include "gc-managed.h"
 
20
#include "gc-anchored.h"
 
21
#include "gc-finalized.h"
 
22
#include "message.h"
 
23
 
 
24
namespace Inkscape {
 
25
 
 
26
namespace Whiteboard {
 
27
 
 
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
        }
 
64
 
 
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
        }
 
74
 
 
75
        unsigned int sequence()
 
76
        {
 
77
                return this->_seq;
 
78
        }
 
79
 
 
80
        MessageType type()
 
81
        {
 
82
                return this->_type;
 
83
        }
 
84
 
 
85
        bool chatroom()
 
86
        {
 
87
                return this->_chatroom;
 
88
        }
 
89
 
 
90
        bool document()
 
91
        {
 
92
                return this->_document;
 
93
        }
 
94
 
 
95
        std::string recipient()
 
96
        {
 
97
                return this->_recipient;
 
98
        }
 
99
 
 
100
        std::string sender()
 
101
        {
 
102
                return this->_sender;
 
103
        }
 
104
 
 
105
        Glib::ustring const& message()
 
106
        {
 
107
                return this->_message;
 
108
        }
 
109
 
 
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
};
 
119
 
 
120
}
 
121
 
 
122
}
 
123
 
 
124
#endif
 
125
 
 
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 :