From: daleharvey Date: Sun, 30 Jul 2006 17:19:19 +0000 (+0000) Subject: more session establishment X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f8baee4ba103cf6d6be4012d6fe0484861665e8f;p=inkscape.git more session establishment --- diff --git a/src/jabber_whiteboard/defines.cpp b/src/jabber_whiteboard/defines.cpp index d97520d55..3e3895ea0 100644 --- a/src/jabber_whiteboard/defines.cpp +++ b/src/jabber_whiteboard/defines.cpp @@ -21,18 +21,18 @@ namespace Whiteboard { namespace Message { - Wrapper PROTOCOL = 0; - Wrapper NEW = 1; - Wrapper REMOVE = 2; - Wrapper CONFIGURE = 3; - Wrapper MOVE = 4; - - 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 = ""; + Message CONNECTED = ""; + Message ACCEPT_INVITATION = ""; + Message DECLINE_INVITATION = ""; + Message DOCUMENT_BEGIN = ""; + Message DOCUMENT_END = ""; } namespace Vars { diff --git a/src/jabber_whiteboard/defines.h b/src/jabber_whiteboard/defines.h index 05e4b9b76..a5d2d2ce6 100644 --- a/src/jabber_whiteboard/defines.h +++ b/src/jabber_whiteboard/defines.h @@ -67,7 +67,7 @@ namespace Whiteboard { namespace Message { - typedef int const Wrapper; + typedef char const* Wrapper; typedef char const* Message; extern Wrapper PROTOCOL; diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp index e53b7ec80..e6bd43713 100644 --- a/src/jabber_whiteboard/inkboard-document.cpp +++ b/src/jabber_whiteboard/inkboard-document.cpp @@ -52,7 +52,7 @@ InkboardDocument::getRecipient() const void InkboardDocument::startSessionNegotiation() { - send(_recipient, Message::PROTOCOL,Message::CONNECT_REQUEST); + sendProtocol(_recipient, Message::PROTOCOL,Message::CONNECT_REQUEST); } void @@ -68,19 +68,20 @@ InkboardDocument::processInkboardEvent(Message::Wrapper mtype, unsigned int seqn } bool -InkboardDocument::send(const Glib::ustring &destJid, Message::Wrapper wrapper, Message::Message message) +InkboardDocument::sendProtocol(const Glib::ustring &destJid, Message::Wrapper wrapper, + Message::Message message) { char *fmt= "" "" - "" + "<%s>" "%s" - "" + "" "" ""; if (!sm->getClient().write( fmt,_type,sm->getClient().getJid().c_str(), - destJid.c_str(),Vars::INKBOARD_XMLNS,message)) + destJid.c_str(),wrapper,Vars::INKBOARD_XMLNS,message,wrapper)) return false; return true; diff --git a/src/jabber_whiteboard/inkboard-document.h b/src/jabber_whiteboard/inkboard-document.h index 1249c42f8..6e04fddac 100644 --- a/src/jabber_whiteboard/inkboard-document.h +++ b/src/jabber_whiteboard/inkboard-document.h @@ -34,19 +34,15 @@ public: return Inkscape::XML::DOCUMENT_NODE; } - SessionManager *sm; - void setRecipient(Glib::ustring const& val); Glib::ustring getRecipient() const; - void setSession(); - void startSessionNegotiation(); void terminateSession(); void processInkboardEvent(Message::Wrapper mtype, unsigned int seqnum, Glib::ustring const& data); - bool send(const Glib::ustring &destJid, Message::Wrapper mwrapper, Message::Message message); - bool send(const Glib::ustring &destJid, Message::Wrapper mwrapper, const Glib::ustring &data); + bool sendProtocol(const Glib::ustring &destJid, Message::Wrapper mwrapper, + Message::Message message); protected: @@ -70,6 +66,7 @@ private: void _initBindings(); + SessionManager *sm; State::SessionType _type; Glib::ustring _recipient; diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index daab6bcbe..e669403cf 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -96,7 +96,7 @@ SessionManager::send(const Glib::ustring &destJid, getClient().getMsgId(), INKBOARD_XMLNS, 2, - (MessageType)type, + type, getSequenceNumber(), xmlData.c_str() ))