diff --git a/include/ctx.h b/include/ctx.h index d02b17f..2a926fa 100644 --- a/include/ctx.h +++ b/include/ctx.h @@ -101,8 +101,10 @@ lm_pool_t *lm_ctx_pool_by_url(lm_ctx_t *ctx, char *host, char *path); // find p /* ######################## ## database fucntions ## ######################## */ -bool lm_ctx_database_init(lm_ctx_t *ctx); // init ctx database (if not already present) -bool lm_ctx_database_is_installed(lm_ctx_t *ctx, lm_pkg_t *pkg, bool check_version); // check if a package is installed -bool lm_ctx_database_find(lm_ctx_t *ctx, lm_pkg_t *pkg, char *name, char *version); // find a package by name -bool lm_ctx_database_next(lm_ctx_t *ctx, lm_pkg_t *pkg); // load the next package into pkg pointer -bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_pkg_t *pkg); // free the used next pointers +bool lm_ctx_database_init(lm_ctx_t *ctx); // init ctx database (if not already present) +bool lm_ctx_database_is_installed(lm_ctx_t *ctx, lm_pkg_t *pkg, bool check_version); // check if a package is installed +bool lm_ctx_database_find(lm_ctx_t *ctx, lm_pkg_t *pkg, char *name, char *version); // find a package by name +bool lm_ctx_database_next(lm_ctx_t *ctx, lm_pkg_t *pkg); // load the next package into pkg pointer +bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_pkg_t *pkg); // free the used next pointers +char *lm_ctx_database_changes( + lm_ctx_t *ctx, lm_pkg_t *pkg); // get changes file path for a package, FREE THE RETURNED POINTER diff --git a/locale/tr/LC_MESSAGES/libmp.po b/locale/tr/LC_MESSAGES/libmp.po index 4635394..a6af3d6 100644 --- a/locale/tr/LC_MESSAGES/libmp.po +++ b/locale/tr/LC_MESSAGES/libmp.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-18 19:15+0300\n" +"POT-Creation-Date: 2024-07-18 23:48+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/ctx/database.c b/src/ctx/database.c index 526f255..a2f63a8 100644 --- a/src/ctx/database.c +++ b/src/ctx/database.c @@ -39,7 +39,7 @@ bool lm_ctx_database_find(lm_ctx_t *ctx, lm_pkg_t *pkg, char *name, char *versio if(!lm_ctx_database_init(ctx)) return false; // error set by function - + lm_error_clear(); return lm_database_package_find(ctx->db, pkg, name, version); } @@ -49,10 +49,10 @@ bool lm_ctx_database_next(lm_ctx_t *ctx, lm_pkg_t *pkg){ lm_error_set(LM_ERR_ArgNULL); return false; } - + if(!lm_ctx_database_init(ctx)) return false; // error set by function - + return lm_database_package_next(ctx->db, pkg); } @@ -61,10 +61,22 @@ bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_pkg_t *pkg){ lm_error_set(LM_ERR_ArgNULL); return false; } - + if(!lm_ctx_database_init(ctx)) return false; // error set by function - + lm_database_package_next_free(ctx->db, pkg); return true; } + +char *lm_ctx_database_changes(lm_ctx_t *ctx, lm_pkg_t *pkg){ + if(NULL == ctx || NULL == pkg){ + lm_error_set(LM_ERR_ArgNULL); + return false; + } + + if(!lm_ctx_database_init(ctx)) + return false; // error set by function + + return lm_database_changes_get(ctx->db, pkg); +} diff --git a/src/database/changes.c b/src/database/changes.c index e5edae5..65138ce 100644 --- a/src/database/changes.c +++ b/src/database/changes.c @@ -39,7 +39,7 @@ bool lm_database_changes_del(lm_database_t *db, lm_pkg_t *pkg){ lm_error_set(LM_ERR_DbChangesUnlinkFail); return false; } - + return true; }