view mcabber/src/settings.h @ 1497:35020a2ed115

Do not use srand()/rand() if better alternatives exist (mirabilos) arc4random(3) is a self-seeding PRNG available on a lot of OSes (all BSDs, Darwin / Mac OSX, Interix / Microsoft® Services for Unix, Windows® 2003SR1, Windows® Vista, Debian with the new libbsd package installed, ???) and much better than srand(3)/rand(3). Thanks to GNU autoconf, this can be made portable. http://www.mirbsd.org/man/arc4random.3 //mirabilos
author Mikael Berthe <mikael@lilotux.net>
date Mon, 30 Jun 2008 23:13:50 +0200
parents d431cd75eb53
children a087125d8fc8
line wrap: on
line source

#ifndef __SETTINGS_H__
#define __SETTINGS_H__ 1

#include <ctype.h>
#include <glib.h>

#include "jabglue.h"

#ifndef isblank
# define isblank(c)  ((c) == 0x20 || (c) == 0x09)
#endif


#define SETTINGS_TYPE_OPTION    1
#define SETTINGS_TYPE_ALIAS     2
#define SETTINGS_TYPE_BINDING   3
#ifdef HAVE_LIBOTR
#define SETTINGS_TYPE_OTR       4
#endif

#define COMMAND_CHAR    '/'
#define COMMAND_CHARSTR "/"

#define settings_opt_get(k)     settings_get(SETTINGS_TYPE_OPTION, k)
#define settings_opt_get_int(k) settings_get_int(SETTINGS_TYPE_OPTION, k)

#define mkcmdstr(cmd) COMMAND_CHARSTR cmd

void    settings_init(void);
int     cfg_read_file(char *filename, guint mainfile);
guint   parse_assigment(gchar *assignment, gchar **pkey, gchar **pval);
void    settings_set(guint type, const gchar *key, const gchar *value);
void    settings_del(guint type, const gchar *key);
const gchar *settings_get(guint type, const gchar *key);
int     settings_get_int(guint type, const gchar *key);
const gchar *settings_get_status_msg(enum imstatus status);
void    settings_foreach(guint type,
                         void (*pfunc)(char *k, char *v, void *param),
                         void *param);

void    settings_pgp_setdisabled(const char *bjid, guint value);
guint   settings_pgp_getdisabled(const char *bjid);
void    settings_pgp_setforce(const char *bjid, guint value);
guint   settings_pgp_getforce(const char *bjid);
void    settings_pgp_setkeyid(const char *bjid, const char *keyid);
const char *settings_pgp_getkeyid(const char *bjid);

#ifdef HAVE_LIBOTR
guint   settings_otr_getpolicy(const char *bjid);
void    settings_otr_setpolicy(const char *bjid, guint value);
#endif

guint get_max_history_blocks(void);

char *default_muc_nickname(const char *roomid);

const gchar *isbound(int key);

#endif /* __SETTINGS_H__ */

/* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */