Changeset - 59194bbd38ae
[Not reviewed]
0 1 0
Jan Kaluza - 10 years ago 2016-01-02 19:48:52
jkaluza@redhat.com
Set default type of user settings in Twitter
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -244,13 +244,13 @@ void TwitterPlugin::handleMessageSendRequest(const std::string &user, const std:
 
			int m = 0;
 
			m = atoi(data.c_str());
 
			mode prevm = userdb[user].twitterMode;
 

	
 
			if((mode)m == userdb[user].twitterMode) return; //If same as current mode return
 
			if(m < 0 || m > 2) { // Invalid modes
 
				handleMessage(user, adminLegacyName, std::string("Error! Unknown mode ") + data + ". Allowed values 0,1,2." );
 
				handleMessage(user, adminLegacyName, std::string("Error! Unknown mode ") + data + ". Allowed values 0 or 1." );
 
				return;
 
			}
 

	
 
			setTwitterMode(user, m);
 
			if((userdb[user].twitterMode == SINGLECONTACT || userdb[user].twitterMode == CHATROOM) && prevm == MULTIPLECONTACT) clearRoster(user);
 
			else if(userdb[user].twitterMode == MULTIPLECONTACT) 
 
@@ -369,13 +369,13 @@ 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!")
 
		return false;
 
	}
 

	
 
	key="", secret=""; int type;
 
	key="", secret=""; int type = TYPE_STRING;;
 
	storagebackend->getUserSetting((long)info.id, OAUTH_KEY, type, key);
 
	storagebackend->getUserSetting((long)info.id, OAUTH_SECRET, type, secret);
 
	return true;
 
}
 

	
 
bool TwitterPlugin::checkSpectrum1User(const std::string user) 
 
@@ -386,13 +386,13 @@ bool TwitterPlugin::checkSpectrum1User(const std::string user)
 
	if(storagebackend->getUser(user, info) == false) {
 
		LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
		return false;
 
	}
 

	
 
	std::string first_synchronization_done = "";
 
	int type;
 
	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)
 

	
 
	if(first_synchronization_done.length()) return true;
 
	return false;
 
@@ -405,13 +405,13 @@ 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!")
 
		return -1;
 
	}
 

	
 
	int type; int m;
 
	int type = TYPE_STRING; int m;
 
	std::string s_m;
 
	storagebackend->getUserSetting((long)info.id, MODE, type, s_m);
 
	if(s_m == "") {
 
		s_m  = "0";
 
		storagebackend->updateUserSetting((long)info.id, MODE, s_m);
 
	}
 
@@ -549,13 +549,13 @@ void TwitterPlugin::updateLastTweetID(const std::string user, const std::string
 
std::string TwitterPlugin::getMostRecentTweetIDUnsafe(const std::string user)
 
{	
 
	std::string ID = "";
 
	if(onlineUsers.count(user)) {
 
		ID = userdb[user].mostRecentTweetID;
 
		if (ID.empty()) {
 
			int type;
 
			int type = TYPE_STRING;
 
			UserInfo info;
 
			if(storagebackend->getUser(user, info) == false) {
 
				LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
			}
 
			else {
 
				storagebackend->getUserSetting(info.id, "twitter_last_tweet", type, ID);
 
@@ -587,13 +587,13 @@ void TwitterPlugin::updateLastDMID(const std::string user, const std::string ID)
 

	
 
std::string TwitterPlugin::getMostRecentDMIDUnsafe(const std::string user) {
 
	std::string ID = "";
 
	if(onlineUsers.count(user)) {
 
		ID = userdb[user].mostRecentDirectMessageID;
 
		if (ID.empty()) {
 
			int type;
 
			int type = TYPE_STRING;
 
			UserInfo info;
 
			if(storagebackend->getUser(user, info) == false) {
 
				LOG4CXX_ERROR(logger, "Didn't find entry for " << user << " in the database!")
 
			}
 
			else {
 
				storagebackend->getUserSetting(info.id, "twitter_last_dm", type, ID);
0 comments (0 inline, 0 general)