Changeset - d93cc2ce66eb
backends/libpurple/main.cpp
Show inline comments
 
@@ -191,7 +191,7 @@ static bool getUserOAuthToken(const std::string user, std::string &token)
 
	boost::mutex::scoped_lock lock(dblock);
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
    LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return false;
 
	}
 
	token = "";
 
@@ -205,7 +205,7 @@ static bool storeUserOAuthToken(const std::string user, const std::string OAuthT
 
	boost::mutex::scoped_lock lock(dblock);
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
    LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return false;
 
	}
 
	storagebackend->updateUserSetting((long)info.id, OAUTH_TOKEN, OAuthToken);
 
@@ -430,7 +430,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
 
			}
 
			// OAuth helper
 
			if (protocol == "prpl-hangouts") {
 
				LOG4CXX_INFO(logger, user << ": Adding Buddy " << adminLegacyName << " " << adminAlias)
 
				LOG4CXX_INFO(logger, user << ": Adding Buddy " << adminLegacyName << " " << adminAlias);
 
				handleBuddyChanged(user, adminLegacyName, adminAlias, std::vector<std::string>(), pbnetwork::STATUS_ONLINE);
 
			}
 
		}
 
@@ -2287,7 +2287,7 @@ int main(int argc, char **argv) {
 
			return NetworkPlugin::StorageBackendNeeded;
 
		}
 
		else if (!storagebackend->connect()) {
 
			LOG4CXX_ERROR(logger, "Can't connect to database!")
 
			LOG4CXX_ERROR(logger, "Can't connect to database!");
 
			return -1;
 
		}
 
	}
backends/smstools3/main.cpp
Show inline comments
 
@@ -82,7 +82,7 @@ class SMSNetworkPlugin : public NetworkPlugin {
 

	
 

	
 
		void handleSMS(const std::string &sms) {
 
			LOG4CXX_INFO(logger, "Handling SMS " << sms << ".")
 
			LOG4CXX_INFO(logger, "Handling SMS " << sms << ".");
 
			std::ifstream t(sms.c_str());
 
			std::string str;
 

	
backends/twitter/HTTPRequest.cpp
Show inline comments
 
@@ -11,7 +11,7 @@ bool HTTPRequest::init()
 
		curl_easy_setopt(curlhandle, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY);
 
		return true;
 
	}
 
	LOG4CXX_ERROR(logger, "Couldn't Initialize curl!")
 
	LOG4CXX_ERROR(logger, "Couldn't Initialize curl!");
 
	return false;
 
}
 

	
 
@@ -25,7 +25,7 @@ void HTTPRequest::setProxy(std::string IP, std::string port, std::string usernam
 
			curl_easy_setopt(curlhandle, CURLOPT_PROXYUSERPWD, proxyUserPass.c_str());
 
		}
 
	} else {
 
		LOG4CXX_ERROR(logger, "Trying to set proxy while CURL isn't initialized")
 
		LOG4CXX_ERROR(logger, "Trying to set proxy while CURL isn't initialized");
 
	}
 
}
 

	
 
@@ -65,7 +65,7 @@ bool HTTPRequest::GET(std::string url, 	std::string &data)
 
			return true;
 
		}
 
	} else {
 
		LOG4CXX_ERROR(logger, "CURL not initialized!")
 
		LOG4CXX_ERROR(logger, "CURL not initialized!");
 
		strcpy(curl_errorbuffer, "CURL not initialized!");
 
	}
 
	return false;
backends/twitter/Requests/CreateFriendRequest.cpp
Show inline comments
 
@@ -4,16 +4,16 @@ DEFINE_LOGGER(logger, "CreateFriendRequest")
 

	
 
void CreateFriendRequest::run()
 
{
 
	LOG4CXX_INFO(logger, user << " - Sending follow request for " << frnd)
 
	LOG4CXX_INFO(logger, user << " - Sending follow request for " << frnd);
 
	replyMsg = "";
 
	success = twitObj->friendshipCreate(frnd, false);
 
	if(success) {
 
		twitObj->getLastWebResponse(replyMsg);
 

	
 
		LOG4CXX_INFO(logger, user << replyMsg)		
 
		LOG4CXX_INFO(logger, user << replyMsg);
 

	
 
	   	friendInfo = getUser(replyMsg);
 
		if(friendInfo.getScreenName() == "") {LOG4CXX_INFO(logger, user << " - Was unable to fetch user info for " << frnd)}
 
		if(friendInfo.getScreenName() == "") LOG4CXX_INFO(logger, user << " - Was unable to fetch user info for " << frnd);
 

	
 
		HTTPRequest req;
 
		std::string img;
 
@@ -37,14 +37,14 @@ void CreateFriendRequest::finalize()
 
		std::string curlerror;
 
		twitObj->getLastCurlError(curlerror);
 
		error.setMessage(curlerror);
 
		LOG4CXX_ERROR(logger, user << " - Curl error: " << curlerror)
 
		LOG4CXX_ERROR(logger, user << " - Curl error: " << curlerror);
 
		callBack(user, friendInfo, profileImg, error);
 
	} else {
 
		error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) {
 
			LOG4CXX_ERROR(logger, user << " - " << error.getMessage())
 
			LOG4CXX_ERROR(logger, user << " - " << error.getMessage());
 
		}
 
		else LOG4CXX_INFO(logger, user << ": Now following " << frnd)
 
		else LOG4CXX_INFO(logger, user << ": Now following " << frnd);
 
		callBack(user, friendInfo, profileImg, error);
 
	}
 
}
backends/twitter/Requests/DestroyFriendRequest.cpp
Show inline comments
 
