summaryrefslogblamecommitdiffstats
path: root/msg_sender/handler.c
blob: 9b74339057e8ca2257df55204f226cdbf702bc84 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12

                                    

                                          

                     





                               

 

                       
                       



                          




















                            





















                                             

                                    





                                                         







                                                       

                                                  
                                                                           







                                
#include "Ecore.h"
#include "/usr/local/include/Evas.h"
#include "/usr/local/include/Ecore_Evas.h"
#include "/usr/local/include/Elementary.h"
#include "receiver.h"
#include "sender.h"
#include "msg_sender.h"

int is_init = 0;
double interval = 0.1;
double current_time, last_call;



void pause_msg_sender()
{	
	msg_stop_irc();
}

void continue_msg_sender()
{
	msg_run_irc();
}

void pause_receiver()
{
	receiver_stop_irc();
}

void continue_receiver()
{
	receiver_run_irc();
}

void pause_sender()
{
	sender_stop_irc();
}

void continue_sender()
{
	sender_run_irc();
}

void exit_all()
{
	elm_exit();
	ecore_shutdown();
	elm_shutdown();	
}

void continue_gui(void *data)
{
	elm_run();
}

void init_ecore_handler(char *from, char *to)
{
	ecore_init();
	
	if (is_init == 0)
	{
		is_init = 1;
		msg_main_loop(from, to);
		sender_main(from);
		receiver_main(from);
	}

	ecore_idle_exiter_add(continue_msg_sender, NULL);

	ecore_idle_exiter_add(pause_msg_sender, NULL);	

	ecore_idle_exiter_add(continue_sender, NULL);

	ecore_idle_exiter_add(pause_sender, NULL);

	ecore_idle_exiter_add(continue_receiver, NULL);

	ecore_idle_exiter_add(pause_receiver, NULL);

	ecore_idle_exiter_add(continue_gui, NULL);

	//ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_all, NULL);

	ecore_main_loop_begin();
}

void shutdown_ecore_handler()
{
	ecore_shutdown();
}