/*************************************************************************************************************
* This file contains broadcasting messages to all buddies
* 2012/8 by Dlxko
* Version 3.0
**************************************************************************************************************/
#include "BroadBuddies.h"

// Local static variable
static int counter;

// Function to broadcast messages to all buddies except current
void function_broadcast_buddies ( char *message, _client *current_client, int size)
{
	// Reset counter
	counter = RESET;

	do
	{
		// Check all informations to prevent sending trash
		if (function_check_client(&client[counter]) && (&client[counter].socket != &current_client->socket) && (function_check_friendstate(current_client, &client[counter])))
		{
			// Send contacts
			function_send_data ( &client[counter], message, size );
		}
		++counter;
	}
	while ( counter < MAX_CLIENTS);
}