@@ -8,7 +8,7 @@ void DestroyFriendRequest::run()
 
	if(success) {
 
		twitObj->getLastWebResponse(replyMsg);
 

	
 
		LOG4CXX_INFO(logger, user << replyMsg)		
 
		LOG4CXX_INFO(logger, user << replyMsg);
 

	
 

	
 
	   	friendInfo = getUser(replyMsg);
 
@@ -23,11 +23,11 @@ void DestroyFriendRequest::finalize()
 
		std::string curlerror;
 
		twitObj->getLastCurlError(curlerror);
 
		error.setMessage(curlerror);
 
		LOG4CXX_ERROR(logger, user << " Curl error: " << curlerror)
 
		LOG4CXX_ERROR(logger, user << " Curl error: " << curlerror);
 
		callBack(user, friendInfo, error);
 
	} else {
 
		error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger, user << " - " << error.getMessage())
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger, user << " - " << error.getMessage());
 
		callBack(user, friendInfo, error);
 
	}
 
}
backends/twitter/Requests/DirectMessageRequest.cpp
Show inline comments
 
@@ -25,8 +25,11 @@ void DirectMessageRequest::finalize()
 
		callBack(user, username, messages, error);
 
	} else {
 
		error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger,  user << " - " << error.getMessage())
 
		else LOG4CXX_INFO(logger, user << " - " << replyMsg)
 
		if(error.getMessage().length()) {
 
			LOG4CXX_ERROR(logger,  user << " - " << error.getMessage());
 
		} else {
 
			LOG4CXX_INFO(logger, user << " - " << replyMsg);
 
		}
 
		callBack(user, username, messages, error);
 
	}
 
}
backends/twitter/Requests/FetchFriends.cpp
Show inline comments
 
@@ -28,7 +28,7 @@ void FetchFriends::run()
 
		friendAvatars.push_back("");
 
		if(req.GET(friends[i].getProfileImgURL(), img)) friendAvatars[i] = img;
 
		else {
 
			LOG4CXX_INFO(logger, "Warning: Couldn't fetch Profile Image for " << user << "'s friend " << friends[i].getScreenName())
 
			LOG4CXX_INFO(logger, "Warning: Couldn't fetch Profile Image for " << user << "'s friend " << friends[i].getScreenName());
 
		}
 
	}
 
}
 
@@ -40,11 +40,11 @@ void FetchFriends::finalize()
 
		std::string curlerror;
 
		twitObj->getLastCurlError(curlerror);
 
		error.setMessage(curlerror);
 
		LOG4CXX_ERROR(logger,  user << " - " << curlerror)
 
		LOG4CXX_ERROR(logger,  user << " - " << curlerror);
 
		callBack(user, friends, friendAvatars, error);
 
	} else {
 
		error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger,  user << " - " << error.getMessage())
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger,  user << " - " << error.getMessage());
 
		callBack(user, friends, friendAvatars, error);
 
	}
 
}
backends/twitter/Requests/PINExchangeProcess.cpp
Show inline comments
 
@@ -2,8 +2,8 @@
 
DEFINE_LOGGER(logger, "PINExchangeProcess")
 
void PINExchangeProcess::run()
 
{
 
	LOG4CXX_INFO(logger, user << ": Sending PIN " << data) 
 
	LOG4CXX_INFO(logger, user << " " << twitObj->getProxyServerIp() << " " << twitObj->getProxyServerPort())
 
	LOG4CXX_INFO(logger, user << ": Sending PIN " << data);
 
	LOG4CXX_INFO(logger, user << " " << twitObj->getProxyServerIp() << " " << twitObj->getProxyServerPort());
 
	twitObj->getOAuth().setOAuthPin( data );
 
	success = twitObj->oAuthAccessToken();
 
}
 
@@ -11,7 +11,7 @@ void PINExchangeProcess::run()
 
void PINExchangeProcess::finalize()
 
