summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Sluift/ElementConvertors/StatusShowConvertor.cpp14
-rw-r--r--Sluift/Helpers.cpp35
-rw-r--r--Sluift/Helpers.h1
-rw-r--r--Sluift/SluiftComponent.cpp2
-rw-r--r--Sluift/SluiftComponent.h1
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp1
6 files changed, 27 insertions, 27 deletions
diff --git a/Sluift/ElementConvertors/StatusShowConvertor.cpp b/Sluift/ElementConvertors/StatusShowConvertor.cpp
index d8e24ab..27876ff 100644
--- a/Sluift/ElementConvertors/StatusShowConvertor.cpp
+++ b/Sluift/ElementConvertors/StatusShowConvertor.cpp
@@ -26,33 +26,33 @@ boost::shared_ptr<StatusShow> StatusShowConvertor::doConvertFromLua(lua_State* L
if (lua_isstring(L, -1)) {
result->setType(convertStatusShowTypeFromString(lua_tostring(L, -1)));
}
lua_pop(L, 1);
return result;
}
void StatusShowConvertor::doConvertToLua(lua_State* L, boost::shared_ptr<StatusShow> payload) {
lua_createtable(L, 0, 0);
- const std::string show = convertStatusShowTypeToString(payload->getType());
+ const std::string show = convertStatusShowTypeToString(payload->getType());
if (!show.empty()) {
lua_pushstring(L, show.c_str());
lua_setfield(L, -2, "type");
}
}
std::string StatusShowConvertor::convertStatusShowTypeToString(const StatusShow::Type &show) {
switch (show) {
- case StatusShow::Online: return "online"; break;
- case StatusShow::FFC: return "ffc"; break;
- case StatusShow::Away: return "away"; break;
- case StatusShow::XA: return "xa"; break;
- case StatusShow::DND: return "dnd"; break;
- case StatusShow::None: return ""; break;
+ case StatusShow::Online: return "online";
+ case StatusShow::FFC: return "ffc";
+ case StatusShow::Away: return "away";
+ case StatusShow::XA: return "xa";
+ case StatusShow::DND: return "dnd";
+ case StatusShow::None: return "";
}
assert(false);
return "";
}
StatusShow::Type StatusShowConvertor::convertStatusShowTypeFromString(const std::string& show) {
if (show == "online") {
return StatusShow::Online;
}
diff --git a/Sluift/Helpers.cpp b/Sluift/Helpers.cpp
index 29e2b04..756ae59 100644
--- a/Sluift/Helpers.cpp
+++ b/Sluift/Helpers.cpp
@@ -5,35 +5,28 @@
*/
#include <Sluift/Helpers.h>
#include <Swiften/Client/ClientError.h>
#include <Swiften/Component/ComponentError.h>
using namespace Swift;
-template<class T> std::string Swift::getCommonErrorString(T& error) {
- std::string reason = "Disconnected: ";
- switch(error.getType()) {
- case T::UnknownError: reason += "Unknown Error"; break;
- case T::ConnectionError: reason += "Error connecting to server"; break;
- case T::ConnectionReadError: reason += "Error while receiving server data"; break;
- case T::ConnectionWriteError: reason += "Error while sending data to the server"; break;
- case T::XMLError: reason += "Error parsing server data"; break;
- case T::AuthenticationFailedError: reason += "Login/password invalid"; break;
- case T::UnexpectedElementError: reason += "Unexpected response"; break;
- }
- return reason;
-}
-
std::string Swift::getErrorString(const ClientError& error) {
- std::string reason = getCommonErrorString(error);
+ std::string reason = "Disconnected: ";
switch(error.getType()) {
+ case ClientError::UnknownError: reason += "Unknown Error"; break;
+ case ClientError::ConnectionError: reason += "Error connecting to server"; break;
+ case ClientError::ConnectionReadError: reason += "Error while receiving server data"; break;
+ case ClientError::ConnectionWriteError: reason += "Error while sending data to the server"; break;
+ case ClientError::XMLError: reason += "Error parsing server data"; break;
+ case ClientError::AuthenticationFailedError: reason += "Login/password invalid"; break;
+ case ClientError::UnexpectedElementError: reason += "Unexpected response"; break;
case ClientError::DomainNameResolveError: reason += "Unable to find server"; break;
case ClientError::CompressionFailedError: reason += "Error while compressing stream"; break;
case ClientError::ServerVerificationFailedError: reason += "Server verification failed"; break;
case ClientError::NoSupportedAuthMechanismsError: reason += "Authentication mechanisms not supported"; break;
case ClientError::ResourceBindError: reason += "Error binding resource"; break;
case ClientError::RevokedError: reason += "Certificate got revoked"; break;
case ClientError::RevocationCheckFailedError: reason += "Failed to do revokation check"; break;
case ClientError::SessionStartError: reason += "Error starting session"; break;
case ClientError::StreamError: reason += "Stream error"; break;
@@ -51,12 +44,22 @@ std::string Swift::getErrorString(const ClientError& error) {
case ClientError::CertificatePathLengthExceededError: reason += "Certificate path length constraint exceeded"; break;
case ClientError::InvalidCertificateSignatureError: reason += "Invalid certificate signature"; break;
case ClientError::InvalidCAError: reason += "Invalid Certificate Authority"; break;
case ClientError::InvalidServerIdentityError: reason += "Certificate does not match the host identity"; break;
}
return reason;
}
std::string Swift::getErrorString(const ComponentError& error) {
- return getCommonErrorString(error);
+ std::string reason = "Disconnected: ";
+ switch(error.getType()) {
+ case ComponentError::UnknownError: reason += "Unknown Error"; break;
+ case ComponentError::ConnectionError: reason += "Error connecting to server"; break;
+ case ComponentError::ConnectionReadError: reason += "Error while receiving server data"; break;
+ case ComponentError::ConnectionWriteError: reason += "Error while sending data to the server"; break;
+ case ComponentError::XMLError: reason += "Error parsing server data"; break;
+ case ComponentError::AuthenticationFailedError: reason += "Login/password invalid"; break;
+ case ComponentError::UnexpectedElementError: reason += "Unexpected response"; break;
+ }
+ return reason;
}
diff --git a/Sluift/Helpers.h b/Sluift/Helpers.h
index d04a610..157e116 100644
--- a/Sluift/Helpers.h
+++ b/Sluift/Helpers.h
@@ -9,13 +9,12 @@
#include <Swiften/Base/Override.h>
#include <Swiften/Base/API.h>
#include <string>
namespace Swift {
class ClientError;
class ComponentError;
- template<typename T> std::string getCommonErrorString(T& error);
std::string getErrorString(const ClientError& error);
std::string getErrorString(const ComponentError& error);
}
diff --git a/Sluift/SluiftComponent.cpp b/Sluift/SluiftComponent.cpp
index c08a103..c8a17a7 100644
--- a/Sluift/SluiftComponent.cpp
+++ b/Sluift/SluiftComponent.cpp
@@ -73,19 +73,19 @@ bool SluiftComponent::isConnected() const {
}
void SluiftComponent::disconnect() {
component->disconnect();
while (component->isAvailable()) {
eventLoop->runUntilEvents();
}
}
-void SluiftComponent::setSoftwareVersion(const std::string& name, const std::string& version, const std::string& os) {
+void SluiftComponent::setSoftwareVersion(const std::string& name, const std::string& version, const std::string& /* os */) {
component->setSoftwareVersion(name, version);
}
boost::optional<SluiftComponent::Event> SluiftComponent::getNextEvent(
int timeout, boost::function<bool (const Event&)> condition) {
Watchdog watchdog(timeout, networkFactories->getTimerFactory());
size_t currentIndex = 0;
while (true) {
// Look for pending events in the queue
diff --git a/Sluift/SluiftComponent.h b/Sluift/SluiftComponent.h
index 3d5792b..ba848e1 100644
--- a/Sluift/SluiftComponent.h
+++ b/Sluift/SluiftComponent.h
@@ -92,17 +92,16 @@ namespace Swift {
void handleIncomingPresence(boost::shared_ptr<Presence> stanza);
void handleRequestResponse(boost::shared_ptr<Payload> response, boost::shared_ptr<ErrorPayload> error);
void handleError(const boost::optional<ComponentError>& error);
private:
NetworkFactories* networkFactories;
SimpleEventLoop* eventLoop;
Component* component;
ComponentXMLTracer* tracer;
- bool rosterReceived;
std::deque<Event> pendingEvents;
boost::optional<ComponentError> disconnectedError;
bool requestResponseReceived;
boost::shared_ptr<Payload> requestResponse;
boost::shared_ptr<ErrorPayload> requestError;
};
}
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 32e25a2..3ff2a3d 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -391,19 +391,18 @@ ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const
}
nick = controller->getNick();
if (controller->getPassword()) {
password = *controller->getPassword();
}
if (controller->isImpromptu()) {
ChatListWindow::Chat chat = ChatListWindow::Chat(jid, jid.toString(), activity, unreadCount, type, boost::filesystem::path(), true, privateMessage, nick, password);
- typedef std::pair<std::string, JID> StringJIDPair;
std::map<std::string, JID> participants = controller->getParticipantJIDs();
chat.impromptuJIDs = participants;
return chat;
}
}
return ChatListWindow::Chat(jid, jid.toString(), activity, unreadCount, type, boost::filesystem::path(), true, privateMessage, nick, password);
} else {
ChatController* controller = getChatControllerIfExists(jid, false);
if (controller) {