コード例 #1
0
IslInterface::~IslInterface()
{
	logger->logMessage("[ISL] session ended", this);
	
	flushOutputBuffer();
	
	// As these signals are connected with Qt::QueuedConnection implicitly,
	// we don't need to worry about them modifying the lists while we're iterating.
	
	server->roomsLock.lockForRead();
	QMapIterator<int, Server_Room *> roomIterator(server->getRooms());
	while (roomIterator.hasNext()) {
		Server_Room *room = roomIterator.next().value();
		room->usersLock.lockForRead();
		QMapIterator<QString, ServerInfo_User_Container> roomUsers(room->getExternalUsers());
		while (roomUsers.hasNext()) {
			roomUsers.next();
			if (roomUsers.value().getUserInfo()->server_id() == serverId)
				emit externalRoomUserLeft(room->getId(), roomUsers.key());
		}
		room->usersLock.unlock();
	}
	server->roomsLock.unlock();
	
	server->clientsLock.lockForRead();
	QMapIterator<QString, Server_AbstractUserInterface *> extUsers(server->getExternalUsers());
	while (extUsers.hasNext()) {
		extUsers.next();
		if (extUsers.value()->getUserInfo()->server_id() == serverId)
			emit externalUserLeft(extUsers.key());
	}
	server->clientsLock.unlock();
}
コード例 #2
0
ファイル: servatrice.cpp プロジェクト: Aurenos/Cockatrice
void Servatrice::addIslInterface(int serverId, IslInterface *interface)
{
    // Only call with islLock locked for writing
    
    islInterfaces.insert(serverId, interface);
    connect(interface, SIGNAL(externalUserJoined(ServerInfo_User)), this, SLOT(externalUserJoined(ServerInfo_User)));
    connect(interface, SIGNAL(externalUserLeft(QString)), this, SLOT(externalUserLeft(QString)));
    connect(interface, SIGNAL(externalRoomUserJoined(int, ServerInfo_User)), this, SLOT(externalRoomUserJoined(int, ServerInfo_User)));
    connect(interface, SIGNAL(externalRoomUserLeft(int, QString)), this, SLOT(externalRoomUserLeft(int, QString)));
    connect(interface, SIGNAL(externalRoomSay(int, QString, QString)), this, SLOT(externalRoomSay(int, QString, QString)));
    connect(interface, SIGNAL(externalRoomGameListChanged(int, ServerInfo_Game)), this, SLOT(externalRoomGameListChanged(int, ServerInfo_Game)));
    connect(interface, SIGNAL(joinGameCommandReceived(Command_JoinGame, int, int, int, qint64)), this, SLOT(externalJoinGameCommandReceived(Command_JoinGame, int, int, int, qint64)));
    connect(interface, SIGNAL(gameCommandContainerReceived(CommandContainer, int, int, qint64)), this, SLOT(externalGameCommandContainerReceived(CommandContainer, int, int, qint64)));
    connect(interface, SIGNAL(responseReceived(Response, qint64)), this, SLOT(externalResponseReceived(Response, qint64)));
    connect(interface, SIGNAL(gameEventContainerReceived(GameEventContainer, qint64)), this, SLOT(externalGameEventContainerReceived(GameEventContainer, qint64)));
}
コード例 #3
0
void IslInterface::sessionEvent_UserLeft(const Event_UserLeft &event)
{
	emit externalUserLeft(QString::fromStdString(event.name()));
}