memory leak issue fixed
[platform/core/messaging/msg-service.git] / manager / src / msg-manager.cpp
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <glib.h>
4
5 extern "C"
6 {
7 #include <tizen.h>
8 #include <service_app.h>
9 #include <app_event.h>
10 #include <bundle.h>
11 #include <notification_list.h>
12 #include <notification_text_domain.h>
13 #include <notification_internal.h>
14 #include <vconf.h>
15 #include <call-manager.h>
16 }
17
18 #include "msg.h"
19 #include "msg_storage.h"
20
21 #include "msg-manager-contact.h"
22 #include "msg-manager-debug.h"
23 #include "msg-manager-notification.h"
24 #include "msg-manager-sound.h"
25
26 /* below defines will be removed */
27 #define EVENT_KEY_OUT_MSG_TYPE "msg_type"
28 #define EVENT_KEY_OUT_MSG_ID "msg_id"
29
30 msg_handle_t msg_handle = NULL;
31 cm_client_h cm_handle = NULL;
32
33 bool service_app_create(void *data)
34 {
35         MSG_MGR_INFO("app_create");
36
37         int msg_server_ready = 0;
38         for (int i = 0; i < 100; i++) {
39                 vconf_get_bool(VCONFKEY_MSG_SERVER_READY, &msg_server_ready);
40                 if (msg_server_ready == 1) {
41                         int msg_err = msg_open_msg_handle(&msg_handle);
42                         if (msg_err != MSG_SUCCESS)
43                                 MSG_MGR_DEBUG("msg_open_msg_handle() failed [%d]", msg_err);
44                         else
45                                 MSG_MGR_DEBUG("msg_open_msg_handle() success");
46
47                         break;
48                 } else {
49                         MSG_MGR_DEBUG("msg-server is not ready.");
50                         sleep(1);
51                 }
52         }
53
54         MsgMgrInitNoti();
55         initMsgMgrSoundPlayer();
56         cm_init(&cm_handle);
57
58         return true;
59 }
60
61 void service_app_terminate(void *data)
62 {
63         MSG_MGR_INFO("app_terminate");
64
65         cm_deinit(cm_handle);
66         MsgMgrCloseContactSvc();
67         msg_close_msg_handle(&msg_handle);
68
69         return;
70 }
71
72 void _incoming_msg_func(app_control_h app_control)
73 {
74         MSG_MGR_BEGIN();
75
76         int ret = 0;
77         char *rcv_msg_type = NULL;
78         char *rcv_msg_id = NULL;
79
80         ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_ID, &rcv_msg_id);
81         if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_id == NULL) {
82                 MSG_MGR_ERR("app_control_get_extra_data failed");
83                 return;
84         }
85
86         ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_TYPE, &rcv_msg_type);
87         if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_type == NULL) {
88                 MSG_MGR_ERR("app_control_get_extra_data failed");
89                 g_free(rcv_msg_id);
90                 return;
91         }
92
93         MSG_MGR_INFO("rcv_msg_type(%s), rcv_msg_id(%s)", rcv_msg_type, rcv_msg_id);
94
95         int msg_err = MSG_SUCCESS;
96         msg_message_id_t msg_id = atoi(rcv_msg_id);
97         msg_struct_t msg = NULL;
98         msg_struct_t opt = NULL;
99         contactInfo contact_info = {0,};
100         contact_info.msgId = msg_id;
101
102         msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
103         opt = msg_create_struct(MSG_STRUCT_SENDOPT);
104         msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
105         if (msg_err != MSG_SUCCESS) {
106                 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
107                 return;
108         }
109
110         msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &contact_info.msgType);
111         msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &contact_info.folderId);
112         msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &contact_info.simIndex);
113         msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&contact_info.addrList);
114         msg_get_str_value(msg, MSG_MESSAGE_SUBJECT_STR, contact_info.subject, MAX_CONTACT_TEXT_LEN);
115         int msgSize = 0;
116         msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msgSize);
117         if (msgSize > 0)
118                 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, contact_info.msgText, MAX_CONTACT_TEXT_LEN);
119
120         if ((contact_info.folderId == MSG_INBOX_ID || contact_info.folderId == MSG_SPAMBOX_ID)) {
121                 MsgMgrAddPhoneLog(&contact_info);
122         }
123
124         msg_release_struct(&msg);
125         msg_release_struct(&opt);
126
127         g_free(rcv_msg_id);
128         g_free(rcv_msg_type);
129
130         MSG_MGR_END();
131 }
132
133 void _outgoing_msg_func(app_control_h app_control)
134 {
135         MSG_MGR_BEGIN();
136
137         int ret = 0;
138         char *sent_msg_type = NULL;
139         char *sent_msg_id = NULL;
140
141         ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_ID, &sent_msg_id);
142         if (ret != APP_CONTROL_ERROR_NONE || sent_msg_id == NULL) {
143                 MSG_MGR_ERR("app_control_get_extra_data failed");
144                 return;
145         }
146
147         ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_TYPE, &sent_msg_type);
148         if (ret != APP_CONTROL_ERROR_NONE || sent_msg_type == NULL) {
149                 MSG_MGR_ERR("app_control_get_extra_data failed");
150                 g_free(sent_msg_id);
151                 return;
152         }
153
154         MSG_MGR_INFO("sent_msg_type(%s) sent_msg_id(%s)", sent_msg_type, sent_msg_id);
155
156         int msg_err = MSG_SUCCESS;
157         msg_message_id_t msg_id = atoi(sent_msg_id);
158         msg_struct_t msg = NULL;
159         msg_struct_t opt = NULL;
160         contactInfo contact_info = {0,};
161         contact_info.msgId = msg_id;
162
163         msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
164         opt = msg_create_struct(MSG_STRUCT_SENDOPT);
165         msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
166         if (msg_err != MSG_SUCCESS) {
167                 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
168                 return;
169         }
170
171         msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &contact_info.msgType);
172         msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &contact_info.folderId);
173         msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &contact_info.simIndex);
174         msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&contact_info.addrList);
175         msg_get_str_value(msg, MSG_MESSAGE_SUBJECT_STR, contact_info.subject, 100);
176         int msgSize = 0;
177         msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msgSize);
178         if (msgSize > 0)
179                 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, contact_info.msgText, 100);
180
181         MsgMgrAddPhoneLog(&contact_info);
182
183         msg_release_struct(&msg);
184         msg_release_struct(&opt);
185
186         g_free(sent_msg_id);
187         g_free(sent_msg_type);
188
189         MSG_MGR_END();
190 }
191
192 void _refresh_noti_func(app_control_h app_control)
193 {
194         char *type = NULL;
195         char *feedback = NULL;
196         char *active_type = NULL;
197         msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
198         bool bFeedback = true;
199         msg_mgr_active_notification_type_t active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_NONE;
200
201         int ret = app_control_get_extra_data(app_control, "type", &type);
202         if (ret == APP_CONTROL_ERROR_NONE && type) {
203                 MSG_MGR_DEBUG("type [%s]", type);
204                 if (g_strcmp0(type, "normal") == 0)
205                         noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
206
207                 g_free(type);
208         } else {
209                 MSG_MGR_ERR("app_control_get_extra_data failed");
210                 return;
211         }
212
213         ret = app_control_get_extra_data(app_control, "feedback", &feedback);
214         if (ret == APP_CONTROL_ERROR_NONE && feedback) {
215                 MSG_MGR_DEBUG("feedback [%s]", feedback);
216                 if (g_strcmp0(feedback, "false") == 0)
217                         bFeedback = false;
218                 else if (g_strcmp0(feedback, "true") == 0)
219                         bFeedback = true;
220
221                 g_free(feedback);
222         }
223
224         ret = app_control_get_extra_data(app_control, "active_type", &active_type);
225         if (ret == APP_CONTROL_ERROR_NONE && active_type) {
226                 MSG_MGR_DEBUG("active_type [%s]", active_type);
227                 if (g_strcmp0(active_type, "none") == 0)
228                         active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_NONE;
229                 else if (g_strcmp0(active_type, "active") == 0)
230                         active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_ACTIVE;
231                 else if (g_strcmp0(active_type, "instant") == 0)
232                         active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT;
233
234                 g_free(active_type);
235         }
236
237         MsgMgrRefreshNotification(noti_type, bFeedback, active_noti_type);
238 }
239
240 void _add_noti_func(app_control_h app_control)
241 {
242         char *type;
243         msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
244
245         int ret = app_control_get_extra_data(app_control, "type", &type);
246         if (ret == APP_CONTROL_ERROR_NONE && type) {
247                 if (g_strcmp0(type, "voice1") == 0) {
248                         noti_type = MSG_MGR_NOTI_TYPE_VOICE_1;
249                 } else if (g_strcmp0(type, "voice2") == 0) {
250                         noti_type = MSG_MGR_NOTI_TYPE_VOICE_2;
251                 } else if (g_strcmp0(type, "mwi") == 0) {
252                         noti_type = MSG_MGR_NOTI_TYPE_MWI;
253                 } else if (g_strcmp0(type, "class0") == 0) {
254                         noti_type = MSG_MGR_NOTI_TYPE_CLASS0;
255                 }
256
257                 g_free(type);
258         } else {
259                 MSG_MGR_ERR("app_control_get_extra_data failed");
260                 return;
261         }
262
263         char *msgId = NULL;
264         ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
265         if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
266                 MSG_MGR_ERR("app_control_get_extra_data failed");
267                 return;
268         }
269
270         int msg_err = MSG_SUCCESS;
271         msg_message_id_t msg_id = atoi(msgId);
272         msg_struct_t msg = NULL;
273         msg_struct_t opt = NULL;
274         msg_list_handle_t addr_list = NULL;
275         MSG_MGR_MESSAGE_INFO_S msg_info = {0,};
276         msg_info.msgId = msg_id;
277
278         msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
279         opt = msg_create_struct(MSG_STRUCT_SENDOPT);
280         msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
281         if (msg_err != MSG_SUCCESS) {
282                 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
283                 return;
284         }
285
286         msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
287         msg_get_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, (int *)&msg_info.displayTime);
288         msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, (int *)&msg_info.networkStatus);
289         msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
290
291         msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
292         msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
293         msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
294
295         if (noti_type == MSG_MGR_NOTI_TYPE_MWI || noti_type == MSG_MGR_NOTI_TYPE_CLASS0) {
296                 int msg_size = 0;
297                 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msg_size);
298                 if (msg_size > 0)
299                         msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, msg_info.msgText, MAX_MSG_TEXT_LEN);
300         }
301
302         msg_release_struct(&msg);
303         msg_release_struct(&opt);
304
305         g_free(msgId);
306
307         MsgMgrAddNotification(noti_type, &msg_info);
308 }
309
310 void _add_report_noti_func(app_control_h app_control)
311 {
312         char *type;
313         msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
314
315         int ret = app_control_get_extra_data(app_control, "type", &type);
316         if (ret == APP_CONTROL_ERROR_NONE && type) {
317                 if (g_strcmp0(type, "sms_delivery") == 0) {
318                         noti_type = MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT;
319                 } else if (g_strcmp0(type, "mms_delivery") == 0) {
320                         noti_type = MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT;
321                 } else if (g_strcmp0(type, "mms_read") == 0) {
322                         noti_type = MSG_MGR_NOTI_TYPE_MMS_READ_REPORT;
323                 }
324
325                 g_free(type);
326         } else {
327                 MSG_MGR_ERR("app_control_get_extra_data failed");
328                 return;
329         }
330
331         char *msgId = NULL;
332         ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
333         if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
334                 MSG_MGR_ERR("app_control_get_extra_data failed");
335                 return;
336         }
337
338         int msg_err = MSG_SUCCESS;
339         msg_message_id_t msg_id = atoi(msgId);
340         msg_struct_t msg = NULL;
341         msg_struct_t opt = NULL;
342         msg_list_handle_t addr_list = NULL;
343         MSG_MGR_MESSAGE_INFO_S msg_info = {0,};
344         msg_info.msgId = msg_id;
345
346         msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
347         opt = msg_create_struct(MSG_STRUCT_SENDOPT);
348         msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
349         if (msg_err != MSG_SUCCESS) {
350                 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
351                 return;
352         }
353
354         msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
355         msg_get_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, (int *)&msg_info.displayTime);
356         msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, (int *)&msg_info.networkStatus);
357         msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
358
359         msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
360         msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
361         msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
362
363         msg_release_struct(&msg);
364         msg_release_struct(&opt);
365
366         g_free(msgId);
367
368         MsgMgrAddReportNotification(noti_type, &msg_info);
369 }
370
371 void _del_report_noti_func(app_control_h app_control)
372 {
373         char *addr = NULL;
374         int ret = app_control_get_extra_data(app_control, "address", &addr);
375         if (ret != APP_CONTROL_ERROR_NONE || addr == NULL) {
376                 MSG_MGR_ERR("app_control_get_extra_data failed");
377                 return;
378         }
379
380         MsgMgrDeleteReportNotification(addr);
381
382         g_free(addr);
383 }
384
385 void _insert_only_active_noti_func(app_control_h app_control)
386 {
387         char *type;
388         msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
389
390         int ret = app_control_get_extra_data(app_control, "type", &type);
391         if (ret == APP_CONTROL_ERROR_NONE && type) {
392                 if (g_strcmp0(type, "normal") == 0) {
393                         noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
394                 } else if (g_strcmp0(type, "class0") == 0) {
395                         noti_type = MSG_MGR_NOTI_TYPE_CLASS0;
396                 }
397
398                 g_free(type);
399         } else {
400                 MSG_MGR_ERR("app_control_get_extra_data failed");
401                 return;
402         }
403
404         char *msgId = NULL;
405         ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
406         if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
407                 MSG_MGR_ERR("app_control_get_extra_data failed");
408                 return;
409         }
410
411         int msg_err = MSG_SUCCESS;
412         msg_message_id_t msg_id = atoi(msgId);
413         msg_struct_t msg = NULL;
414         msg_struct_t opt = NULL;
415         msg_list_handle_t addr_list = NULL;
416         MSG_MGR_MESSAGE_INFO_S msg_info = {0,};
417         msg_info.msgId = msg_id;
418
419         msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
420         opt = msg_create_struct(MSG_STRUCT_SENDOPT);
421         msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
422         if (msg_err != MSG_SUCCESS) {
423                 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
424                 return;
425         }
426
427         msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
428
429         if (noti_type == MSG_MGR_NOTI_TYPE_CLASS0) {
430                 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
431
432                 msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
433                 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
434                 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
435
436                 int msg_size = 0;
437                 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msg_size);
438                 if (msg_size > 0)
439                         msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, msg_info.msgText, MAX_MSG_TEXT_LEN);
440         }
441
442         msg_release_struct(&msg);
443         msg_release_struct(&opt);
444
445         g_free(msgId);
446
447         MsgMgrInsertOnlyActiveNotification(noti_type, &msg_info);
448 }
449
450 void _sound_play_start_func(app_control_h app_control)
451 {
452         char *type;
453         MSG_MGR_SOUND_TYPE_T sound_type = MSG_MGR_SOUND_PLAY_DEFAULT;
454
455         int ret = app_control_get_extra_data(app_control, "type", &type);
456         if (ret == APP_CONTROL_ERROR_NONE && type) {
457                 if (g_strcmp0(type, "default") == 0) {
458                         sound_type = MSG_MGR_SOUND_PLAY_DEFAULT;
459                 } else if (g_strcmp0(type, "user") == 0) {
460                         sound_type = MSG_MGR_SOUND_PLAY_USER;
461                 } else if (g_strcmp0(type, "emergency") == 0) {
462                         sound_type = MSG_MGR_SOUND_PLAY_EMERGENCY;
463                 } else if (g_strcmp0(type, "voicemail") == 0) {
464                         sound_type = MSG_MGR_SOUND_PLAY_VOICEMAIL;
465                 }
466
467                 g_free(type);
468         } else {
469                 MSG_MGR_ERR("app_control_get_extra_data failed");
470                 return;
471         }
472
473         char *addr = NULL;
474         ret = app_control_get_extra_data(app_control, "address", &addr);
475
476         if (addr) {
477                 MSG_MGR_ADDRESS_INFO_S addr_info = {0,};
478                 snprintf(addr_info.addressVal, MAX_ADDRESS_VAL_LEN, "%s", addr);
479
480                 MsgMgrSoundPlayStart(&addr_info, sound_type);
481
482                 g_free(addr);
483         } else {
484                 MsgMgrSoundPlayStart(NULL, sound_type);
485         }
486 }
487
488 void service_app_control(app_control_h app_control, void *data)
489 {
490         MSG_MGR_INFO("service_app_control called");
491
492         int ret = 0;
493         char *operation = NULL;
494         char *cmd = NULL;
495
496         ret = app_control_get_operation(app_control, &operation);
497         if (ret == APP_CONTROL_ERROR_NONE && operation) {
498                 if (g_strcmp0(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) {
499                         ret = app_control_get_extra_data(app_control, "cmd", &cmd);
500                         if (ret == APP_CONTROL_ERROR_NONE && cmd) {
501                                 MSG_MGR_DEBUG("cmd [%s]", cmd);
502
503                                 if (g_strcmp0(cmd, "incoming_msg") == 0) {
504                                         _incoming_msg_func(app_control);
505                                 } else if (g_strcmp0(cmd, "outgoing_msg") == 0) {
506                                         _outgoing_msg_func(app_control);
507                                 } else if (g_strcmp0(cmd, "refresh_noti") == 0) {
508                                         _refresh_noti_func(app_control);
509                                 } else if (g_strcmp0(cmd, "add_noti") == 0) {
510                                         _add_noti_func(app_control);
511                                 } else if (g_strcmp0(cmd, "add_report_noti") == 0) {
512                                         _add_report_noti_func(app_control);
513                                 } else if (g_strcmp0(cmd, "del_report_noti") == 0) {
514                                         _del_report_noti_func(app_control);
515                                 } else if (g_strcmp0(cmd, "insert_only_active_noti") == 0) {
516                                         _insert_only_active_noti_func(app_control);
517                                 } else if (g_strcmp0(cmd, "sound_play_start") == 0) {
518                                         _sound_play_start_func(app_control);
519                                 }
520
521                                 g_free(cmd);
522                         }
523                 }
524                 g_free(operation);
525         }
526
527         return;
528 }
529
530 int main(int argc, char* argv[])
531 {
532         service_app_lifecycle_callback_s event_callback = {0,};
533
534         event_callback.create = service_app_create;
535         event_callback.terminate = service_app_terminate;
536         event_callback.app_control = service_app_control;
537
538         return service_app_main(argc, argv, &event_callback, NULL);
539 }