e59c080b8ed0dafda2ee07c12b54fef932dd4e43
[profile/ivi/ico-uxf-homescreen.git] / tool / notification / del_notification.cpp
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <iostream>
5 #include "notification.h"
6 using namespace std;
7
8 int
9 main(int argc, char **argv)
10 {
11     notification_error_e err = NOTIFICATION_ERROR_NONE;
12
13     if (argc == 2) {
14         if (0 == strcmp("--all", argv[1])) {
15             printf("delete all notifications\n");
16             err = notification_delete_all_by_type("", NOTIFICATION_TYPE_NOTI);
17             if (NOTIFICATION_ERROR_NONE != err) {
18                 printf("notification_delete_group_by_priv_id failed(%d).\n", err);
19                 return -1;
20             }
21             return 0;
22         }
23     }
24
25     if (argc < 3) {
26         printf("%s pkgname priv_id\n", argv[0]);
27         return -1;
28     }
29
30     char *pkgname = argv[1];
31     int  priv_id  = atoi(argv[2]);
32     err = notification_delete_by_priv_id(pkgname, 
33                                          NOTIFICATION_TYPE_NONE,
34                                          priv_id);
35     if (err != NOTIFICATION_ERROR_NONE) {
36         printf("notification_delete_by_priv_id failed(%d).\n", err);
37         return -1;
38     }
39
40     return 0;
41 }