/*************************************************************************************************************
* This file contains creating and functionality of info system
* 2012/10 by Dlxko
* Version 4.0
**************************************************************************************************************/
#include "Infos.h"

// Function to request server for info
void function_info_request(GtkWidget *unused_button, gint input_buddy_number)
{
	// Check buddy nuber
	if( (input_buddy_number == 0) || (input_buddy_number < 0) || (input_buddy_number > MAX_BUDDIES))
		return;

	// Count lenght
	sending_text_len = LENGHT_SIZE + DATA_ONE_SIZE + OPCODE_SIZE;
	sprintf_s(sending_text_len_char, LENGHT_SIZE, "%d", sending_text_len);

	// Update text for server with "DX_OPCODE_INF" and name datas
	memset(sending_text,0,BUF_SIZE);
	memcpy(sending_text, sending_text_len_char, LENGHT_SIZE);
	memcpy(&sending_text[LENGHT_SIZE], DX_OPCODE_INF, OPCODE_SIZE);
	memcpy(&sending_text[LENGHT_SIZE+OPCODE_SIZE], buddy[input_buddy_number].nick_name, strlen(buddy[input_buddy_number].nick_name));

	// Send socket
	function_send_data(sending_text, sending_text_len);
	return;
}