{
 
	if(!success) {
 
		LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token!")
 
		LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token!");
 
		np->handleMessage(user, "twitter.com", "Error while exchanging PIN for Access Token!");
 
		np->handleLogoutRequest(user, "");
 
	} else {
 
@@ -22,7 +22,7 @@ void PINExchangeProcess::finalize()
 

	
 
		Error error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) {
 
			LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token! " << error.getMessage())
 
			LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token! " << error.getMessage());
 
			np->handleMessage(user, "twitter.com", error.getMessage());
 
			np->handleLogoutRequest(user, "");
 
			return;
 
@@ -47,7 +47,7 @@ void PINExchangeProcess::finalize()
 
/*void handlePINExchange(const std::string &user, std::string &data) {
 
	sessions[user]->getOAuth().setOAuthPin( data );
 
	if (sessions[user]->oAuthAccessToken() == false) {
 
		LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token!")
 
		LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token!");
 
		handleLogoutRequest(user, "");
 
		return;
 
	}
 
@@ -58,7 +58,7 @@ void PINExchangeProcess::finalize()
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		handleLogoutRequest(user, "");
 
		return;
 
	}
backends/twitter/Requests/ProfileImageRequest.cpp
Show inline comments
 
@@ -14,7 +14,7 @@ void ProfileImageRequest::finalize()
 
{
 
	Error errResponse;
 
	if(!success) {
 
		LOG4CXX_ERROR(logger,  user << " - " << error)
 
		LOG4CXX_ERROR(logger,  user << " - " << error);
 
		img = "";
 
		errResponse.setMessage(error);
 
		callBack(user, buddy, img, reqID, errResponse);
backends/twitter/Requests/RetweetRequest.cpp
Show inline comments
 
@@ -2,7 +2,7 @@
 
DEFINE_LOGGER(logger, "RetweetRequest")
 
void RetweetRequest::run()
 
{
 
	LOG4CXX_INFO(logger, user << " Retweeting " << data)
 
	LOG4CXX_INFO(logger, user << " Retweeting " << data);
 
	success = twitObj->retweetById( data );
 
}
 

	
 
@@ -13,13 +13,16 @@ void RetweetRequest::finalize()
 
		std::string curlerror;
 
		twitObj->getLastCurlError(curlerror);
 
		error.setMessage(curlerror);
 
		LOG4CXX_ERROR(logger, user << " Curl error: " << curlerror)
 
		LOG4CXX_ERROR(logger, user << " Curl error: " << curlerror);
 
		callBack(user, error);
 
	} else {
 
		twitObj->getLastWebResponse(replyMsg);
 
		error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger, user << " - " << error.getMessage())
 
		else LOG4CXX_INFO(logger, user << " " << replyMsg);
 
		if(error.getMessage().length()) {
 
			LOG4CXX_ERROR(logger, user << " - " << error.getMessage());
 
		} else {
 
			LOG4CXX_INFO(logger, user << " " << replyMsg);
 
		}
 
		callBack(user, error);
 
	}
 
}
backends/twitter/Requests/StatusUpdateRequest.cpp
Show inline comments
 
@@ -23,8 +23,11 @@ void StatusUpdateRequest::finalize()
 
		callBack(user, error);
 
	} else {
 
		error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger, user << " - " << error.getMessage())
 
		else LOG4CXX_INFO(logger, "Updated status for " << user << ": " << data);
 
		if(error.getMessage().length()) {
 
			LOG4CXX_ERROR(logger, user << " - " << error.getMessage());
 
		} else {
 
			LOG4CXX_INFO(logger, "Updated status for " << user << ": " << data);
 
		}
 
		callBack(user, error);
 
	}
 
}
backends/twitter/Requests/TimelineRequest.cpp
Show inline comments
 
@@ -2,7 +2,7 @@
 
DEFINE_LOGGER(logger, "TimelineRequest")
 
void TimelineRequest::run()
 
{
 
	LOG4CXX_INFO(logger, "Sending timeline request for user " << userRequested)
 
	LOG4CXX_INFO(logger, "Sending timeline request for user " << userRequested);
 

	
 
	if(userRequested != "") success = twitObj->timelineUserGet(false, false, 20, userRequested, false);
 
	else success = twitObj->timelineHomeGet(since_id);
 
@@ -22,11 +22,11 @@ void TimelineRequest::finalize()
 
		std::string curlerror;
 
		twitObj->getLastCurlError(curlerror);
 
		error.setMessage(curlerror);
 
		LOG4CXX_ERROR(logger,  user << " - Curl error: " << curlerror)
 
		LOG4CXX_ERROR(logger,  user << " - Curl error: " << curlerror);
 
		callBack(user, userRequested, tweets, error);
 
	} else {
 
		error = getErrorMessage(replyMsg);
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger,  user << " - " << error.getMessage())
 
		if(error.getMessage().length()) LOG4CXX_ERROR(logger,  user << " - " << error.getMessage());
 
		callBack(user, userRequested, tweets, error);
 
	}
 
}
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -130,31 +130,31 @@ void TwitterPlugin::handleLoginRequest(const std::string &user, const std::strin
 
	if(userdb.count(user) && (userdb[user].connectionState == NEW ||
 
										userdb[user].connectionState == CONNECTED ||
 
										userdb[user].connectionState == WAITING_FOR_PIN)) {
 
		LOG4CXX_INFO(logger, std::string("A session corresponding to ") + user + std::string(" is already active"))
 
		LOG4CXX_INFO(logger, std::string("A session corresponding to ") + user + std::string(" is already active"));
 
		return;
 
	}
 

	
 
	LOG4CXX_INFO(logger, std::string("Received login request for ") + user)	
 
	LOG4CXX_INFO(logger, std::string("Received login request for ") + user);
 
	initUserSession(user, legacyName, password);
 
	handleConnected(user);
 

	
 
	LOG4CXX_INFO(logger, "SPECTRUM 1 USER? - " << (userdb[user].spectrum1User? "true" : "false")) 
 
	LOG4CXX_INFO(logger, "SPECTRUM 1 USER? - " << (userdb[user].spectrum1User? "true" : "false"));
 

	
 
	LOG4CXX_INFO(logger, user << ": Adding Buddy " << adminLegacyName << " " << adminAlias)
 
	LOG4CXX_INFO(logger, user << ": Adding Buddy " << adminLegacyName << " " << adminAlias);
 
	handleBuddyChanged(user, adminLegacyName, adminAlias, std::vector<std::string>(), pbnetwork::STATUS_ONLINE);
 
	userdb[user].nickName = "";
 

	
 
	LOG4CXX_INFO(logger, "Querying database for usersettings of " << user)
 
	LOG4CXX_INFO(logger, "Querying database for usersettings of " << user);
 
	std::string key, secret;
 
	getUserOAuthKeyAndSecret(user, key, secret);
 

	
 
	if(key == "" || secret == "") {
 
		LOG4CXX_INFO(logger, "Intiating OAuth Flow for user " << user)
 
		LOG4CXX_INFO(logger, "Intiating OAuth Flow for user " << user);
 
		setTwitterMode(user, 0);
 
		tp->runAsThread(new OAuthFlow(np, userdb[user].sessions, user, userdb[user].sessions->getTwitterUsername()));
 
	} else {
 
		LOG4CXX_INFO(logger, user << " is already registerd. Using the stored oauth key and secret")
 
		LOG4CXX_INFO(logger, key << " " << secret)	
 
		LOG4CXX_INFO(logger, user << " is already registerd. Using the stored oauth key and secret");
 
		LOG4CXX_INFO(logger, key << " " << secret);
 
		pinExchangeComplete(user, key, secret);
 
	}
 
}
 
@@ -177,7 +177,7 @@ void TwitterPlugin::handleLogoutRequest(const std::string &user, const std::stri
 
void TwitterPlugin::handleJoinRoomRequest(const std::string &user, const std::string &room, const std::string &nickname, const std::string &password)
 
{
 
	if(room == adminChatRoom) {
 
		LOG4CXX_INFO(logger, "Received Join Twitter room request for " << user << " '" << nickname << "'")
 
		LOG4CXX_INFO(logger, "Received Join Twitter room request for " << user << " '" << nickname << "'");
 

	
 
		setTwitterMode(user, 2);
 
		handleParticipantChanged(user, nickname, room, 0, pbnetwork::STATUS_ONLINE);
 
@@ -188,7 +188,7 @@ void TwitterPlugin::handleJoinRoomRequest(const std::string &user, const std::st
 
										 boost::bind(&TwitterPlugin::populateRoster, this, _1, _2, _3, _4)));
 
	} else {
 
		setTwitterMode(user, 0);
 
		LOG4CXX_ERROR(logger, "Couldn't connect to chatroom - " << room <<"! Try twitter-chatroom as the chatroom to access Twitter account")
 
		LOG4CXX_ERROR(logger, "Couldn't connect to chatroom - " << room <<"! Try twitter-chatroom as the chatroom to access Twitter account");
 
		handleMessage(user, adminLegacyName, "Couldn't connect to chatroom! Try twitter-chatroom as the chatroom to access Twitter account");
 
	}
 
}
 
@@ -197,7 +197,7 @@ void TwitterPlugin::handleJoinRoomRequest(const std::string &user, const std::st
 
void TwitterPlugin::handleLeaveRoomRequest(const std::string &user, const std::string &room)
 
{
 
	if(room == adminChatRoom && onlineUsers.count(user)) {
 
		LOG4CXX_INFO(logger, "Leaving chatroom! Switching back to default mode 0")
 
		LOG4CXX_INFO(logger, "Leaving chatroom! Switching back to default mode 0");
 
		setTwitterMode(user, 0);
 
		handleBuddyChanged(user, adminLegacyName, adminAlias, std::vector<std::string>(), pbnetwork::STATUS_ONLINE);
 
	}
 
@@ -207,7 +207,7 @@ void TwitterPlugin::handleLeaveRoomRequest(const std::string &user, const std::s
 
void TwitterPlugin::handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &xhtml, const std::string &/*id*/)
 
{
 

	
 
	LOG4CXX_INFO(logger, "Received " << user << " --> " << legacyName << " - " << message)
 
	LOG4CXX_INFO(logger, "Received " << user << " --> " << legacyName << " - " << message);
 

	
 
	if(legacyName == adminLegacyName || legacyName == adminChatRoom)  {
 
		std::string cmd = "", data = "";
 
@@ -265,7 +265,7 @@ void TwitterPlugin::handleMessageSendRequest(const std::string &user, const std:
 
			handleMessage(user, userdb[user].twitterMode == CHATROOM ? adminChatRoom : adminLegacyName,
 
								std::string("Changed mode to ") + data, userdb[user].twitterMode == CHATROOM ? adminNickName : "");
 

	
 
			LOG4CXX_INFO(logger, user << ": Changed mode to " << data  << " <" << (userdb[user].twitterMode == CHATROOM ? adminNickName : "") << ">" )
 
			LOG4CXX_INFO(logger, user << ": Changed mode to " << data  << " <" << (userdb[user].twitterMode == CHATROOM ? adminNickName : "") << ">" );
 
		}
 

	
 
		else if(userdb[user].twitterMode == CHATROOM) {
 
@@ -296,11 +296,11 @@ void TwitterPlugin::handleMessageSendRequest(const std::string &user, const std:
 
void TwitterPlugin::handleBuddyUpdatedRequest(const std::string &user, const std::string &buddyName, const std::string &alias, const std::vector<std::string> &groups)
 
{
 
	if(userdb[user].connectionState != CONNECTED) {
 
		LOG4CXX_ERROR(logger, user << " is not connected to twitter!")
 
		LOG4CXX_ERROR(logger, user << " is not connected to twitter!");
 
		return;
 
	}
 

	
 
	LOG4CXX_INFO(logger, user << " - Adding Twitter contact " << buddyName)
 
	LOG4CXX_INFO(logger, user << " - Adding Twitter contact " << buddyName);
 
	tp->runAsThread(new CreateFriendRequest(userdb[user].sessions, user, buddyName,
 
											boost::bind(&TwitterPlugin::createFriendResponse, this, _1, _2, _3, _4)));
 
}
 
@@ -308,16 +308,16 @@ void TwitterPlugin::handleBuddyUpdatedRequest(const std::string &user, const std
 
void TwitterPlugin::handleBuddyRemovedRequest(const std::string &user, const std::string &buddyName, const std::vector<std::string> &groups)
 
{
 
	if(userdb[user].connectionState != CONNECTED) {
 
		LOG4CXX_ERROR(logger, user << " is not connected to twitter!")
 
		LOG4CXX_ERROR(logger, user << " is not connected to twitter!");
 
		return;
 
	}
 

	
 
	if (getTwitterMode(user) == MULTIPLECONTACT) {
 
		LOG4CXX_ERROR(logger, user << " not removing Twitter contact " << buddyName << ", because the mode is not MULTIPLECONTACT")
 
		LOG4CXX_ERROR(logger, user << " not removing Twitter contact " << buddyName << ", because the mode is not MULTIPLECONTACT");
 
		return;
 
	}
 

	
 
	LOG4CXX_INFO(logger, user << " - Removing Twitter contact " << buddyName)
 
	LOG4CXX_INFO(logger, user << " - Removing Twitter contact " << buddyName);
 
	tp->runAsThread(new DestroyFriendRequest(userdb[user].sessions, user, buddyName,
 
											 boost::bind(&TwitterPlugin::deleteFriendResponse, this, _1, _2, _3)));
 
}
 
@@ -325,11 +325,11 @@ void TwitterPlugin::handleBuddyRemovedRequest(const std::string &user, const std
 
void TwitterPlugin::handleVCardRequest(const std::string &user, const std::string &legacyName, unsigned int id)
 
{
 
	if(userdb[user].connectionState != CONNECTED) {
 
		LOG4CXX_ERROR(logger, user << " is not connected to twitter!")
 
		LOG4CXX_ERROR(logger, user << " is not connected to twitter!");
 
		return;
 
	}
 

	
 
	LOG4CXX_INFO(logger, user << " - VCardRequest for " << legacyName << ", " << userdb[user].buddiesInfo[legacyName].getProfileImgURL())
 
	LOG4CXX_INFO(logger, user << " - VCardRequest for " << legacyName << ", " << userdb[user].buddiesInfo[legacyName].getProfileImgURL());
 

	
 
	if(getTwitterMode(user) != SINGLECONTACT && userdb[user].buddies.count(legacyName)
 
		&& userdb[user].buddiesInfo[legacyName].getProfileImgURL().length()) {
 
@@ -374,7 +374,7 @@ bool TwitterPlugin::getUserOAuthKeyAndSecret(const std::string user, std::string
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return false;
 
	}
 

	
 
@@ -390,7 +390,7 @@ bool TwitterPlugin::checkSpectrum1User(const std::string user)
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return false;
 
	}
 

	
 
@@ -398,7 +398,7 @@ bool TwitterPlugin::checkSpectrum1User(const std::string user)
 
	int type = TYPE_STRING;
 
	storagebackend->getUserSetting((long)info.id, "first_synchronization_done", type, first_synchronization_done);
 

	
 
	LOG4CXX_INFO(logger, "first_synchronization_done: " << first_synchronization_done)
 
	LOG4CXX_INFO(logger, "first_synchronization_done: " << first_synchronization_done);
 

	
 
	if(first_synchronization_done.length()) return true;
 
	return false;
 
@@ -410,7 +410,7 @@ int TwitterPlugin::getTwitterMode(const std::string user)
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return -1;
 
	}
 

	
 
@@ -431,12 +431,12 @@ bool TwitterPlugin::setTwitterMode(const std::string user, int m)
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return false;
 
	}
 

	
 
	if(m < 0 || m > 2) {
 
		LOG4CXX_ERROR(logger, "Unknown mode " << m <<". Using default mode 0")
 
		LOG4CXX_ERROR(logger, "Unknown mode " << m <<". Using default mode 0");
 
		m = 0;
 
	}
 

	
 
@@ -444,7 +444,7 @@ bool TwitterPlugin::setTwitterMode(const std::string user, int m)
 

	
 
	//int type;
 
	std::string s_m = std::string(1,m+'0');
 
	LOG4CXX_INFO(logger, "Storing mode " << m <<" for user " << user)
 
	LOG4CXX_INFO(logger, "Storing mode " << m <<" for user " << user);
 
	storagebackend->updateUserSetting((long)info.id, MODE, s_m);
 
	return true;
 
}
 
@@ -456,7 +456,7 @@ bool TwitterPlugin::storeUserOAuthKeyAndSecret(const std::string user, const std
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return false;
 
	}
 

	
 
@@ -471,7 +471,7 @@ void TwitterPlugin::initUserSession(const std::string user, const std::string le
 

	
 
	std::string username = legacyName;
 
	std::string passwd = password;
 
	LOG4CXX_INFO(logger, username + "  " + passwd)
 
	LOG4CXX_INFO(logger, username + "  " + passwd);
 

	
 
	userdb[user].sessions = new twitCurl();
 
	if(CONFIG_HAS_KEY(config,"proxy.server")) {
 
@@ -484,7 +484,7 @@ void TwitterPlugin::initUserSession(const std::string user, const std::string le
 
		std::string puser = CONFIG_STRING(config,"proxy.user");
 
		std::string ppasswd = CONFIG_STRING(config,"proxy.password");
 

	
 
		LOG4CXX_INFO(logger, ip << " " << port << " " << puser << " " << ppasswd)
 
		LOG4CXX_INFO(logger, ip << " " << port << " " << puser << " " << ppasswd);
 

	
 
		if(ip != "localhost" && port != "0") {
 
			userdb[user].sessions->setProxyServerIp(ip);
 
@@ -545,7 +545,7 @@ void TwitterPlugin::updateLastTweetID(const std::string user, const std::string
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return;
 
	}
 

	
 
@@ -561,7 +561,7 @@ std::string TwitterPlugin::getMostRecentTweetIDUnsafe(const std::string user)
 
			int type = TYPE_STRING;
 
			UserInfo info;
 
			if(storagebackend->getUser(user, info) == false) {
 
				LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
				LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
			}
 
			else {
 
				storagebackend->getUserSetting(info.id, "twitter_last_tweet", type, ID);
 
@@ -584,7 +584,7 @@ void TwitterPlugin::updateLastDMID(const std::string user, const std::string ID)
 

	
 
	UserInfo info;
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
		return;
 
	}
 

	
 
@@ -599,7 +599,7 @@ std::string TwitterPlugin::getMostRecentDMIDUnsafe(const std::string user) {
 
			int type = TYPE_STRING;
 
			UserInfo info;
 
			if(storagebackend->getUser(user, info) == false) {
 
				LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
				LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!");
 
			}
 
			else {
 
				storagebackend->getUserSetting(info.id, "twitter_last_dm", type, ID);
 
@@ -813,7 +813,7 @@ void TwitterPlugin::directMessageResponse(std::string &user, std::string &userna
 
			}
 
		}
 

	
 
		if(maxID == getMostRecentDMID(user)) LOG4CXX_INFO(logger, "No new direct messages for " << user)
 
		if(maxID == getMostRecentDMID(user)) LOG4CXX_INFO(logger, "No new direct messages for " << user);
 
		updateLastDMID(user, maxID);
 
	}
 
}
 
@@ -837,7 +837,7 @@ void TwitterPlugin::createFriendResponse(std::string &user, User &frnd, std::str
 
	userdb[user].buddiesInfo[frnd.getScreenName()] = frnd;
 
	userdb[user].buddiesImgs[frnd.getScreenName()] = img;
 

	
 
	LOG4CXX_INFO(logger, user << " - " << frnd.getScreenName() << ", " << frnd.getProfileImgURL())
 
	LOG4CXX_INFO(logger, user << " - " << frnd.getScreenName() << ", " << frnd.getProfileImgURL());
 
	if(userdb[user].twitterMode == MULTIPLECONTACT) {
 
#if HAVE_SWIFTEN_3
 
		handleBuddyChanged(user, frnd.getScreenName(), frnd.getUserName(), std::vector<std::string>(), pbnetwork::STATUS_ONLINE, "", Swift::byteArrayToString(cryptoProvider->getSHA1Hash(Swift::createByteArray(img))));
 
@@ -861,7 +861,7 @@ void TwitterPlugin::deleteFriendResponse(std::string &user, User &frnd, Error &e
 
		return;
 
	}
 

	
 
	LOG4CXX_INFO(logger, user << " - " << frnd.getScreenName() << ", " << frnd.getProfileImgURL())
 
	LOG4CXX_INFO(logger, user << " - " << frnd.getScreenName() << ", " << frnd.getProfileImgURL());
 
	userdb[user].buddies.erase(frnd.getScreenName());
 

	
 
	handleMessage(user, userdb[user].twitterMode == CHATROOM ? adminChatRoom : adminLegacyName,
 
@@ -902,7 +902,7 @@ void TwitterPlugin::profileImageResponse(std::string &user, std::string &buddy,
 
		handleMessage(user, userdb[user].twitterMode == CHATROOM ? adminChatRoom : adminLegacyName,
 
							errMsg.getMessage(), userdb[user].twitterMode == CHATROOM ? adminNickName : "");
 
	} else {
 
		LOG4CXX_INFO(logger, user << " - Sending VCard for " << buddy)
 
		LOG4CXX_INFO(logger, user << " - Sending VCard for " << buddy);
 
		handleVCard(user, reqID, buddy, buddy, "", img);
 
	}
 
}
backends/twitter/TwitterResponseParser.cpp
Show inline comments
 
@@ -53,7 +53,7 @@ EmbeddedStatus getEmbeddedStatus(const rapidjson::Value &element)
 
{
 
	EmbeddedStatus status;
 
	if(!element.IsObject()) {
 
		LOG4CXX_ERROR(logger, "Not a status element!")
 
		LOG4CXX_ERROR(logger, "Not a status element!");
 
		return status;
 
	}
 
	status.setCreationTime( toIsoTime ( std::string( element[TwitterReponseTypes::created_at.c_str()].GetString() ) ) );
 
@@ -76,7 +76,7 @@ User getUser(const rapidjson::Value &element)
 
{
 
	User user;
 
	if(!element.IsObject()) {
 
		LOG4CXX_ERROR(logger, "Not a user element!")
 
		LOG4CXX_ERROR(logger, "Not a user element!");
 
		return user;
 
	}
 

	
 
@@ -142,14 +142,14 @@ std::vector<Status> getTimeline(std::string &json)
 
	rapidjson::Document rootElement;
 

	
 
	if(rootElement.Parse<0>(json.c_str()).HasParseError()) {
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON");
 
		LOG4CXX_ERROR(logger, json);
 
		return statuses;
 
	}
 

	
 
	if(!rootElement.IsArray()) {
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to timeline:")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to timeline:");
 
		LOG4CXX_ERROR(logger, json);
 
		return statuses;
 
	}
 

	
 
@@ -166,14 +166,14 @@ std::vector<DirectMessage> getDirectMessages(std::string &json)
 

	
 

	
 
	if(rootElement.Parse<0>(json.c_str()).HasParseError()) {
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON");
 
		LOG4CXX_ERROR(logger, json);
 
		return DMs;
 
	}
 

	
 
	if(!rootElement.IsArray()) {
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to direct messages:")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to direct messages:");
 
		LOG4CXX_ERROR(logger, json);
 
		return DMs;
 
	}
 

	
 
@@ -190,14 +190,14 @@ std::vector<User> getUsers(std::string &json)
 

	
 

	
 
	if(rootElement.Parse<0>(json.c_str()).HasParseError()) {
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON");
 
		LOG4CXX_ERROR(logger, json);
 
		return users;
 
	}
 

	
 
	if(!rootElement.IsArray()) {
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to user list:")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to user list:");
 
		LOG4CXX_ERROR(logger, json);
 
		return users;
 
	}
 

	
 
@@ -213,14 +213,14 @@ User getUser(std::string &json)
 
	rapidjson::Document rootElement;
 

	
 
	if(rootElement.Parse<0>(json.c_str()).HasParseError()) {
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON");
 
		LOG4CXX_ERROR(logger, json);
 
		return user;
 
	}
 

	
 
	if(!rootElement.IsObject()) {
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to user object")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to user object");
 
		LOG4CXX_ERROR(logger, json);
 
		return user;
 
	}
 

	
 
@@ -233,14 +233,14 @@ std::vector<std::string> getIDs(std::string &json)
 
	rapidjson::Document rootElement;
 

	
 
	if(rootElement.Parse<0>(json.c_str()).HasParseError()) {
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON");
 
		LOG4CXX_ERROR(logger, json);
 
		return IDs;
 
	}
 

	
 
	if(!rootElement.IsObject()) {
 
		LOG4CXX_ERROR(logger, "JSON doesn't correspond to id_list");
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, json);
 
		return IDs;
 
	}
 

	
 
@@ -260,8 +260,8 @@ Error getErrorMessage(std::string &json)
 
	rapidjson::Document rootElement;
 

	
 
	if(rootElement.Parse<0>(json.c_str()).HasParseError()) {
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON")
 
        LOG4CXX_ERROR(logger, json)
 
		LOG4CXX_ERROR(logger, "Error while parsing JSON");
 
		LOG4CXX_ERROR(logger, json);
 
		return resp;
 
	}
 
	if (rootElement.IsObject()) {
backends/twitter/main.cpp
Show inline comments
 
@@ -48,7 +48,7 @@ int main (int argc, char* argv[]) {
 
	}
 

	
 
	else if (!storagebackend->connect()) {
 
		LOG4CXX_ERROR(logger, "Can't connect to database!")
 
		LOG4CXX_ERROR(logger, "Can't connect to database!");
 
		return -1;
 
	}
 

	
libtransport/HTTPRequest.cpp
Show inline comments
 
@@ -40,7 +40,7 @@ bool HTTPRequest::init() {
 
		return true;
 
	}
 

	
 
	LOG4CXX_ERROR(logger, "Couldn't Initialize curl!")
 
	LOG4CXX_ERROR(logger, "Couldn't Initialize curl!");
 
	return false;
 
}
 

	
 
@@ -53,7 +53,7 @@ void HTTPRequest::setProxy(std::string IP, std::string port, std::string usernam
 
			curl_easy_setopt(curlhandle, CURLOPT_PROXYUSERPWD, proxyUserPass.c_str());
 
		}
 
	} else {
 
		LOG4CXX_ERROR(logger, "Trying to set proxy while CURL isn't initialized")
 
		LOG4CXX_ERROR(logger, "Trying to set proxy while CURL isn't initialized");
 
	}
 
}
 

	
 
@@ -91,7 +91,7 @@ bool HTTPRequest::GET(std::string url, 	std::string &data) {
 
			return true;
 
		}
 
	} else {
 
		LOG4CXX_ERROR(logger, "CURL not initialized!")
 
		LOG4CXX_ERROR(logger, "CURL not initialized!");
 
		strcpy(curl_errorbuffer, "CURL not initialized!");
 
	}
 
	LOG4CXX_ERROR(logger, "Error fetching " << url);
libtransport/ThreadPool.cpp
Show inline comments
 
@@ -79,7 +79,7 @@ void ThreadPool::releaseThread(int i)
 

	
 
void ThreadPool::cleandUp(Thread *t, int wid)
 
{
 
	LOG4CXX_INFO(logger, "Cleaning up thread #" << t->getThreadID())
 
	LOG4CXX_INFO(logger, "Cleaning up thread #" << t->getThreadID());
 
	t->finalize();
 
	delete t;
 
	releaseThread(wid);
 
@@ -93,7 +93,7 @@ void ThreadPool::scheduleFromQueue()
 
		int  w = getFreeThread();
 
		if(w == -1) break;
 

	
 
		LOG4CXX_INFO(logger, "Worker Available. Creating thread #" << w)
 
		LOG4CXX_INFO(logger, "Worker Available. Creating thread #" << w);
 
		Thread *t = requestQueue.front(); requestQueue.pop();
 
		t->setThreadID(w);
 
		worker[w] = new boost::thread(boost::bind(&ThreadPool::workerBody, this, _1, _2), t, w, loop);
 
@@ -107,19 +107,19 @@ void ThreadPool::runAsThread(Thread *t)
 
{
 
	int w;
 
	if((w = getFreeThread()) != -1) {
 
		LOG4CXX_INFO(logger, "Creating thread #" << w)
 
		LOG4CXX_INFO(logger, "Creating thread #" << w);
 
		t->setThreadID(w);
 
		worker[w] = new boost::thread(boost::bind(&ThreadPool::workerBody, this, _1, _2), t, w, loop);
 
		updateActiveThreadCount(-1);
 
	}
 
	else {
 
		LOG4CXX_INFO(logger, "No workers available! adding to queue.")
 
		LOG4CXX_INFO(logger, "No workers available! adding to queue.");
 
		requestQueue.push(t);
 
	}
 
}
 

	
 
void ThreadPool::workerBody(Thread *t, int wid) {
 
	LOG4CXX_INFO(logger, "Starting thread " << wid)
 
	LOG4CXX_INFO(logger, "Starting thread " << wid);
 
	t->run();
 
	loop->postEvent(boost::bind(&ThreadPool::cleandUp, this, t, wid), SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::EventOwner>());
 
}
libtransport/User.cpp
Show inline comments
 
@@ -180,7 +180,7 @@ void User::handlePresence(Swift::Presence::ref presence, bool forceJoin) {
 
			m_storageBackend->getUserSetting(m_userInfo.id, "photohash", type, value);
 
		}
 
		if (value != vcardUpdate->getPhotoHash()) {
 
			LOG4CXX_INFO(logger, m_jid.toString() << ": Requesting VCard")
 
			LOG4CXX_INFO(logger, m_jid.toString() << ": Requesting VCard");
 
			if (m_storageBackend) {
 
				m_storageBackend->updateUserSetting(m_userInfo.id, "photohash", vcardUpdate->getPhotoHash());
 
			}
spectrum/src/frontends/slack/SlackSession.cpp
Show inline comments
 
@@ -229,7 +229,7 @@ void SlackSession::leaveRoom(const std::string &channel_) {
 
	std::string channelId = m_idManager->getId(channel);
 
	std::string to = m_channel2jid[channelId];
 
	if (to.empty()) {
 
		LOG4CXX_ERROR(logger, "Spectrum 2 is not configured to transport this Slack channel.")
 
		LOG4CXX_ERROR(logger, "Spectrum 2 is not configured to transport this Slack channel.");
 
		return;
 
	}
 

	
spectrum/src/frontends/xmpp/XMPPUserRegistration.cpp
Show inline comments
 
@@ -266,7 +266,7 @@ bool XMPPUserRegistration::handleGetRequest(const Swift::JID& from, const Swift:
 
	if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) {
 
		std::vector<std::string> const &x = CONFIG_VECTOR(m_config,"service.allowed_servers");
 
		if (std::find(x.begin(), x.end(), from.getDomain()) == x.end()) {
 
			LOG4CXX_INFO(logger, from.toBare().toString() << ": This user has no permissions to register an account")
 
			LOG4CXX_INFO(logger, from.toBare().toString() << ": This user has no permissions to register an account");
 
			sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify);
 
			return true;
 
		}
 
@@ -290,7 +290,7 @@ bool XMPPUserRegistration::handleSetRequest(const Swift::JID& from, const Swift:
 
	if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) {
 
		std::vector<std::string> const &x = CONFIG_VECTOR(m_config,"service.allowed_servers");
 
		if (std::find(x.begin(), x.end(), from.getDomain()) == x.end()) {
 
			LOG4CXX_INFO(logger, barejid << ": This user has no permissions to register an account")
 
			LOG4CXX_INFO(logger, barejid << ": This user has no permissions to register an account");
 
			sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify);
 
			return true;
 
		}
0 comments (0 inline, 0 general)