* @endcode
*/
int notification_send_event(notification_h noti, int event_type);
+int notification_send_event_by_priv_id(int priv_id, int event_type);
/**
* @brief Gets the event flag.
*/
int notification_get_text_input_max_length(notification_h noti, int *text_input_max_length);
+int notification_set_extention_data(notification_h noti, const char *key, bundle *value);
+int notification_get_extention_data(notification_h noti, const char *key, bundle **value);
+
/**
* @}
*/
int notification_ipc_make_dnd_allow_exception_from_gvariant(
struct notification_system_setting_dnd_allow_exception *dnd_allow_exception,
GVariant *variant);
-int notification_ipc_send_event(notification_h noti, int event_type);
+int notification_ipc_send_event(notification_h noti, int event_type, int priv_id);
int notification_ipc_check_event_receiver(int priv_id, bool *available);
void notification_ipc_reset_event_handler(int priv_id);
#ifdef __cplusplus
int notification_noti_delete_all(notification_type_e type, const char *pkgname, int *num_deleted, int **list_deleted_rowid, uid_t uid);
-int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int priv_id, uid_t uid);
+int notification_noti_get_by_priv_id(notification_h noti, int priv_id);
int notification_noti_get_by_tag(notification_h noti, char *pkgname, char* tag, uid_t uid);
int notification_noti_delete_by_priv_id(const char *pkgname, int priv_id);
#include <tizen.h>
#include <vconf-keys.h>
#include <vconf.h>
+#include <bundle.h>
+#include <bundle_internal.h>
#include <notification.h>
#include <notification_list.h>
if (ret != NOTIFICATION_ERROR_NONE || event_flag == false)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- ret = notification_ipc_send_event(noti, event_type);
+ ret = notification_ipc_send_event(noti, event_type, -1);
return ret;
}
+EXPORT_API int notification_send_event_by_priv_id(int priv_id, int event_type)
+{
+ int ret;
+
+ if (priv_id <= 0)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (!((event_type >= NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1
+ && event_type < NOTIFICATION_EVENT_TYPE_MAX) ||
+ (event_type >= NOTIFICATION_EVENT_TYPE_HIDDEN_BY_USER
+ && event_type <= NOTIFICATION_EVENT_TYPE_HIDDEN_BY_TIMEOUT) ||
+ (event_type >= NOTIFICATION_EVENT_TYPE_PRESSED
+ && event_type <= NOTIFICATION_EVENT_TYPE_DELETED)))
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ ret = notification_ipc_send_event(NULL, event_type, priv_id);
+ return ret;
+}
+
EXPORT_API int notification_get_event_flag(notification_h noti, bool *flag)
{
if (noti == NULL || flag == NULL)
return ret;
}
+
+static bundle *_create_bundle_from_bundle_raw(bundle_raw *string)
+{
+ if (string == NULL || string[0] == '\0')
+ return NULL;
+
+ return bundle_decode(string, strlen((char *)string));
+}
+
+EXPORT_API int notification_set_extention_data(notification_h noti, const char *key, bundle *value)
+{
+ int ret;
+ int len = 0;
+ char *del = NULL;
+ bundle_raw *raw = NULL;
+
+ if (noti == NULL || key == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (noti->args == NULL)
+ noti->args = bundle_create();
+
+ if (value == NULL) {
+ ret = bundle_del(noti->args, key);
+ if (ret == BUNDLE_ERROR_NONE)
+ return NOTIFICATION_ERROR_NONE;
+ else
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ }
+
+ bundle_get_str(noti->args, key, &del);
+ if (del != NULL) {
+ bundle_del(noti->args, key);
+ del = NULL;
+ }
+
+ bundle_encode(value, &raw, &len);
+ bundle_add_str(noti->args, key, (const char *)raw);
+ bundle_free_encoded_rawdata(&raw);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_get_extention_data(notification_h noti, const char *key, bundle **value)
+{
+ char *ret_str;
+ bundle *args;
+
+ if (noti == NULL || key == NULL || value == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (noti->args == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ args = noti->args;
+
+ bundle_get_str(args, key, &ret_str);
+ if (ret_str == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ *value = _create_bundle_from_bundle_raw((bundle_raw *)ret_str);
+ if (*value == NULL)
+ return NOTIFICATION_ERROR_IO_ERROR;
+
+ return NOTIFICATION_ERROR_NONE;
+}
return ret;
}
-int notification_ipc_send_event(notification_h noti, int event_type)
+int notification_ipc_send_event(notification_h noti, int event_type, int priv_id)
{
int ret;
GVariant *body = NULL;
return ret;
}
- body = notification_ipc_make_gvariant_from_noti(noti, false);
- if (body == NULL) {
- NOTIFICATION_ERR("Can't make gvariant to noti");
- return NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
+ if (priv_id > 0) {
+ ret = _send_sync_noti(g_variant_new("(ii)", priv_id, event_type), &reply, "send_noti_event_by_priv_id");
+ } else {
+ body = notification_ipc_make_gvariant_from_noti(noti, false);
+ if (body == NULL) {
+ NOTIFICATION_ERR("Can't make gvariant to noti");
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ }
- ret = _send_sync_noti(g_variant_new("(vi)", body, event_type), &reply, "send_noti_event");
+ ret = _send_sync_noti(g_variant_new("(vi)", body, event_type), &reply, "send_noti_event");
+ }
if (reply)
g_object_unref(reply);
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_DISPLAY_APPLIST, g_variant_new_int32(noti->display_applist));
if (noti->args) {
- bundle_encode(noti->args, (bundle_raw **)&args, NULL);
+ bundle_encode(noti->args, (bundle_raw **)&args, &b_encode_len);
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_ARGS, g_variant_new_string((const gchar *)args));
if (args)
}
/* LCOV_EXCL_START */
-EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int priv_id, uid_t uid)
+EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, int priv_id)
{
int ret = 0;
char *query = NULL;
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, "
"ongoing_current, ongoing_duration, auto_remove, default_button_index, hide_timeout, delete_timeout, "
"text_input_max_length, event_flag, extension_image_size, uid "
- "from noti_list ";
+ "from noti_list";
- if (pkgname != NULL && strlen(pkgname) != 0)
- query = sqlite3_mprintf("%s where caller_pkgname = '%s' and priv_id = %d and uid = %d",
- base_query, pkgname, priv_id, uid);
- else
- query = sqlite3_mprintf("%s where priv_id = %d and uid = %d", base_query, priv_id, uid);
+ query = sqlite3_mprintf("%s where priv_id = %d", base_query, priv_id);
if (query == NULL) {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;