diff --git a/include/transport/transport.h b/include/transport/transport.h index b194281f..8fef955f 100644 --- a/include/transport/transport.h +++ b/include/transport/transport.h @@ -111,8 +111,8 @@ namespace Transport { void handlePresence(Swift::Presence::ref presence); void handleSubscription(Swift::Presence::ref presence); void handleProbePresence(Swift::Presence::ref presence); - void handleDataRead(const Swift::String &data); - void handleDataWritten(const Swift::String &data); + void handleDataRead(const std::string &data); + void handleDataWritten(const std::string &data); void handleDiscoInfoResponse(boost::shared_ptr info, Swift::ErrorPayload::ref error, const Swift::JID& jid); // void handleCapsChanged(const Swift::JID& jid); diff --git a/include/transport/userregistration.h b/include/transport/userregistration.h index 21ac00d0..ca5069e3 100644 --- a/include/transport/userregistration.h +++ b/include/transport/userregistration.h @@ -49,8 +49,8 @@ class UserRegistration : Swift::GetResponder, boost::signal onUserUpdated; private: - bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr payload); - bool handleSetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr payload); + bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr payload); + bool handleSetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr payload); Component *m_component; StorageBackend *m_storageBackend; diff --git a/src/discoinforesponder.cpp b/src/discoinforesponder.cpp index b6661bd5..1807a84d 100644 --- a/src/discoinforesponder.cpp +++ b/src/discoinforesponder.cpp @@ -72,14 +72,14 @@ void DiscoInfoResponder::setBuddyFeatures(std::list &f) { onBuddyCapsInfoChanged(caps.generateCapsInfo(m_buddyInfo)); } -bool DiscoInfoResponder::handleGetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr info) { - if (!info->getNode().isEmpty()) { +bool DiscoInfoResponder::handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr info) { + if (!info->getNode().empty()) { sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); return true; } // presence for transport - if (to.getNode().isEmpty()) { + if (to.getNode().empty()) { sendResponse(from, id, boost::shared_ptr(new DiscoInfo(m_transportInfo))); } // presence for buddy diff --git a/src/discoinforesponder.h b/src/discoinforesponder.h index 47ec0715..f609e666 100644 --- a/src/discoinforesponder.h +++ b/src/discoinforesponder.h @@ -39,7 +39,7 @@ class DiscoInfoResponder : public Swift::GetResponder { boost::signal onBuddyCapsInfoChanged; private: - virtual bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr payload); + virtual bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr payload); Swift::DiscoInfo m_transportInfo; Swift::DiscoInfo m_buddyInfo; diff --git a/src/sqlite3backend.cpp b/src/sqlite3backend.cpp index cb42cd19..bfeb042b 100644 --- a/src/sqlite3backend.cpp +++ b/src/sqlite3backend.cpp @@ -132,7 +132,7 @@ bool SQLite3Backend::getBuddies(long id, std::list &roster) { } bool SQLite3Backend::removeUser(long id) { - + return true; } } diff --git a/src/transport.cpp b/src/transport.cpp index 2e3e9317..01e5298c 100644 --- a/src/transport.cpp +++ b/src/transport.cpp @@ -102,12 +102,12 @@ void Component::handleConnectionError(const ComponentError &error) { m_reconnectTimer->start(); } -void Component::handleDataRead(const String &data) { - onXMLIn(data.getUTF8String()); +void Component::handleDataRead(const std::string &data) { + onXMLIn(data); } -void Component::handleDataWritten(const String &data) { - onXMLOut(data.getUTF8String()); +void Component::handleDataWritten(const std::string &data) { + onXMLOut(data); } void Component::handlePresenceReceived(Swift::Presence::ref presence) { @@ -133,7 +133,7 @@ void Component::handlePresence(Swift::Presence::ref presence) { bool isMUC = presence->getPayload() != NULL; // filter out login/logout presence spam - if (!presence->getTo().getNode().isEmpty() && isMUC == false) + if (!presence->getTo().getNode().empty() && isMUC == false) return; // filter out bad presences @@ -173,7 +173,7 @@ void Component::handleProbePresence(Swift::Presence::ref presence) { void Component::handleSubscription(Swift::Presence::ref presence) { // answer to subscibe - if (presence->getType() == Swift::Presence::Subscribe && presence->getTo().getNode().isEmpty()) { + if (presence->getType() == Swift::Presence::Subscribe && presence->getTo().getNode().empty()) { // Log(presence->getFrom().toString().getUTF8String(), "Subscribe presence received => sending subscribed"); Swift::Presence::ref response = Swift::Presence::create(); response->setFrom(presence->getTo()); diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 812dc3da..28c0477b 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -35,7 +35,7 @@ UserManager::~UserManager(){ } User *UserManager::getUserByJID(const std::string &barejid){ - if (m_cachedUser && barejid == m_cachedUser->getJID().toBare().toString().getUTF8String()) { + if (m_cachedUser && barejid == m_cachedUser->getJID().toBare().toString()) { return m_cachedUser; } diff --git a/src/userregistration.cpp b/src/userregistration.cpp index a6dfda3f..14f952f7 100644 --- a/src/userregistration.cpp +++ b/src/userregistration.cpp @@ -119,18 +119,18 @@ bool UserRegistration::unregisterUser(const std::string &barejid) { return true; } -bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr payload) { +bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr payload) { if (CONFIG_STRING(m_config, "service.protocol") == "irc") { Swift::GetResponder::sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify); return true; } - std::string barejid = from.toBare().toString().getUTF8String(); + std::string barejid = from.toBare().toString(); // User *user = m_userManager->getUserByJID(barejid); if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) { std::list const &x = CONFIG_LIST(m_config,"service.allowed_servers"); - if (std::find(x.begin(), x.end(), from.getDomain().getUTF8String()) == x.end()) { + if (std::find(x.begin(), x.end(), from.getDomain()) == x.end()) { // Log("UserRegistration", "This user has no permissions to register an account"); Swift::GetResponder::sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify); return true; @@ -215,18 +215,18 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID return true; } -bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr payload) { +bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr payload) { if (CONFIG_STRING(m_config, "service.protocol") == "irc") { Swift::GetResponder::sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify); return true; } - std::string barejid = from.toBare().toString().getUTF8String(); + std::string barejid = from.toBare().toString(); // AbstractUser *user = m_component->userManager()->getUserByJID(barejid); if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) { std::list const &x = CONFIG_LIST(m_config,"service.allowed_servers"); - if (std::find(x.begin(), x.end(), from.getDomain().getUTF8String()) == x.end()) { + if (std::find(x.begin(), x.end(), from.getDomain()) == x.end()) { // Log("UserRegistration", "This user has no permissions to register an account"); Swift::SetResponder::sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify); return true; @@ -249,7 +249,7 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID payload->setUsername(textSingle->getValue()); } else if (textSingle->getName() == "encoding") { - encoding = textSingle->getValue().getUTF8String(); + encoding = textSingle->getValue(); } continue; } @@ -265,7 +265,7 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID ListSingleFormField::ref listSingle = boost::dynamic_pointer_cast(*it); if (listSingle) { if (listSingle->getName() == "language") { - language = listSingle->getValue().getUTF8String(); + language = listSingle->getValue(); } continue; } @@ -294,8 +294,8 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID } // Register or change password - if (payload->getUsername()->isEmpty() || - (payload->getPassword()->isEmpty() && CONFIG_STRING(m_config, "service.protocol") != "twitter" && CONFIG_STRING(m_config, "service.protocol") != "bonjour") + if (payload->getUsername()->empty() || + (payload->getPassword()->empty() && CONFIG_STRING(m_config, "service.protocol") != "twitter" && CONFIG_STRING(m_config, "service.protocol") != "bonjour") // || localization.getLanguages().find(language) == localization.getLanguages().end() ) { @@ -312,14 +312,14 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID // User tries to register someone who's already registered. UserInfo user_row; - bool registered = m_storageBackend->getUser(Swift::JID(*payload->getUsername()).toBare().toString().getUTF8String(), user_row); + bool registered = m_storageBackend->getUser(Swift::JID(*payload->getUsername()).toBare().toString(), user_row); if (registered) { Swift::SetResponder::sendError(from, id, ErrorPayload::NotAcceptable, ErrorPayload::Modify); return true; } } - std::string username = payload->getUsername()->getUTF8String(); + std::string username = *payload->getUsername(); // m_component->protocol()->prepareUsername(username); std::string newUsername(username); @@ -345,7 +345,7 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID if (!registered) { res.jid = barejid; res.uin = username; - res.password = payload->getPassword()->getUTF8String(); + res.password = *payload->getPassword(); res.language = language; res.encoding = encoding; res.vip = 0; @@ -356,7 +356,7 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID // change passwordhttp://soumar.jabbim.cz/phpmyadmin/index.php // Log("UserRegistration", "changing user password: "<< barejid << ", " << username); res.jid = barejid; - res.password = payload->getPassword()->getUTF8String(); + res.password = *payload->getPassword(); res.language = language; res.encoding = encoding; m_storageBackend->setUser(res);