Code

whiteboard now works on jep compliant servers only, aka wildfire
[inkscape.git] / src / jabber_whiteboard / message-utilities.h
1 /**
2  * Whiteboard session manager
3  * Message generation utilities
4  * 
5  * Authors:
6  * David Yip <yipdw@rose-hulman.edu>
7  * Jonas Collaros, Stephen Montgomery
8  *
9  * Copyright (c) 2004-2005 Authors
10  *
11  * Released under GNU GPL, read the file 'COPYING' for more information
12  */
14 #ifndef __WHITEBOARD_MESSAGE_UTILITIES_H__
15 #define __WHITEBOARD_MESSAGE_UTILITIES_H__
17 #include <glibmm.h>
18 #include "xml/repr.h"
20 #include "xml/node.h"
21 #include "jabber_whiteboard/typedefs.h"
23 using Glib::ustring;
25 namespace Inkscape {
27 namespace Util {
29 template <typename T>
30 class ptr_shared;
32 }
34 namespace Whiteboard {
36 struct Node {
37         ustring tag;
38         ustring data;
39         ustring::size_type next_pos;
40 };
42 class XMLNodeTracker;
44 class MessageUtilities {
45 public:
46         // Message generation utilities
47         static void newObjectMessage(ustring* msgbuf, KeyToNodeMap& newidsbuf, NodeToKeyMap& newnodesbuf, NewChildObjectMessageList& childmsgbuf, XMLNodeTracker* xmt, Inkscape::XML::Node const* node, bool only_collect_nodes = false, bool collect_children = true); 
48         static void objectChangeMessage(ustring* msgbuf, XMLNodeTracker* xmt, std::string const id, gchar const* key, gchar const* oldval, gchar const* newval, bool is_interactive);
49         static void objectDeleteMessage(ustring* msgbuf, XMLNodeTracker* xmt, Inkscape::XML::Node const& parent, Inkscape::XML::Node const& child, Inkscape::XML::Node const* prev);
50         static void contentChangeMessage(ustring& msgbuf, std::string const nodeid, Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value);
51         static void childOrderChangeMessage(ustring& msgbuf, std::string const childid, std::string const oldprevid, std::string const newprevid);
53         // Message parsing utilities
54         static bool getFirstMessageTag(struct Node& buf, ustring const& msg);
55         static bool findTag(struct Node& buf, ustring const& msg);
57         // Message tag generation utilities
58         static Glib::ustring makeTagWithContent(Glib::ustring tagname, Glib::ustring content);
60 private:
61         // noncopyable, nonassignable
62         MessageUtilities(MessageUtilities const&);
63         MessageUtilities& operator=(MessageUtilities const&);
65 };
67 }
69 }
75 /*
76   Local Variables:
77   mode:c++
78   c-file-style:"stroustrup"
79   c-file-offsets:((innamespace . 0)(inline-open . 0))
80   indent-tabs-mode:nil
81   fill-column:99
82   End:
83 */
84 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
85 #endif