Perlify config
FossilOrigin-Name: e39a49305b7b3a890a937a41550e7d927764bf768e2a8d1b916df553f23c31cf
This commit is contained in:
parent
10875ff940
commit
004b47ad07
4 changed files with 56 additions and 3 deletions
|
@ -1,9 +1,10 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub square
|
||||
sub base_page
|
||||
{
|
||||
|
||||
2 * 2;
|
||||
}
|
||||
|
||||
print "Hello treebird" . square;
|
||||
print "Hello from Perl\n";
|
||||
|
|
|
@ -225,7 +225,6 @@ int main(int argc, char **argv, char **env)
|
|||
|
||||
// Hell, let's not sit around here either
|
||||
cgi_start(&api);
|
||||
|
||||
|
||||
free_instance_info_cache();
|
||||
mastodont_cleanup(&api);
|
||||
|
|
|
@ -29,3 +29,54 @@ const char* const get_token(struct session* ssn)
|
|||
{
|
||||
return keystr(ssn->cookies.access_token);
|
||||
}
|
||||
|
||||
static HV* perlify_post_values(struct post_values* post)
|
||||
{
|
||||
}
|
||||
|
||||
static HV* perlify_get_values(struct get_values* get)
|
||||
{
|
||||
}
|
||||
|
||||
static HV* perlify_config(struct local_config* config)
|
||||
{
|
||||
HV* ssn_config_hv = newHV();
|
||||
|
||||
hv_stores(ssn_config_hv, "logged_in", newSVpv(config->logged_in, 0));
|
||||
hv_stores(ssn_config_hv, "theme", newSVpv(config->theme, 0));
|
||||
hv_stores(ssn_config_hv, "background_url", newSVpv(config->background_url, 0));
|
||||
hv_stores(ssn_config_hv, "lang", newSViv(config->lang));
|
||||
hv_stores(ssn_config_hv, "themeclr", newSViv(config->themeclr));
|
||||
hv_stores(ssn_config_hv, "jsactions", newSViv(config->jsactions));
|
||||
hv_stores(ssn_config_hv, "jslive", newSViv(config->jslive));
|
||||
hv_stores(ssn_config_hv, "js", newSViv(config->js));
|
||||
hv_stores(ssn_config_hv, "interact_img", newSViv(config->interact_img));
|
||||
hv_stores(ssn_config_hv, "stat_attachments", newSViv(config->stat_attachments));
|
||||
hv_stores(ssn_config_hv, "stat_greentexts", newSViv(config->stat_greentexts));
|
||||
hv_stores(ssn_config_hv, "stat_dope", newSViv(config->stat_dope));
|
||||
hv_stores(ssn_config_hv, "stat_oneclicksoftware", newSViv(config->stat_oneclicksoftware));
|
||||
hv_stores(ssn_config_hv, "stat_emojo_likes", newSViv(config->stat_emojo_likes));
|
||||
hv_stores(ssn_config_hv, "stat_hide_muted", newSViv(config->stat_hide_muted));
|
||||
hv_stores(ssn_config_hv, "instance_show_shoutbox", newSViv(config->instance_show_shoutbox));
|
||||
hv_stores(ssn_config_hv, "instance_panel", newSViv(config->instance_panel));
|
||||
hv_stores(ssn_config_hv, "notif_embed", newSViv(config->notif_embed));
|
||||
hv_stores(ssn_config_hv, "sidebar_opacity", newSViv(config->sidebar_opacity));
|
||||
|
||||
return ssn_config_hv;
|
||||
}
|
||||
|
||||
HV* perlify_session(struct session* ssn)
|
||||
{
|
||||
HV* ssn_hv = newHV();
|
||||
hv_stores(ssn_hv, "logged_in", newSVuv(ssn->logged_in));
|
||||
// HV* ssn_post_values = perlify_post_values(&(ssn->post));
|
||||
// HV* ssn_get_values = perlify_get_values(&(ssn->query));
|
||||
// HV* ssn_get_values = perlify_cookie_values(&(ssn->query))
|
||||
// Config
|
||||
HV* ssn_config = perlify_config(&(ssn->config));
|
||||
hv_stores(ssn_hv, "config", newRV_inc((SV*)ssn_config));
|
||||
|
||||
|
||||
return ssn_hv;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef SESSION_H
|
||||
#define SESSION_H
|
||||
#include <mastodont.h>
|
||||
#include "global_perl.h"
|
||||
#include "query.h"
|
||||
#include "local_config.h"
|
||||
#include "cookie.h"
|
||||
|
@ -36,5 +37,6 @@ struct session
|
|||
|
||||
const char* const get_instance(struct session* ssn);
|
||||
const char* const get_token(struct session* ssn);
|
||||
HV* perlify_session(struct session* ssn);
|
||||
|
||||
#endif // SESSION_H
|
||||
|
|
Loading…
Reference in a new issue