summaryrefslogtreecommitdiffstats
path: root/msg_sender/handler.c
blob: 9b74339057e8ca2257df55204f226cdbf702bc84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#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();
}