diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-14 18:57:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-14 21:36:32 (GMT) |
commit | cb05f5a908e20006c954ce38755c2e422ecc2388 (patch) | |
tree | a793551a5fe279a57d4330119560e8542f745484 /Swift | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Swift')
110 files changed, 601 insertions, 589 deletions
diff --git a/Swift/Controllers/CertificateFileStorage.cpp b/Swift/Controllers/CertificateFileStorage.cpp index 65da1ec..4462556 100644 --- a/Swift/Controllers/CertificateFileStorage.cpp +++ b/Swift/Controllers/CertificateFileStorage.cpp @@ -55,7 +55,7 @@ void CertificateFileStorage::addCertificate(Certificate::ref certificate) { } boost::filesystem::path CertificateFileStorage::getCertificatePath(Certificate::ref certificate) const { - return path / Hexify::hexify(SHA1::getHash(certificate->toDER())).getUTF8String(); + return path / Hexify::hexify(SHA1::getHash(certificate->toDER())); } } diff --git a/Swift/Controllers/CertificateFileStorageFactory.h b/Swift/Controllers/CertificateFileStorageFactory.h index bcac56d..7ed8287 100644 --- a/Swift/Controllers/CertificateFileStorageFactory.h +++ b/Swift/Controllers/CertificateFileStorageFactory.h @@ -17,7 +17,7 @@ namespace Swift { CertificateFileStorageFactory(const boost::filesystem::path& basePath, CertificateFactory* certificateFactory) : basePath(basePath), certificateFactory(certificateFactory) {} virtual CertificateStorage* createCertificateStorage(const JID& profile) const { - boost::filesystem::path profilePath = basePath / profile.toString().getUTF8String(); + boost::filesystem::path profilePath = basePath / profile.toString(); return new CertificateFileStorage(profilePath / "certificates", certificateFactory); } diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 3fffbb1..e4ad9c8 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -35,9 +35,9 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ chatStateTracker_->onChatStateChange.connect(boost::bind(&ChatWindow::setContactChatState, chatWindow_, _1)); stanzaChannel_->onStanzaAcked.connect(boost::bind(&ChatController::handleStanzaAcked, this, _1)); nickResolver_->onNickChanged.connect(boost::bind(&ChatController::handleContactNickChanged, this, _1, _2)); - String nick = nickResolver_->jidToNick(toJID_); + std::string nick = nickResolver_->jidToNick(toJID_); chatWindow_->setName(nick); - String startMessage("Starting chat with " + nick); + std::string startMessage("Starting chat with " + nick); Presence::ref theirPresence; if (isInMUC) { startMessage += " in chatroom " + contact.toBare().toString(); @@ -47,7 +47,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ theirPresence = contact.isBare() ? presenceOracle->getHighestPriorityPresence(contact.toBare()) : presenceOracle->getLastPresence(contact); } startMessage += ": " + StatusShow::typeToFriendlyName(theirPresence ? theirPresence->getShow() : StatusShow::None); - if (theirPresence && !theirPresence->getStatus().isEmpty()) { + if (theirPresence && !theirPresence->getStatus().empty()) { startMessage += " (" + theirPresence->getStatus() + ")"; } lastShownStatus_ = theirPresence ? theirPresence->getShow() : StatusShow::None; @@ -59,7 +59,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ } -void ChatController::handleContactNickChanged(const JID& jid, const String& /*oldNick*/) { +void ChatController::handleContactNickChanged(const JID& jid, const std::string& /*oldNick*/) { if (jid.toBare() == toJID_.toBare()) { chatWindow_->setName(nickResolver_->jidToNick(jid)); } @@ -108,8 +108,8 @@ void ChatController::preSendMessageRequest(boost::shared_ptr<Message> message) { chatStateNotifier_->addChatStateRequest(message); } -void ChatController::postSendMessage(const String& body, boost::shared_ptr<Stanza> sentStanza) { - String id = addMessage(body, "me", true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel() : boost::optional<SecurityLabel>(), String(avatarManager_->getAvatarPath(selfJID_).string()), boost::posix_time::microsec_clock::universal_time()); +void ChatController::postSendMessage(const std::string& body, boost::shared_ptr<Stanza> sentStanza) { + std::string id = addMessage(body, "me", true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel() : boost::optional<SecurityLabel>(), std::string(avatarManager_->getAvatarPath(selfJID_).string()), boost::posix_time::microsec_clock::universal_time()); if (stanzaChannel_->getStreamManagementEnabled()) { chatWindow_->setAckState(id, ChatWindow::Pending); unackedStanzas_[sentStanza] = id; @@ -119,7 +119,7 @@ void ChatController::postSendMessage(const String& body, boost::shared_ptr<Stanz } void ChatController::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) { - String id = unackedStanzas_[stanza]; + std::string id = unackedStanzas_[stanza]; if (id != "") { chatWindow_->setAckState(id, ChatWindow::Received); } @@ -128,7 +128,7 @@ void ChatController::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) { void ChatController::setOnline(bool online) { if (!online) { - std::map<boost::shared_ptr<Stanza>, String>::iterator it = unackedStanzas_.begin(); + std::map<boost::shared_ptr<Stanza>, std::string>::iterator it = unackedStanzas_.begin(); for ( ; it != unackedStanzas_.end(); it++) { chatWindow_->setAckState(it->second, ChatWindow::Failed); } @@ -142,13 +142,13 @@ void ChatController::setOnline(bool online) { ChatControllerBase::setOnline(online); } -String ChatController::senderDisplayNameFromMessage(const JID& from) { +std::string ChatController::senderDisplayNameFromMessage(const JID& from) { return nickResolver_->jidToNick(from); } -String ChatController::getStatusChangeString(boost::shared_ptr<Presence> presence) { - String nick = senderDisplayNameFromMessage(presence->getFrom()); - String response = nick; +std::string ChatController::getStatusChangeString(boost::shared_ptr<Presence> presence) { + std::string nick = senderDisplayNameFromMessage(presence->getFrom()); + std::string response = nick; if (!presence || presence->getType() == Presence::Unavailable || presence->getType() == Presence::Error) { response += " has gone offline"; } else if (presence->getType() == Presence::Available) { @@ -161,7 +161,7 @@ String ChatController::getStatusChangeString(boost::shared_ptr<Presence> presenc response += " is now busy"; } } - if (!presence->getStatus().isEmpty()) { + if (!presence->getStatus().empty()) { response += " (" + presence->getStatus() + ")"; } return response + "."; @@ -188,7 +188,7 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc chatStateTracker_->handlePresenceChange(newPresence); chatStateNotifier_->setContactIsOnline(newPresence->getType() == Presence::Available); - String newStatusChangeString = getStatusChangeString(newPresence); + std::string newStatusChangeString = getStatusChangeString(newPresence); if (newStatusChangeString != lastStatusChangeString_) { if (lastWasPresence_) { chatWindow_->replaceLastMessage(newStatusChangeString); diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h index c013387..b8ac1cd 100644 --- a/Swift/Controllers/Chat/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h @@ -24,16 +24,16 @@ namespace Swift { private: void handlePresenceChange(boost::shared_ptr<Presence> newPresence); - String getStatusChangeString(boost::shared_ptr<Presence> presence); + std::string getStatusChangeString(boost::shared_ptr<Presence> presence); bool isIncomingMessageFromMe(boost::shared_ptr<Message> message); - void postSendMessage(const String &body, boost::shared_ptr<Stanza> sentStanza); + void postSendMessage(const std::string &body, boost::shared_ptr<Stanza> sentStanza); void preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent); void preSendMessageRequest(boost::shared_ptr<Message>); - String senderDisplayNameFromMessage(const JID& from); + std::string senderDisplayNameFromMessage(const JID& from); virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const; void handleStanzaAcked(boost::shared_ptr<Stanza> stanza); void dayTicked() {lastWasPresence_ = false;} - void handleContactNickChanged(const JID& jid, const String& /*oldNick*/); + void handleContactNickChanged(const JID& jid, const std::string& /*oldNick*/); private: NickResolver* nickResolver_; @@ -41,8 +41,8 @@ namespace Swift { ChatStateTracker* chatStateTracker_; bool isInMUC_; bool lastWasPresence_; - String lastStatusChangeString_; - std::map<boost::shared_ptr<Stanza>, String> unackedStanzas_; + std::string lastStatusChangeString_; + std::map<boost::shared_ptr<Stanza>, std::string> unackedStanzas_; StatusShow::Type lastShownStatus_; }; } diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index ca0916d..f70ec81 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -11,7 +11,9 @@ #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> #include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/algorithm/string.hpp> +#include "Swiften/Base/String.h" #include "Swiften/Client/StanzaChannel.h" #include "Swiften/Elements/Delay.h" #include "Swiften/Base/foreach.h" @@ -49,7 +51,7 @@ void ChatControllerBase::createDayChangeTimer() { void ChatControllerBase::handleDayChangeTick() { dateChangeTimer_->stop(); boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); - chatWindow_->addSystemMessage("The day is now " + String(boost::posix_time::to_iso_extended_string(now)).getSubstring(0,10)); + chatWindow_->addSystemMessage("The day is now " + std::string(boost::posix_time::to_iso_extended_string(now)).substr(0,10)); dayTicked(); createDayChangeTimer(); } @@ -84,8 +86,8 @@ void ChatControllerBase::handleAllMessagesRead() { chatWindow_->setUnreadMessageCount(0); } -void ChatControllerBase::handleSendMessageRequest(const String &body) { - if (!stanzaChannel_->isAvailable() || body.isEmpty()) { +void ChatControllerBase::handleSendMessageRequest(const std::string &body) { + if (!stanzaChannel_->isAvailable() || body.empty()) { return; } boost::shared_ptr<Message> message(new Message()); @@ -130,9 +132,9 @@ void ChatControllerBase::activateChatWindow() { chatWindow_->activate(); } -String ChatControllerBase::addMessage(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time) { - if (message.beginsWith("/me ")) { - return chatWindow_->addAction(message.getSplittedAtFirst(' ').second, senderName, senderIsSelf, label, avatarPath, time); +std::string ChatControllerBase::addMessage(const std::string& message, const std::string& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time) { + if (boost::starts_with(message, "/me ")) { + return chatWindow_->addAction(String::getSplittedAtFirst(message, ' ').second, senderName, senderIsSelf, label, avatarPath, time); } else { return chatWindow_->addMessage(message, senderName, senderIsSelf, label, avatarPath, time); } @@ -148,9 +150,9 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m unreadMessages_.push_back(messageEvent); } boost::shared_ptr<Message> message = messageEvent->getStanza(); - String body = message->getBody(); + std::string body = message->getBody(); if (message->isError()) { - String errorMessage = getErrorMessage(message->getPayload<ErrorPayload>()); + std::string errorMessage = getErrorMessage(message->getPayload<ErrorPayload>()); chatWindow_->addErrorMessage(errorMessage); } else { @@ -167,7 +169,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time(); std::ostringstream s; s << "The following message took " << (now - delayPayloads[i]->getStamp()).total_milliseconds() / 1000.0 << " seconds to be delivered from " << delayPayloads[i]->getFrom()->toString() << "."; - chatWindow_->addSystemMessage(String(s.str())); + chatWindow_->addSystemMessage(std::string(s.str())); } boost::shared_ptr<SecurityLabel> label = message->getPayload<SecurityLabel>(); boost::optional<SecurityLabel> maybeLabel = label ? boost::optional<SecurityLabel>(*label) : boost::optional<SecurityLabel>(); @@ -179,15 +181,15 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m timeStamp = *messageTimeStamp; } - addMessage(body, senderDisplayNameFromMessage(from), isIncomingMessageFromMe(message), maybeLabel, String(avatarManager_->getAvatarPath(from).string()), timeStamp); + addMessage(body, senderDisplayNameFromMessage(from), isIncomingMessageFromMe(message), maybeLabel, std::string(avatarManager_->getAvatarPath(from).string()), timeStamp); } chatWindow_->show(); chatWindow_->setUnreadMessageCount(unreadMessages_.size()); } -String ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload> error) { - String defaultMessage = "Error sending message"; - if (!error->getText().isEmpty()) { +std::string ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload> error) { + std::string defaultMessage = "Error sending message"; + if (!error->getText().empty()) { return error->getText(); } else { diff --git a/Swift/Controllers/Chat/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h index e1e5e62..4a1f8e0 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.h +++ b/Swift/Controllers/Chat/ChatControllerBase.h @@ -18,7 +18,7 @@ #include "Swiften/Network/Timer.h" #include "Swiften/Network/TimerFactory.h" #include "Swiften/Elements/Stanza.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/DiscoInfo.h" #include "Swift/Controllers/XMPPEvents/MessageEvent.h" #include "Swiften/JID/JID.h" @@ -43,7 +43,7 @@ namespace Swift { void activateChatWindow(); void setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info); void handleIncomingMessage(boost::shared_ptr<MessageEvent> message); - String addMessage(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time); + std::string addMessage(const std::string& message, const std::string& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time); virtual void setOnline(bool online); virtual void setEnabled(bool enabled); virtual void setToJID(const JID& jid) {toJID_ = jid;}; @@ -53,8 +53,8 @@ namespace Swift { /** * Pass the Message appended, and the stanza used to send it. */ - virtual void postSendMessage(const String&, boost::shared_ptr<Stanza>) {}; - virtual String senderDisplayNameFromMessage(const JID& from) = 0; + virtual void postSendMessage(const std::string&, boost::shared_ptr<Stanza>) {}; + virtual std::string senderDisplayNameFromMessage(const JID& from) = 0; virtual bool isIncomingMessageFromMe(boost::shared_ptr<Message>) = 0; virtual void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>) {}; virtual void preSendMessageRequest(boost::shared_ptr<Message>) {}; @@ -64,10 +64,10 @@ namespace Swift { private: void createDayChangeTimer(); - void handleSendMessageRequest(const String &body); + void handleSendMessageRequest(const std::string &body); void handleAllMessagesRead(); void handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog>, ErrorPayload::ref error); - String getErrorMessage(boost::shared_ptr<ErrorPayload>); + std::string getErrorMessage(boost::shared_ptr<ErrorPayload>); void handleDayChangeTick(); protected: diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index b7e8432..94d4b9a 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -221,7 +221,7 @@ void ChatsManager::setOnline(bool enabled) { } -void ChatsManager::handleChatRequest(const String &contact) { +void ChatsManager::handleChatRequest(const std::string &contact) { ChatController* controller = getChatControllerOrFindAnother(JID(contact)); controller->activateChatWindow(); } @@ -280,7 +280,7 @@ void ChatsManager::rebindControllerJID(const JID& from, const JID& to) { chatControllers_[to]->setToJID(to); } -void ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional<String>& nickMaybe, bool autoJoin) { +void ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional<std::string>& nickMaybe, bool autoJoin) { if (autoJoin) { MUCBookmark bookmark(mucJID, mucJID.getNode()); bookmark.setAutojoin(true); @@ -294,7 +294,7 @@ void ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional if (it != mucControllers_.end()) { it->second->rejoin(); } else { - String nick = nickMaybe ? nickMaybe.get() : jid_.getNode(); + std::string nick = nickMaybe ? nickMaybe.get() : jid_.getNode(); MUC::ref muc = mucManager->createMUC(mucJID); MUCController* controller = new MUCController(jid_, muc, nick, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory_, eventController_); mucControllers_[mucJID] = controller; @@ -311,7 +311,7 @@ void ChatsManager::handleSearchMUCRequest() { void ChatsManager::handleIncomingMessage(boost::shared_ptr<Message> message) { JID jid = message->getFrom(); boost::shared_ptr<MessageEvent> event(new MessageEvent(message)); - if (!event->isReadable() && !message->getPayload<ChatState>() && message->getSubject().isEmpty()) { + if (!event->isReadable() && !message->getPayload<ChatState>() && message->getSubject().empty()) { return; } diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index 62b14d9..3740186 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.h @@ -10,7 +10,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/Elements/Message.h" #include "Swiften/Elements/Presence.h" @@ -52,8 +52,8 @@ namespace Swift { void setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info); void handleIncomingMessage(boost::shared_ptr<Message> message); private: - void handleChatRequest(const String& contact); - void handleJoinMUCRequest(const JID& muc, const boost::optional<String>& nick, bool autoJoin); + void handleChatRequest(const std::string& contact); + void handleJoinMUCRequest(const JID& muc, const boost::optional<std::string>& nick, bool autoJoin); void handleSearchMUCRequest(); void handleMUCSelectedAfterSearch(const JID&); void rebindControllerJID(const JID& from, const JID& to); diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 0ed2b35..765c49d 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -8,6 +8,7 @@ #include <boost/bind.hpp> #include <boost/regex.hpp> +#include <boost/algorithm/string.hpp> #include "Swiften/Network/Timer.h" #include "Swiften/Network/TimerFactory.h" @@ -38,7 +39,7 @@ namespace Swift { MUCController::MUCController ( const JID& self, MUC::ref muc, - const String &nick, + const std::string &nick, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, @@ -119,8 +120,8 @@ void MUCController::receivedActivity() { void MUCController::handleJoinFailed(boost::shared_ptr<ErrorPayload> error) { receivedActivity(); - String errorMessage = "Unable to join this room"; - String rejoinNick; + std::string errorMessage = "Unable to join this room"; + std::string rejoinNick; if (error) { switch (error->getCondition()) { case ErrorPayload::Conflict: rejoinNick = nick_ + "_"; errorMessage += " as " + nick_ + ", retrying as " + rejoinNick; break; @@ -136,17 +137,17 @@ void MUCController::handleJoinFailed(boost::shared_ptr<ErrorPayload> error) { } errorMessage += "."; chatWindow_->addErrorMessage(errorMessage); - if (!rejoinNick.isEmpty()) { + if (!rejoinNick.empty()) { nick_ = rejoinNick; parting_ = true; rejoin(); } } -void MUCController::handleJoinComplete(const String& nick) { +void MUCController::handleJoinComplete(const std::string& nick) { receivedActivity(); joined_ = true; - String joinMessage = "You have joined room " + toJID_.toString() + " as " + nick; + std::string joinMessage = "You have joined room " + toJID_.toString() + " as " + nick; nick_ = nick; chatWindow_->addSystemMessage(joinMessage); clearPresenceQueue(); @@ -158,7 +159,7 @@ void MUCController::handleAvatarChanged(const JID& jid) { if (parting_ || !jid.equals(toJID_, JID::WithoutResource)) { return; } - String path = avatarManager_->getAvatarPath(jid).string(); + std::string path = avatarManager_->getAvatarPath(jid).string(); roster_->applyOnItems(SetAvatar(jid, path, JID::WithResource)); } @@ -184,7 +185,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { appendToJoinParts(joinParts_, event); roster_->addContact(jid, realJID, occupant.getNick(), roleToGroupName(occupant.getRole()), avatarManager_->getAvatarPath(jid).string()); if (joined_) { - String joinString = occupant.getNick() + " has joined the room"; + std::string joinString = occupant.getNick() + " has joined the room"; MUCOccupant::Role role = occupant.getRole(); if (role != MUCOccupant::NoRole && role != MUCOccupant::Participant) { joinString += " as a " + roleToFriendlyName(role); @@ -203,7 +204,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { } } -void MUCController::addPresenceMessage(const String& message) { +void MUCController::addPresenceMessage(const std::string& message) { lastWasPresence_ = true; chatWindow_->addPresenceMessage(message); } @@ -213,7 +214,7 @@ void MUCController::clearPresenceQueue() { joinParts_.clear(); } -String MUCController::roleToFriendlyName(MUCOccupant::Role role) { +std::string MUCController::roleToFriendlyName(MUCOccupant::Role role) { switch (role) { case MUCOccupant::Moderator: return "moderator"; case MUCOccupant::Participant: return "participant"; @@ -223,14 +224,14 @@ String MUCController::roleToFriendlyName(MUCOccupant::Role role) { return ""; } -JID MUCController::nickToJID(const String& nick) { +JID MUCController::nickToJID(const std::string& nick) { return JID(toJID_.getNode(), toJID_.getDomain(), nick); } bool MUCController::messageTargetsMe(boost::shared_ptr<Message> message) { - String stringRegexp(".*\\b" + nick_.getLowerCase() + "\\b.*"); - boost::regex myRegexp(stringRegexp.getUTF8String()); - return boost::regex_match(message->getBody().getLowerCase().getUTF8String(), myRegexp); + std::string stringRegexp(".*\\b" + boost::to_lower_copy(nick_) + "\\b.*"); + boost::regex myRegexp(stringRegexp); + return boost::regex_match(boost::to_lower_copy(message->getBody()), myRegexp); } void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { @@ -246,7 +247,7 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes } } if (joined_) { - String nick = message->getFrom().getResource(); + std::string nick = message->getFrom().getResource(); if (nick != nick_ && currentOccupants_.find(nick) != currentOccupants_.end()) { completer_->addWord(nick); } @@ -255,7 +256,7 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes receivedActivity(); joined_ = true; - if (!message->getSubject().isEmpty() && message->getBody().isEmpty()) { + if (!message->getSubject().empty() && message->getBody().empty()) { chatWindow_->addSystemMessage("The room subject is now: " + message->getSubject()); doneGettingHistory_ = true; } @@ -269,7 +270,7 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes } } -void MUCController::handleOccupantRoleChanged(const String& nick, const MUCOccupant& occupant, const MUCOccupant::Role& oldRole) { +void MUCController::handleOccupantRoleChanged(const std::string& nick, const MUCOccupant& occupant, const MUCOccupant::Role& oldRole) { clearPresenceQueue(); receivedActivity(); JID jid(nickToJID(nick)); @@ -282,8 +283,8 @@ void MUCController::handleOccupantRoleChanged(const String& nick, const MUCOccup chatWindow_->addSystemMessage(nick + " is now a " + roleToFriendlyName(occupant.getRole())); } -String MUCController::roleToGroupName(MUCOccupant::Role role) { - String result; +std::string MUCController::roleToGroupName(MUCOccupant::Role role) { + std::string result; switch (role) { case MUCOccupant::Moderator: result = "Moderators"; break; case MUCOccupant::Participant: result = "Participants"; break; @@ -326,13 +327,13 @@ bool MUCController::shouldUpdateJoinParts() { return lastWasPresence_; } -void MUCController::handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType, const String& reason) { +void MUCController::handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType, const std::string& reason) { NickJoinPart event(occupant.getNick(), Part); appendToJoinParts(joinParts_, event); currentOccupants_.erase(occupant.getNick()); completer_->removeWord(occupant.getNick()); - String partMessage = (occupant.getNick() != nick_) ? occupant.getNick() + " has left the room" : "You have left the room"; - if (!reason.isEmpty()) { + std::string partMessage = (occupant.getNick() != nick_) ? occupant.getNick() + " has left the room" : "You have left the room"; + if (!reason.empty()) { partMessage += " (" + reason + ")"; } partMessage += "."; @@ -361,7 +362,7 @@ bool MUCController::isIncomingMessageFromMe(boost::shared_ptr<Message> message) return nick_ == from.getResource(); } -String MUCController::senderDisplayNameFromMessage(const JID& from) { +std::string MUCController::senderDisplayNameFromMessage(const JID& from) { return from.getResource(); } @@ -398,8 +399,8 @@ void MUCController::appendToJoinParts(std::vector<NickJoinPart>& joinParts, cons } } -String MUCController::concatenateListOfNames(const std::vector<NickJoinPart>& joinParts) { - String result; +std::string MUCController::concatenateListOfNames(const std::vector<NickJoinPart>& joinParts) { + std::string result; for (size_t i = 0; i < joinParts.size(); i++) { if (i > 0) { if (i < joinParts.size() - 1) { @@ -414,18 +415,18 @@ String MUCController::concatenateListOfNames(const std::vector<NickJoinPart>& jo return result; } -String MUCController::generateJoinPartString(const std::vector<NickJoinPart>& joinParts) { +std::string MUCController::generateJoinPartString(const std::vector<NickJoinPart>& joinParts) { std::vector<NickJoinPart> sorted[4]; - String eventStrings[4]; + std::string eventStrings[4]; foreach (NickJoinPart event, joinParts) { sorted[event.type].push_back(event); } - String result; + std::string result; std::vector<JoinPart> populatedEvents; for (size_t i = 0; i < 4; i++) { - String eventString = concatenateListOfNames(sorted[i]); - if (!eventString.isEmpty()) { - String haveHas = sorted[i].size() > 1 ? " have" : " has"; + std::string eventString = concatenateListOfNames(sorted[i]); + if (!eventString.empty()) { + std::string haveHas = sorted[i].size() > 1 ? " have" : " has"; switch (i) { case Join: eventString += haveHas + " joined";break; case Part: eventString += haveHas + " left";break; diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 258b730..30f7aa5 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -11,7 +11,7 @@ #include <boost/signals/connection.hpp> #include <set> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Network/Timer.h" #include "Swift/Controllers/Chat/ChatControllerBase.h" #include "Swiften/Elements/Message.h" @@ -34,44 +34,44 @@ namespace Swift { enum JoinPart {Join, Part, JoinThenPart, PartThenJoin}; struct NickJoinPart { - NickJoinPart(const String& nick, JoinPart type) : nick(nick), type(type) {}; - String nick; + NickJoinPart(const std::string& nick, JoinPart type) : nick(nick), type(type) {}; + std::string nick; JoinPart type; }; class MUCController : public ChatControllerBase { public: - MUCController(const JID& self, MUC::ref muc, const String &nick, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager, UIEventStream* events, bool useDelayForLatency, TimerFactory* timerFactory, EventController* eventController); + MUCController(const JID& self, MUC::ref muc, const std::string &nick, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager, UIEventStream* events, bool useDelayForLatency, TimerFactory* timerFactory, EventController* eventController); ~MUCController(); boost::signal<void ()> onUserLeft; virtual void setOnline(bool online); void rejoin(); static void appendToJoinParts(std::vector<NickJoinPart>& joinParts, const NickJoinPart& newEvent); - static String generateJoinPartString(const std::vector<NickJoinPart>& joinParts); - static String concatenateListOfNames(const std::vector<NickJoinPart>& joinParts); + static std::string generateJoinPartString(const std::vector<NickJoinPart>& joinParts); + static std::string concatenateListOfNames(const std::vector<NickJoinPart>& joinParts); protected: void preSendMessageRequest(boost::shared_ptr<Message> message); bool isIncomingMessageFromMe(boost::shared_ptr<Message> message); - String senderDisplayNameFromMessage(const JID& from); + std::string senderDisplayNameFromMessage(const JID& from); boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message> message) const; void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>); private: void clearPresenceQueue(); - void addPresenceMessage(const String& message); + void addPresenceMessage(const std::string& message); void handleWindowClosed(); void handleAvatarChanged(const JID& jid); void handleOccupantJoined(const MUCOccupant& occupant); - void handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType type, const String& reason); + void handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType type, const std::string& reason); void handleOccupantPresenceChange(boost::shared_ptr<Presence> presence); - void handleOccupantRoleChanged(const String& nick, const MUCOccupant& occupant,const MUCOccupant::Role& oldRole); - void handleJoinComplete(const String& nick); + void handleOccupantRoleChanged(const std::string& nick, const MUCOccupant& occupant,const MUCOccupant::Role& oldRole); + void handleJoinComplete(const std::string& nick); void handleJoinFailed(boost::shared_ptr<ErrorPayload> error); void handleJoinTimeoutTick(); - String roleToGroupName(MUCOccupant::Role role); - JID nickToJID(const String& nick); - String roleToFriendlyName(MUCOccupant::Role role); + std::string roleToGroupName(MUCOccupant::Role role); + JID nickToJID(const std::string& nick); + std::string roleToFriendlyName(MUCOccupant::Role role); void receivedActivity(); bool messageTargetsMe(boost::shared_ptr<Message> message); void updateJoinParts(); @@ -82,8 +82,8 @@ namespace Swift { private: MUC::ref muc_; UIEventStream* events_; - String nick_; - String desiredNick_; + std::string nick_; + std::string desiredNick_; Roster* roster_; TabComplete* completer_; bool parting_; @@ -93,7 +93,7 @@ namespace Swift { bool doneGettingHistory_; boost::bsignals::scoped_connection avatarChangedConnection_; boost::shared_ptr<Timer> loginCheckTimer_; - std::set<String> currentOccupants_; + std::set<std::string> currentOccupants_; std::vector<NickJoinPart> joinParts_; boost::posix_time::ptime lastActivity_; }; diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp index 2b25e2a..743aabb 100644 --- a/Swift/Controllers/Chat/MUCSearchController.cpp +++ b/Swift/Controllers/Chat/MUCSearchController.cpp @@ -13,6 +13,7 @@ #include <Swiften/Disco/GetDiscoItemsRequest.h> #include <Swiften/Base/Log.h> +#include <Swiften/Base/String.h> #include <Swift/Controllers/UIEvents/UIEventStream.h> #include <Swift/Controllers/UIInterfaces/MUCSearchWindowFactory.h> #include <Swift/Controllers/DiscoServiceWalker.h> @@ -20,7 +21,7 @@ namespace Swift { -static const String SEARCHED_SERVICES = "searchedServices"; +static const std::string SEARCHED_SERVICES = "searchedServices"; MUCSearchController::MUCSearchController(const JID& jid, MUCSearchWindowFactory* factory, IQRouter* iqRouter, SettingsProvider* settings) : jid_(jid), factory_(factory), iqRouter_(iqRouter), settings_(settings), window_(NULL), walker_(NULL) { itemsInProgress_ = 0; @@ -45,7 +46,7 @@ void MUCSearchController::openSearchWindow() { void MUCSearchController::loadSavedServices() { savedServices_.clear(); - foreach (String stringItem, settings_->getStringSetting(SEARCHED_SERVICES).split('\n')) { + foreach (std::string stringItem, String::split(settings_->getStringSetting(SEARCHED_SERVICES), '\n')) { savedServices_.push_back(JID(stringItem)); } } @@ -54,13 +55,13 @@ void MUCSearchController::addToSavedServices(const JID& jid) { savedServices_.erase(std::remove(savedServices_.begin(), savedServices_.end(), jid), savedServices_.end()); savedServices_.push_front(jid); - String collapsed; + std::string collapsed; int i = 0; foreach (JID jidItem, savedServices_) { if (i >= 15) { break; } - if (!collapsed.isEmpty()) { + if (!collapsed.empty()) { collapsed += "\n"; } collapsed += jidItem.toString(); @@ -100,7 +101,7 @@ void MUCSearchController::handleSearchService(const JID& jid) { void MUCSearchController::handleDiscoServiceFound(const JID& jid, boost::shared_ptr<DiscoInfo> info) { bool isMUC = false; - String name; + std::string name; foreach (DiscoInfo::Identity identity, info->getIdentities()) { if ((identity.getCategory() == "directory" && identity.getType() == "chatroom") diff --git a/Swift/Controllers/Chat/MUCSearchController.h b/Swift/Controllers/Chat/MUCSearchController.h index 6d3afd1..b348886 100644 --- a/Swift/Controllers/Chat/MUCSearchController.h +++ b/Swift/Controllers/Chat/MUCSearchController.h @@ -12,7 +12,7 @@ #include <boost/shared_ptr.hpp> #include "Swiften/Base/boost_bsignals.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swift/Controllers/UIEvents/UIEvent.h" @@ -34,13 +34,13 @@ namespace Swift { public: class MUCRoom { public: - MUCRoom(const String& node, const String& name, int occupants) : node_(node), name_(name), occupants_(occupants) {} - String getNode() {return node_;} - String getName() {return name_;} + MUCRoom(const std::string& node, const std::string& name, int occupants) : node_(node), name_(name), occupants_(occupants) {} + std::string getNode() {return node_;} + std::string getName() {return name_;} int getOccupantCount() {return occupants_;} private: - String node_; - String name_; + std::string node_; + std::string name_; int occupants_; }; @@ -50,7 +50,7 @@ namespace Swift { complete_ = complete; } - void setName(const String& name) { + void setName(const std::string& name) { name_ = name; } @@ -66,11 +66,11 @@ namespace Swift { return jid_; } - String getName() const { + std::string getName() const { return name_; } - void setError(const String& errorText) {error_ = true; errorText_ = errorText;} + void setError(const std::string& errorText) {error_ = true; errorText_ = errorText;} void clearRooms() {rooms_.clear();} @@ -78,12 +78,12 @@ namespace Swift { std::vector<MUCRoom> getRooms() const {return rooms_;} private: - String name_; + std::string name_; JID jid_; std::vector<MUCRoom> rooms_; bool complete_; bool error_; - String errorText_; + std::string errorText_; }; class MUCSearchController { diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 4d6ca08..40f7445 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -43,7 +43,7 @@ using namespace Swift; class DummyCapsProvider : public CapsProvider { - DiscoInfo::ref getCaps(const String&) const {return DiscoInfo::ref(new DiscoInfo());} + DiscoInfo::ref getCaps(const std::string&) const {return DiscoInfo::ref(new DiscoInfo());} }; class ChatsManagerTest : public CppUnit::TestFixture { @@ -119,7 +119,7 @@ public: boost::shared_ptr<Message> message(new Message()); message->setFrom(messageJID); - String body("This is a legible message. >HEH@)oeueu"); + std::string body("This is a legible message. >HEH@)oeueu"); message->setBody(body); manager_->handleIncomingMessage(message); CPPUNIT_ASSERT_EQUAL(body, window->lastMessageBody_); @@ -133,7 +133,7 @@ public: boost::shared_ptr<Message> message1(new Message()); message1->setFrom(messageJID1); - String body1("This is a legible message. >HEH@)oeueu"); + std::string body1("This is a legible message. >HEH@)oeueu"); message1->setBody(body1); manager_->handleIncomingMessage(message1); CPPUNIT_ASSERT_EQUAL(body1, window1->lastMessageBody_); @@ -145,14 +145,14 @@ public: boost::shared_ptr<Message> message2(new Message()); message2->setFrom(messageJID2); - String body2("This is a legible message. .cmaulm.chul"); + std::string body2("This is a legible message. .cmaulm.chul"); message2->setBody(body2); manager_->handleIncomingMessage(message2); CPPUNIT_ASSERT_EQUAL(body2, window1->lastMessageBody_); } void testFirstOpenWindowOutgoing() { - String messageJIDString("testling@test.com"); + std::string messageJIDString("testling@test.com"); ChatWindow* window = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString), uiEventStream_).Return(window); @@ -162,8 +162,8 @@ public: void testFirstOpenWindowBareToFull() { - String bareJIDString("testling@test.com"); - String fullJIDString("testling@test.com/resource1"); + std::string bareJIDString("testling@test.com"); + std::string fullJIDString("testling@test.com/resource1"); MockChatWindow* window = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(bareJIDString), uiEventStream_).Return(window); @@ -171,19 +171,19 @@ public: boost::shared_ptr<Message> message(new Message()); message->setFrom(JID(fullJIDString)); - String body("This is a legible message. mjuga3089gm8G(*>M)@*("); + std::string body("This is a legible message. mjuga3089gm8G(*>M)@*("); message->setBody(body); manager_->handleIncomingMessage(message); CPPUNIT_ASSERT_EQUAL(body, window->lastMessageBody_); } void testSecondWindow() { - String messageJIDString1("testling1@test.com"); + std::string messageJIDString1("testling1@test.com"); ChatWindow* window1 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString1), uiEventStream_).Return(window1); uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString1)))); - String messageJIDString2("testling2@test.com"); + std::string messageJIDString2("testling2@test.com"); ChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString2), uiEventStream_).Return(window2); @@ -197,9 +197,9 @@ public: Rebind it. */ void testUnbindRebind() { - String bareJIDString("testling@test.com"); - String fullJIDString1("testling@test.com/resource1"); - String fullJIDString2("testling@test.com/resource2"); + std::string bareJIDString("testling@test.com"); + std::string fullJIDString1("testling@test.com/resource1"); + std::string fullJIDString2("testling@test.com/resource2"); MockChatWindow* window = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(bareJIDString), uiEventStream_).Return(window); @@ -207,7 +207,7 @@ public: boost::shared_ptr<Message> message1(new Message()); message1->setFrom(JID(fullJIDString1)); - String messageBody1("This is a legible message."); + std::string messageBody1("This is a legible message."); message1->setBody(messageBody1); manager_->handleIncomingMessage(message1); CPPUNIT_ASSERT_EQUAL(messageBody1, window->lastMessageBody_); @@ -221,7 +221,7 @@ public: boost::shared_ptr<Message> message2(new Message()); message2->setFrom(JID(fullJIDString2)); - String messageBody2("This is another legible message."); + std::string messageBody2("This is another legible message."); message2->setBody(messageBody2); manager_->handleIncomingMessage(message2); CPPUNIT_ASSERT_EQUAL(messageBody2, window->lastMessageBody_); @@ -234,21 +234,21 @@ public: JID muc("testling@test.com"); ChatWindow* mucWindow = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(muc, uiEventStream_).Return(mucWindow); - uiEventStream_->send(boost::shared_ptr<JoinMUCUIEvent>(new JoinMUCUIEvent(muc, String("nick")))); + uiEventStream_->send(boost::shared_ptr<JoinMUCUIEvent>(new JoinMUCUIEvent(muc, std::string("nick")))); - String messageJIDString1("testling@test.com/1"); + std::string messageJIDString1("testling@test.com/1"); ChatWindow* window1 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString1), uiEventStream_).Return(window1); uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString1)))); - String messageJIDString2("testling@test.com/2"); + std::string messageJIDString2("testling@test.com/2"); ChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString2), uiEventStream_).Return(window2); uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString2)))); - String messageJIDString3("testling@test.com/3"); + std::string messageJIDString3("testling@test.com/3"); ChatWindow* window3 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString3), uiEventStream_).Return(window3); @@ -308,14 +308,14 @@ public: boost::shared_ptr<Message> message3(new Message()); message3->setFrom(messageJID3); - String body3("This is a legible message3."); + std::string body3("This is a legible message3."); message3->setBody(body3); manager_->handleIncomingMessage(message3); CPPUNIT_ASSERT_EQUAL(body3, window1->lastMessageBody_); boost::shared_ptr<Message> message2b(new Message()); message2b->setFrom(messageJID2); - String body2b("This is a legible message2b."); + std::string body2b("This is a legible message2b."); message2b->setBody(body2b); manager_->handleIncomingMessage(message2b); CPPUNIT_ASSERT_EQUAL(body2b, window1->lastMessageBody_); diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp index 62f0ccd..7c7a8b9 100644 --- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp @@ -6,6 +6,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> +#include <boost/algorithm/string.hpp> #include "3rdParty/hippomocks.h" #include "Swift/Controllers/XMPPEvents/EventController.h" @@ -112,7 +113,7 @@ public: message = Message::ref(new Message()); message->setFrom(JID(muc_->getJID().toString() + "/other2")); - message->setBody("Hi " + nick_.getLowerCase() + "."); + message->setBody("Hi " + boost::to_lower_copy(nick_) + "."); message->setType(Message::Groupchat); controller_->handleIncomingMessage(MessageEvent::ref(new MessageEvent(message))); CPPUNIT_ASSERT_EQUAL((size_t)4, eventController_->getEvents().size()); @@ -126,7 +127,7 @@ public: message = Message::ref(new Message()); message->setFrom(JID(muc_->getJID().toString() + "/other2")); - message->setBody("Hi " + nick_.getLowerCase() + "ie."); + message->setBody("Hi " + boost::to_lower_copy(nick_) + "ie."); message->setType(Message::Groupchat); controller_->handleIncomingMessage(MessageEvent::ref(new MessageEvent(message))); CPPUNIT_ASSERT_EQUAL((size_t)4, eventController_->getEvents().size()); @@ -199,31 +200,31 @@ public: void testJoinPartStringContructionSimple() { std::vector<NickJoinPart> list; list.push_back(NickJoinPart("Kev", Join)); - CPPUNIT_ASSERT_EQUAL(String("Kev has joined the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Kev has joined the room."), MUCController::generateJoinPartString(list)); list.push_back(NickJoinPart("Remko", Part)); - CPPUNIT_ASSERT_EQUAL(String("Kev has joined and Remko has left the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Kev has joined and Remko has left the room."), MUCController::generateJoinPartString(list)); list.push_back(NickJoinPart("Bert", Join)); - CPPUNIT_ASSERT_EQUAL(String("Kev and Bert have joined and Remko has left the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Kev and Bert have joined and Remko has left the room."), MUCController::generateJoinPartString(list)); list.push_back(NickJoinPart("Ernie", Join)); - CPPUNIT_ASSERT_EQUAL(String("Kev, Bert and Ernie have joined and Remko has left the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Kev, Bert and Ernie have joined and Remko has left the room."), MUCController::generateJoinPartString(list)); } void testJoinPartStringContructionMixed() { std::vector<NickJoinPart> list; list.push_back(NickJoinPart("Kev", JoinThenPart)); - CPPUNIT_ASSERT_EQUAL(String("Kev joined then left the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Kev joined then left the room."), MUCController::generateJoinPartString(list)); list.push_back(NickJoinPart("Remko", Part)); - CPPUNIT_ASSERT_EQUAL(String("Remko has left and Kev joined then left the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Remko has left and Kev joined then left the room."), MUCController::generateJoinPartString(list)); list.push_back(NickJoinPart("Bert", PartThenJoin)); - CPPUNIT_ASSERT_EQUAL(String("Remko has left, Kev joined then left and Bert left then rejoined the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Remko has left, Kev joined then left and Bert left then rejoined the room."), MUCController::generateJoinPartString(list)); list.push_back(NickJoinPart("Ernie", JoinThenPart)); - CPPUNIT_ASSERT_EQUAL(String("Remko has left, Kev and Ernie joined then left and Bert left then rejoined the room."), MUCController::generateJoinPartString(list)); + CPPUNIT_ASSERT_EQUAL(std::string("Remko has left, Kev and Ernie joined then left and Bert left then rejoined the room."), MUCController::generateJoinPartString(list)); } private: JID self_; MUC::ref muc_; - String nick_; + std::string nick_; StanzaChannel* stanzaChannel_; IQChannel* iqChannel_; IQRouter* iqRouter_; diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index 7473849..37059c2 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.cpp @@ -92,7 +92,7 @@ void UserSearchController::handleDiscoServiceFound(const JID& jid, boost::shared isUserDirectory = true; } } - std::vector<String> features = info->getFeatures(); + std::vector<std::string> features = info->getFeatures(); supports55 = std::find(features.begin(), features.end(), DiscoInfo::JabberSearchFeature) != features.end(); if (/*isUserDirectory && */supports55) { //FIXME: once M-Link correctly advertises directoryness. /* Abort further searches.*/ @@ -125,7 +125,7 @@ void UserSearchController::handleSearchResponse(boost::shared_ptr<SearchPayload> std::vector<UserSearchResult> results; foreach (SearchPayload::Item item, resultsPayload->getItems()) { JID jid(item.jid); - std::map<String, String> fields; + std::map<std::string, std::string> fields; fields["first"] = item.first; fields["last"] = item.last; fields["nick"] = item.nick; diff --git a/Swift/Controllers/Chat/UserSearchController.h b/Swift/Controllers/Chat/UserSearchController.h index 9b81020..69795fb 100644 --- a/Swift/Controllers/Chat/UserSearchController.h +++ b/Swift/Controllers/Chat/UserSearchController.h @@ -12,7 +12,7 @@ #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/SearchPayload.h> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/JID/JID.h> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Elements/DiscoItems.h> @@ -28,12 +28,12 @@ namespace Swift { class UserSearchResult { public: - UserSearchResult(const JID& jid, const std::map<String, String>& fields) : jid_(jid), fields_(fields) {} + UserSearchResult(const JID& jid, const std::map<std::string, std::string>& fields) : jid_(jid), fields_(fields) {} const JID& getJID() const {return jid_;} - const std::map<String, String>& getFields() const {return fields_;} + const std::map<std::string, std::string>& getFields() const {return fields_;} private: JID jid_; - std::map<String, String> fields_; + std::map<std::string, std::string> fields_; }; class UserSearchController { diff --git a/Swift/Controllers/ContactEditController.cpp b/Swift/Controllers/ContactEditController.cpp index de99895..b4729a8 100644 --- a/Swift/Controllers/ContactEditController.cpp +++ b/Swift/Controllers/ContactEditController.cpp @@ -60,13 +60,13 @@ void ContactEditController::handleRemoveContactRequest() { contactEditWindow->hide(); } -void ContactEditController::handleChangeContactRequest(const String& name, const std::set<String>& newGroups) { - std::vector<String> oldGroupsVector = currentContact->getGroups(); - std::set<String> oldGroups(oldGroupsVector.begin(), oldGroupsVector.end()); +void ContactEditController::handleChangeContactRequest(const std::string& name, const std::set<std::string>& newGroups) { + std::vector<std::string> oldGroupsVector = currentContact->getGroups(); + std::set<std::string> oldGroups(oldGroupsVector.begin(), oldGroupsVector.end()); if (oldGroups != newGroups || currentContact->getName() != name) { XMPPRosterItem newContact(*currentContact); newContact.setName(name); - newContact.setGroups(std::vector<String>(newGroups.begin(), newGroups.end())); + newContact.setGroups(std::vector<std::string>(newGroups.begin(), newGroups.end())); rosterController->updateItem(newContact); } contactEditWindow->hide(); diff --git a/Swift/Controllers/ContactEditController.h b/Swift/Controllers/ContactEditController.h index b5c8101..1947944 100644 --- a/Swift/Controllers/ContactEditController.h +++ b/Swift/Controllers/ContactEditController.h @@ -11,7 +11,7 @@ #include <boost/optional.hpp> #include <Swiften/JID/JID.h> -#include <Swiften/Base/String.h> +#include <string> #include <Swift/Controllers/UIEvents/UIEvent.h> #include <Swiften/Roster/XMPPRosterItem.h> @@ -30,7 +30,7 @@ namespace Swift { private: void handleRemoveContactRequest(); - void handleChangeContactRequest(const String& name, const std::set<String>& groups); + void handleChangeContactRequest(const std::string& name, const std::set<std::string>& groups); private: void handleUIEvent(UIEvent::ref event); diff --git a/Swift/Controllers/DiscoServiceWalker.cpp b/Swift/Controllers/DiscoServiceWalker.cpp index 15d2aaa..ce29927 100644 --- a/Swift/Controllers/DiscoServiceWalker.cpp +++ b/Swift/Controllers/DiscoServiceWalker.cpp @@ -110,7 +110,7 @@ void DiscoServiceWalker::handleDiscoItemsResponse(boost::shared_ptr<DiscoItems> return; } foreach (DiscoItems::Item item, items->getItems()) { - if (item.getNode().isEmpty()) { + if (item.getNode().empty()) { /* Don't look at noded items. It's possible that this will exclude some services, * but I've never seen one in the wild, and it's an easy fix for not looping. */ diff --git a/Swift/Controllers/DiscoServiceWalker.h b/Swift/Controllers/DiscoServiceWalker.h index 00e2436..7982bbc 100644 --- a/Swift/Controllers/DiscoServiceWalker.h +++ b/Swift/Controllers/DiscoServiceWalker.h @@ -11,7 +11,7 @@ #include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/JID/JID.h> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Elements/DiscoItems.h> diff --git a/Swift/Controllers/EventNotifier.cpp b/Swift/Controllers/EventNotifier.cpp index 343abd9..405fa77 100644 --- a/Swift/Controllers/EventNotifier.cpp +++ b/Swift/Controllers/EventNotifier.cpp @@ -31,8 +31,8 @@ EventNotifier::~EventNotifier() { void EventNotifier::handleEventAdded(boost::shared_ptr<StanzaEvent> event) { if (boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event)) { JID jid = messageEvent->getStanza()->getFrom(); - String title = nickResolver->jidToNick(jid); - if (!messageEvent->getStanza()->isError() && !messageEvent->getStanza()->getBody().isEmpty()) { + std::string title = nickResolver->jidToNick(jid); + if (!messageEvent->getStanza()->isError() && !messageEvent->getStanza()->getBody().empty()) { JID activationJID = jid; if (messageEvent->getStanza()->getType() == Message::Groupchat) { activationJID = jid.toBare(); @@ -42,8 +42,8 @@ void EventNotifier::handleEventAdded(boost::shared_ptr<StanzaEvent> event) { } else if(boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event)) { JID jid = subscriptionEvent->getJID(); - String title = ""; - String message = nickResolver->jidToNick(jid) + " wants to add you to his/her roster"; + std::string title = ""; + std::string message = nickResolver->jidToNick(jid) + " wants to add you to his/her roster"; notifier->showMessage(Notifier::SystemMessage, title, message, boost::filesystem::path(), boost::function<void()>()); } else if(boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event)) { diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 31a1d5a..1257845 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -41,7 +41,7 @@ #include "SwifTools/Dock/Dock.h" #include "SwifTools/Notifier/TogglableNotifier.h" #include "Swiften/Base/foreach.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Client/Client.h" #include "Swiften/Presence/PresenceSender.h" #include "Swiften/Elements/ChatState.h" @@ -66,10 +66,10 @@ namespace Swift { -static const String CLIENT_NAME = "Swift"; -static const String CLIENT_NODE = "http://swift.im"; +static const std::string CLIENT_NAME = "Swift"; +static const std::string CLIENT_NODE = "http://swift.im"; -static const String SHOW_NOTIFICATIONS = "showNotifications"; +static const std::string SHOW_NOTIFICATIONS = "showNotifications"; MainController::MainController( EventLoop* eventLoop, @@ -119,15 +119,15 @@ MainController::MainController( loginWindow_ = uiFactory_->createLoginWindow(uiEventStream_); soundEventController_ = new SoundEventController(eventController_, soundPlayer, settings, uiEventStream_); - String selectedLoginJID = settings_->getStringSetting("lastLoginJID"); + std::string selectedLoginJID = settings_->getStringSetting("lastLoginJID"); bool loginAutomatically = settings_->getBoolSetting("loginAutomatically", false); - String cachedPassword; - String cachedCertificate; - foreach (String profile, settings->getAvailableProfiles()) { + std::string cachedPassword; + std::string cachedCertificate; + foreach (std::string profile, settings->getAvailableProfiles()) { ProfileSettingsProvider profileSettings(profile, settings); - String password = profileSettings.getStringSetting("pass"); - String certificate = profileSettings.getStringSetting("certificate"); - String jid = profileSettings.getStringSetting("jid"); + std::string password = profileSettings.getStringSetting("pass"); + std::string certificate = profileSettings.getStringSetting("certificate"); + std::string jid = profileSettings.getStringSetting("jid"); loginWindow_->addAvailableAccount(jid, password, certificate); if (jid == selectedLoginJID) { cachedPassword = password; @@ -292,7 +292,7 @@ void MainController::reconnectAfterError() { performLoginFromCachedCredentials(); } -void MainController::handleChangeStatusRequest(StatusShow::Type show, const String &statusText) { +void MainController::handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText) { boost::shared_ptr<Presence> presence(new Presence()); if (show == StatusShow::None) { // Note: this is misleading, None doesn't mean unavailable on the wire. @@ -323,7 +323,7 @@ void MainController::sendPresence(boost::shared_ptr<Presence> presence) { notifier_->setTemporarilyDisabled(presence->getShow() == StatusShow::DND); // Add information and send - if (!vCardPhotoHash_.isEmpty()) { + if (!vCardPhotoHash_.empty()) { presence->updatePayload(boost::shared_ptr<VCardUpdate>(new VCardUpdate(vCardPhotoHash_))); } client_->getPresenceSender()->sendPresence(presence); @@ -352,7 +352,7 @@ void MainController::handleInputIdleChanged(bool idle) { } } -void MainController::handleLoginRequest(const String &username, const String &password, const String& certificateFile, bool remember, bool loginAutomatically) { +void MainController::handleLoginRequest(const std::string &username, const std::string &password, const std::string& certificateFile, bool remember, bool loginAutomatically) { loginWindow_->setMessage(""); loginWindow_->setIsLoggingIn(true); profileSettings_ = new ProfileSettingsProvider(username, settings_); @@ -368,7 +368,7 @@ void MainController::handleLoginRequest(const String &username, const String &pa performLoginFromCachedCredentials(); } -void MainController::handlePurgeSavedLoginRequest(const String& username) { +void MainController::handlePurgeSavedLoginRequest(const std::string& username) { settings_->removeProfile(username); loginWindow_->removeAvailableAccount(username); } @@ -404,7 +404,7 @@ void MainController::performLoginFromCachedCredentials() { presenceNotifier_->onNotificationActivated.connect(boost::bind(&MainController::handleNotificationClicked, this, _1)); eventNotifier_ = new EventNotifier(eventController_, notifier_, client_->getAvatarManager(), client_->getNickResolver()); eventNotifier_->onNotificationActivated.connect(boost::bind(&MainController::handleNotificationClicked, this, _1)); - if (!certificateFile_.isEmpty()) { + if (!certificateFile_.empty()) { client_->setCertificate(certificateFile_); } boost::shared_ptr<Presence> presence(new Presence()); @@ -429,8 +429,8 @@ void MainController::handleDisconnected(const boost::optional<ClientError>& erro loginWindow_->quit(); } else if (error) { - String message; - String certificateErrorMessage; + std::string message; + std::string certificateErrorMessage; switch(error->getType()) { case ClientError::UnknownError: message = "Unknown Error"; break; case ClientError::DomainNameResolveError: message = "Unable to find server"; break; @@ -464,7 +464,7 @@ void MainController::handleDisconnected(const boost::optional<ClientError>& erro } bool forceReconnectAfterCertificateTrust = false; - if (!certificateErrorMessage.isEmpty()) { + if (!certificateErrorMessage.empty()) { Certificate::ref certificate = certificateTrustChecker_->getLastCertificate(); if (loginWindow_->askUserToTrustCertificatePermanently(certificateErrorMessage, certificate)) { certificateStorage_->addCertificate(certificate); diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index 07bf661..f402f8f 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -13,7 +13,7 @@ #include "Swiften/Network/Timer.h" #include "SwifTools/Idle/PlatformIdleQuerier.h" #include "SwifTools/Idle/ActualIdleDetector.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Client/ClientError.h" #include "Swiften/JID/JID.h" #include "Swiften/Elements/DiscoInfo.h" @@ -83,16 +83,16 @@ namespace Swift { private: void resetClient(); void handleConnected(); - void handleLoginRequest(const String& username, const String& password, const String& certificateFile, bool remember, bool loginAutomatically); + void handleLoginRequest(const std::string& username, const std::string& password, const std::string& certificateFile, bool remember, bool loginAutomatically); void handleCancelLoginRequest(); void handleQuitRequest(); - void handleChangeStatusRequest(StatusShow::Type show, const String &statusText); + void handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText); void handleDisconnected(const boost::optional<ClientError>& error); void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo>, ErrorPayload::ref); void handleEventQueueLengthChange(int count); void handleVCardReceived(const JID& j, VCard::ref vCard); void handleUIEvent(boost::shared_ptr<UIEvent> event); - void handlePurgeSavedLoginRequest(const String& username); + void handlePurgeSavedLoginRequest(const std::string& username); void sendPresence(boost::shared_ptr<Presence> presence); void handleInputIdleChanged(bool); void logout(); @@ -139,9 +139,9 @@ namespace Swift { JID boundJID_; SystemTrayController* systemTrayController_; SoundEventController* soundEventController_; - String vCardPhotoHash_; - String password_; - String certificateFile_; + std::string vCardPhotoHash_; + std::string password_; + std::string certificateFile_; boost::shared_ptr<ErrorEvent> lastDisconnectError_; bool useDelayForLatency_; UserSearchController* userSearchControllerChat_; diff --git a/Swift/Controllers/PresenceNotifier.cpp b/Swift/Controllers/PresenceNotifier.cpp index de6b2c9..3d5d71e 100644 --- a/Swift/Controllers/PresenceNotifier.cpp +++ b/Swift/Controllers/PresenceNotifier.cpp @@ -85,9 +85,9 @@ void PresenceNotifier::handleStanzaChannelAvailableChanged(bool available) { } void PresenceNotifier::showNotification(const JID& jid, Notifier::Type type) { - String name = nickResolver->jidToNick(jid); - String title = name + " (" + getStatusType(jid) + ")"; - String message = getStatusMessage(jid); + std::string name = nickResolver->jidToNick(jid); + std::string title = name + " (" + getStatusType(jid) + ")"; + std::string message = getStatusMessage(jid); notifier->showMessage(type, title, message, avatarManager->getAvatarPath(jid), boost::bind(&PresenceNotifier::handleNotificationActivated, this, jid)); } @@ -95,7 +95,7 @@ void PresenceNotifier::handleNotificationActivated(JID jid) { onNotificationActivated(jid); } -String PresenceNotifier::getStatusType(const JID& jid) const { +std::string PresenceNotifier::getStatusType(const JID& jid) const { Presence::ref presence = presenceOracle->getLastPresence(jid); if (presence) { return StatusShow::typeToFriendlyName(presence->getShow()); @@ -105,13 +105,13 @@ String PresenceNotifier::getStatusType(const JID& jid) const { } } -String PresenceNotifier::getStatusMessage(const JID& jid) const { +std::string PresenceNotifier::getStatusMessage(const JID& jid) const { Presence::ref presence = presenceOracle->getLastPresence(jid); if (presence) { return presence->getStatus(); } else { - return String(); + return std::string(); } } diff --git a/Swift/Controllers/PresenceNotifier.h b/Swift/Controllers/PresenceNotifier.h index 9b2d9de..0d187bd 100644 --- a/Swift/Controllers/PresenceNotifier.h +++ b/Swift/Controllers/PresenceNotifier.h @@ -37,8 +37,8 @@ namespace Swift { void handleStanzaChannelAvailableChanged(bool); void handleNotificationActivated(JID jid); void handleTimerTick(); - String getStatusType(const JID&) const; - String getStatusMessage(const JID&) const; + std::string getStatusType(const JID&) const; + std::string getStatusMessage(const JID&) const; private: void showNotification(const JID& jid, Notifier::Type type); diff --git a/Swift/Controllers/PreviousStatusStore.cpp b/Swift/Controllers/PreviousStatusStore.cpp index 271658f..947cdc7 100644 --- a/Swift/Controllers/PreviousStatusStore.cpp +++ b/Swift/Controllers/PreviousStatusStore.cpp @@ -18,25 +18,25 @@ PreviousStatusStore::~PreviousStatusStore() { } -void PreviousStatusStore::addStatus(StatusShow::Type status, const String& message) { +void PreviousStatusStore::addStatus(StatusShow::Type status, const std::string& message) { //FIXME: remove old entries store_.push_back(TypeStringPair(status, message)); } -std::vector<TypeStringPair> PreviousStatusStore::exactMatchSuggestions(StatusShow::Type status, const String& message) { +std::vector<TypeStringPair> PreviousStatusStore::exactMatchSuggestions(StatusShow::Type status, const std::string& message) { std::vector<TypeStringPair> suggestions; suggestions.push_back(TypeStringPair(status, message)); return suggestions; } -std::vector<TypeStringPair> PreviousStatusStore::getSuggestions(const String& message) { +std::vector<TypeStringPair> PreviousStatusStore::getSuggestions(const std::string& message) { std::vector<TypeStringPair> suggestions; foreach (TypeStringPair status, store_) { if (status.second == message) { suggestions.clear(); suggestions.push_back(status); break; - } else if (status.second.contains(message)) { + } else if (status.second.find(message) != std::string::npos) { suggestions.push_back(status); } } diff --git a/Swift/Controllers/PreviousStatusStore.h b/Swift/Controllers/PreviousStatusStore.h index 66c49e4..6403123 100644 --- a/Swift/Controllers/PreviousStatusStore.h +++ b/Swift/Controllers/PreviousStatusStore.h @@ -9,20 +9,20 @@ #include <utility> /* std::pair */ #include <vector> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/StatusShow.h" namespace Swift { - typedef std::pair<StatusShow::Type, String> TypeStringPair; + typedef std::pair<StatusShow::Type, std::string> TypeStringPair; class PreviousStatusStore { public: PreviousStatusStore(); ~PreviousStatusStore(); - void addStatus(StatusShow::Type status, const String& message); - std::vector<TypeStringPair> getSuggestions(const String& message); + void addStatus(StatusShow::Type status, const std::string& message); + std::vector<TypeStringPair> getSuggestions(const std::string& message); private: - std::vector<TypeStringPair> exactMatchSuggestions(StatusShow::Type status, const String& message); + std::vector<TypeStringPair> exactMatchSuggestions(StatusShow::Type status, const std::string& message); std::vector<TypeStringPair> store_; }; } diff --git a/Swift/Controllers/ProfileSettingsProvider.h b/Swift/Controllers/ProfileSettingsProvider.h index defe6ca..74bcd12 100644 --- a/Swift/Controllers/ProfileSettingsProvider.h +++ b/Swift/Controllers/ProfileSettingsProvider.h @@ -12,10 +12,10 @@ namespace Swift { class ProfileSettingsProvider { public: - ProfileSettingsProvider(const String& profile, SettingsProvider* provider) : profile_(profile) { + ProfileSettingsProvider(const std::string& profile, SettingsProvider* provider) : profile_(profile) { provider_ = provider; bool found = false; - foreach (String existingProfile, provider->getAvailableProfiles()) { + foreach (std::string existingProfile, provider->getAvailableProfiles()) { if (existingProfile == profile) { found = true; } @@ -25,15 +25,15 @@ class ProfileSettingsProvider { } }; virtual ~ProfileSettingsProvider() {}; - virtual String getStringSetting(const String &settingPath) {return provider_->getStringSetting(profileSettingPath(settingPath));}; - virtual void storeString(const String &settingPath, const String &settingValue) {provider_->storeString(profileSettingPath(settingPath), settingValue);}; - virtual int getIntSetting(const String& settingPath, int defaultValue) {return provider_->getIntSetting(settingPath, defaultValue);} - virtual void storeInt(const String& settingPath, int settingValue) {provider_->storeInt(settingPath, settingValue);} + virtual std::string getStringSetting(const std::string &settingPath) {return provider_->getStringSetting(profileSettingPath(settingPath));}; + virtual void storeString(const std::string &settingPath, const std::string &settingValue) {provider_->storeString(profileSettingPath(settingPath), settingValue);}; + virtual int getIntSetting(const std::string& settingPath, int defaultValue) {return provider_->getIntSetting(settingPath, defaultValue);} + virtual void storeInt(const std::string& settingPath, int settingValue) {provider_->storeInt(settingPath, settingValue);} private: - String profileSettingPath(const String &settingPath) {return profile_ + ":" + settingPath;}; + std::string profileSettingPath(const std::string &settingPath) {return profile_ + ":" + settingPath;}; SettingsProvider* provider_; - String profile_; + std::string profile_; }; } diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp index df0eb7b..c6064d6 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.cpp +++ b/Swift/Controllers/Roster/ContactRosterItem.cpp @@ -10,7 +10,7 @@ namespace Swift { -ContactRosterItem::ContactRosterItem(const JID& jid, const JID& displayJID, const String& name, GroupRosterItem* parent) : RosterItem(name, parent), jid_(jid), displayJID_(displayJID) { +ContactRosterItem::ContactRosterItem(const JID& jid, const JID& displayJID, const std::string& name, GroupRosterItem* parent) : RosterItem(name, parent), jid_(jid), displayJID_(displayJID) { } ContactRosterItem::~ContactRosterItem() { @@ -33,15 +33,15 @@ StatusShow::Type ContactRosterItem::getSimplifiedStatusShow() const { return StatusShow::None; } -String ContactRosterItem::getStatusText() const { +std::string ContactRosterItem::getStatusText() const { return shownPresence_ ? shownPresence_->getStatus() : ""; } -void ContactRosterItem::setAvatarPath(const String& path) { +void ContactRosterItem::setAvatarPath(const std::string& path) { avatarPath_ = path; onDataChanged(); } -const String& ContactRosterItem::getAvatarPath() const { +const std::string& ContactRosterItem::getAvatarPath() const { return avatarPath_; } @@ -58,7 +58,7 @@ const JID& ContactRosterItem::getDisplayJID() const { } -typedef std::pair<String, boost::shared_ptr<Presence> > StringPresencePair; +typedef std::pair<std::string, boost::shared_ptr<Presence> > StringPresencePair; void ContactRosterItem::calculateShownPresence() { shownPresence_ = offlinePresence_; @@ -76,12 +76,12 @@ void ContactRosterItem::clearPresence() { onDataChanged(); } -void ContactRosterItem::applyPresence(const String& resource, boost::shared_ptr<Presence> presence) { +void ContactRosterItem::applyPresence(const std::string& resource, boost::shared_ptr<Presence> presence) { if (offlinePresence_) { offlinePresence_ = boost::shared_ptr<Presence>(); } if (presence->getType() == Presence::Unavailable) { - if (resource.isEmpty()) { + if (resource.empty()) { /* Unavailable from the bare JID means all resources are offline.*/ presences_.clear(); } else { @@ -99,15 +99,15 @@ void ContactRosterItem::applyPresence(const String& resource, boost::shared_ptr< onDataChanged(); } -const std::vector<String> ContactRosterItem::getGroups() const { +const std::vector<std::string> ContactRosterItem::getGroups() const { return groups_; } /** Only used so a contact can know about the groups it's in*/ -void ContactRosterItem::addGroup(const String& group) { +void ContactRosterItem::addGroup(const std::string& group) { groups_.push_back(group); } -void ContactRosterItem::removeGroup(const String& group) { +void ContactRosterItem::removeGroup(const std::string& group) { groups_.erase(std::remove(groups_.begin(), groups_.end(), group), groups_.end()); } diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h index ca9d727..ae8d5b0 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.h +++ b/Swift/Controllers/Roster/ContactRosterItem.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swift/Controllers/Roster/RosterItem.h" #include "Swiften/Elements/StatusShow.h" @@ -22,32 +22,32 @@ namespace Swift { class GroupRosterItem; class ContactRosterItem : public RosterItem { public: - ContactRosterItem(const JID& jid, const JID& displayJID, const String& name, GroupRosterItem* parent); + ContactRosterItem(const JID& jid, const JID& displayJID, const std::string& name, GroupRosterItem* parent); virtual ~ContactRosterItem(); StatusShow::Type getStatusShow() const; StatusShow::Type getSimplifiedStatusShow() const; - String getStatusText() const; - void setAvatarPath(const String& path); - const String& getAvatarPath() const; + std::string getStatusText() const; + void setAvatarPath(const std::string& path); + const std::string& getAvatarPath() const; const JID& getJID() const; void setDisplayJID(const JID& jid); const JID& getDisplayJID() const; - void applyPresence(const String& resource, boost::shared_ptr<Presence> presence); + void applyPresence(const std::string& resource, boost::shared_ptr<Presence> presence); void clearPresence(); void calculateShownPresence(); - const std::vector<String> getGroups() const; + const std::vector<std::string> getGroups() const; /** Only used so a contact can know about the groups it's in*/ - void addGroup(const String& group); - void removeGroup(const String& group); + void addGroup(const std::string& group); + void removeGroup(const std::string& group); private: JID jid_; JID displayJID_; - String avatarPath_; - std::map<String, boost::shared_ptr<Presence> > presences_; + std::string avatarPath_; + std::map<std::string, boost::shared_ptr<Presence> > presences_; boost::shared_ptr<Presence> offlinePresence_; boost::shared_ptr<Presence> shownPresence_; - std::vector<String> groups_; + std::vector<std::string> groups_; }; } diff --git a/Swift/Controllers/Roster/GroupRosterItem.cpp b/Swift/Controllers/Roster/GroupRosterItem.cpp index 7d0cf85..f0a377a 100644 --- a/Swift/Controllers/Roster/GroupRosterItem.cpp +++ b/Swift/Controllers/Roster/GroupRosterItem.cpp @@ -12,7 +12,7 @@ namespace Swift { -GroupRosterItem::GroupRosterItem(const String& name, GroupRosterItem* parent, bool sortByStatus) : RosterItem(name, parent), sortByStatus_(sortByStatus) { +GroupRosterItem::GroupRosterItem(const std::string& name, GroupRosterItem* parent, bool sortByStatus) : RosterItem(name, parent), sortByStatus_(sortByStatus) { expanded_ = true; } @@ -110,7 +110,7 @@ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) { return removed; } -GroupRosterItem* GroupRosterItem::removeGroupChild(const String& groupName) { +GroupRosterItem* GroupRosterItem::removeGroupChild(const std::string& groupName) { std::vector<RosterItem*>::iterator it = children_.begin(); GroupRosterItem* removed = NULL; while (it != children_.end()) { diff --git a/Swift/Controllers/Roster/GroupRosterItem.h b/Swift/Controllers/Roster/GroupRosterItem.h index ff5e798..57fa9fa 100644 --- a/Swift/Controllers/Roster/GroupRosterItem.h +++ b/Swift/Controllers/Roster/GroupRosterItem.h @@ -7,7 +7,7 @@ #pragma once #include "Swift/Controllers/Roster/RosterItem.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swift/Controllers/Roster/ContactRosterItem.h" #include <vector> @@ -16,13 +16,13 @@ namespace Swift { class GroupRosterItem : public RosterItem { public: - GroupRosterItem(const String& name, GroupRosterItem* parent, bool sortByStatus); + GroupRosterItem(const std::string& name, GroupRosterItem* parent, bool sortByStatus); virtual ~GroupRosterItem(); const std::vector<RosterItem*>& getChildren() const; const std::vector<RosterItem*>& getDisplayedChildren() const; void addChild(RosterItem* item); ContactRosterItem* removeChild(const JID& jid); - GroupRosterItem* removeGroupChild(const String& group); + GroupRosterItem* removeGroupChild(const std::string& group); void removeAll(); void setDisplayed(RosterItem* item, bool displayed); boost::signal<void ()> onChildrenChanged; @@ -35,7 +35,7 @@ class GroupRosterItem : public RosterItem { void handleChildrenChanged(GroupRosterItem* group); void handleDataChanged(RosterItem* item); bool sortDisplayed(); - String name_; + std::string name_; bool expanded_; std::vector<RosterItem*> children_; std::vector<RosterItem*> displayedChildren_; diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp index 9edcaaf..4e34105 100644 --- a/Swift/Controllers/Roster/Roster.cpp +++ b/Swift/Controllers/Roster/Roster.cpp @@ -7,7 +7,7 @@ #include "Swift/Controllers/Roster/Roster.h" #include "Swiften/Base/foreach.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swift/Controllers/Roster/ContactRosterItem.h" #include "Swift/Controllers/Roster/RosterItem.h" @@ -46,7 +46,7 @@ GroupRosterItem* Roster::getRoot() { return root_; } -GroupRosterItem* Roster::getGroup(const String& groupName) { +GroupRosterItem* Roster::getGroup(const std::string& groupName) { foreach (RosterItem *item, root_->getChildren()) { GroupRosterItem *group = dynamic_cast<GroupRosterItem*>(item); if (group && group->getDisplayName() == groupName) { @@ -60,7 +60,7 @@ GroupRosterItem* Roster::getGroup(const String& groupName) { return group; } -void Roster::removeGroup(const String& group) { +void Roster::removeGroup(const std::string& group) { root_->removeGroupChild(group); } @@ -72,13 +72,13 @@ void Roster::handleChildrenChanged(GroupRosterItem* item) { onChildrenChanged(item); } -void Roster::addContact(const JID& jid, const JID& displayJID, const String& name, const String& groupName, const String& avatarPath) { +void Roster::addContact(const JID& jid, const JID& displayJID, const std::string& name, const std::string& groupName, const std::string& avatarPath) { GroupRosterItem* group(getGroup(groupName)); ContactRosterItem *item = new ContactRosterItem(jid, displayJID, name, group); item->setAvatarPath(avatarPath); group->addChild(item); if (itemMap_[fullJIDMapping_ ? jid : jid.toBare()].size() > 0) { - foreach (String existingGroup, itemMap_[fullJIDMapping_ ? jid : jid.toBare()][0]->getGroups()) { + foreach (std::string existingGroup, itemMap_[fullJIDMapping_ ? jid : jid.toBare()][0]->getGroups()) { item->addGroup(existingGroup); } } @@ -114,7 +114,7 @@ void Roster::removeContact(const JID& jid) { root_->removeChild(jid); } -void Roster::removeContactFromGroup(const JID& jid, const String& groupName) { +void Roster::removeContactFromGroup(const JID& jid, const std::string& groupName) { std::vector<RosterItem*> children = root_->getChildren(); std::vector<RosterItem*>::iterator it = children.begin(); while (it != children.end()) { diff --git a/Swift/Controllers/Roster/Roster.h b/Swift/Controllers/Roster/Roster.h index 5589f97..53161a8 100644 --- a/Swift/Controllers/Roster/Roster.h +++ b/Swift/Controllers/Roster/Roster.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swift/Controllers/Roster/RosterItemOperation.h" #include "Swift/Controllers/Roster/RosterFilter.h" @@ -27,10 +27,10 @@ class Roster { Roster(bool sortByStatus = true, bool fullJIDMapping = false); ~Roster(); - void addContact(const JID& jid, const JID& displayJID, const String& name, const String& group, const String& avatarPath); + void addContact(const JID& jid, const JID& displayJID, const std::string& name, const std::string& group, const std::string& avatarPath); void removeContact(const JID& jid); - void removeContactFromGroup(const JID& jid, const String& group); - void removeGroup(const String& group); + void removeContactFromGroup(const JID& jid, const std::string& group); + void removeGroup(const std::string& group); void removeAll(); void applyOnItems(const RosterItemOperation& operation); void applyOnAllItems(const RosterItemOperation& operation); @@ -42,7 +42,7 @@ class Roster { boost::signal<void (GroupRosterItem*)> onChildrenChanged; boost::signal<void (GroupRosterItem*)> onGroupAdded; boost::signal<void (RosterItem*)> onDataChanged; - GroupRosterItem* getGroup(const String& groupName); + GroupRosterItem* getGroup(const std::string& groupName); private: void handleDataChanged(RosterItem* item); void handleChildrenChanged(GroupRosterItem* item); diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index 758d4f2..e03a8d4 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.cpp @@ -9,6 +9,7 @@ #include <boost/bind.hpp> #include <boost/smart_ptr/make_shared.hpp> +#include "Swiften/JID/JID.h" #include "Swiften/Base/foreach.h" #include "Swift/Controllers/UIInterfaces/MainWindow.h" #include "Swift/Controllers/UIInterfaces/MainWindowFactory.h" @@ -39,7 +40,7 @@ namespace Swift { -static const String SHOW_OFFLINE = "showOffline"; +static const std::string SHOW_OFFLINE = "showOffline"; /** * The controller does not gain ownership of these parameters. @@ -107,15 +108,15 @@ void RosterController::handleShowOfflineToggled(bool state) { } } -void RosterController::handleChangeStatusRequest(StatusShow::Type show, const String &statusText) { +void RosterController::handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText) { onChangeStatusRequest(show, statusText); } void RosterController::handleOnJIDAdded(const JID& jid) { - std::vector<String> groups = xmppRoster_->getGroupsForJID(jid); - String name = nickResolver_->jidToNick(jid); + std::vector<std::string> groups = xmppRoster_->getGroupsForJID(jid); + std::string name = nickResolver_->jidToNick(jid); if (!groups.empty()) { - foreach(const String& group, groups) { + foreach(const std::string& group, groups) { roster_->addContact(jid, jid, name, group, avatarManager_->getAvatarPath(jid).string()); } } @@ -139,26 +140,26 @@ void RosterController::handleOnJIDRemoved(const JID& jid) { roster_->removeContact(jid); } -void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName, const std::vector<String> passedOldGroups) { +void RosterController::handleOnJIDUpdated(const JID& jid, const std::string& oldName, const std::vector<std::string> passedOldGroups) { if (oldName != xmppRoster_->getNameForJID(jid)) { roster_->applyOnItems(SetName(nickResolver_->jidToNick(jid), jid)); } - std::vector<String> groups = xmppRoster_->getGroupsForJID(jid); - std::vector<String> oldGroups = passedOldGroups; - String name = nickResolver_->jidToNick(jid); - String contactsGroup = "Contacts"; + std::vector<std::string> groups = xmppRoster_->getGroupsForJID(jid); + std::vector<std::string> oldGroups = passedOldGroups; + std::string name = nickResolver_->jidToNick(jid); + std::string contactsGroup = "Contacts"; if (oldGroups.empty()) { oldGroups.push_back(contactsGroup); } if (groups.empty()) { groups.push_back(contactsGroup); } - foreach(const String& group, groups) { + foreach(const std::string& group, groups) { if (std::find(oldGroups.begin(), oldGroups.end(), group) == oldGroups.end()) { roster_->addContact(jid, jid, name, group, avatarManager_->getAvatarPath(jid).string()); } } - foreach(const String& group, oldGroups) { + foreach(const std::string& group, oldGroups) { if (std::find(groups.begin(), groups.end(), group) == groups.end()) { roster_->removeContactFromGroup(jid, group); if (roster_->getGroup(group)->getChildren().size() == 0) { @@ -205,14 +206,14 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) { } else if (boost::shared_ptr<RenameGroupUIEvent> renameGroupEvent = boost::dynamic_pointer_cast<RenameGroupUIEvent>(event)) { std::vector<XMPPRosterItem> items = xmppRoster_->getItems(); - String group = renameGroupEvent->getGroup(); + std::string group = renameGroupEvent->getGroup(); // FIXME: We should handle contacts groups specially to avoid clashes if (group == "Contacts") { group = ""; } foreach(XMPPRosterItem& item, items) { - std::vector<String> groups = item.getGroups(); - if ( (group.isEmpty() && groups.empty()) || std::find(groups.begin(), groups.end(), group) != groups.end()) { + std::vector<std::string> groups = item.getGroups(); + if ( (group.empty() && groups.empty()) || std::find(groups.begin(), groups.end(), group) != groups.end()) { groups.erase(std::remove(groups.begin(), groups.end(), group), groups.end()); if (std::find(groups.begin(), groups.end(), renameGroupEvent->getNewName()) == groups.end()) { groups.push_back(renameGroupEvent->getNewName()); @@ -224,7 +225,7 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) { } } -void RosterController::setContactGroups(const JID& jid, const std::vector<String>& groups) { +void RosterController::setContactGroups(const JID& jid, const std::vector<std::string>& groups) { updateItem(XMPPRosterItem(jid, xmppRoster_->getNameForJID(jid), groups, xmppRoster_->getSubscriptionStateForJID(jid))); } @@ -244,8 +245,8 @@ void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shar if (!error) { return; } - String text = "Server " + myJID_.getDomain() + " rejected roster change to item '" + rosterPayload->getItems()[0].getJID() + "'"; - if (!error->getText().isEmpty()) { + std::string text = "Server " + myJID_.getDomain() + " rejected roster change to item '" + rosterPayload->getItems()[0].getJID().toString() + "'"; + if (!error->getText().empty()) { text += ": " + error->getText(); } boost::shared_ptr<ErrorEvent> errorEvent(new ErrorEvent(JID(myJID_.getDomain()), text)); @@ -259,7 +260,7 @@ void RosterController::handleIncomingPresence(Presence::ref newPresence) { roster_->applyOnItems(SetPresence(newPresence)); } -void RosterController::handleSubscriptionRequest(const JID& jid, const String& message) { +void RosterController::handleSubscriptionRequest(const JID& jid, const std::string& message) { if (xmppRoster_->containsJID(jid) && (xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::To || xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::Both)) { subscriptionManager_->confirmSubscription(jid); return; @@ -283,7 +284,7 @@ void RosterController::handleSubscriptionRequestDeclined(SubscriptionRequestEven } void RosterController::handleAvatarChanged(const JID& jid) { - String path = avatarManager_->getAvatarPath(jid).string(); + std::string path = avatarManager_->getAvatarPath(jid).string(); roster_->applyOnItems(SetAvatar(jid, path)); if (jid.equals(myJID_, JID::WithoutResource)) { mainWindow_->setMyAvatarPath(path); @@ -294,7 +295,7 @@ boost::optional<XMPPRosterItem> RosterController::getItem(const JID& jid) const return xmppRoster_->getItem(jid); } -std::set<String> RosterController::getGroups() const { +std::set<std::string> RosterController::getGroups() const { return xmppRoster_->getGroups(); } diff --git a/Swift/Controllers/Roster/RosterController.h b/Swift/Controllers/Roster/RosterController.h index b0641c3..f224180 100644 --- a/Swift/Controllers/Roster/RosterController.h +++ b/Swift/Controllers/Roster/RosterController.h @@ -7,7 +7,7 @@ #pragma once #include "Swiften/JID/JID.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/Presence.h" #include "Swiften/Elements/ErrorPayload.h" #include "Swiften/Elements/RosterPayload.h" @@ -42,27 +42,27 @@ namespace Swift { ~RosterController(); void showRosterWindow(); MainWindow* getWindow() {return mainWindow_;}; - boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest; + boost::signal<void (StatusShow::Type, const std::string&)> onChangeStatusRequest; boost::signal<void ()> onSignOutRequest; void handleAvatarChanged(const JID& jid); void setEnabled(bool enabled); boost::optional<XMPPRosterItem> getItem(const JID&) const; - std::set<String> getGroups() const; + std::set<std::string> getGroups() const; - void setContactGroups(const JID& jid, const std::vector<String>& groups); + void setContactGroups(const JID& jid, const std::vector<std::string>& groups); void updateItem(const XMPPRosterItem&); private: void handleOnJIDAdded(const JID &jid); void handleRosterCleared(); void handleOnJIDRemoved(const JID &jid); - void handleOnJIDUpdated(const JID &jid, const String& oldName, const std::vector<String> oldGroups); + void handleOnJIDUpdated(const JID &jid, const std::string& oldName, const std::vector<std::string> oldGroups); void handleStartChatRequest(const JID& contact); - void handleChangeStatusRequest(StatusShow::Type show, const String &statusText); + void handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText); void handleShowOfflineToggled(bool state); void handleIncomingPresence(boost::shared_ptr<Presence> newPresence); - void handleSubscriptionRequest(const JID& jid, const String& message); + void handleSubscriptionRequest(const JID& jid, const std::string& message); void handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event); void handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event); void handleUIEvent(boost::shared_ptr<UIEvent> event); diff --git a/Swift/Controllers/Roster/RosterGroupExpandinessPersister.cpp b/Swift/Controllers/Roster/RosterGroupExpandinessPersister.cpp index 64baac9..c1045ee 100644 --- a/Swift/Controllers/Roster/RosterGroupExpandinessPersister.cpp +++ b/Swift/Controllers/Roster/RosterGroupExpandinessPersister.cpp @@ -9,6 +9,7 @@ #include <boost/bind.hpp> #include <vector> +#include "Swiften/Base/String.h" #include "Swift/Controllers/Roster/GroupRosterItem.h" namespace Swift { @@ -29,7 +30,7 @@ void RosterGroupExpandinessPersister::handleGroupAdded(GroupRosterItem* group) { void RosterGroupExpandinessPersister::handleExpandedChanged(GroupRosterItem* group, bool expanded) { if (expanded) { - String displayName = group->getDisplayName(); + std::string displayName = group->getDisplayName(); //collapsed_.erase(std::remove(collapsed_.begin(), collapsed_.end(), displayName), collapsed_.end()); collapsed_.erase(displayName); } else { @@ -39,9 +40,9 @@ void RosterGroupExpandinessPersister::handleExpandedChanged(GroupRosterItem* gro } void RosterGroupExpandinessPersister::save() { - String setting; - foreach (const String& group, collapsed_) { - if (!setting.isEmpty()) { + std::string setting; + foreach (const std::string& group, collapsed_) { + if (!setting.empty()) { setting += "\n"; } setting += group; @@ -50,11 +51,11 @@ void RosterGroupExpandinessPersister::save() { } void RosterGroupExpandinessPersister::load() { - String saved = settings_->getStringSetting(SettingPath); - std::vector<String> collapsed = saved.split('\n'); + std::string saved = settings_->getStringSetting(SettingPath); + std::vector<std::string> collapsed = String::split(saved, '\n'); collapsed_.insert(collapsed.begin(), collapsed.end()); } -const String RosterGroupExpandinessPersister::SettingPath = "GroupExpandiness"; +const std::string RosterGroupExpandinessPersister::SettingPath = "GroupExpandiness"; } diff --git a/Swift/Controllers/Roster/RosterGroupExpandinessPersister.h b/Swift/Controllers/Roster/RosterGroupExpandinessPersister.h index f73afa8..63affe4 100644 --- a/Swift/Controllers/Roster/RosterGroupExpandinessPersister.h +++ b/Swift/Controllers/Roster/RosterGroupExpandinessPersister.h @@ -19,9 +19,9 @@ namespace Swift { void handleGroupAdded(GroupRosterItem* group); void load(); void save(); - std::set<String> collapsed_; + std::set<std::string> collapsed_; Roster* roster_; SettingsProvider* settings_; - static const String SettingPath; + static const std::string SettingPath; }; } diff --git a/Swift/Controllers/Roster/RosterItem.cpp b/Swift/Controllers/Roster/RosterItem.cpp index 61c5aea..3f130bb 100644 --- a/Swift/Controllers/Roster/RosterItem.cpp +++ b/Swift/Controllers/Roster/RosterItem.cpp @@ -6,11 +6,13 @@ #include "Swift/Controllers/Roster/RosterItem.h" +#include <boost/algorithm/string.hpp> + #include "Swift/Controllers/Roster/GroupRosterItem.h" namespace Swift { -RosterItem::RosterItem(const String& name, GroupRosterItem* parent) : name_(name), sortableDisplayName_(name_.getLowerCase()), parent_(parent) { +RosterItem::RosterItem(const std::string& name, GroupRosterItem* parent) : name_(name), sortableDisplayName_(boost::to_lower_copy(name_)), parent_(parent) { /* The following would be good, but because of C++'s inheritance not working in constructors, it's not going to work. */ //if (parent) { // parent_->addChild(this); @@ -25,17 +27,17 @@ GroupRosterItem* RosterItem::getParent() const { return parent_; } -void RosterItem::setDisplayName(const String& name) { +void RosterItem::setDisplayName(const std::string& name) { name_ = name; - sortableDisplayName_ = name_.getLowerCase(); + sortableDisplayName_ = boost::to_lower_copy(name_); onDataChanged(); } -String RosterItem::getDisplayName() const { +std::string RosterItem::getDisplayName() const { return name_; } -String RosterItem::getSortableDisplayName() const { +std::string RosterItem::getSortableDisplayName() const { return sortableDisplayName_; } diff --git a/Swift/Controllers/Roster/RosterItem.h b/Swift/Controllers/Roster/RosterItem.h index 35dbe73..ed8cb16 100644 --- a/Swift/Controllers/Roster/RosterItem.h +++ b/Swift/Controllers/Roster/RosterItem.h @@ -9,22 +9,22 @@ #include "Swiften/Base/boost_bsignals.h" #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> namespace Swift { class GroupRosterItem; class RosterItem { public: - RosterItem(const String& name, GroupRosterItem* parent); + RosterItem(const std::string& name, GroupRosterItem* parent); virtual ~RosterItem(); boost::signal<void ()> onDataChanged; GroupRosterItem* getParent() const; - void setDisplayName(const String& name); - String getDisplayName() const; - String getSortableDisplayName() const; + void setDisplayName(const std::string& name); + std::string getDisplayName() const; + std::string getSortableDisplayName() const; private: - String name_; - String sortableDisplayName_; + std::string name_; + std::string sortableDisplayName_; GroupRosterItem* parent_; }; diff --git a/Swift/Controllers/Roster/SetAvatar.h b/Swift/Controllers/Roster/SetAvatar.h index 2b9cfa8..241b741 100644 --- a/Swift/Controllers/Roster/SetAvatar.h +++ b/Swift/Controllers/Roster/SetAvatar.h @@ -17,7 +17,7 @@ class RosterItem; class SetAvatar : public RosterItemOperation { public: - SetAvatar(const JID& jid, const String& path, JID::CompareType compareType = JID::WithoutResource) : RosterItemOperation(true, jid), jid_(jid), path_(path), compareType_(compareType) { + SetAvatar(const JID& jid, const std::string& path, JID::CompareType compareType = JID::WithoutResource) : RosterItemOperation(true, jid), jid_(jid), path_(path), compareType_(compareType) { } virtual void operator() (RosterItem* item) const { @@ -29,7 +29,7 @@ class SetAvatar : public RosterItemOperation { private: JID jid_; - String path_; + std::string path_; JID::CompareType compareType_; }; diff --git a/Swift/Controllers/Roster/SetName.h b/Swift/Controllers/Roster/SetName.h index 4d75392..aefb0dc 100644 --- a/Swift/Controllers/Roster/SetName.h +++ b/Swift/Controllers/Roster/SetName.h @@ -16,7 +16,7 @@ class RosterItem; class SetName : public RosterItemOperation { public: - SetName(const String& name, const JID& jid, JID::CompareType compareType = JID::WithoutResource) : RosterItemOperation(true, jid), name_(name), jid_(jid), compareType_(compareType) { + SetName(const std::string& name, const JID& jid, JID::CompareType compareType = JID::WithoutResource) : RosterItemOperation(true, jid), name_(name), jid_(jid), compareType_(compareType) { } virtual void operator() (RosterItem* item) const { @@ -27,7 +27,7 @@ class SetName : public RosterItemOperation { } private: - String name_; + std::string name_; JID jid_; JID::CompareType compareType_; }; diff --git a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp index 466a528..16f2745 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp @@ -91,12 +91,12 @@ class RosterControllerTest : public CppUnit::TestFixture { return dynamic_cast<GroupRosterItem*>(CHILDREN[i]); } - JID withResource(const JID& jid, const String& resource) { + JID withResource(const JID& jid, const std::string& resource) { return JID(jid.toBare().toString() + "/" + resource); } void testPresence() { - std::vector<String> groups; + std::vector<std::string> groups; groups.push_back("testGroup1"); groups.push_back("testGroup2"); JID from("test@testdomain.com"); @@ -116,7 +116,7 @@ class RosterControllerTest : public CppUnit::TestFixture { }; void testHighestPresence() { - std::vector<String> groups; + std::vector<std::string> groups; groups.push_back("testGroup1"); JID from("test@testdomain.com"); xmppRoster_->addContact(from, "name", groups, RosterItemPayload::Both); @@ -136,7 +136,7 @@ class RosterControllerTest : public CppUnit::TestFixture { }; void testNotHighestPresence() { - std::vector<String> groups; + std::vector<std::string> groups; groups.push_back("testGroup1"); JID from("test@testdomain.com"); xmppRoster_->addContact(from, "name", groups, RosterItemPayload::Both); @@ -156,7 +156,7 @@ class RosterControllerTest : public CppUnit::TestFixture { }; void testUnavailablePresence() { - std::vector<String> groups; + std::vector<std::string> groups; groups.push_back("testGroup1"); JID from("test@testdomain.com"); xmppRoster_->addContact(from, "name", groups, RosterItemPayload::Both); @@ -198,17 +198,17 @@ class RosterControllerTest : public CppUnit::TestFixture { }; void testAdd() { - std::vector<String> groups; + std::vector<std::string> groups; groups.push_back("testGroup1"); groups.push_back("testGroup2"); xmppRoster_->addContact(JID("test@testdomain.com/bob"), "name", groups, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(CHILDREN.size())); - //CPPUNIT_ASSERT_EQUAL(String("Bob"), xmppRoster_->getNameForJID(JID("foo@bar.com"))); + //CPPUNIT_ASSERT_EQUAL(std::string("Bob"), xmppRoster_->getNameForJID(JID("foo@bar.com"))); }; void testAddSubscription() { - std::vector<String> groups; + std::vector<std::string> groups; JID jid("test@testdomain.com"); xmppRoster_->addContact(jid, "name", groups, RosterItemPayload::None); @@ -225,24 +225,24 @@ class RosterControllerTest : public CppUnit::TestFixture { }; void testReceiveRename() { - std::vector<String> groups; + std::vector<std::string> groups; JID jid("test@testdomain.com"); xmppRoster_->addContact(jid, "name", groups, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(CHILDREN.size())); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(groupChild(0)->getChildren().size())); - CPPUNIT_ASSERT_EQUAL(String("name"), groupChild(0)->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("name"), groupChild(0)->getChildren()[0]->getDisplayName()); xmppRoster_->addContact(jid, "NewName", groups, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(CHILDREN.size())); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(groupChild(0)->getChildren().size())); - CPPUNIT_ASSERT_EQUAL(String("NewName"), groupChild(0)->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("NewName"), groupChild(0)->getChildren()[0]->getDisplayName()); }; void testReceiveRegroup() { - std::vector<String> oldGroups; - std::vector<String> newGroups; + std::vector<std::string> oldGroups; + std::vector<std::string> newGroups; newGroups.push_back("A Group"); - std::vector<String> newestGroups; + std::vector<std::string> newestGroups; newestGroups.push_back("Best Group"); JID jid("test@testdomain.com"); xmppRoster_->addContact(jid, "", oldGroups, RosterItemPayload::Both); @@ -254,19 +254,19 @@ class RosterControllerTest : public CppUnit::TestFixture { xmppRoster_->addContact(jid, "new name", newGroups, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(CHILDREN.size())); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(groupChild(0)->getChildren().size())); - CPPUNIT_ASSERT_EQUAL(String("new name"), groupChild(0)->getChildren()[0]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("A Group"), groupChild(0)->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("new name"), groupChild(0)->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("A Group"), groupChild(0)->getDisplayName()); xmppRoster_->addContact(jid, "new name", newestGroups, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(CHILDREN.size())); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(groupChild(0)->getChildren().size())); - CPPUNIT_ASSERT_EQUAL(String("new name"), groupChild(0)->getChildren()[0]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("Best Group"), groupChild(0)->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("new name"), groupChild(0)->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Best Group"), groupChild(0)->getDisplayName()); }; void testSendRename() { JID jid("testling@wonderland.lit"); - std::vector<String> groups; + std::vector<std::string> groups; groups.push_back("Friends"); groups.push_back("Enemies"); xmppRoster_->addContact(jid, "Bob", groups, RosterItemPayload::From); @@ -278,17 +278,17 @@ class RosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), payload->getItems().size()); RosterItemPayload item = payload->getItems()[0]; CPPUNIT_ASSERT_EQUAL(jid, item.getJID()); - CPPUNIT_ASSERT_EQUAL(String("Robert"), item.getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Robert"), item.getName()); CPPUNIT_ASSERT_EQUAL(groups.size(), item.getGroups().size()); assertVectorsEqual(groups, item.getGroups(), __LINE__); } - void assertVectorsEqual(const std::vector<String>& v1, const std::vector<String>& v2, int line) { - foreach (const String& entry, v1) { + void assertVectorsEqual(const std::vector<std::string>& v1, const std::vector<std::string>& v2, int line) { + foreach (const std::string& entry, v1) { if (std::find(v2.begin(), v2.end(), entry) == v2.end()) { std::stringstream stream; - stream << "Couldn't find " << entry.getUTF8String() << " in v2 (line " << line << ")"; + stream << "Couldn't find " << entry << " in v2 (line " << line << ")"; CPPUNIT_FAIL(stream.str()); } } diff --git a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp index 754f3e1..cbef787 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp @@ -41,17 +41,17 @@ class RosterTest : public CppUnit::TestFixture { roster_->addContact(jid3_, JID(), "Cookie", "group1", ""); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(roster_->getRoot()->getChildren().size())); - CPPUNIT_ASSERT_EQUAL(String("group1"), roster_->getRoot()->getChildren()[0]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("group2"), roster_->getRoot()->getChildren()[1]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("Ernie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[1])->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("group1"), roster_->getRoot()->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("group2"), roster_->getRoot()->getChildren()[1]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Ernie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[1])->getChildren()[0]->getDisplayName()); } void testRemoveContact() { roster_->addContact(jid1_, jid1_, "Bert", "group1", ""); - CPPUNIT_ASSERT_EQUAL(String("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); roster_->removeContact(jid1_); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren().size())); @@ -60,11 +60,11 @@ class RosterTest : public CppUnit::TestFixture { void testRemoveSecondContact() { roster_->addContact(jid1_, jid1_, "Bert", "group1", ""); roster_->addContact(jid2_, jid2_, "Cookie", "group1", ""); - CPPUNIT_ASSERT_EQUAL(String("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); roster_->removeContact(jid2_); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren().size())); - CPPUNIT_ASSERT_EQUAL(String("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); } void testRemoveSecondContactSameBare() { @@ -72,11 +72,11 @@ class RosterTest : public CppUnit::TestFixture { JID jid4b("a@b/d"); roster_->addContact(jid4a, JID(), "Bert", "group1", ""); roster_->addContact(jid4b, JID(), "Cookie", "group1", ""); - CPPUNIT_ASSERT_EQUAL(String("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Cookie"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[1]->getDisplayName()); roster_->removeContact(jid4b); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren().size())); - CPPUNIT_ASSERT_EQUAL(String("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Bert"), static_cast<GroupRosterItem*>(roster_->getRoot()->getChildren()[0])->getChildren()[0]->getDisplayName()); } void testApplyPresenceLikeMUC() { @@ -105,9 +105,9 @@ class RosterTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(children.size())); /* Check order */ - CPPUNIT_ASSERT_EQUAL(String("Ernie"), children[0]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("Bert"), children[1]->getDisplayName()); - CPPUNIT_ASSERT_EQUAL(String("Bird"), children[2]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Ernie"), children[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Bert"), children[1]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(std::string("Bird"), children[2]->getDisplayName()); presence = boost::shared_ptr<Presence>(new Presence()); presence->setFrom(jid4c); diff --git a/Swift/Controllers/Settings/DummySettingsProvider.h b/Swift/Controllers/Settings/DummySettingsProvider.h index 631b68d..90e1921 100644 --- a/Swift/Controllers/Settings/DummySettingsProvider.h +++ b/Swift/Controllers/Settings/DummySettingsProvider.h @@ -13,15 +13,15 @@ namespace Swift { class DummySettingsProvider : public SettingsProvider { public: virtual ~DummySettingsProvider() {} - virtual String getStringSetting(const String&) {return "";} - virtual void storeString(const String &, const String &) {} - virtual bool getBoolSetting(const String &, bool ) {return true;} - virtual void storeBool(const String &, bool ) {} - virtual int getIntSetting(const String &, int ) {return 0;} - virtual void storeInt(const String &, int ) {} - virtual std::vector<String> getAvailableProfiles() {return std::vector<String>();} - virtual void createProfile(const String& ) {} - virtual void removeProfile(const String& ) {} + virtual std::string getStringSetting(const std::string&) {return "";} + virtual void storeString(const std::string &, const std::string &) {} + virtual bool getBoolSetting(const std::string &, bool ) {return true;} + virtual void storeBool(const std::string &, bool ) {} + virtual int getIntSetting(const std::string &, int ) {return 0;} + virtual void storeInt(const std::string &, int ) {} + virtual std::vector<std::string> getAvailableProfiles() {return std::vector<std::string>();} + virtual void createProfile(const std::string& ) {} + virtual void removeProfile(const std::string& ) {} }; } diff --git a/Swift/Controllers/Settings/SettingsProvider.h b/Swift/Controllers/Settings/SettingsProvider.h index a2cdad4..a5ff4eb 100644 --- a/Swift/Controllers/Settings/SettingsProvider.h +++ b/Swift/Controllers/Settings/SettingsProvider.h @@ -7,7 +7,7 @@ #ifndef SWIFTEN_SettingsProvider_H #define SWIFTEN_SettingsProvider_H -#include "Swiften/Base/String.h" +#include <string> #include <vector> @@ -16,15 +16,15 @@ namespace Swift { class SettingsProvider { public: virtual ~SettingsProvider() {} - virtual String getStringSetting(const String &settingPath) = 0; - virtual void storeString(const String &settingPath, const String &settingValue) = 0; - virtual bool getBoolSetting(const String &settingPath, bool defaultValue) = 0; - virtual void storeBool(const String &settingPath, bool settingValue) = 0; - virtual int getIntSetting(const String &settingPath, int defaultValue) = 0; - virtual void storeInt(const String &settingPath, int settingValue) = 0; - virtual std::vector<String> getAvailableProfiles() = 0; - virtual void createProfile(const String& profile) = 0; - virtual void removeProfile(const String& profile) = 0; + virtual std::string getStringSetting(const std::string &settingPath) = 0; + virtual void storeString(const std::string &settingPath, const std::string &settingValue) = 0; + virtual bool getBoolSetting(const std::string &settingPath, bool defaultValue) = 0; + virtual void storeBool(const std::string &settingPath, bool settingValue) = 0; + virtual int getIntSetting(const std::string &settingPath, int defaultValue) = 0; + virtual void storeInt(const std::string &settingPath, int settingValue) = 0; + virtual std::vector<std::string> getAvailableProfiles() = 0; + virtual void createProfile(const std::string& profile) = 0; + virtual void removeProfile(const std::string& profile) = 0; }; } diff --git a/Swift/Controllers/UIEvents/AddContactUIEvent.h b/Swift/Controllers/UIEvents/AddContactUIEvent.h index 1c5e54b..b2bf5ce 100644 --- a/Swift/Controllers/UIEvents/AddContactUIEvent.h +++ b/Swift/Controllers/UIEvents/AddContactUIEvent.h @@ -6,18 +6,18 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swift/Controllers/UIEvents/UIEvent.h" namespace Swift { class AddContactUIEvent : public UIEvent { public: - AddContactUIEvent(const JID& jid, const String& name) : jid_(jid), name_(name) {}; - String getName() {return name_;}; + AddContactUIEvent(const JID& jid, const std::string& name) : jid_(jid), name_(name) {}; + std::string getName() {return name_;}; JID getJID() {return jid_;}; private: JID jid_; - String name_; + std::string name_; }; } diff --git a/Swift/Controllers/UIEvents/JoinMUCUIEvent.h b/Swift/Controllers/UIEvents/JoinMUCUIEvent.h index 2a2cd96..c7f8be6 100644 --- a/Swift/Controllers/UIEvents/JoinMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/JoinMUCUIEvent.h @@ -8,7 +8,7 @@ #include <boost/optional.hpp> #include <boost/shared_ptr.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swift/Controllers/UIEvents/UIEvent.h" @@ -16,11 +16,11 @@ namespace Swift { class JoinMUCUIEvent : public UIEvent { public: typedef boost::shared_ptr<JoinMUCUIEvent> ref; - JoinMUCUIEvent(const JID& jid, const boost::optional<String>& nick = boost::optional<String>()) : jid_(jid), nick_(nick) {}; - boost::optional<String> getNick() {return nick_;}; + JoinMUCUIEvent(const JID& jid, const boost::optional<std::string>& nick = boost::optional<std::string>()) : jid_(jid), nick_(nick) {}; + boost::optional<std::string> getNick() {return nick_;}; JID getJID() {return jid_;}; private: JID jid_; - boost::optional<String> nick_; + boost::optional<std::string> nick_; }; } diff --git a/Swift/Controllers/UIEvents/RenameGroupUIEvent.h b/Swift/Controllers/UIEvents/RenameGroupUIEvent.h index 1825d77..9773b9e 100644 --- a/Swift/Controllers/UIEvents/RenameGroupUIEvent.h +++ b/Swift/Controllers/UIEvents/RenameGroupUIEvent.h @@ -7,24 +7,24 @@ #pragma once #include <Swift/Controllers/UIEvents/UIEvent.h> -#include <Swiften/Base/String.h> +#include <string> namespace Swift { class RenameGroupUIEvent : public UIEvent { public: - RenameGroupUIEvent(const String& group, const String& newName) : group(group), newName(newName) { + RenameGroupUIEvent(const std::string& group, const std::string& newName) : group(group), newName(newName) { } - const String& getGroup() const { + const std::string& getGroup() const { return group; } - const String& getNewName() const { + const std::string& getNewName() const { return newName; } private: - String group; - String newName; + std::string group; + std::string newName; }; } diff --git a/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h b/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h index 4b550e6..f3542fe 100644 --- a/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h +++ b/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h @@ -14,13 +14,13 @@ namespace Swift { class RenameRosterItemUIEvent : public UIEvent { public: - RenameRosterItemUIEvent(const JID& jid, const String& newName) : jid_(jid), newName_(newName) {} + RenameRosterItemUIEvent(const JID& jid, const std::string& newName) : jid_(jid), newName_(newName) {} const JID& getJID() const {return jid_;} - const String& getNewName() const {return newName_;} + const std::string& getNewName() const {return newName_;} private: JID jid_; - String newName_; + std::string newName_; }; } diff --git a/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h b/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h index 1415140..dd2ff6c 100644 --- a/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h @@ -9,7 +9,7 @@ #include <boost/optional.hpp> #include <boost/shared_ptr.hpp> -#include <Swiften/Base/String.h> +#include <string> #include <Swift/Controllers/UIEvents/UIEvent.h> namespace Swift { diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index a07f90b..b90ae46 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -13,7 +13,7 @@ #include <boost/date_time/posix_time/posix_time.hpp> #include <vector> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/SecurityLabel.h" #include "Swiften/Elements/ChatState.h" @@ -32,17 +32,17 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual String addMessage(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addMessage(const std::string& message, const std::string& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; /** Adds action to window. * @return id of added message (for acks); */ - virtual String addAction(const String& message, const String& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time) = 0; - virtual void addSystemMessage(const String& message) = 0; - virtual void addPresenceMessage(const String& message) = 0; - virtual void addErrorMessage(const String& message) = 0; + virtual std::string addAction(const std::string& message, const std::string& senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual void addSystemMessage(const std::string& message) = 0; + virtual void addPresenceMessage(const std::string& message) = 0; + virtual void addErrorMessage(const std::string& message) = 0; virtual void setContactChatState(ChatState::ChatStateType state) = 0; - virtual void setName(const String& name) = 0; + virtual void setName(const std::string& name) = 0; virtual void show() = 0; virtual void activate() = 0; virtual void setAvailableSecurityLabels(const std::vector<SecurityLabel>& labels) = 0; @@ -55,13 +55,13 @@ namespace Swift { virtual void setInputEnabled(bool enabled) = 0; virtual void setRosterModel(Roster* model) = 0; virtual void setTabComplete(TabComplete* completer) = 0; - virtual void replaceLastMessage(const String& message) = 0; - virtual void setAckState(const String& id, AckState state) = 0; + virtual void replaceLastMessage(const std::string& message) = 0; + virtual void setAckState(const std::string& id, AckState state) = 0; virtual void flash() = 0; boost::signal<void ()> onClosed; boost::signal<void ()> onAllMessagesRead; - boost::signal<void (const String&)> onSendMessageRequest; + boost::signal<void (const std::string&)> onSendMessageRequest; boost::signal<void ()> onUserTyping; boost::signal<void ()> onUserCancelsTyping; }; diff --git a/Swift/Controllers/UIInterfaces/ContactEditWindow.h b/Swift/Controllers/UIInterfaces/ContactEditWindow.h index fe552c2..2445456 100644 --- a/Swift/Controllers/UIInterfaces/ContactEditWindow.h +++ b/Swift/Controllers/UIInterfaces/ContactEditWindow.h @@ -11,7 +11,7 @@ #include <set> #include <vector> -#include <Swiften/Base/String.h> +#include <string> namespace Swift { class JID; @@ -22,12 +22,12 @@ namespace Swift { virtual void setEnabled(bool b) = 0; - virtual void setContact(const JID& jid, const String& name, const std::vector<String>& groups, const std::set<String>& allGroups) = 0; + virtual void setContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const std::set<std::string>& allGroups) = 0; virtual void show() = 0; virtual void hide() = 0; boost::signal<void ()> onRemoveContactRequest; - boost::signal<void (const String& /* name */, const std::set<String>& /* groups */)> onChangeContactRequest; + boost::signal<void (const std::string& /* name */, const std::set<std::string>& /* groups */)> onChangeContactRequest; }; } diff --git a/Swift/Controllers/UIInterfaces/JoinMUCWindow.h b/Swift/Controllers/UIInterfaces/JoinMUCWindow.h index 8cf712c..2e3d43c 100644 --- a/Swift/Controllers/UIInterfaces/JoinMUCWindow.h +++ b/Swift/Controllers/UIInterfaces/JoinMUCWindow.h @@ -8,7 +8,7 @@ #include <vector> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/JID/JID.h> @@ -17,11 +17,11 @@ namespace Swift { public: virtual ~JoinMUCWindow() {}; - virtual void setNick(const String& nick) = 0; - virtual void setMUC(const String& nick) = 0; + virtual void setNick(const std::string& nick) = 0; + virtual void setMUC(const std::string& nick) = 0; virtual void show() = 0; - boost::signal<void (const JID& /* muc */, const String& /* nick */, bool /* autoJoin */)> onJoinMUC; + boost::signal<void (const JID& /* muc */, const std::string& /* nick */, bool /* autoJoin */)> onJoinMUC; boost::signal<void ()> onSearchMUC; }; } diff --git a/Swift/Controllers/UIInterfaces/LoginWindow.h b/Swift/Controllers/UIInterfaces/LoginWindow.h index fc28424..61fcaa1 100644 --- a/Swift/Controllers/UIInterfaces/LoginWindow.h +++ b/Swift/Controllers/UIInterfaces/LoginWindow.h @@ -9,7 +9,7 @@ #include "Swiften/Base/boost_bsignals.h" #include <boost/shared_ptr.hpp> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/TLS/Certificate.h> namespace Swift { @@ -17,21 +17,21 @@ namespace Swift { class LoginWindow { public: virtual ~LoginWindow() {}; - virtual void selectUser(const String&) = 0; + virtual void selectUser(const std::string&) = 0; virtual void morphInto(MainWindow *mainWindow) = 0; virtual void loggedOut() = 0; - virtual void setMessage(const String&) = 0; + virtual void setMessage(const std::string&) = 0; virtual void setIsLoggingIn(bool loggingIn) = 0; - virtual void addAvailableAccount(const String& defaultJID, const String& defaultPassword, const String& defaultCertificate) = 0; - virtual void removeAvailableAccount(const String& jid) = 0; - boost::signal<void (const String&, const String&, const String& /* certificateFile */, bool /* remember password*/, bool /* login automatically */)> onLoginRequest; + virtual void addAvailableAccount(const std::string& defaultJID, const std::string& defaultPassword, const std::string& defaultCertificate) = 0; + virtual void removeAvailableAccount(const std::string& jid) = 0; + boost::signal<void (const std::string&, const std::string&, const std::string& /* certificateFile */, bool /* remember password*/, bool /* login automatically */)> onLoginRequest; virtual void setLoginAutomatically(bool loginAutomatically) = 0; virtual void quit() = 0; /** Blocking request whether a cert should be permanently trusted.*/ - virtual bool askUserToTrustCertificatePermanently(const String& message, Certificate::ref) = 0; + virtual bool askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref) = 0; boost::signal<void ()> onCancelLoginRequest; boost::signal<void ()> onQuitRequest; - boost::signal<void (const String&)> onPurgeSavedLoginRequest; + boost::signal<void (const std::string&)> onPurgeSavedLoginRequest; }; } diff --git a/Swift/Controllers/UIInterfaces/LoginWindowFactory.h b/Swift/Controllers/UIInterfaces/LoginWindowFactory.h index 81fde93..1cead2a 100644 --- a/Swift/Controllers/UIInterfaces/LoginWindowFactory.h +++ b/Swift/Controllers/UIInterfaces/LoginWindowFactory.h @@ -11,7 +11,7 @@ namespace Swift { class LoginWindow; - class String; + class UIEventStream; class LoginWindowFactory { diff --git a/Swift/Controllers/UIInterfaces/MUCSearchWindow.h b/Swift/Controllers/UIInterfaces/MUCSearchWindow.h index ded2a0a..5814b06 100644 --- a/Swift/Controllers/UIInterfaces/MUCSearchWindow.h +++ b/Swift/Controllers/UIInterfaces/MUCSearchWindow.h @@ -11,7 +11,7 @@ #include <vector> #include <boost/optional.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include <Swift/Controllers/Chat/MUCSearchController.h> diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h index 125aae5..2fd463b 100644 --- a/Swift/Controllers/UIInterfaces/MainWindow.h +++ b/Swift/Controllers/UIInterfaces/MainWindow.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swiften/Elements/StatusShow.h" @@ -25,16 +25,16 @@ namespace Swift { return canDelete_; } - virtual void setMyNick(const String& name) = 0; + virtual void setMyNick(const std::string& name) = 0; virtual void setMyJID(const JID& jid) = 0; - virtual void setMyAvatarPath(const String& path) = 0; - virtual void setMyStatusText(const String& status) = 0; + virtual void setMyAvatarPath(const std::string& path) = 0; + virtual void setMyStatusText(const std::string& status) = 0; virtual void setMyStatusType(StatusShow::Type type) = 0; /** Must be able to cope with NULL to clear the roster */ virtual void setRosterModel(Roster* roster) = 0; virtual void setConnecting() = 0; - boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest; + boost::signal<void (StatusShow::Type, const std::string&)> onChangeStatusRequest; boost::signal<void ()> onSignOutRequest; private: diff --git a/Swift/Controllers/UIInterfaces/ProfileWindow.h b/Swift/Controllers/UIInterfaces/ProfileWindow.h index e9c9a63..5d5c754 100644 --- a/Swift/Controllers/UIInterfaces/ProfileWindow.h +++ b/Swift/Controllers/UIInterfaces/ProfileWindow.h @@ -20,7 +20,7 @@ namespace Swift { virtual void setEnabled(bool b) = 0; virtual void setProcessing(bool b) = 0; - virtual void setError(const String&) = 0; + virtual void setError(const std::string&) = 0; virtual void show() = 0; virtual void hide() = 0; diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindow.h b/Swift/Controllers/UIInterfaces/UserSearchWindow.h index e4a665b..0bb7400 100644 --- a/Swift/Controllers/UIInterfaces/UserSearchWindow.h +++ b/Swift/Controllers/UIInterfaces/UserSearchWindow.h @@ -10,7 +10,7 @@ #include <vector> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" #include "Swift/Controllers/Chat/UserSearchController.h" diff --git a/Swift/Controllers/UIInterfaces/XMLConsoleWidget.h b/Swift/Controllers/UIInterfaces/XMLConsoleWidget.h index 9061b07..3cd0947 100644 --- a/Swift/Controllers/UIInterfaces/XMLConsoleWidget.h +++ b/Swift/Controllers/UIInterfaces/XMLConsoleWidget.h @@ -6,15 +6,15 @@ #pragma once -namespace Swift { - class String; +#include <string> +namespace Swift { class XMLConsoleWidget { public: virtual ~XMLConsoleWidget(); - virtual void handleDataRead(const String& data) = 0; - virtual void handleDataWritten(const String& data) = 0; + virtual void handleDataRead(const std::string& data) = 0; + virtual void handleDataWritten(const std::string& data) = 0; virtual void show() = 0; virtual void activate() = 0; diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index 03adcfe..27b9c9e 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -14,14 +14,14 @@ namespace Swift { MockChatWindow() {}; virtual ~MockChatWindow(); - virtual String addMessage(const String& message, const String& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const String& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";}; - virtual String addAction(const String& message, const String& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const String& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";}; - virtual void addSystemMessage(const String& /*message*/) {}; - virtual void addErrorMessage(const String& /*message*/) {}; - virtual void addPresenceMessage(const String& /*message*/) {}; + virtual std::string addMessage(const std::string& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";}; + virtual std::string addAction(const std::string& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";}; + virtual void addSystemMessage(const std::string& /*message*/) {}; + virtual void addErrorMessage(const std::string& /*message*/) {}; + virtual void addPresenceMessage(const std::string& /*message*/) {}; virtual void setContactChatState(ChatState::ChatStateType /*state*/) {}; - virtual void setName(const String& name) {name_ = name;}; + virtual void setName(const std::string& name) {name_ = name;}; virtual void show() {}; virtual void activate() {}; virtual void setAvailableSecurityLabels(const std::vector<SecurityLabel>& labels) {labels_ = labels;}; @@ -33,16 +33,16 @@ namespace Swift { virtual void setInputEnabled(bool /*enabled*/) {}; virtual void setRosterModel(Roster* /*roster*/) {}; virtual void setTabComplete(TabComplete*) {}; - virtual void replaceLastMessage(const Swift::String&) {}; - void setAckState(const String& /*id*/, AckState /*state*/) {}; + virtual void replaceLastMessage(const std::string&) {}; + void setAckState(const std::string& /*id*/, AckState /*state*/) {}; virtual void flash() {}; boost::signal<void ()> onClosed; boost::signal<void ()> onAllMessagesRead; - boost::signal<void (const String&)> onSendMessageRequest; + boost::signal<void (const std::string&)> onSendMessageRequest; - String name_; - String lastMessageBody_; + std::string name_; + std::string lastMessageBody_; std::vector<SecurityLabel> labels_; bool labelsEnabled_; }; diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h index 9da5490..afa5c2a 100644 --- a/Swift/Controllers/UnitTest/MockMainWindow.h +++ b/Swift/Controllers/UnitTest/MockMainWindow.h @@ -15,10 +15,10 @@ namespace Swift { MockMainWindow() : roster(NULL) {}; virtual ~MockMainWindow() {}; virtual void setRosterModel(Roster* roster) {this->roster = roster;}; - virtual void setMyNick(const String& /*name*/) {};; + virtual void setMyNick(const std::string& /*name*/) {};; virtual void setMyJID(const JID& /*jid*/) {};; - virtual void setMyAvatarPath(const String& /*path*/) {}; - virtual void setMyStatusText(const String& /*status*/) {}; + virtual void setMyAvatarPath(const std::string& /*path*/) {}; + virtual void setMyStatusText(const std::string& /*status*/) {}; virtual void setMyStatusType(StatusShow::Type /*type*/) {}; virtual void setConnecting() {}; Roster* roster; diff --git a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp index 969555c..42cfc5f 100644 --- a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp +++ b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp @@ -165,12 +165,13 @@ class PresenceNotifierTest : public CppUnit::TestFixture { void testNotificationSubjectContainsNameForJIDInRoster() { std::auto_ptr<PresenceNotifier> testling = createNotifier(); - roster->addContact(user1.toBare(), "User 1", std::vector<String>(), RosterItemPayload::Both); + roster->addContact(user1.toBare(), "User 1", std::vector<std::string>(), RosterItemPayload::Both); sendPresence(user1, StatusShow::Online); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size())); - CPPUNIT_ASSERT(notifier->notifications[0].subject.contains("User 1")); + std::string subject = notifier->notifications[0].subject; + CPPUNIT_ASSERT(subject.find("User 1") != std::string::npos); } void testNotificationSubjectContainsJIDForJIDNotInRoster() { @@ -179,7 +180,8 @@ class PresenceNotifierTest : public CppUnit::TestFixture { sendPresence(user1, StatusShow::Online); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size())); - CPPUNIT_ASSERT(notifier->notifications[0].subject.contains(user1.toBare().toString())); + std::string subject = notifier->notifications[0].subject; + CPPUNIT_ASSERT(subject.find(user1.toBare().toString()) != std::string::npos); } void testNotificationSubjectContainsStatus() { @@ -188,7 +190,8 @@ class PresenceNotifierTest : public CppUnit::TestFixture { sendPresence(user1, StatusShow::Away); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size())); - CPPUNIT_ASSERT(notifier->notifications[0].subject.contains("Away")); + std::string subject = notifier->notifications[0].subject; + CPPUNIT_ASSERT(subject.find("Away") != std::string::npos); } void testNotificationMessageContainsStatusMessage() { @@ -197,7 +200,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { sendPresence(user1, StatusShow::Away); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size())); - CPPUNIT_ASSERT(notifier->notifications[0].description.contains("Status Message")); + CPPUNIT_ASSERT(notifier->notifications[0].description.find("Status Message") != std::string::npos); } void testReceiveFirstPresenceWithQuietPeriodDoesNotNotify() { diff --git a/Swift/Controllers/XMLConsoleController.cpp b/Swift/Controllers/XMLConsoleController.cpp index ce0b24f..a3510d1 100644 --- a/Swift/Controllers/XMLConsoleController.cpp +++ b/Swift/Controllers/XMLConsoleController.cpp @@ -30,13 +30,13 @@ void XMLConsoleController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { } } -void XMLConsoleController::handleDataRead(const String& data) { +void XMLConsoleController::handleDataRead(const std::string& data) { if (xmlConsoleWidget) { xmlConsoleWidget->handleDataRead(data); } } -void XMLConsoleController::handleDataWritten(const String& data) { +void XMLConsoleController::handleDataWritten(const std::string& data) { if (xmlConsoleWidget) { xmlConsoleWidget->handleDataWritten(data); } diff --git a/Swift/Controllers/XMLConsoleController.h b/Swift/Controllers/XMLConsoleController.h index 3e1d990..d12982f 100644 --- a/Swift/Controllers/XMLConsoleController.h +++ b/Swift/Controllers/XMLConsoleController.h @@ -13,7 +13,7 @@ #include "Swift/Controllers/UIEvents/UIEventStream.h" namespace Swift { - class String; + class XMLConsoleWidgetFactory; class XMLConsoleWidget; @@ -23,8 +23,8 @@ namespace Swift { ~XMLConsoleController(); public: - void handleDataRead(const String& data); - void handleDataWritten(const String& data); + void handleDataRead(const std::string& data); + void handleDataWritten(const std::string& data); private: void handleUIEvent(boost::shared_ptr<UIEvent> event); diff --git a/Swift/Controllers/XMPPEvents/ErrorEvent.h b/Swift/Controllers/XMPPEvents/ErrorEvent.h index 3f78109..cbfc471 100644 --- a/Swift/Controllers/XMPPEvents/ErrorEvent.h +++ b/Swift/Controllers/XMPPEvents/ErrorEvent.h @@ -12,20 +12,20 @@ #include <boost/shared_ptr.hpp> #include "Swift/Controllers/XMPPEvents/StanzaEvent.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" namespace Swift { class ErrorEvent : public StanzaEvent { public: - ErrorEvent(const JID& jid, const String& text) : jid_(jid), text_(text){}; + ErrorEvent(const JID& jid, const std::string& text) : jid_(jid), text_(text){}; virtual ~ErrorEvent(){}; const JID& getJID() const {return jid_;}; - const String& getText() const {return text_;}; + const std::string& getText() const {return text_;}; private: JID jid_; - String text_; + std::string text_; }; } diff --git a/Swift/Controllers/XMPPEvents/MessageEvent.h b/Swift/Controllers/XMPPEvents/MessageEvent.h index e02995d..d1021dc 100644 --- a/Swift/Controllers/XMPPEvents/MessageEvent.h +++ b/Swift/Controllers/XMPPEvents/MessageEvent.h @@ -25,7 +25,7 @@ namespace Swift { boost::shared_ptr<Message> getStanza() {return stanza_;} bool isReadable() { - return getStanza()->isError() || !getStanza()->getBody().isEmpty(); + return getStanza()->isError() || !getStanza()->getBody().empty(); } void read() { diff --git a/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h index 704a86c..1f7812e 100644 --- a/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h +++ b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h @@ -12,16 +12,16 @@ #include <boost/shared_ptr.hpp> #include "Swift/Controllers/XMPPEvents/StanzaEvent.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/JID/JID.h" namespace Swift { class SubscriptionRequestEvent : public StanzaEvent { public: - SubscriptionRequestEvent(const JID& jid, const String& reason) : jid_(jid), reason_(reason){}; + SubscriptionRequestEvent(const JID& jid, const std::string& reason) : jid_(jid), reason_(reason){}; virtual ~SubscriptionRequestEvent(){}; const JID& getJID() const {return jid_;}; - const String& getReason() const {return reason_;}; + const std::string& getReason() const {return reason_;}; boost::signal<void()> onAccept; boost::signal<void()> onDecline; void accept() { @@ -40,7 +40,7 @@ namespace Swift { private: JID jid_; - String reason_; + std::string reason_; }; } diff --git a/Swift/QtUI/ApplicationTest/main.cpp b/Swift/QtUI/ApplicationTest/main.cpp index 4e93452..a5f3820 100644 --- a/Swift/QtUI/ApplicationTest/main.cpp +++ b/Swift/QtUI/ApplicationTest/main.cpp @@ -9,7 +9,7 @@ #include <QVBoxLayout> #include <QLineEdit> #include "../QtSwiftUtil.h" -#include "Swiften/Base/String.h" +#include <string> #include "SwifTools/Application/Platform/PlatformApplication.h" using namespace Swift; diff --git a/Swift/QtUI/EventViewer/QtEvent.cpp b/Swift/QtUI/EventViewer/QtEvent.cpp index 21d713f..f0bc276 100644 --- a/Swift/QtUI/EventViewer/QtEvent.cpp +++ b/Swift/QtUI/EventViewer/QtEvent.cpp @@ -57,8 +57,8 @@ QString QtEvent::text() { } boost::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); if (subscriptionRequestEvent) { - String reason = subscriptionRequestEvent->getReason(); - String message = subscriptionRequestEvent->getJID().toBare().toString() + " would like to add you to their roster" + (reason.isEmpty() ? "." : ", saying '" + reason + "'."); + std::string reason = subscriptionRequestEvent->getReason(); + std::string message = subscriptionRequestEvent->getJID().toBare().toString() + " would like to add you to their roster" + (reason.empty() ? "." : ", saying '" + reason + "'."); return P2QSTRING(message); } boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); diff --git a/Swift/QtUI/FreeDesktopNotifier.cpp b/Swift/QtUI/FreeDesktopNotifier.cpp index 1edf19c..037f67b 100644 --- a/Swift/QtUI/FreeDesktopNotifier.cpp +++ b/Swift/QtUI/FreeDesktopNotifier.cpp @@ -18,10 +18,10 @@ namespace Swift { -FreeDesktopNotifier::FreeDesktopNotifier(const String& name) : applicationName(name) { +FreeDesktopNotifier::FreeDesktopNotifier(const std::string& name) : applicationName(name) { } -void FreeDesktopNotifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()>) { +void FreeDesktopNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()>) { QDBusConnection bus = QDBusConnection::sessionBus(); if (!bus.isConnected()) { return; diff --git a/Swift/QtUI/FreeDesktopNotifier.h b/Swift/QtUI/FreeDesktopNotifier.h index 0bbf6bb..2214a1a 100644 --- a/Swift/QtUI/FreeDesktopNotifier.h +++ b/Swift/QtUI/FreeDesktopNotifier.h @@ -12,12 +12,12 @@ namespace Swift { class FreeDesktopNotifier : public Notifier { public: - FreeDesktopNotifier(const String& name); + FreeDesktopNotifier(const std::string& name); - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback); + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback); private: - String applicationName; + std::string applicationName; QtCachedImageScaler imageScaler; }; } diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp index bdc121c..1e624b3 100644 --- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp +++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp @@ -185,7 +185,7 @@ MUCSearchRoomItem* QtMUCSearchWindow::getSelectedRoom() const { } } } - if (lstIndex.empty()) { + if (lstIndex.isEmpty()) { return NULL; } else { diff --git a/Swift/QtUI/NotifierTest/NotifierTest.cpp b/Swift/QtUI/NotifierTest/NotifierTest.cpp index 65641b0..e165993 100644 --- a/Swift/QtUI/NotifierTest/NotifierTest.cpp +++ b/Swift/QtUI/NotifierTest/NotifierTest.cpp @@ -7,14 +7,14 @@ #include <iostream> #include <boost/bind.hpp> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/ByteArray.h" #include "Swiften/Notifier/GrowlNotifier.h" #include <QApplication> using namespace Swift; -void notificationClicked(const String& message) { +void notificationClicked(const std::string& message) { std::cout << "Notification clicked: " << message << std::endl; } diff --git a/Swift/QtUI/QtAvatarWidget.cpp b/Swift/QtUI/QtAvatarWidget.cpp index 941e20e..0879d46 100644 --- a/Swift/QtUI/QtAvatarWidget.cpp +++ b/Swift/QtUI/QtAvatarWidget.cpp @@ -42,7 +42,7 @@ QtAvatarWidget::QtAvatarWidget(QWidget* parent) : QWidget(parent) { layout->addWidget(label); } -void QtAvatarWidget::setAvatar(const ByteArray& data, const String& type) { +void QtAvatarWidget::setAvatar(const ByteArray& data, const std::string& type) { this->data = data; this->type = type; diff --git a/Swift/QtUI/QtAvatarWidget.h b/Swift/QtUI/QtAvatarWidget.h index ce4d192..8830d82 100644 --- a/Swift/QtUI/QtAvatarWidget.h +++ b/Swift/QtUI/QtAvatarWidget.h @@ -18,13 +18,13 @@ namespace Swift { public: QtAvatarWidget(QWidget* parent); - void setAvatar(const ByteArray& data, const String& type); + void setAvatar(const ByteArray& data, const std::string& type); const ByteArray& getAvatarData() const { return data; } - const String& getAvatarType() const { + const std::string& getAvatarType() const { return type; } @@ -32,7 +32,7 @@ namespace Swift { private: ByteArray data; - String type; + std::string type; QLabel* label; }; } diff --git a/Swift/QtUI/QtBookmarkDetailWindow.cpp b/Swift/QtUI/QtBookmarkDetailWindow.cpp index d83e2eb..c0f04e2 100644 --- a/Swift/QtUI/QtBookmarkDetailWindow.cpp +++ b/Swift/QtUI/QtBookmarkDetailWindow.cpp @@ -27,23 +27,23 @@ boost::optional<MUCBookmark> QtBookmarkDetailWindow::createBookmarkFromForm() { //check room //check bookmarkName JID room(Q2PSTRING(room_->text())); - if (!room.isValid() || room.getNode().isEmpty() || !room.getResource().isEmpty()) { + if (!room.isValid() || room.getNode().empty() || !room.getResource().empty()) { QMessageBox::warning(this, "Bookmark not valid", "You must specify a valid room address (e.g. myroom@chats.example.com)."); return boost::optional<MUCBookmark>(); } - String name(Q2PSTRING(name_->text())); - if (name.isEmpty()) { + std::string name(Q2PSTRING(name_->text())); + if (name.empty()) { name = room.toString(); } MUCBookmark bookmark(room, name); - String nick(Q2PSTRING(nick_->text())); - String password(Q2PSTRING(password_->text())); + std::string nick(Q2PSTRING(nick_->text())); + std::string password(Q2PSTRING(password_->text())); bookmark.setAutojoin(autojoin_->isChecked()); - if (!nick.isEmpty()) { + if (!nick.empty()) { bookmark.setNick(nick); } - if (!password.isEmpty()) { + if (!password.empty()) { bookmark.setPassword(password); } return bookmark; diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 62a696e..dac9e93 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -233,7 +233,7 @@ QtTabbable::AlertType QtChatWindow::getWidgetAlertState() { return NoActivity; } -void QtChatWindow::setName(const String& name) { +void QtChatWindow::setName(const std::string& name) { contact_ = P2QSTRING(name); updateTitleWithUnreadCount(); } @@ -247,11 +247,11 @@ void QtChatWindow::updateTitleWithUnreadCount() { emit titleUpdated(); } -String QtChatWindow::addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(message, senderName, senderIsSelf, label, avatarPath, "", time); } -String QtChatWindow::addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const QString& style, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -269,8 +269,8 @@ String QtChatWindow::addMessage(const String &message, const String &senderName, htmlString += styleSpanStart + messageHTML + styleSpanEnd; bool appendToPrevious = !previousMessageWasSystem_ && !previousMessageWasPresence_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName))); - QString qAvatarPath = avatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(P2QSTRING(avatarPath)).toEncoded(); - String id = id_.generateID(); + QString qAvatarPath = avatarPath.empty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(P2QSTRING(avatarPath)).toEncoded(); + std::string id = id_.generateID(); messageLog_->addMessage(boost::shared_ptr<ChatSnippet>(new MessageSnippet(htmlString, Qt::escape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); previousMessageWasSelf_ = senderIsSelf; @@ -284,7 +284,7 @@ void QtChatWindow::flash() { emit requestFlash(); } -void QtChatWindow::setAckState(String const& id, ChatWindow::AckState state) { +void QtChatWindow::setAckState(std::string const& id, ChatWindow::AckState state) { QString xml; switch (state) { case ChatWindow::Pending: xml = "<img src='qrc:/icons/throbber.gif' alt='This message has not been received by your server yet.'/>"; break; @@ -298,11 +298,11 @@ int QtChatWindow::getCount() { return unreadCount_; } -String QtChatWindow::addAction(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addAction(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(" *" + message + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ", time); } -void QtChatWindow::addErrorMessage(const String& errorMessage) { +void QtChatWindow::addErrorMessage(const std::string& errorMessage) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -316,7 +316,7 @@ void QtChatWindow::addErrorMessage(const String& errorMessage) { previousMessageWasPresence_ = false; } -void QtChatWindow::addSystemMessage(const String& message) { +void QtChatWindow::addSystemMessage(const std::string& message) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -331,7 +331,7 @@ void QtChatWindow::addSystemMessage(const String& message) { previousMessageWasPresence_ = false; } -void QtChatWindow::addPresenceMessage(const String& message) { +void QtChatWindow::addPresenceMessage(const std::string& message) { if (isWidgetSelected()) { onAllMessagesRead(); } @@ -390,7 +390,7 @@ void QtChatWindow::moveEvent(QMoveEvent*) { emit geometryChanged(); } -void QtChatWindow::replaceLastMessage(const String& message) { +void QtChatWindow::replaceLastMessage(const std::string& message) { messageLog_->replaceLastMessage(P2QSTRING(Linkify::linkify(message))); } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 20c8685..dbcfe9c 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -30,11 +30,11 @@ namespace Swift { public: QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventStream* eventStream); ~QtChatWindow(); - String addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time); - String addAction(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const boost::posix_time::ptime& time); - void addSystemMessage(const String& message); - void addPresenceMessage(const String& message); - void addErrorMessage(const String& errorMessage); + std::string addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time); + std::string addAction(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const boost::posix_time::ptime& time); + void addSystemMessage(const std::string& message); + void addPresenceMessage(const std::string& message); + void addErrorMessage(const std::string& errorMessage); void show(); void activate(); void setUnreadMessageCount(int count); @@ -44,15 +44,15 @@ namespace Swift { void setSecurityLabelsEnabled(bool enabled); void setSecurityLabelsError(); SecurityLabel getSelectedSecurityLabel(); - void setName(const String& name); + void setName(const std::string& name); void setInputEnabled(bool enabled); QtTabbable::AlertType getWidgetAlertState(); void setContactChatState(ChatState::ChatStateType state); void setRosterModel(Roster* roster); void setTabComplete(TabComplete* completer); int getCount(); - void replaceLastMessage(const String& message); - void setAckState(const String& id, AckState state); + void replaceLastMessage(const std::string& message); + void setAckState(const std::string& id, AckState state); void flash(); signals: @@ -75,7 +75,7 @@ namespace Swift { private: void updateTitleWithUnreadCount(); void tabComplete(); - String addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const QString& style, const boost::posix_time::ptime& time); + std::string addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time); int unreadCount_; bool contactIsTyping_; diff --git a/Swift/QtUI/QtContactEditWidget.cpp b/Swift/QtUI/QtContactEditWidget.cpp index 1f97a37..e8fe24a 100644 --- a/Swift/QtUI/QtContactEditWidget.cpp +++ b/Swift/QtUI/QtContactEditWidget.cpp @@ -18,7 +18,7 @@ namespace Swift { -QtContactEditWidget::QtContactEditWidget(const std::set<String>& allGroups, QWidget* parent) : QWidget(parent), groups_(NULL) { +QtContactEditWidget::QtContactEditWidget(const std::set<std::string>& allGroups, QWidget* parent) : QWidget(parent), groups_(NULL) { QBoxLayout* layout = new QVBoxLayout(this); setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0); @@ -43,7 +43,7 @@ QtContactEditWidget::QtContactEditWidget(const std::set<String>& allGroups, QWid groupsArea->setWidget(groups); QVBoxLayout* scrollLayout = new QVBoxLayout(groups); - foreach (String group, allGroups) { + foreach (std::string group, allGroups) { QCheckBox* check = new QCheckBox(groups); check->setText(P2QSTRING(group)); check->setCheckState(Qt::Unchecked); @@ -63,22 +63,22 @@ QtContactEditWidget::QtContactEditWidget(const std::set<String>& allGroups, QWid scrollLayout->addItem(new QSpacerItem(20, 73, QSizePolicy::Minimum, QSizePolicy::Expanding)); } -void QtContactEditWidget::setName(const String& name) { +void QtContactEditWidget::setName(const std::string& name) { name_->setText(P2QSTRING(name)); } -String QtContactEditWidget::getName() const { +std::string QtContactEditWidget::getName() const { return Q2PSTRING(name_->text()); } -void QtContactEditWidget::setSelectedGroups(const std::vector<String>& groups) { - foreach (String group, groups) { +void QtContactEditWidget::setSelectedGroups(const std::vector<std::string>& groups) { + foreach (std::string group, groups) { checkBoxes_[group]->setCheckState(Qt::Checked); } } -std::set<String> QtContactEditWidget::getSelectedGroups() const { - std::set<String> groups; +std::set<std::string> QtContactEditWidget::getSelectedGroups() const { + std::set<std::string> groups; foreach(const CheckBoxMap::value_type& group, checkBoxes_) { if (group.second->checkState() == Qt::Checked) { groups.insert(group.first); diff --git a/Swift/QtUI/QtContactEditWidget.h b/Swift/QtUI/QtContactEditWidget.h index b855b6c..26a9968 100644 --- a/Swift/QtUI/QtContactEditWidget.h +++ b/Swift/QtUI/QtContactEditWidget.h @@ -12,7 +12,7 @@ #include <QWidget> -#include <Swiften/Base/String.h> +#include <string> class QLineEdit; class QCheckBox; @@ -22,16 +22,16 @@ namespace Swift { Q_OBJECT public: - QtContactEditWidget(const std::set<String>& allGroups, QWidget* parent); + QtContactEditWidget(const std::set<std::string>& allGroups, QWidget* parent); - void setName(const String&); - String getName() const; + void setName(const std::string&); + std::string getName() const; - void setSelectedGroups(const std::vector<String>& groups); - std::set<String> getSelectedGroups() const; + void setSelectedGroups(const std::vector<std::string>& groups); + std::set<std::string> getSelectedGroups() const; private: - typedef std::map<String, QCheckBox*> CheckBoxMap; + typedef std::map<std::string, QCheckBox*> CheckBoxMap; CheckBoxMap checkBoxes_; QLineEdit* name_; QWidget* groups_; diff --git a/Swift/QtUI/QtContactEditWindow.cpp b/Swift/QtUI/QtContactEditWindow.cpp index 0781f64..97b8f95 100644 --- a/Swift/QtUI/QtContactEditWindow.cpp +++ b/Swift/QtUI/QtContactEditWindow.cpp @@ -47,7 +47,7 @@ QtContactEditWindow::QtContactEditWindow() : contactEditWidget_(NULL) { buttonLayout->addWidget(okButton); } -void QtContactEditWindow::setContact(const JID& jid, const String& name, const std::vector<String>& groups, const std::set<String>& allGroups) { +void QtContactEditWindow::setContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const std::set<std::string>& allGroups) { delete contactEditWidget_; jid_ = jid; jidLabel_->setText("<b>" + P2QSTRING(jid.toString()) + "</b>"); diff --git a/Swift/QtUI/QtContactEditWindow.h b/Swift/QtUI/QtContactEditWindow.h index 25ea9b7..2d283de 100644 --- a/Swift/QtUI/QtContactEditWindow.h +++ b/Swift/QtUI/QtContactEditWindow.h @@ -9,7 +9,7 @@ #include <QWidget> #include <Swift/Controllers/UIInterfaces/ContactEditWindow.h> -#include <Swiften/Base/String.h> +#include <string> #include <Swiften/JID/JID.h> class QLabel; @@ -24,7 +24,7 @@ namespace Swift { public: QtContactEditWindow(); - virtual void setContact(const JID& jid, const String& name, const std::vector<String>& groups, const std::set<String>& allGroups); + virtual void setContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const std::set<std::string>& allGroups); void setEnabled(bool); void show(); diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp index 60558ad..5ffc34d 100644 --- a/Swift/QtUI/QtJoinMUCWindow.cpp +++ b/Swift/QtUI/QtJoinMUCWindow.cpp @@ -39,12 +39,12 @@ void QtJoinMUCWindow::handleSearch() { onSearchMUC(); } -void QtJoinMUCWindow::setNick(const String& nick) { +void QtJoinMUCWindow::setNick(const std::string& nick) { ui.nickName->setText(P2QSTRING(nick)); lastSetNick = nick; } -void QtJoinMUCWindow::setMUC(const String& nick) { +void QtJoinMUCWindow::setMUC(const std::string& nick) { ui.room->setText(P2QSTRING(nick)); } diff --git a/Swift/QtUI/QtJoinMUCWindow.h b/Swift/QtUI/QtJoinMUCWindow.h index 2d12319..6e8e846 100644 --- a/Swift/QtUI/QtJoinMUCWindow.h +++ b/Swift/QtUI/QtJoinMUCWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <Swiften/Base/String.h> +#include <string> #include <Swift/Controllers/UIInterfaces/JoinMUCWindow.h> #include <Swift/QtUI/ui_QtJoinMUCWindow.h> @@ -16,8 +16,8 @@ namespace Swift { public: QtJoinMUCWindow(); - virtual void setNick(const String& nick); - virtual void setMUC(const String& nick); + virtual void setNick(const std::string& nick); + virtual void setMUC(const std::string& nick); virtual void show(); @@ -27,6 +27,6 @@ namespace Swift { private: Ui::QtJoinMUCWindow ui; - String lastSetNick; + std::string lastSetNick; }; } diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index c3fdac2..aae11d1 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -215,7 +215,7 @@ void QtLoginWindow::handleUIEvent(boost::shared_ptr<UIEvent> event) { } } -void QtLoginWindow::selectUser(const String& username) { +void QtLoginWindow::selectUser(const std::string& username) { for (int i = 0; i < usernames_.count(); i++) { if (P2QSTRING(username) == usernames_[i]) { username_->setCurrentIndex(i); @@ -225,7 +225,7 @@ void QtLoginWindow::selectUser(const String& username) { } } -void QtLoginWindow::removeAvailableAccount(const String& jid) { +void QtLoginWindow::removeAvailableAccount(const std::string& jid) { QString username = P2QSTRING(jid); int index = -1; for (int i = 0; i < usernames_.count(); i++) { @@ -241,7 +241,7 @@ void QtLoginWindow::removeAvailableAccount(const String& jid) { } } -void QtLoginWindow::addAvailableAccount(const String& defaultJID, const String& defaultPassword, const String& defaultCertificate) { +void QtLoginWindow::addAvailableAccount(const std::string& defaultJID, const std::string& defaultPassword, const std::string& defaultCertificate) { QString username = P2QSTRING(defaultJID); int index = -1; for (int i = 0; i < usernames_.count(); i++) { @@ -371,8 +371,8 @@ void QtLoginWindow::morphInto(MainWindow *mainWindow) { } } -void QtLoginWindow::setMessage(const String& message) { - if (!message.isEmpty()) { +void QtLoginWindow::setMessage(const std::string& message) { + if (!message.empty()) { message_->setText("<center><font color=\"red\">" + P2QSTRING(message) + "</font></center>"); } else { @@ -406,7 +406,7 @@ void QtLoginWindow::moveEvent(QMoveEvent*) { emit geometryChanged(); } -bool QtLoginWindow::askUserToTrustCertificatePermanently(const String& message, Certificate::ref certificate) { +bool QtLoginWindow::askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref certificate) { QMessageBox dialog(this); dialog.setText("The certificate presented by the server is not valid."); diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index 6987906..3f3b5f8 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -32,13 +32,13 @@ namespace Swift { void morphInto(MainWindow *mainWindow); virtual void loggedOut(); - virtual void setMessage(const String& message); - virtual void addAvailableAccount(const String& defaultJID, const String& defaultPassword, const String& defaultCertificate); - virtual void removeAvailableAccount(const String& jid); + virtual void setMessage(const std::string& message); + virtual void addAvailableAccount(const std::string& defaultJID, const std::string& defaultPassword, const std::string& defaultCertificate); + virtual void removeAvailableAccount(const std::string& jid); virtual void setLoginAutomatically(bool loginAutomatically); virtual void setIsLoggingIn(bool loggingIn); - void selectUser(const String& user); - bool askUserToTrustCertificatePermanently(const String& message, Certificate::ref certificate); + void selectUser(const std::string& user); + bool askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref certificate); void hide(); virtual void quit(); diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index 2fd5700..6ebd8aa 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -175,7 +175,7 @@ void QtMainWindow::handleShowOfflineToggled(bool state) { } } -void QtMainWindow::setMyNick(const String& nick) { +void QtMainWindow::setMyNick(const std::string& nick) { meView_->setNick(P2QSTRING(nick)); } @@ -183,11 +183,11 @@ void QtMainWindow::setMyJID(const JID& jid) { meView_->setJID(P2QSTRING(jid.toBare().toString())); } -void QtMainWindow::setMyAvatarPath(const String& path) { +void QtMainWindow::setMyAvatarPath(const std::string& path) { meView_->setAvatar(P2QSTRING(path)); } -void QtMainWindow::setMyStatusText(const String& status) { +void QtMainWindow::setMyStatusText(const std::string& status) { meView_->setStatusText(P2QSTRING(status)); } diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index 66b0caf..0dc9d36 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -37,10 +37,10 @@ namespace Swift { QtMainWindow(QtSettingsProvider*, UIEventStream* eventStream); ~QtMainWindow(); std::vector<QMenu*> getMenus() {return menus_;} - void setMyNick(const String& name); + void setMyNick(const std::string& name); void setMyJID(const JID& jid); - void setMyAvatarPath(const String& path); - void setMyStatusText(const String& status); + void setMyAvatarPath(const std::string& path); + void setMyStatusText(const std::string& status); void setMyStatusType(StatusShow::Type type); void setConnecting(); QtEventWindow* getEventWindow(); diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp index 0a53f11..c4fe400 100644 --- a/Swift/QtUI/QtProfileWindow.cpp +++ b/Swift/QtUI/QtProfileWindow.cpp @@ -118,8 +118,8 @@ void QtProfileWindow::handleSave() { onVCardChangeRequest(vcard); } -void QtProfileWindow::setError(const String& error) { - if (!error.isEmpty()) { +void QtProfileWindow::setError(const std::string& error) { + if (!error.empty()) { errorLabel->setText("<font color='red'>" + P2QSTRING(error) + "</font>"); } else { diff --git a/Swift/QtUI/QtProfileWindow.h b/Swift/QtUI/QtProfileWindow.h index 1ad73e8..edb9cce 100644 --- a/Swift/QtUI/QtProfileWindow.h +++ b/Swift/QtUI/QtProfileWindow.h @@ -26,7 +26,7 @@ namespace Swift { void setVCard(Swift::VCard::ref); void setEnabled(bool); void setProcessing(bool); - virtual void setError(const String&); + virtual void setError(const std::string&); void show(); void hide(); diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 0dc611d..3380610 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -12,7 +12,7 @@ #include <QSize> #include <QToolBar> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Elements/StatusShow.h" #include "QtTextEdit.h" diff --git a/Swift/QtUI/QtSettingsProvider.cpp b/Swift/QtUI/QtSettingsProvider.cpp index 4bddce3..4a8a868 100644 --- a/Swift/QtUI/QtSettingsProvider.cpp +++ b/Swift/QtUI/QtSettingsProvider.cpp @@ -18,35 +18,35 @@ QtSettingsProvider::~QtSettingsProvider() { } -String QtSettingsProvider::getStringSetting(const String &settingPath) { +std::string QtSettingsProvider::getStringSetting(const std::string &settingPath) { QVariant setting = settings_.value(P2QSTRING(settingPath)); return setting.isNull() ? "" : Q2PSTRING(setting.toString()); } -void QtSettingsProvider::storeString(const String &settingPath, const String &settingValue) { +void QtSettingsProvider::storeString(const std::string &settingPath, const std::string &settingValue) { settings_.setValue(P2QSTRING(settingPath), P2QSTRING(settingValue)); } -bool QtSettingsProvider::getBoolSetting(const String &settingPath, bool defaultValue) { +bool QtSettingsProvider::getBoolSetting(const std::string &settingPath, bool defaultValue) { QVariant setting = settings_.value(P2QSTRING(settingPath)); return setting.isNull() ? defaultValue : setting.toBool(); } -void QtSettingsProvider::storeBool(const String &settingPath, bool settingValue) { +void QtSettingsProvider::storeBool(const std::string &settingPath, bool settingValue) { settings_.setValue(P2QSTRING(settingPath), settingValue); } -int QtSettingsProvider::getIntSetting(const String &settingPath, int defaultValue) { +int QtSettingsProvider::getIntSetting(const std::string &settingPath, int defaultValue) { QVariant setting = settings_.value(P2QSTRING(settingPath)); return setting.isNull() ? defaultValue : setting.toInt(); } -void QtSettingsProvider::storeInt(const String &settingPath, int settingValue) { +void QtSettingsProvider::storeInt(const std::string &settingPath, int settingValue) { settings_.setValue(P2QSTRING(settingPath), settingValue); } -std::vector<String> QtSettingsProvider::getAvailableProfiles() { - std::vector<String> profiles; +std::vector<std::string> QtSettingsProvider::getAvailableProfiles() { + std::vector<std::string> profiles; QVariant profilesVariant = settings_.value("profileList"); foreach(QString profileQString, profilesVariant.toStringList()) { profiles.push_back(Q2PSTRING(profileQString)); @@ -54,13 +54,13 @@ std::vector<String> QtSettingsProvider::getAvailableProfiles() { return profiles; } -void QtSettingsProvider::createProfile(const String& profile) { +void QtSettingsProvider::createProfile(const std::string& profile) { QStringList stringList = settings_.value("profileList").toStringList(); stringList.append(P2QSTRING(profile)); settings_.setValue("profileList", stringList); } -void QtSettingsProvider::removeProfile(const String& profile) { +void QtSettingsProvider::removeProfile(const std::string& profile) { QString profileStart(P2QSTRING(profile) + ":"); foreach (QString key, settings_.allKeys()) { if (key.startsWith(profileStart)) { diff --git a/Swift/QtUI/QtSettingsProvider.h b/Swift/QtUI/QtSettingsProvider.h index d1dbc5e..ca05fe1 100644 --- a/Swift/QtUI/QtSettingsProvider.h +++ b/Swift/QtUI/QtSettingsProvider.h @@ -17,15 +17,15 @@ class QtSettingsProvider : public SettingsProvider { public: QtSettingsProvider(); virtual ~QtSettingsProvider(); - virtual String getStringSetting(const String &settingPath); - virtual void storeString(const String &settingPath, const String &settingValue); - virtual bool getBoolSetting(const String &settingPath, bool defaultValue); - virtual void storeBool(const String &settingPath, bool settingValue); - virtual int getIntSetting(const String &settingPath, int defaultValue); - virtual void storeInt(const String &settingPath, int settingValue); - virtual std::vector<String> getAvailableProfiles(); - virtual void createProfile(const String& profile); - virtual void removeProfile(const String& profile); + virtual std::string getStringSetting(const std::string &settingPath); + virtual void storeString(const std::string &settingPath, const std::string &settingValue); + virtual bool getBoolSetting(const std::string &settingPath, bool defaultValue); + virtual void storeBool(const std::string &settingPath, bool settingValue); + virtual int getIntSetting(const std::string &settingPath, int defaultValue); + virtual void storeInt(const std::string &settingPath, int settingValue); + virtual std::vector<std::string> getAvailableProfiles(); + virtual void createProfile(const std::string& profile); + virtual void removeProfile(const std::string& profile); QSettings* getQSettings(); private: QSettings settings_; diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp index b967cef..387c6f3 100644 --- a/Swift/QtUI/QtSoundPlayer.cpp +++ b/Swift/QtUI/QtSoundPlayer.cpp @@ -24,7 +24,7 @@ void QtSoundPlayer::playSound(SoundEffect sound) { } } -void QtSoundPlayer::playSound(const String& soundResource) { +void QtSoundPlayer::playSound(const std::string& soundResource) { boost::filesystem::path resourcePath = applicationPathProvider->getResourcePath(soundResource); if (boost::filesystem::exists(resourcePath)) { QSound::play(resourcePath.string().c_str()); diff --git a/Swift/QtUI/QtSoundPlayer.h b/Swift/QtUI/QtSoundPlayer.h index 21ad8bb..6945f45 100644 --- a/Swift/QtUI/QtSoundPlayer.h +++ b/Swift/QtUI/QtSoundPlayer.h @@ -12,7 +12,7 @@ namespace Swift { class ApplicationPathProvider; - class String; + class QtSoundPlayer : public QObject, public SoundPlayer { Q_OBJECT @@ -22,7 +22,7 @@ namespace Swift { void playSound(SoundEffect sound); private: - void playSound(const String& soundResource); + void playSound(const std::string& soundResource); private: ApplicationPathProvider* applicationPathProvider; diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 1c14dee..d4c306f 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -22,7 +22,7 @@ #include "SwifTools/Application/PlatformApplicationPathProvider.h" #include "Swiften/Avatars/AvatarFileStorage.h" #include "Swiften/Disco/CapsFileStorage.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/Platform.h" #include "Swift/Controllers/FileStoragesFactory.h" #include "Swiften/Elements/Presence.h" diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h index cc9eb38..978fa14 100644 --- a/Swift/QtUI/QtSwift.h +++ b/Swift/QtUI/QtSwift.h @@ -11,7 +11,7 @@ #include <Swiften/TLS/PlatformTLSFactories.h> #include <Swiften/Network/BoostNetworkFactories.h> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Base/Platform.h" #include "Swiften/EventLoop/Qt/QtEventLoop.h" #include "QtSettingsProvider.h" diff --git a/Swift/QtUI/QtSwiftUtil.h b/Swift/QtUI/QtSwiftUtil.h index 3f1ad3b..60a9f18 100644 --- a/Swift/QtUI/QtSwiftUtil.h +++ b/Swift/QtUI/QtSwiftUtil.h @@ -7,8 +7,8 @@ #ifndef SWIFT_QtSwiftUtil_H #define SWIFT_QtSwiftUtil_H -#define P2QSTRING(a) QString::fromUtf8(a.getUTF8Data()) -#define Q2PSTRING(a) Swift::String(a.toUtf8()) +#define P2QSTRING(a) QString::fromUtf8(a.c_str()) +#define Q2PSTRING(a) std::string(a.toUtf8()) #define B2QDATE(a) QDateTime::fromTime_t((a - boost::posix_time::from_time_t(0)).total_seconds()) diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp index 57e1278..42c8a8f 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.cpp +++ b/Swift/QtUI/QtXMLConsoleWidget.cpp @@ -14,7 +14,7 @@ #include <QCheckBox> #include "QtSwiftUtil.h" -#include "Swiften/Base/String.h" +#include <string> namespace Swift { @@ -71,15 +71,15 @@ void QtXMLConsoleWidget::closeEvent(QCloseEvent* event) { event->accept(); } -void QtXMLConsoleWidget::handleDataRead(const String& data) { +void QtXMLConsoleWidget::handleDataRead(const std::string& data) { appendTextIfEnabled("<!-- IN -->\n" + data + "\n", QColor(33,98,33)); } -void QtXMLConsoleWidget::handleDataWritten(const String& data) { +void QtXMLConsoleWidget::handleDataWritten(const std::string& data) { appendTextIfEnabled("<!-- OUT -->\n" + data + "\n", QColor(155,1,0)); } -void QtXMLConsoleWidget::appendTextIfEnabled(const String& data, const QColor& color) { +void QtXMLConsoleWidget::appendTextIfEnabled(const std::string& data, const QColor& color) { if (enabled->isChecked()) { QScrollBar* scrollBar = textEdit->verticalScrollBar(); bool scrollToBottom = (!scrollBar || scrollBar->value() == scrollBar->maximum()); diff --git a/Swift/QtUI/QtXMLConsoleWidget.h b/Swift/QtUI/QtXMLConsoleWidget.h index 1cfe54f..a345495 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.h +++ b/Swift/QtUI/QtXMLConsoleWidget.h @@ -23,14 +23,14 @@ namespace Swift { void show(); void activate(); - virtual void handleDataRead(const String& data); - virtual void handleDataWritten(const String& data); + virtual void handleDataRead(const std::string& data); + virtual void handleDataWritten(const std::string& data); private: virtual void closeEvent(QCloseEvent* event); virtual void showEvent(QShowEvent* event); - void appendTextIfEnabled(const String& data, const QColor& color); + void appendTextIfEnabled(const std::string& data, const QColor& color); private: QTextEdit* textEdit; diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp index 97b2028..fcd8691 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp @@ -20,18 +20,18 @@ QtTreeWidgetItem::QtTreeWidgetItem(QtTreeWidgetItem* parentItem) : QObject(), te } -void QtTreeWidgetItem::setText(const String& text) { +void QtTreeWidgetItem::setText(const std::string& text) { displayName_ = P2QSTRING(text); displayNameLower_ = displayName_.toLower(); emit changed(this); } -void QtTreeWidgetItem::setStatusText(const String& text) { +void QtTreeWidgetItem::setStatusText(const std::string& text) { statusText_ = P2QSTRING(text); emit changed(this); } -void QtTreeWidgetItem::setAvatarPath(const String& path) { +void QtTreeWidgetItem::setAvatarPath(const std::string& path) { avatar_ = QIcon(P2QSTRING(path)); emit changed(this); } diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h index c042ae0..a2d0cdd 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.h +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h @@ -10,7 +10,7 @@ #include <QColor> #include <QVariant> -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Roster/TreeWidgetFactory.h" #include "Swiften/Roster/TreeWidget.h" #include "Swiften/Roster/TreeWidgetItem.h" @@ -43,9 +43,9 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem { QVariant data(int role); QIcon getPresenceIcon(); QtTreeWidgetItem(QtTreeWidgetItem* parentItem); - void setText(const String& text); - void setAvatarPath(const String& path); - void setStatusText(const String& text); + void setText(const std::string& text); + void setAvatarPath(const std::string& path); + void setStatusText(const std::string& text); void setStatusShow(StatusShow::Type show); void setTextColor(unsigned long color); void setBackgroundColor(unsigned long color); diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index 95452c8..306b76f 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -137,9 +137,9 @@ QString RosterModel::getToolTip(RosterItem* item) const { QIcon RosterModel::getAvatar(RosterItem* item) const { ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item); if (!contact) return QIcon(); - String path = contact->getAvatarPath(); + std::string path = contact->getAvatarPath(); - return path.isEmpty() ? QIcon() : QIcon(P2QSTRING(path)); + return path.empty() ? QIcon() : QIcon(P2QSTRING(path)); } QString RosterModel::getStatusText(RosterItem* item) const { diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index ad06654..c6fb004 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -209,7 +209,7 @@ void QtUserSearchWindow::show() { // //void QtUserSearchWindow::handleOkClicked() { // JID contact = JID(Q2PSTRING(jid_->text())); -// String nick = Q2PSTRING(nickName_->text()); +// std::string nick = Q2PSTRING(nickName_->text()); // if (addToRoster_->isChecked()) { // boost::shared_ptr<UIEvent> event(new AddContactUIEvent(contact, nick)); // eventStream_->send(event); diff --git a/Swift/QtUI/UserSearch/UserSearchModel.cpp b/Swift/QtUI/UserSearch/UserSearchModel.cpp index 1187c29..aafd789 100644 --- a/Swift/QtUI/UserSearch/UserSearchModel.cpp +++ b/Swift/QtUI/UserSearch/UserSearchModel.cpp @@ -46,12 +46,12 @@ QVariant UserSearchModel::data(UserSearchResult* item, int role) { QString UserSearchModel::nameLine(UserSearchResult* item) { QString result; - const std::map<String, String> fields = item->getFields(); - std::map<String, String>::const_iterator first = fields.find("first"); + const std::map<std::string, std::string> fields = item->getFields(); + std::map<std::string, std::string>::const_iterator first = fields.find("first"); if (first != fields.end()) { result += P2QSTRING((*first).second); } - std::map<String, String>::const_iterator last = fields.find("last"); + std::map<std::string, std::string>::const_iterator last = fields.find("last"); if (last != fields.end()) { if (!result.isEmpty()) { result += " "; diff --git a/Swift/QtUI/WindowsNotifier.cpp b/Swift/QtUI/WindowsNotifier.cpp index 9646b90..49489a3 100644 --- a/Swift/QtUI/WindowsNotifier.cpp +++ b/Swift/QtUI/WindowsNotifier.cpp @@ -16,7 +16,7 @@ namespace Swift { -WindowsNotifier::WindowsNotifier(const String& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray) : tray(tray) { +WindowsNotifier::WindowsNotifier(const std::string& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray) : tray(tray) { notifierWindow = new QtWin32NotifierWindow(); snarlNotifier = new SnarlNotifier(name, notifierWindow, icon); connect(tray, SIGNAL(messageClicked()), SLOT(handleMessageClicked())); @@ -27,7 +27,7 @@ WindowsNotifier::~WindowsNotifier() { delete notifierWindow; } -void WindowsNotifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback) { +void WindowsNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) { if (snarlNotifier->isAvailable()) { snarlNotifier->showMessage(type, subject, description, picture, callback); return; diff --git a/Swift/QtUI/WindowsNotifier.h b/Swift/QtUI/WindowsNotifier.h index dbf86a2..062b76f 100644 --- a/Swift/QtUI/WindowsNotifier.h +++ b/Swift/QtUI/WindowsNotifier.h @@ -19,10 +19,10 @@ namespace Swift { Q_OBJECT public: - WindowsNotifier(const String& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray); + WindowsNotifier(const std::string& name, const boost::filesystem::path& icon, QSystemTrayIcon* tray); ~WindowsNotifier(); - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback); + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback); private slots: void handleMessageClicked(); diff --git a/Swift/QtUI/tmp/QtRosterContextMenu.cpp b/Swift/QtUI/tmp/QtRosterContextMenu.cpp index a59a2f7..c8375ba 100644 --- a/Swift/QtUI/tmp/QtRosterContextMenu.cpp +++ b/Swift/QtUI/tmp/QtRosterContextMenu.cpp @@ -18,7 +18,7 @@ #include "Swiften/Roster/ContactRosterItem.h" #include "Swiften/Roster/GroupRosterItem.h" -#include "Swiften/Base/String.h" +#include <string> #include "Swiften/Roster/Roster.h" #include "Swift/Controllers/UIEvents/UIEvent.h" #include "Swift/Controllers/UIEvents/RemoveRosterItemUIEvent.h" @@ -92,8 +92,8 @@ void QtRosterContextMenu::handleRenameGroup() { bool ok; QString newName = QInputDialog::getText(NULL, "Rename group", "New name for " + P2QSTRING(item_->getDisplayName()), QLineEdit::Normal, P2QSTRING(item_->getDisplayName()), &ok); if (ok) { - std::vector<String> addedGroups; - std::vector<String> removedGroups; + std::vector<std::string> addedGroups; + std::vector<std::string> removedGroups; addedGroups.push_back(Q2PSTRING(newName)); removedGroups.push_back(group->getDisplayName()); foreach (RosterItem* child, group->getChildren()) { |