Esempio n. 1
0
IRCNetworkPlugin::IRCNetworkPlugin(Config *config, Swift::QtEventLoop *loop, const std::string &host, int port) {
	m_config = config;
	m_currentServer = 0;
	m_firstPing = true;

	m_socket = new QTcpSocket();
	m_socket->connectToHost(FROM_UTF8(host), port);
	connect(m_socket, SIGNAL(readyRead()), this, SLOT(readData()));

	std::string server = CONFIG_STRING_DEFAULTED(m_config, "service.irc_server", "");
	if (!server.empty()) {
		m_servers.push_back(server);
	}
	else {
		std::list<std::string> list;
		list = CONFIG_LIST_DEFAULTED(m_config, "service.irc_server", list);
		m_servers.insert(m_servers.begin(), list.begin(), list.end());
	}

	if (CONFIG_HAS_KEY(m_config, "service.irc_identify")) {
		m_identify = CONFIG_STRING(m_config, "service.irc_identify");
	}
	else {
		m_identify = "NickServ identify $name $password";
	}
}
Esempio n. 2
0
void AdHocManager::handleUserCreated(User *user) {
	for (std::map<std::string, AdHocCommandFactory *>::const_iterator it = m_factories.begin(); it != m_factories.end(); it++) {
		for (std::map<std::string, std::string>::const_iterator it2 = it->second->getUserSettings().begin(); it2 != it->second->getUserSettings().end(); it2++) {
			std::string value = CONFIG_STRING_DEFAULTED(m_component->getConfig(), it->second->getNode() + "." + it2->first, it2->second);
			if (m_storageBackend) {
				int type = (int) TYPE_BOOLEAN;
				m_storageBackend->getUserSetting(user->getUserInfo().id, it2->first, type, value);
			}
			user->addUserSetting(it2->first, value);
		}
	}
}