summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6eda248)
raw | patch | inline | side by side (parent: 6eda248)
author | daleharvey <daleharvey@users.sourceforge.net> | |
Fri, 4 Aug 2006 19:24:52 +0000 (19:24 +0000) | ||
committer | daleharvey <daleharvey@users.sourceforge.net> | |
Fri, 4 Aug 2006 19:24:52 +0000 (19:24 +0000) |
index 43a75cb7c21ce3a5a4ccd262a8c9d34fed6e206a..ca2bbab0e73277271744ee6b6652483a38ef5cd6 100644 (file)
namespace Message {
- Wrapper PROTOCOL = "protocol";
- Wrapper NEW = "new";
- Wrapper REMOVE = "remove";
- Wrapper CONFIGURE = "configure";
- Wrapper MOVE = "move";
-
- Message CONNECT_REQUEST = "connect-request";
- Message CONNECTED = "connected";
- Message ACCEPT_INVITATION = "accept-invitation";
- Message DECLINE_INVITATION = "decline-invitation";
- Message DOCUMENT_BEGIN = "document-begin";
- Message DOCUMENT_END = "document-end";
+ Wrapper PROTOCOL ("protocol");
+ Wrapper NEW ("new");
+ Wrapper REMOVE ("remove");
+ Wrapper CONFIGURE ("configure");
+ Wrapper MOVE ("move");
+
+ Message CONNECT_REQUEST ("connect-request");
+ Message CONNECTED ("connected");
+ Message ACCEPT_INVITATION ("accept-invitation");
+ Message DECLINE_INVITATION ("decline-invitation");
+ Message DOCUMENT_BEGIN ("document-begin");
+ Message DOCUMENT_END ("document-end");
}
namespace Vars {
- char const* INKBOARD_XMLNS = "http://inkscape.org/inkboard";
+ const std::string INKBOARD_XMLNS("http://inkscape.org/inkboard");
}
namespace State {
- SessionType WHITEBOARD_MUC = "groupchat";
- SessionType WHITEBOARD_PEER = "chat";
+ SessionType WHITEBOARD_MUC ("groupchat");
+ SessionType WHITEBOARD_PEER ("chat");
}
char const* DOCUMENT_ROOT_NAME = "svg:svg";
char const* DOCUMENT_NAMEDVIEW_NAME = "sodipodi:namedview";
-// Inkboard client states
-int const IN_WHITEBOARD = 0;
-int const LOGGED_IN = 1;
-int const IN_CHATROOM = 2;
-int const WAITING_FOR_INVITE_RESPONSE = 3;
-int const CONNECTING_TO_CHAT = 4;
-int const WAITING_TO_SYNC_TO_CHAT = 5;
-int const SYNCHRONIZING_WITH_CHAT = 6;
-int const OPEN_FOR_DOC = 7;
-int const PLAYING_SESSION_FILE = 8;
-
-// TODO: make this user-configurable, within sane limits
-// ("sane" limits being roughly in the range (10, 100], from personal testing)
-// Based on discussions with Ted, it seems that we're going to make the Jabber guys
-// accomodate Inkscape, not the other way around...
-// Dispatch interval (in milliseconds)
-int const SEND_TIMEOUT = 35;
}
}
index e1cc8cb8b3e7bd07d4b3cb316ede47cbda5d7c41..19b87624b527b1aa1d297ba3de79a59ea697f14e 100644 (file)
namespace Message {
- typedef char const* Wrapper;
- typedef char const* Message;
+ typedef const std::string Wrapper;
+ typedef const std::string Message;
extern Wrapper PROTOCOL;
extern Wrapper NEW;
namespace Vars {
- extern char const* INKBOARD_XMLNS;
+ extern const std::string INKBOARD_XMLNS;
}
namespace State {
- typedef char const* SessionType;
+ typedef const std::string SessionType;
extern SessionType WHITEBOARD_MUC;
extern SessionType WHITEBOARD_PEER;
extern char const* DOCUMENT_ROOT_NAME;
extern char const* DOCUMENT_NAMEDVIEW_NAME;
-// Inkboard client states
-extern int const IN_WHITEBOARD;
-extern int const LOGGED_IN;
-extern int const IN_CHATROOM;
-extern int const WAITING_FOR_INVITE_RESPONSE;
-extern int const CONNECTING_TO_CHAT;
-extern int const WAITING_TO_SYNC_TO_CHAT;
-extern int const SYNCHRONIZING_WITH_CHAT;
-extern int const OPEN_FOR_DOC;
-extern int const PLAYING_SESSION_FILE;
-
-// update this if any other status flags are added
-
-// TODO: make this user-configurable, within sane limits
-// ("sane" limits being roughly in the range (10, 100], from personal testing)
-// Based on discussions with Ted, it seems that we're going to make the Jabber guys
-// accomodate Inkscape, not the other way around...
-// Dispatch interval (in milliseconds)
-extern int const SEND_TIMEOUT;
-
}
}
diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index e8baee4c70b8c2a073d64b0894c571ca3aee888a..e9363ecd95c02a2728ce54627e9f7e71b21bda9f 100644 (file)
void
InkboardDocument::startSessionNegotiation()
{
- sendProtocol(_recipient, Message::PROTOCOL,Message::CONNECT_REQUEST);
+ if(_type == State::WHITEBOARD_PEER)
+ sendProtocol(_recipient, Message::PROTOCOL,Message::CONNECT_REQUEST);
+
+ else if(_type == State::WHITEBOARD_MUC)
+ {
+ // Check that the MUC room is whiteboard enabled, if not no need to send
+ // anything, just set the room to be whiteboard enabled
+ }
}
void
@@ -81,13 +88,26 @@ InkboardDocument::processInkboardEvent(Message::Wrapper &wrapper, Pedro::Element
{
if(wrapper == Message::PROTOCOL)
{
- if(data->exists(Message::ACCEPT_INVITATION));
+ Glib::ustring message = data->getFirstChild()->getFirstChild()->getFirstChild()->getName();
+
+ if(message == Message::CONNECT_REQUEST)
+ {
+ // An MUC member requesting document
+
+ }else if(message == Message::ACCEPT_INVITATION)
{
- // TODO : Would be nice to create the desktp
+ // TODO : Would be nice to create the desktop here
sendProtocol(getRecipient(),Message::PROTOCOL, Message::CONNECTED);
sendProtocol(getRecipient(),Message::PROTOCOL, Message::DOCUMENT_BEGIN);
+
+ // Send the Document
+
sendProtocol(getRecipient(),Message::PROTOCOL, Message::DOCUMENT_END);
+
+ }else if(message == Message::DECLINE_INVITATION)
+ {
+ this->_sm->terminateSession(this->getSessionId());
}
}
}else{
bool
InkboardDocument::sendProtocol(const Glib::ustring &destJid, Message::Wrapper &wrapper,
- Message::Message message)
+ Message::Message &message)
{
if(this->handleOutgoingState(wrapper,message))
{
@@ -112,8 +132,8 @@ InkboardDocument::sendProtocol(const Glib::ustring &destJid, Message::Wrapper &w
"</message>";
if (!_sm->getClient().write(fmt,
- _type,_sm->getClient().getJid().c_str(),destJid.c_str(),Vars::INKBOARD_XMLNS,
- this->getSessionId().c_str(),wrapper,message,wrapper))
+ _type.c_str(),_sm->getClient().getJid().c_str(),destJid.c_str(),Vars::INKBOARD_XMLNS.c_str(),
+ this->getSessionId().c_str(),wrapper.c_str(),message.c_str(),wrapper.c_str()))
{ return false; }
else
@@ -121,7 +141,7 @@ InkboardDocument::sendProtocol(const Glib::ustring &destJid, Message::Wrapper &w
}else
{
- g_warning("Sending Message in invalid state message=%s , state=%d",message,this->state);
+ g_warning("Sending Message in invalid state message=%s , state=%d",message.c_str(),this->state);
return false;
}
}
@@ -164,7 +184,8 @@ InkboardDocument::handleIncomingState(Message::Wrapper &wrapper, Pedro::Element*
{
Glib::ustring message = data->getFirstChild()->getFirstChild()->getFirstChild()->getName();
- // Connect Requests are handled in SessionManager
+ if(message == Message::CONNECT_REQUEST)
+ return this->handleState(State::INITIAL,State::CONNECTING);
if(message == Message::ACCEPT_INVITATION)
return this->handleState(State::AWAITING_INVITATION_REPLY,State::INVITATION_RECIEVED);
index fcd3bab6aaeda3994b1298634996f671fdc0a559..9eff38003494f159d959e9401a0443b436a745f7 100644 (file)
void terminateSession();
void processInkboardEvent(Message::Wrapper &wrapper, Pedro::Element* data);
- bool sendProtocol(const Glib::ustring &destJid, Message::Wrapper &mwrapper,
- Message::Message message);
+ bool sendProtocol(const Glib::ustring &destJid, Message::Wrapper &mwrapper, Message::Message &message);
bool handleOutgoingState(Message::Wrapper &wrapper,Glib::ustring const& message);
bool handleIncomingState(Message::Wrapper &wrapper,Pedro::Element* data);
index 55b41ac204cbb3828ef047a87567dc148ad665c9..3dcb8e217bdf08a9aef87406f18e25d4df1ba8bf 100644 (file)
}
Pedro::DOMString session = root->getTagAttribute("wb", "session");
+ Pedro::DOMString type = root->getTagAttribute("session", "type");
Pedro::DOMString domwrapper = root->getFirstChild()->getFirstChild()->getFirstChild()->getName();
if (session.empty()) {
return;
}
- if(root->exists(Message::CONNECT_REQUEST))
+ if(root->exists(Message::CONNECT_REQUEST) && type == State::WHITEBOARD_PEER)
+ {
handleIncomingInvitation(Invitation(event.getFrom(),session));
- else
+ }else
{
- Message::Wrapper wrapper = static_cast< Message::Wrapper >("protocol");
+ Message::Wrapper wrapper = static_cast< Message::Wrapper >(domwrapper);
InkboardDocument* doc = getInkboardSession(session);
doc->processInkboardEvent(wrapper, root->getFirstChild());
}
+
}
char*