diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index 9477399e5e5e2a0c237a720fb370115884c3ea0e..e53b7ec800b71b72856814535d087defd455c4cf 100644 (file)
namespace Whiteboard {
-InkboardDocument::InkboardDocument(int code, SessionType type, Glib::ustring const& to) :
+InkboardDocument::InkboardDocument(int code, State::SessionType type, Glib::ustring const& to) :
XML::SimpleNode(code), _type(type), _recipient(to)
{
_initBindings();
void
InkboardDocument::_initBindings()
{
+ this->sm = &SessionManager::instance();
_bindDocument(*this);
_bindLogger(*(new XML::SimpleSession()));
}
void
InkboardDocument::startSessionNegotiation()
{
- SessionManager& sm = SessionManager::instance();
- switch (_type) {
- case INKBOARD_MUC:
- sm.sendGroup(_recipient, Message::PROTOCOL, " ");
- break;
- case INKBOARD_PRIVATE:
- default:
- sm.send(_recipient, Message::PROTOCOL," ");
- break;
- }
+ send(_recipient, Message::PROTOCOL,Message::CONNECT_REQUEST);
}
void
InkboardDocument::send(const Glib::ustring &destJid, Message::Wrapper wrapper, Message::Message message)
{
char *fmt=
- "<message type='chat' from='%s' to='%s'>"
+ "<message type='%s' from='%s' to='%s'>"
"<wb xmlns='%s'>"
"<protocol>"
"%s"
"</protocol>"
"</wb>"
"</message>";
- //if (!getClient().write(fmt,getClient().getJid().c_str(),destJid.c_str(),Vars::INKBOARD_XMLNS,message))
- // return false;
+ if (!sm->getClient().write(
+ fmt,_type,sm->getClient().getJid().c_str(),
+ destJid.c_str(),Vars::INKBOARD_XMLNS,message))
+ return false;
return true;
}