return NULL;
}
+static void _free_sticker_data(sticker_data_h sticker_data)
+{
+ if (!sticker_data)
+ return;
+
+ if (sticker_data->app_id) {
+ free(sticker_data->app_id);
+ sticker_data->app_id = NULL;
+ }
+
+ if (sticker_data->uri) {
+ free(sticker_data->uri);
+ sticker_data->uri = NULL;
+ }
+
+ if (sticker_data->thumbnail) {
+ free(sticker_data->thumbnail);
+ sticker_data->thumbnail = NULL;
+ }
+
+ if (sticker_data->keyword) {
+ g_list_free_full(sticker_data->keyword, free);
+ sticker_data->keyword = NULL;
+ }
+
+ if (sticker_data->group) {
+ free(sticker_data->group);
+ sticker_data->group = NULL;
+ }
+
+ if (sticker_data->description) {
+ free(sticker_data->description);
+ sticker_data->description = NULL;
+ }
+
+ if (sticker_data->date) {
+ free(sticker_data->date);
+ sticker_data->date = NULL;
+ }
+
+ free(sticker_data);
+ sticker_data = NULL;
+}
+
EXPORT_API int sticker_data_create(sticker_data_h *data_handle)
{
CHECK_STICKER_FEATURE();
return STICKER_ERROR_NONE;
}
+EXPORT_API int sticker_data_get_handle(const char* uri, sticker_data_h *data_handle)
+{
+ CHECK_STICKER_FEATURE();
+
+ int ret;
+ GDBusConnection *gdbus_connection = NULL;
+ int server_watcher_id = 0;
+ int monitor_id = 0;
+ int server_monitor_id = 0;
+ int is_exist = 0;
+
+ if (!uri || uri[0] == '\0' || !data_handle)
+ return STICKER_ERROR_INVALID_PARAMETER;
+
+ struct sticker_data_s *handle = (sticker_data_h)calloc(1, sizeof(struct sticker_data_s));
+ if (!handle)
+ return STICKER_ERROR_OUT_OF_MEMORY;
+
+ ret = sticker_dbus_init(&gdbus_connection, &server_watcher_id, &monitor_id, &server_monitor_id, STICKER_CLIENT_LIB_PROVIDER, NULL);
+ if (ret != STICKER_ERROR_NONE) {
+ LOGE("Failed to initialize dbus : %d", ret);
+ ret = STICKER_ERROR_OPERATION_FAILED;
+ goto cleanup;
+ }
+
+ ret = sticker_dbus_check_file_exists(gdbus_connection, uri, &is_exist);
+ if (ret != STICKER_ERROR_NONE) {
+ LOGE("Failed to check file exists : %d", ret);
+ ret = STICKER_ERROR_OPERATION_FAILED;
+ goto cleanup;
+ }
+
+ if (!is_exist) {
+ LOGE("Sticker does not exist. URI : %s", uri);
+ ret = STICKER_ERROR_NO_SUCH_FILE;
+ goto cleanup;
+ }
+
+ ret = sticker_dbus_get_sticker_info_by_uri(gdbus_connection, handle, uri);
+ if (ret != STICKER_ERROR_NONE) {
+ LOGE("Failed to get sticker information : %d", ret);
+ goto cleanup;
+ }
+
+ *data_handle = handle;
+
+ ret = sticker_dbus_shutdown(gdbus_connection, &server_watcher_id, &server_monitor_id, &monitor_id, STICKER_CLIENT_LIB_PROVIDER);
+ if (ret != STICKER_ERROR_NONE)
+ LOGE("Failed to finalize dbus : %d", ret);
+
+ g_object_unref(gdbus_connection);
+
+ return STICKER_ERROR_NONE;
+
+cleanup:
+ if (handle)
+ _free_sticker_data(handle);
+
+ if (gdbus_connection) {
+ ret = sticker_dbus_shutdown(gdbus_connection, &server_watcher_id, &server_monitor_id, &monitor_id, STICKER_CLIENT_LIB_PROVIDER);
+ if (ret != STICKER_ERROR_NONE)
+ LOGE("Failed to finalize dbus : %d", ret);
+
+ g_object_unref(gdbus_connection);
+ }
+
+ return ret;
+}
+
EXPORT_API int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id)
{
CHECK_STICKER_FEATURE();
while (g_variant_iter_loop (info_iter, "{iv}", &key, &value)) {
switch(key) {
+ case STICKER_DATA_TYPE_INFO_ID:
+ sticker_data->sticker_info_id = g_variant_get_int32(value);
+ break;
case STICKER_DATA_TYPE_APP_ID:
sticker_data->app_id = g_variant_dup_string(value, NULL);
break;
g_object_unref(reply);
return ret;
+}
+
+int sticker_dbus_get_sticker_info_by_uri(GDBusConnection *gdbus_connection, sticker_data_h sticker_data, const char *uri)
+{
+ int ret;
+ GDBusMessage *reply = NULL;
+ GVariant *reply_body = NULL;
+ GVariantIter *info_iter = NULL;
+ GVariantIter *keyword_iter = NULL;
+
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(s)", uri), &reply, "get_sticker_info_by_uri");
+ if (ret == STICKER_CLIENT_ERROR_NONE) {
+ reply_body = g_dbus_message_get_body(reply);
+ g_variant_get(reply_body, "(a{iv}a(s))", &info_iter, &keyword_iter);
+ _get_sticker_info_from_gvariant(info_iter, keyword_iter, sticker_data);
+
+ if (reply_body)
+ g_variant_unref(reply_body);
+
+ if (info_iter)
+ g_variant_iter_free(info_iter);
+
+ if (keyword_iter)
+ g_variant_iter_free(keyword_iter);
+ }
+
+ if (reply)
+ g_object_unref(reply);
+
+ return ret;
}
\ No newline at end of file
int sticker_dbus_check_file_exists(GDBusConnection *gdbus_connection, const char *uri, int *result);
int sticker_dbus_insert_recent_sticker_info(GDBusConnection *gdbus_connection, int record_id);
int sticker_dbus_get_recent_sticker_list(GDBusConnection *gdbus_connection, int count, GVariantIter **id_iter);
+int sticker_dbus_get_sticker_info_by_uri(GDBusConnection *gdbus_connection, sticker_data_h sticker_data, const char *uri);
#ifdef __cplusplus
}
int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_handle);
/**
+ * @brief Gets the sticker data handle for the given URI.
+ * @since_tizen 5.5
+ * @remarks If the function succeeds, @a data_handle must be released with sticker_data_destroy().
+ * @param[in] uri The URI of the sticker data handle
+ * @param[out] data_handle The sticker data handle for the given sticker URI
+ * @return 0 on success, otherwise a negative error value
+ * @retval #STICKER_ERROR_NONE Successful
+ * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
+ * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_NO_SUCH_FILE A sticker with given @a uri does not exist
+ * @see sticker_data_destroy()
+ */
+int sticker_data_get_handle(const char* uri, sticker_data_h *data_handle);
+
+/**
* @brief Gets the name of the sticker provider application from sticker data handle.
* @since_tizen 5.5
* @remarks @a app_id must be released using free().
Name: capi-ui-sticker
Summary: Sticker client library and daemon
-Version: 0.1.40
+Version: 0.1.44
Release: 1
Group: Graphics & UI Framework/Input
License: Apache-2.0
typedef enum {
REQUEST_TYPE_SYNC,
- REQUEST_TYPE_FEATURE_REQ
+ REQUEST_TYPE_FEATURE_REQ,
+ REQUEST_TYPE_SHOW_NOTIFICATION
} request_type;
struct StickerRequest {
return result;
}
+static bool process_request_queue()
+{
+ if (ReqQueue.empty())
+ return false;
+
+ StickerRequest request = ReqQueue.front();
+
+ if (request.req_type == REQUEST_TYPE_FEATURE_REQ) {
+ LOGD("[Request feature exchange]");
+ request_sticker_feature();
+ ReqQueue.pop();
+ }
+ else if (request.req_type == REQUEST_TYPE_SYNC) {
+ LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(),
+ request.category.c_str(),
+ request.type.c_str());
+
+ if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str()))
+ ReqQueue.pop();
+ }
+ else if (request.req_type == REQUEST_TYPE_SHOW_NOTIFICATION) {
+ LOGD("[Request to show notification]");
+ request_show_sync_notification();
+ ReqQueue.pop();
+ }
+
+ return true;
+}
+
void request_all_sticker_data(const char *mode, const char *type)
{
+ StickerRequest pending_request;
+ pending_request.req_type = REQUEST_TYPE_SYNC;
+ pending_request.mode = string(mode);
+ pending_request.type = string(type);
+
#ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
int feature_flag = 0;
if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
{
- if (feature_flag & VCONFKEY_STICKER_FEATURE_AREMOJI)
- request_sticker_data(mode, "arsticker", type);
+ if (feature_flag & VCONFKEY_STICKER_FEATURE_AREMOJI) {
+ pending_request.category = string("arsticker");
+ ReqQueue.push(pending_request);
+ }
- if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
- request_sticker_data(mode, "bitmoji", type);
+ if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI) {
+ pending_request.category = string("bitmoji");
+ ReqQueue.push(pending_request);
+ }
}
else
LOGW("Failed to get value of VCONFKEY_STICKER_SUPPORTED_FEATURE");
#else
- request_sticker_data(mode, "arsticker", type);
- request_sticker_data(mode, "bitmoji", type);
+ pending_request.category = string("arsticker");
+ ReqQueue.push(pending_request);
+ pending_request.category = string("bitmoji");
+ ReqQueue.push(pending_request);
#endif
+
+ if (priv_data.socket)
+ process_request_queue();
}
void request_sticker_feature()
void request_show_sync_notification()
{
JsonObject *j_object = NULL;
+
+ if (!priv_data.socket) {
+ job_progress = TRUE;
+ StickerRequest pending_request;
+ pending_request.req_type = REQUEST_TYPE_SHOW_NOTIFICATION;
+ ReqQueue.push(pending_request);
+ LOGI("Push show notification request");
+ return;
+ }
+
j_object = json_object_new();
if (j_object == NULL) {
LOGE("json object create error");
if (_send_json_data(j_object) == FALSE) {
LOGE("Failed to send STICKER_REQUEST_NOTI_REQ");
+ } else {
+ job_progress = TRUE;
}
json_object_unref(j_object);
service_app_exit();
}
-static bool process_request_queue()
-{
- if (ReqQueue.empty())
- return false;
-
- StickerRequest request = ReqQueue.front();
-
- if (request.req_type == REQUEST_TYPE_FEATURE_REQ) {
- LOGD("[Request feature exchange]");
- request_sticker_feature();
- ReqQueue.pop();
- }
- else if (request.req_type == REQUEST_TYPE_SYNC) {
- LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(),
- request.category.c_str(),
- request.type.c_str());
-
- if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str()))
- ReqQueue.pop();
- }
-
- return true;
-}
-
static void quit()
{
job_progress = FALSE;
if (result_code != SYNC_START_RSP_SUCCESS) {
if (!process_request_queue()) {
+#ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
+ int feature_flag = 0;
+
+ if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
+ {
+ LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
+ if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
+ {
+ if (current_request.category == string("bitmoji"))
+ {
+ /* other sticker group(s) has been synchronized completely */
+ if (sync_success_cnt > 0) {
+ set_sync_complete();
+ }
+ }
+ }
+ }
+ else {
+ LOGW("Failed to read support feature");
+ }
+#else
+ LOGW("No vconf supported feature");
+#endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */
+
set_sync_progressing(FALSE);
if (result_code == SYNC_START_RSP_NO_STICKER)
save_last_sync_time();
json_object_set_string_member(j_object, "msgId", STICKER_SEND_STOP_RSP);
json_object_set_int_member(j_object, "tID", t_id);
- if (reason == "complete" && rec_file_cnt_in_group != file_len) {
- json_object_set_string_member(j_object, "result", "failure");
- }
- else {
- int feature_flag = 0;
-
+ if (reason == "complete") {
+ if (rec_file_cnt_in_group == file_len) {
#ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
- if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
- {
- LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
- if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI)
+ int feature_flag = 0;
+
+ if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
{
- if (current_request.category == string("arsticker"))
+ LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
+ if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI)
{
- set_sync_complete();
- set_sync_progressing(FALSE);
+ if (current_request.category == string("arsticker"))
+ {
+ set_sync_complete();
+ set_sync_progressing(FALSE);
+ }
}
- }
- else if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
- {
- if (current_request.category == string("bitmoji"))
+ else if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
{
- set_sync_complete();
- set_sync_progressing(FALSE);
+ if (current_request.category == string("bitmoji"))
+ {
+ set_sync_complete();
+ set_sync_progressing(FALSE);
+ }
}
}
- }
- else {
- LOGW("Failed to read support feature");
- }
+ else {
+ LOGW("Failed to read support feature");
+ }
#else
- LOGW("No vconf supported feature");
+ LOGW("No vconf supported feature");
#endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */
- json_object_set_string_member(j_object, "result", "success");
- sync_success_cnt++;
+ json_object_set_string_member(j_object, "result", "success");
+ sync_success_cnt++;
+ }
+ else {
+ json_object_set_string_member(j_object, "result", "failure");
+ }
+ }
+ else {
+ json_object_set_string_member(j_object, "result", "failure");
}
if (_send_json_data(j_object) == FALSE)
LOGD("current time : %f, last_sync_time : %f", ecore_time_get(), last_sync_time);
if (ecore_time_get() - last_sync_time > MAX_WAIT_TIME) {
+ initialize_sap();
request_show_sync_notification();
result = false;
} else {
int ret;
bool found = false;
- LOGD("command: %s, data: %s", cmd, data);
-
bundle *b = bundle_create();
bundle_add_str(b, "command", cmd);
if (data)
}
else
{
- LOGD("Succeed to send message through event publish");
result = true;
}
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="5.5" package="org.tizen.sticker-receiver" version="1.0.40">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="5.5" package="org.tizen.sticker-receiver" version="1.0.44">
<profile name="wearable" />
<service-application appid="org.tizen.sticker-receiver" exec="sticker-receiver" type="capp" multiple="false" taskmanage="false" nodisplay="true" launch_mode="single">
<label>sticker-receiver</label>
ret = stickerd_get_recent_sticker_info(parameters, &reply_body);
} else if (g_strcmp0(method_name, "send_update_event") == 0) {
ret = stickerd_send_update_event(parameters, &reply_body);
+ } else if (g_strcmp0(method_name, "get_sticker_info_by_uri") == 0) {
+ ret = stickerd_get_sticker_info_by_uri(parameters, &reply_body);
}
if (ret == STICKERD_SERVER_ERROR_NONE) {
" <method name='send_update_event'>"
" <arg type='i' name='record_id' direction='in'/>"
" </method>"
+
+ " <method name='get_sticker_info_by_uri'>"
+ " <arg type='s' name='uri' direction='in'/>"
+ " <arg type='a{iv}' name='sticker_info' direction='out'/>"
+ " <arg type='a(s)' name='keyword_list' direction='out'/>"
+ " </method>"
" </interface>"
" </node>";
}
sticker_info->app_id = strdup(app_id);
+ if (!sticker_info->app_id)
+ goto free_memory;
+
sticker_info->type = _get_int_from_object(info_object, "type");
if (sticker_info->type < 1)
goto free_memory;
sticker_info->uri = _get_string_from_object(info_object, "uri");
- if (!sticker_info->uri || sticker_info->uri[0] != '\0')
+ if (!sticker_info->uri || sticker_info->uri[0] == '\0')
goto free_memory;
if (sticker_info->type == 1) {
}
return ret;
+}
+
+int stickerd_get_sticker_info_by_uri(GVariant *parameters, GVariant **reply_body)
+{
+ int ret;
+ char *uri = NULL;
+ GVariantBuilder *info_builder;
+ GVariantBuilder *keyword_builder;
+
+ g_variant_get(parameters, "(&s)", &uri);
+
+ sticker_info_db *sticker_info = (sticker_info_db *)calloc(1, sizeof(sticker_info_db));
+
+ if (!sticker_info)
+ return STICKERD_SERVER_ERROR_OUT_OF_MEMORY;
+
+ ret = stickerd_db_get_sticker_info_by_uri(uri, sticker_info);
+ if (ret != STICKERD_SERVER_ERROR_NONE) {
+ LOGE("Failed to get sticker info");
+ ret = STICKERD_SERVER_ERROR_OPERATION_FAILED;
+ goto cleanup;
+ }
+
+ info_builder = g_variant_builder_new(G_VARIANT_TYPE("a{iv}"));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_INFO_ID, g_variant_new_int32(sticker_info->record_id));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_APP_ID, g_variant_new_string((const gchar *)sticker_info->app_id));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_URI_TYPE, g_variant_new_int32(sticker_info->type));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_URI, g_variant_new_string((const gchar *)sticker_info->uri));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_THUMBNAIL, g_variant_new_string((const gchar *)sticker_info->thumbnail));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DESCRIPTION, g_variant_new_string((const gchar *)sticker_info->description));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_GROUP, g_variant_new_string((const gchar *)sticker_info->group));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DATE, g_variant_new_string((const gchar *)sticker_info->date));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DISP_TYPE, g_variant_new_int32(sticker_info->display_type));
+
+ keyword_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
+ g_list_foreach(sticker_info->keyword, (GFunc) _set_keyword_builder, keyword_builder);
+
+ *reply_body = g_variant_new("(a{iv}a(s))", info_builder, keyword_builder);
+ g_variant_builder_unref(info_builder);
+ g_variant_builder_unref(keyword_builder);
+
+ if (*reply_body == NULL) {
+ LOGE("Failed to create reply_body");
+ ret = STICKERD_SERVER_ERROR_OPERATION_FAILED;
+ }
+
+cleanup:
+ if (sticker_info) {
+ _free_sticker_data(sticker_info);
+ sticker_info = NULL;
+ }
+
+ return ret;
}
\ No newline at end of file
int stickerd_insert_recent_sticker_info(GVariant *parameters, GVariant **reply_body);
int stickerd_get_recent_sticker_info(GVariant *parameters, GVariant **reply_body);
int stickerd_send_update_event(GVariant *parameters, GVariant **reply_body);
+int stickerd_get_sticker_info_by_uri(GVariant *parameters, GVariant **reply_body);
#ifdef __cplusplus
}
#define STICKER_DB_GET_ALL_GROUP_LIST "SELECT DISTINCT group_name FROM sticker_info WHERE app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?))"
#define STICKER_DB_GET_ALL_KEYWORD_LIST "SELECT DISTINCT keyword FROM sticker_keyword_info WHERE sticker_info_id IN (SELECT sticker_info_id from sticker_info WHERE app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)))"
#define STICKER_DB_GET_STICKER_COUNT "SELECT count(*) FROM sticker_info WHERE app_id = ?"
-#define STICKER_DB_GET_ALL_RECORD_ID "SELECT sticker_info_id FROM sticker_info WHERE app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) LIMIT ?, ?"
-#define STICKER_DB_GET_RECORD_ID_BY_APP_ID "SELECT sticker_info_id from sticker_info WHERE app_id = ? LIMIT ?, ?"
-#define STICKER_DB_GET_RECORD_ID_BY_TYPE "SELECT sticker_info_id FROM sticker_info WHERE type = ? AND app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) LIMIT ?, ?"
-#define STICKER_DB_GET_RECORD_ID_BY_GROUP "SELECT sticker_info_id from sticker_info WHERE group_name = ? AND app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) LIMIT ?, ?"
-#define STICKER_DB_GET_RECORD_ID_BY_KEYWORD "SELECT sticker_info_id FROM sticker_keyword_info WHERE keyword = ? INTERSECT SELECT sticker_info_id from sticker_info WHERE app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) LIMIT ?, ?"
-#define STICKER_DB_GET_RECORD_ID_BY_DISP_TYPE "SELECT sticker_info_id FROM sticker_info WHERE display_type = ? AND app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) LIMIT ?, ?"
+#define STICKER_DB_GET_ALL_RECORD_ID "SELECT sticker_info_id FROM sticker_info WHERE app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) ORDER BY sticker_info_id DESC LIMIT ?, ?"
+#define STICKER_DB_GET_RECORD_ID_BY_APP_ID "SELECT sticker_info_id from sticker_info WHERE app_id = ? ORDER BY sticker_info_id DESC LIMIT ?, ?"
+#define STICKER_DB_GET_RECORD_ID_BY_TYPE "SELECT sticker_info_id FROM sticker_info WHERE type = ? AND app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) ORDER BY sticker_info_id DESC LIMIT ?, ?"
+#define STICKER_DB_GET_RECORD_ID_BY_GROUP "SELECT sticker_info_id from sticker_info WHERE group_name = ? AND app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) ORDER BY sticker_info_id DESC LIMIT ?, ?"
+#define STICKER_DB_GET_RECORD_ID_BY_KEYWORD "SELECT sticker_info_id FROM sticker_keyword_info WHERE keyword = ? INTERSECT SELECT sticker_info_id from sticker_info WHERE app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) ORDER BY sticker_info_id DESC LIMIT ?, ?"
+#define STICKER_DB_GET_RECORD_ID_BY_DISP_TYPE "SELECT sticker_info_id FROM sticker_info WHERE display_type = ? AND app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?)) ORDER BY sticker_info_id DESC LIMIT ?, ?"
#define STICKER_DB_GET_GROUP_LIST_BY_DISP_TYPE "SELECT DISTINCT group_name FROM sticker_info WHERE display_type = ? AND app_id NOT IN (SELECT DISTINCT provider_id FROM sticker_whitelist_info WHERE provider_id NOT IN (SELECT provider_id FROM sticker_whitelist_info WHERE consumer_id = ?))"
#define STICKER_DB_CHECK_FILE_EXISTS "SELECT EXISTS(SELECT 1 FROM sticker_info WHERE uri = ? LIMIT 1)"
#define STICKER_DB_CHECK_RECENT_HISTORY_EXISTS "SELECT EXISTS(SELECT 1 FROM sticker_recent_history_info WHERE sticker_info_id = ? LIMIT 1)"
int stickerd_db_get_sticker_info_by_uri(char *uri, sticker_info_db *sticker_info)
{
int ret;
- int record_id;
sqlite3 *db = NULL;
sqlite3_stmt *stmt = NULL;
goto cleanup;
}
- record_id = sticker_info->display_type = sqlite3_column_int(stmt, 0);
+ sticker_info->record_id = sqlite3_column_int(stmt, 0);
const unsigned char *tmp_app_id = sqlite3_column_text(stmt, 1);
if (tmp_app_id)
goto cleanup;
}
- sqlite3_bind_int(stmt, 1, record_id);
+ sqlite3_bind_int(stmt, 1, sticker_info->record_id);
while (sqlite3_step(stmt) == SQLITE_ROW) {
const unsigned char *keyword = sqlite3_column_text(stmt, 0);
} sticker_info_db_type;
typedef struct {
+ int record_id;
char *app_id;
int type;
char *uri;