X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=lib%2Fperl%2FBlerg-Database%2FDatabase.xs;h=e3614dbb5953309317e5c6246531fcd25299adf7;hb=f0c9b096117c7f0822a888239c67e39cb6722bf5;hp=04406c8f5e41a27f689fc8adc2266c62b30f5f37;hpb=260aec1f9de8f1c904d50d359dfb8964d58d37f2;p=blerg.git diff --git a/lib/perl/Blerg-Database/Database.xs b/lib/perl/Blerg-Database/Database.xs index 04406c8..e3614db 100644 --- a/lib/perl/Blerg-Database/Database.xs +++ b/lib/perl/Blerg-Database/Database.xs @@ -10,6 +10,7 @@ #include "database/tags.h" #include "database/subscription.h" #include "database/util.h" +#include "common/auth.h" #include "const-c.inc" @@ -31,6 +32,12 @@ MODULE = Blerg::Database PACKAGE = Blerg::Database INCLUDE: const-xs.inc PROTOTYPES: ENABLE +int init() + CODE: + RETVAL = blerg_init(); + OUTPUT: + RETVAL + int exists(const char *name) CODE: RETVAL = blerg_exists(name); @@ -110,15 +117,15 @@ const char * _get_subscription_mark(struct blerg *ptr) n = snprintf(buf, 21, "%llu", mark); XPUSHs(sv_2mortal(newSVpv(buf, n))); -int _set_mute(struct blerg *ptr, int v) +int _set_status(struct blerg *ptr, int status, int v) CODE: - RETVAL = blerg_set_mute(ptr, v); + RETVAL = blerg_set_status(ptr, status, v); OUTPUT: RETVAL -int _get_mute(struct blerg *ptr) +int _get_status(struct blerg *ptr, int status) CODE: - RETVAL = blerg_get_mute(ptr); + RETVAL = blerg_get_status(ptr, status); OUTPUT: RETVAL @@ -130,9 +137,10 @@ void tag_list(const char *tag, const char *str_offset, int direction) int count, i; PPCODE: offset = strtoull(str_offset, NULL, 0); + count = 50; list = tag_list(tag, offset, &count, direction); if (list == NULL) { - XSRETURN_UNDEF; + XSRETURN_EMPTY; } i = count - 1; @@ -144,16 +152,8 @@ void tag_list(const char *tag, const char *str_offset, int direction) free(list); int subscription_add(const char *from, const char *to) - CODE: - RETVAL = subscription_add(from, to); - OUTPUT: - RETVAL int subscription_remove(const char *from, const char *to) - CODE: - RETVAL = subscription_remove(from, to); - OUTPUT: - RETVAL void _subscription_list(const char *author, const char *str_offset, int direction) INIT: @@ -163,9 +163,10 @@ void _subscription_list(const char *author, const char *str_offset, int directio int count, i; PPCODE: offset = strtoull(str_offset, NULL, 0); + count = 50; list = subscription_list(author, offset, &count, direction); if (list == NULL) { - XSRETURN_UNDEF; + XSRETURN_EMPTY; } i = count - 1; @@ -179,3 +180,23 @@ void _subscription_list(const char *author, const char *str_offset, int directio int valid_tag_name(const char *name) int valid_name(const char *name) + +int auth_set_password(const char *username, const char *password) + +int auth_check_password(const char *username, const char *password) + +char * auth_login(const char *username, const char *password) + INIT: + char *token; + PPCODE: + token = auth_login(username, password); + if (token != NULL) { + XPUSHs(sv_2mortal(newSVpv(token, TOKEN_SIZE * 2))); + } else { + XSRETURN_UNDEF; + } + free(token); + +int auth_logout(const char *username, const char *token) + +int auth_check_token(const char *username, const char *given_token)