bug fix(StatusBar): Clock is not displayed at the time of the first start
[profile/ivi/ico-uxf-homescreen.git] / tool / notification / del_notification.cpp
1 #include <cstdio>
2 #include <cstdlib>
3 #include <cstring>
4 #include <iostream>
5 #include <string>
6 #include "notification.h"
7 using namespace std;
8
9 int
10 main(int argc, char **argv)
11 {
12     notification_error_e err = NOTIFICATION_ERROR_NONE;
13
14     if (argc == 2) {
15         if (0 == strcmp("--all", argv[1])) {
16             printf("delete all notifications\n");
17             err = notification_delete_all_by_type("", NOTIFICATION_TYPE_NOTI);
18             if (NOTIFICATION_ERROR_NONE != err) {
19                 printf("notification_delete_group_by_priv_id failed(%d).\n", err);
20                 return -1;
21             }
22             err = notification_delete_all_by_type("", NOTIFICATION_TYPE_ONGOING);
23             if (NOTIFICATION_ERROR_NONE != err) {
24                 printf("notification_delete_group_by_priv_id failed(%d).\n", err);
25                 return -1;
26             }
27             return 0;
28         }
29     }
30
31     if (argc < 3) {
32         printf("%s [--ongoing] pkgname priv_id\n", argv[0]);
33         return -1;
34     }
35     int n_geta = 1;
36     notification_type_e nType = NOTIFICATION_TYPE_NOTI;
37     string sargv1(argv[1]);
38     if (0 == sargv1.compare("--ongoing")) {
39         nType = NOTIFICATION_TYPE_ONGOING;
40         n_geta = 2;
41         if (argc < 4) {
42             printf("%s --ongoing pkgname priv_id\n", argv[0]);
43             return -1;
44         }
45     }
46
47     char *pkgname = argv[n_geta];
48     int  priv_id  = atoi(argv[n_geta+1]);
49     err = notification_delete_by_priv_id(pkgname, nType, priv_id);
50     if (err != NOTIFICATION_ERROR_NONE) {
51         printf("notification_delete_by_priv_id failed(%d).\n", err);
52         return -1;
53     }
54
55     return 0;
56 }