Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

fo_arcview.c File Reference

The forum archive viewer program. More...

#include "config.h"
#include "defines.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <dlfcn.h>
#include <errno.h>
#include <sys/types.h>
#include <dirent.h>
#include <locale.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <gdome.h>
#include "readline.h"
#include "hashlib.h"
#include "utils.h"
#include "configparser.h"
#include "cfcgi.h"
#include "template.h"
#include "charconvert.h"
#include "clientlib.h"
#include "fo_arcview.h"

Go to the source code of this file.

Functions

size_t get_month_name (int month, u_char **name)
int is_numeric (register const u_char *ptr)
t_arrayread_dir_content (const u_char *dir)
u_char * get_next_token (register u_char *ptr, const u_char *base, size_t len, const u_char *token, size_t tlen)
u_int64_t get_id (u_char *ptr, const u_char *base, size_t len)
void generate_thread_output (t_arc_message *msg, t_string *threads, t_string *threadlist, t_cf_template *pt_tpl, t_cf_template *tl_tpl, t_cf_template *ud_tpl, t_name_value *cs, int admin, int show_invisible)
void print_thread_structure (t_arc_thread *thr, const u_char *year, const u_char *month, int admin, int show_invisible)
void set_nodevalue_to_str (GdomeNode *n, t_string *str)
void handle_header (t_arc_message *p, GdomeNode *n)
void make_thread_tree (t_arc_thread *thread, t_arc_message *msg, GdomeNode *posting, t_cf_tree *tree)
void create_thread_structure (GdomeDocument *doc, t_arc_thread *thr)
void show_thread (const u_char *year, const u_char *month, const u_char *tid)
void show_month_content (const u_char *year, const u_char *month)
void show_year_content (const u_char *year)
void show_year_list (void)
int main (int argc, char *argv[], char *env[])


Detailed Description

The forum archive viewer program.

Author:
Christian Kruse, <cjk@wwwtech.de>

Definition in file fo_arcview.c.


Function Documentation

void create_thread_structure GdomeDocument *  doc,
t_arc_thread thr
 

Function for creating a thread structure. Uses make_thread_tree()

Parameters:
doc The XML DOM document
thr A reference pointer to the thread

Definition at line 571 of file fo_arcview.c.

void generate_thread_output t_arc_message msg,
t_string threads,
t_string threadlist,
t_cf_template pt_tpl,
t_cf_template tl_tpl,
t_cf_template ud_tpl,
t_name_value cs,
int  admin,
int  show_invisible
 

Recursive function for generating a thread view

Parameters:
msg A pointer to the message
threads The string reference pointer for the threads contents
threadlist The string reference pointer for the thread list in the header of the file
pt_tpl The "per thread" template
tl_tpl The "threadlist" template
ud_tpl The "up down" template
cs The charset to use for output
admin Is the viewing user an administrator?
show_invisible Boolean for showing invisible postings of not (only affects if admin is true)

Definition at line 190 of file fo_arcview.c.

u_int64_t get_id u_char *  ptr,
const u_char *  base,
size_t  len
 

Helper function for reading the id of an element

Parameters:
ptr The position pointer
base The pointer to the beginning of the field
len The length of the field

Definition at line 171 of file fo_arcview.c.

size_t get_month_name int  month,
u_char **  name
 

function for getting the month name from a month number

Parameters:
month The number of the month
name A reference pointer to a u_char pointer
Returns:
Returns -1 on failure and the size of the created u_char pointer on success
Attention:
You have to free the created u_char pointer

Definition at line 65 of file fo_arcview.c.

u_char* get_next_token register u_char *  ptr,
const u_char *  base,
size_t  len,
const u_char *  token,
size_t  tlen
 

Helper function for the parsing of the XML files

Parameters:
ptr The position pointer
base The pointer to the beginning of the field
len The length of the field
token The token to search for
tlen The length of the token
Returns:
Returns NULL if the token could not be found and a pointer to the position of the token if found

Definition at line 153 of file fo_arcview.c.

void handle_header t_arc_message p,
GdomeNode *  n
 

Helper function for getting header informations

Parameters:
p Reference pointer to the message structure
n The node

Definition at line 395 of file fo_arcview.c.

int is_numeric register const u_char *  ptr  ) 
 

function checking if a given u_char array only consists of numbers

Parameters:
ptr The array pointer to check
Returns:
0 if there are characters beside 0-9, 1 if there are only 0-9

Definition at line 86 of file fo_arcview.c.

int main int  argc,
char *  argv[],
char *  env[]
 

The main function of the forum archive viewer. No command line switches used.

Parameters:
argc The argument count
argv The argument vector
env The environment vector
Returns:
EXIT_SUCCESS on success, EXIT_FAILURE on error

Definition at line 960 of file fo_arcview.c.

void make_thread_tree t_arc_thread thread,
t_arc_message msg,
GdomeNode *  posting,
t_cf_tree tree
 

Recursive function to create a hierarchical thread tree

Parameters:
thread Reference pointer to the thread
msg Reference pointer to the message
posting The posting node
tree A tree of MessageContent elements (for fast access)

Definition at line 458 of file fo_arcview.c.

void print_thread_structure t_arc_thread thr,
const u_char *  year,
const u_char *  month,
int  admin,
int  show_invisible
 

Function for printing a thread structure

Parameters:
thr The thread
year The year of the thread
month The month of the thread
admin Boolean If the user is an admin or not
show_invisible If true invisible messages will be printed (only affecting if user is an administrator)

Definition at line 282 of file fo_arcview.c.

t_array* read_dir_content const u_char *  dir  ) 
 

Function for reading directory content. All directory entries beginning with a dot are ignored.

Parameters:
dir The directory to read
Returns:
A (sorted) array of the directory contents

Definition at line 117 of file fo_arcview.c.

void set_nodevalue_to_str GdomeNode *  n,
t_string str
 

Helper function to set the contents of a node to a t_string string

Parameters:
n The node
str Reference pointer to a string object

Definition at line 355 of file fo_arcview.c.

void show_month_content const u_char *  year,
const u_char *  month
 

Function for showing the contents of a month

Parameters:
year The year
month The month

Definition at line 710 of file fo_arcview.c.

void show_thread const u_char *  year,
const u_char *  month,
const u_char *  tid
 

Function for showing a thread of the archive

Parameters:
year The year of the thread
month The month of the thread
tid The thread id

Definition at line 647 of file fo_arcview.c.

void show_year_content const u_char *  year  ) 
 

Functions for showing the contents of a year

Parameters:
year The year

Definition at line 839 of file fo_arcview.c.

void show_year_list void   ) 
 

Function for showing a list of years

Definition at line 906 of file fo_arcview.c.


Generated on Sun Apr 25 16:37:39 2004 for Classic Forum by doxygen 1.3.5