summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordaleharvey <daleharvey@users.sourceforge.net>2006-08-31 19:32:09 +0000
committerdaleharvey <daleharvey@users.sourceforge.net>2006-08-31 19:32:09 +0000
commitcc10bb3b07709f197b753d695605c919d7c0312a (patch)
treea8829b1e67fc6a3d0fc906bebcf2652d655a71c5 /src
parentRemoving wrong plural forms from ja.po file to prevent fatal errors reported (diff)
downloadinkscape-cc10bb3b07709f197b753d695605c919d7c0312a.tar.gz
inkscape-cc10bb3b07709f197b753d695605c919d7c0312a.zip
Update to inkboard
(bzr r1663)
Diffstat (limited to 'src')
-rw-r--r--src/jabber_whiteboard/defines.cpp2
-rw-r--r--src/jabber_whiteboard/defines.h3
-rw-r--r--src/jabber_whiteboard/inkboard-document.cpp65
-rw-r--r--src/jabber_whiteboard/inkboard-document.h17
-rw-r--r--src/jabber_whiteboard/inkboard-node.cpp20
5 files changed, 91 insertions, 16 deletions
diff --git a/src/jabber_whiteboard/defines.cpp b/src/jabber_whiteboard/defines.cpp
index a8843b9e7..b1dac9913 100644
--- a/src/jabber_whiteboard/defines.cpp
+++ b/src/jabber_whiteboard/defines.cpp
@@ -49,7 +49,7 @@ namespace Vars {
"<%1><%2 /></%1>");
const std::string NEW_MESSAGE(
- "<new parent=\"%1\" id=\"%2\" target=\"%3\">%4</new>");
+ "<new parent=\"%1\" id=\"%2\" index=\"%3\">%4</new>");
const std::string CONFIGURE_MESSAGE(
"<configure target=\"%1\" version=\"%2\" attribute=\"%3\" value=\"%4\" />");
diff --git a/src/jabber_whiteboard/defines.h b/src/jabber_whiteboard/defines.h
index 675e13136..8b3c56354 100644
--- a/src/jabber_whiteboard/defines.h
+++ b/src/jabber_whiteboard/defines.h
@@ -99,9 +99,6 @@ namespace Vars {
extern const std::string MOVE_MESSAGE;
extern const std::string REMOVE_MESSAGE;
-
-
-
}
namespace State {
diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index 60d4cdd27..3c063a382 100644
--- a/src/jabber_whiteboard/inkboard-document.cpp
+++ b/src/jabber_whiteboard/inkboard-document.cpp
@@ -115,6 +115,10 @@ InkboardDocument::recieve(Message::Wrapper &wrapper, Pedro::Element* data)
{
this->sm->terminateSession(this->getSessionId());
}
+ }else if(wrapper == Message::NEW || wrapper == Message::CONFIGURE
+ || wrapper == Message::MOVE || wrapper == Message::REMOVE )
+ {
+ handleChange(wrapper,data->getFirstChild()->getFirstChild());
}
}else{
g_warning("Recieved Message in invalid state = %d", this->state);
@@ -133,9 +137,9 @@ InkboardDocument::send(const Glib::ustring &destJid, Message::Wrapper &wrapper,
else
mes = message;
- char *finalmessage = const_cast<char* >(String::ucompose(Vars::WHITEBOARD_MESSAGE,
- this->sessionType,this->sm->getClient().getJid(),destJid,
- Vars::INKBOARD_XMLNS,this->getSessionId(),mes).c_str());
+ char *finalmessage = const_cast<char* >(String::ucompose(
+ Vars::WHITEBOARD_MESSAGE, this->sessionType, this->sm->getClient().getJid(),
+ destJid, Vars::INKBOARD_XMLNS, this->getSessionId(), mes).c_str());
if (!this->sm->getClient().write(finalmessage))
{ return false; }
@@ -154,16 +158,21 @@ InkboardDocument::sendDocument(Inkscape::XML::Node* root)
{
for(Inkscape::XML::Node *child = root->firstChild();child!=NULL;child=child->next())
{
- Glib::ustring parentKey,tempParentKey,key;
+ Glib::ustring name(child->name());
- this->addNodeToTracker(child);
- Message::Message message = this->composeNewMessage(child);
+ if(name != "svg:metadata" && name != "svg:defs" && name != "sodipodi:namedview")
+ {
+ Glib::ustring parentKey,tempParentKey,key;
- this->send(this->getRecipient(),Message::NEW,message);
+ this->addNodeToTracker(child);
+ Message::Message message = this->composeNewMessage(child);
- if(child->childCount() != 0)
- {
- sendDocument(child);
+ this->send(this->getRecipient(),Message::NEW,message);
+
+ if(child->childCount() != 0)
+ {
+ sendDocument(child);
+ }
}
}
}
@@ -242,6 +251,42 @@ InkboardDocument::handleState(State::SessionState expectedState, State::SessionS
return false;
}
+
+void
+InkboardDocument::handleChange(Message::Wrapper &wrapper, Pedro::Element* data)
+{
+ if(wrapper == Message::NEW)
+ {
+ Glib::ustring parent = data->getTagAttribute("new","parent");
+ Glib::ustring id = data->getTagAttribute("new","id");
+
+ signed int index = atoi
+ (data->getTagAttribute("new","index").c_str());
+
+ Pedro::Element* element = data->getFirstChild();
+
+ if(parent.size() > 0 && id.size() > 0)
+ this->changeNew(parent,id,index,element);
+
+ }else if(wrapper == Message::CONFIGURE)
+ {
+ Glib::ustring target = data->getTagAttribute("configure","target");
+ Glib::ustring attribute = data->getTagAttribute("configure","attribute");
+ Glib::ustring value = data->getTagAttribute("configure","value");
+
+ signed int version = atoi
+ (data->getTagAttribute("configure","version").c_str());
+
+ if(target.size() > 0 && attribute.size() > 0 && value.size() > 0)
+ this->changeConfigure(target,version,attribute,value);
+
+ }else if(wrapper == Message::MOVE)
+ {
+ }else if(wrapper == Message::REMOVE)
+ {
+ }
+}
+
} // namespace Whiteboard
} // namespace Inkscape
diff --git a/src/jabber_whiteboard/inkboard-document.h b/src/jabber_whiteboard/inkboard-document.h
index 45a4178d4..510f47c6e 100644
--- a/src/jabber_whiteboard/inkboard-document.h
+++ b/src/jabber_whiteboard/inkboard-document.h
@@ -48,18 +48,31 @@ public:
void terminateSession();
void recieve(Message::Wrapper &wrapper, Pedro::Element* data);
- bool send(const Glib::ustring &destJid, Message::Wrapper &mwrapper, Message::Message &message);
+ bool send(const Glib::ustring &destJid, Message::Wrapper &mwrapper,
+ Message::Message &message);
void sendDocument(Inkscape::XML::Node* root);
bool handleOutgoingState(Message::Wrapper &wrapper,Glib::ustring const& message);
bool handleIncomingState(Message::Wrapper &wrapper,Pedro::Element* data);
- bool handleState(State::SessionState expectedState, State::SessionState newstate);
+ bool handleState(State::SessionState expectedState,
+ State::SessionState newstate);
+ void handleChange(Message::Wrapper &wrapper, Pedro::Element* data);
+
+
+ /* Functions below are defined in inkboard-node.cpp */
Glib::ustring addNodeToTracker(Inkscape::XML::Node* node);
Message::Message composeNewMessage(Inkscape::XML::Node *node);
+ void changeConfigure(Glib::ustring target, signed int target,
+ Glib::ustring attribute, Glib::ustring value);
+
+ void changeNew(Glib::ustring target, Glib::ustring,
+ signed int index, Pedro::Element* data);
+
+
protected:
/**
* Copy constructor.
diff --git a/src/jabber_whiteboard/inkboard-node.cpp b/src/jabber_whiteboard/inkboard-node.cpp
index c463e461a..bcb6cd981 100644
--- a/src/jabber_whiteboard/inkboard-node.cpp
+++ b/src/jabber_whiteboard/inkboard-node.cpp
@@ -52,6 +52,26 @@ InkboardDocument::composeNewMessage(Inkscape::XML::Node *node)
return message;
}
+void
+InkboardDocument::changeConfigure(Glib::ustring target, signed int version,
+ Glib::ustring attribute, Glib::ustring value)
+{
+}
+
+void
+InkboardDocument::changeNew(Glib::ustring target, Glib::ustring,
+ signed int index, Pedro::Element* data)
+{
+ Glib::ustring name = data->getName();
+
+ if(name == "text")
+ {
+ //XML::Node* parent = this->tracker->get(target);
+ //parent->setContent(date->getValue());
+ }
+
+}
+
} // namespace Whiteboard
} // namespace Inkscape