Swift::String removed

This commit is contained in:
HanzZ 2011-03-07 20:52:35 +01:00
parent 599469670e
commit e5fcbf00b7
8 changed files with 30 additions and 30 deletions

View file

@ -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<Swift::DiscoInfo> info, Swift::ErrorPayload::ref error, const Swift::JID& jid);
// void handleCapsChanged(const Swift::JID& jid);

View file

@ -49,8 +49,8 @@ class UserRegistration : Swift::GetResponder<Swift::InBandRegistrationPayload>,
boost::signal<void (const UserInfo &user)> onUserUpdated;
private:
bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr<Swift::InBandRegistrationPayload> payload);
bool handleSetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr<Swift::InBandRegistrationPayload> payload);
bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr<Swift::InBandRegistrationPayload> payload);
bool handleSetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr<Swift::InBandRegistrationPayload> payload);
Component *m_component;
StorageBackend *m_storageBackend;

View file

@ -72,14 +72,14 @@ void DiscoInfoResponder::setBuddyFeatures(std::list<std::string> &f) {
onBuddyCapsInfoChanged(caps.generateCapsInfo(m_buddyInfo));
}
bool DiscoInfoResponder::handleGetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr<Swift::DiscoInfo> info) {
if (!info->getNode().isEmpty()) {
bool DiscoInfoResponder::handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr<Swift::DiscoInfo> 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<DiscoInfo>(new DiscoInfo(m_transportInfo)));
}
// presence for buddy

View file

@ -39,7 +39,7 @@ class DiscoInfoResponder : public Swift::GetResponder<Swift::DiscoInfo> {
boost::signal<void (const Swift::CapsInfo &capsInfo)> onBuddyCapsInfoChanged;
private:
virtual bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const Swift::String& id, boost::shared_ptr<Swift::DiscoInfo> payload);
virtual bool handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr<Swift::DiscoInfo> payload);
Swift::DiscoInfo m_transportInfo;
Swift::DiscoInfo m_buddyInfo;

View file

@ -132,7 +132,7 @@ bool SQLite3Backend::getBuddies(long id, std::list<std::string> &roster) {
}
bool SQLite3Backend::removeUser(long id) {
return true;
}
}

View file

@ -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<MUCPayload>() != 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());

View file

@ -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;
}

View file

@ -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<Swift::InBandRegistrationPayload> payload) {
bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr<Swift::InBandRegistrationPayload> payload) {
if (CONFIG_STRING(m_config, "service.protocol") == "irc") {
Swift::GetResponder<Swift::InBandRegistrationPayload>::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<std::string> 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<Swift::InBandRegistrationPayload>::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<Swift::InBandRegistrationPayload> payload) {
bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr<Swift::InBandRegistrationPayload> payload) {
if (CONFIG_STRING(m_config, "service.protocol") == "irc") {
Swift::GetResponder<Swift::InBandRegistrationPayload>::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<std::string> 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<Swift::InBandRegistrationPayload>::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<ListSingleFormField>(*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<Swift::InBandRegistrationPayload>::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);