Exemplo n.º 1
0
	bool RoomCLEntry::MayChangeAffiliation (QObject *participant, MUCAffiliation aff) const
	{
		MUCAffiliation ourAff = GetAffiliation (0);
		if (ourAff < MUCAAdmin)
			return false;

		if (ourAff == MUCAOwner)
			return true;

		MUCAffiliation partAff = GetAffiliation (participant);
		if (partAff >= ourAff)
			return false;

		if (aff >= MUCAAdmin)
			return false;

		return true;
	}
Exemplo n.º 2
0
	bool RoomCLEntry::MayChangeRole (QObject *participant, MUCRole newRole) const
	{
		MUCAffiliation ourAff = GetAffiliation (0);
		MUCRole ourRole = GetRole (0);

		MUCAffiliation aff = GetAffiliation (participant);
		MUCRole role = GetRole (participant);

		if (role == MUCRInvalid ||
				ourRole == MUCRInvalid ||
				newRole == MUCRInvalid ||
				aff == MUCAInvalid ||
				ourAff == MUCAInvalid)
			return false;

		if (ourRole != MUCRModerator)
			return false;

		if (ourAff <= aff)
			return false;

		return true;
	}
Exemplo n.º 3
0
Arquivo: pilot.C Projeto: zear/sabre
void Pilot::Broadcast(int idx, int channel, int priority, void *extraInfo)
{
int priorityValue;
int affil;

	switch (priority)
	{
	case commPRIORITY_STANDARD:
	default:
		priorityValue = sbrPRIORITY_REGULAR;
		break;

	case commPRIORITY_LOW:
		priorityValue = sbrPRIORITY_LOW;
		break;

	case commPRIORITY_HIGH:
		priorityValue = sbrPRIORITY_HIGH;
		break;
	}

	switch (channel)
	{
	case commCHANNEL_AFFILIATION:
	case commCHANNEL_SQUAD:
	default:
		affil = GetAffiliation();
		break;

	case commCHANNEL_ALL:
		affil = -1;
		break;
	}

	switch (idx)
	{

	case commWINGMAN_KILL:
		{
			aiPilot *targetPilot = (aiPilot *)extraInfo;
			if (targetPilot)
			{
				brdcst(priorityValue,affil,"Kill on %s @ Angels %d",
								targetPilot->GetModel(),
								(int) ANGELS(targetPilot));
				Flight *targetFlight = ((Pilot *)targetPilot)->get_flight();
				sound_on(buildSoundId("kill",targetFlight),affil);
			}
		}
		break;

	case commWINGMAN_ENGAGING:
		{
			aiPilot *targetPilot = (aiPilot *)extraInfo;
			if (targetPilot)
			{
				brdcst(priorityValue,affil,"Engaging %s @ Angels %d",
								targetPilot->GetModel(),
								(int) ANGELS(targetPilot));
				Flight *targetFlight = ((Pilot *)targetPilot)->get_flight();
				sound_on(buildSoundId("engage",targetFlight),affil);
			}
		}
		break;
	}
}