Changeset - f0f819b4fd95
[Not reviewed]
0 3 0
HanzZ - 14 years ago 2011-06-12 19:25:51
hanzz.k@gmail.com
Fixed users_per_backend
3 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
spectrum/src/sample.cfg
Show inline comments
 
[service]
 
jid = localhost
 
password = secret
 
server = 127.0.0.1
 
port = 5222
 
server_mode = 1
 
backend_host=localhost # < this option doesn't work yet
 
backend_port=10001
 
users_per_backend=2
 
backend=../../backends/libpurple/libpurple_backend
 
#backend=../../backends/libircclient-qt/libircclient-qt_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=prpl-jabber
 
protocol=prpl-msn
 
#protocol=prpl-icq
 

	
 
[database]
 
database = test.sql
 
prefix=icq
src/conversation.cpp
Show inline comments
 
@@ -27,25 +27,24 @@
 
#include "transport/rostermanager.h"
 

	
 
namespace Transport {
 

	
 
Conversation::Conversation(ConversationManager *conversationManager, const std::string &legacyName, bool isMUC) : m_conversationManager(conversationManager) {
 
	m_legacyName = legacyName;
 
	m_conversationManager->addConversation(this);
 
	m_muc = isMUC;
 
	std::cout << "new conversation " << legacyName << "\n";
 
}
 

	
 
Conversation::~Conversation() {
 
	m_conversationManager->removeConversation(this);
 
}
 

	
 
void Conversation::handleMessage(boost::shared_ptr<Swift::Message> &message, const std::string &nickname) {
 
	if (m_muc) {
 
		message->setType(Swift::Message::Groupchat);
 
	}
 
	else {
 
		message->setType(Swift::Message::Chat);
 
	}
 
	if (message->getType() != Swift::Message::Groupchat) {
 
		
 
		message->setTo(m_conversationManager->getUser()->getJID().toBare());
src/networkpluginserver.cpp
Show inline comments
 
@@ -163,25 +163,25 @@ void NetworkPluginServer::handleNewClientConnection(boost::shared_ptr<Swift::Con
 

	
 
void NetworkPluginServer::handleSessionFinished(Client *c) {
 
	for (std::list<User *>::const_iterator it = c->users.begin(); it != c->users.end(); it++) {
 
		(*it)->setData(NULL);
 
		(*it)->handleDisconnected("Internal Server Error, please reconnect.");
 
	}
 

	
 
	m_clients.remove(c);
 
	delete c;
 

	
 
	// Execute new session only if there's no free one after this crash/disconnection
 
	for (std::list<Client *>::const_iterator it = m_clients.begin(); it != m_clients.end(); it++) {
 
		if ((*it)->users.size() < 1) {
 
		if ((*it)->users.size() < CONFIG_INT(m_config, "service.users_per_backend")) {
 
			return;
 
		}
 
	}
 
	exec_(CONFIG_STRING(m_config, "service.backend").c_str(), CONFIG_STRING(m_config, "service.backend_host").c_str(), CONFIG_STRING(m_config, "service.backend_port").c_str(), m_config->getConfigFile().c_str());
 
}
 

	
 
void NetworkPluginServer::handleConnectedPayload(const std::string &data) {
 
	pbnetwork::Connected payload;
 
	std::cout << "CONNECTED LOGIN 2 " << payload.user() << "\n";
 
	if (payload.ParseFromString(data) == false) {
 
		// TODO: ERROR
 
		return;
 
@@ -521,24 +521,26 @@ void NetworkPluginServer::handleRoomLeft(User *user, const std::string &r) {
 
	room.SerializeToString(&message);
 

	
 
	WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_LEAVE_ROOM);
 
 
 
	Client *c = (Client *) user->getData();
 
	send(c->connection, message);
 

	
 
	NetworkConversation *conv = (NetworkConversation *) user->getConversationManager()->getConversation(r);
 
	if (!conv) {
 
		return;
 
	}
 

	
 
	user->getConversationManager()->removeConversation(conv);
 

	
 
	delete conv;
 
}
 

	
 
void NetworkPluginServer::handleUserDestroyed(User *user) {
 
	UserInfo userInfo = user->getUserInfo();
 

	
 
	pbnetwork::Logout logout;
 
	logout.set_user(user->getJID().toBare());
 
	logout.set_legacyname(userInfo.uin);
 

	
 
	std::string message;
 
	logout.SerializeToString(&message);
0 comments (0 inline, 0 general)