ekg2
Struktury danych | Definicje | Definicje typów | Wyliczenia | Funkcje | Zmienne

Dokumentacja pliku ekg/stuff.h

#include <sys/types.h>
#include <sys/time.h>
#include "win32.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdbool.h>
#include <time.h>
#include "dynstuff.h"
#include "plugins.h"
#include "sessions.h"
#include "userlist.h"

Idź do kodu źródłowego tego pliku.

Struktury danych

struct  child_s
struct  alias
struct  timer
struct  conference
struct  newconference
struct  buffer
struct  buffer_info
struct  color_map

Definicje

#define DEBUG_MAX_LINES   50
#define TIMER(x)   int x(int type, void *data)
#define TIMER_SESSION(x)   int x(int type, session_t *s)
#define xisxdigit(c)   isxdigit((int) (unsigned char) c)
#define xisdigit(c)   isdigit((int) (unsigned char) c)
#define xisalpha(c)   isalpha_pl((int) (unsigned char) c)
#define xisalnum(c)   isalnum((int) (unsigned char) c)
#define xisspace(c)   isspace((int) (unsigned char) c)
#define xtolower(c)   tolower((int) (unsigned char) c)
#define xtoupper(c)   toupper((int) (unsigned char) c)
#define ekg_update_status_n(a)   ekg_update_status(session_find(a))

Definicje typów

typedef void(* child_handler_t )(struct child_s *c, pid_t pid, const char *name, int status, void *data)
typedef struct child_s child_t
typedef struct alias alias_t
typedef struct newconference newconference_t

Wyliczenia

enum  mesg_t { MESG_CHECK = -1, MESG_OFF, MESG_ON, MESG_DEFAULT }

Funkcje

child_tchild_add (plugin_t *plugin, pid_t pid, const char *name, child_handler_t handler, void *priv_data)
child_tchildren_removei (child_t *c)
void children_destroy (void)
void windows_save ()
int alias_add (const char *string, int quiet, int append)
int alias_remove (const char *name, int quiet)
void aliases_destroy ()
char * base64_encode (const char *buf, size_t len)
char * base64_decode (const char *buf)
int buffer_add (struct buffer_info *type, const char *target, const char *line)
int buffer_add_str (struct buffer_info *type, const char *target, const char *str)
char * buffer_tail (struct buffer_info *type)
void buffer_free (struct buffer_info *type)
void changed_auto_save (const char *var)
void changed_display_blinking (const char *var)
void changed_make_window (const char *var)
void changed_mesg (const char *var)
void changed_theme (const char *var)
const char * compile_time ()
struct conferenceconference_add (session_t *session, const char *string, const char *nicklist, int quiet)
int conference_remove (const char *name, int quiet)
struct conferenceconference_create (session_t *session, const char *nicks)
struct conferenceconference_find (const char *name)
struct conferenceconference_find_by_uids (session_t *s, const char *from, const char **recipients, int count, int quiet)
int conference_set_ignore (const char *name, int flag, int quiet)
int conference_rename (const char *oldname, const char *newname, int quiet)
int conference_participant (struct conference *c, const char *uid)
void conferences_destroy ()
userlist_tnewconference_member_add (newconference_t *conf, const char *uid, const char *nick)
userlist_tnewconference_member_find (newconference_t *conf, const char *uid)
int newconference_member_remove (newconference_t *conf, userlist_t *u)
newconference_tnewconference_create (session_t *s, const char *name, int create_wnd)
newconference_tnewconference_find (session_t *s, const char *name)
void newconference_destroy (newconference_t *conf, int kill_wnd)
void newconferences_destroy ()
int ekg_hash (const char *name)
FILE * help_path (char *name, char *plugin)
int mesg_set (int what)
char * strip_spaces (char *line)
int strncasecmp_pl (const char *cs, const char *ct, size_t count)
int mkdir_recursive (const char *pathname, int isdir)
char * saprintf (const char *format,...)
int play_sound (const char *sound_path)
const char * prepare_path (const char *filename, int do_mkdir)
const char * prepare_pathf (const char *filename,...)
const char * prepare_path_user (const char *path)
char * read_file (FILE *f, int alloc)
char * read_file_iso (FILE *f, int alloc)
const char * timestamp (const char *format)
const char * timestamp_time (const char *format, time_t t)
char * xstrmid (const char *str, int start, int length)
void xstrtr (char *text, char from, char to)
char * xstrncat_pl (char *dest, const char *src, size_t n)
size_t strlen_pl (const char *s)
char color_map (unsigned char r, unsigned char g, unsigned char b)
char * strcasestr (const char *haystack, const char *needle)
int msg_all (session_t *s, const char *function, const char *what)
int say_it (const char *str)
char * split_line (char **ptr)
int isalpha_pl (unsigned char c)
struct timertimer_add (plugin_t *plugin, const char *name, unsigned int period, int persistent, int(*function)(int, void *), void *data)
struct timertimer_add_ms (plugin_t *plugin, const char *name, unsigned int period, int persist, int(*function)(int, void *), void *data)
struct timertimer_add_session (session_t *session, const char *name, unsigned int period, int persist, int(*function)(int, session_t *))
struct timertimer_find_session (session_t *session, const char *name)
int timer_remove (plugin_t *plugin, const char *name)
int timer_remove_session (session_t *session, const char *name)
int timer_remove_user ()
void timers_remove (struct timer *t)
struct timertimers_removei (struct timer *t)
void timers_destroy ()
int timer_handle_command (int type, void *data)
const char * ekg_status_label (const int status, const char *descr, const char *prefix)
void ekg_update_status (session_t *session)
const char * ekg_status_string (const int status, const int cmd)
int ekg_status_int (const char *text)
char * ekg_draw_descr (const int status)
uint32_t * ekg_sent_message_format (const char *text)
void ekg_yield_cpu ()
void * ekg_convert_string_init (const char *from, const char *to, void **rev)
void ekg_convert_string_destroy (void *ptr)
char * ekg_convert_string_p (const char *ps, void *ptr)
char * ekg_convert_string (const char *ps, const char *from, const char *to)
string_t ekg_convert_string_t_p (string_t s, void *ptr)
string_t ekg_convert_string_t (string_t s, const char *from, const char *to)
int ekg_converters_display (int quiet)
char * password_input (const char *prompt, const char *rprompt, const bool norepeat)
int is_utf8_string (const char *txt)
void ekg_exit ()
void ekg_debug_handler (int level, const char *format, va_list ap)
int ekg_close (int fd)
int ekg_write (int fd, const char *buf, int len)
int ekg_writef (int fd, const char *format,...)

Zmienne

child_tchildren
alias_taliases
list_t autofinds
struct timertimers
struct conferenceconferences
newconference_tnewconferences
struct buffer_info buffer_debug
struct buffer_info buffer_speech
time_t last_save
char * config_profile
int config_changed
int ekg2_reason_changed
pid_t speech_pid
int no_mouse
int old_stderr
int mesg_startup
char * config_away_reason
int config_auto_save
int config_auto_user_add
char * config_back_reason
int config_beep
int config_beep_msg
int config_beep_chat
int config_beep_notify
int config_completion_notify
char * config_completion_char
int config_debug
int config_default_status_window
int config_display_ack
int config_display_blinking
int config_display_color
char * config_display_color_map
int config_display_crap
int config_display_day_changed
int config_display_notify
int config_display_sent
int config_display_welcome
int config_emoticons
int config_events_delay
int config_expert_mode
int config_history_savedups
int config_keep_reason
int config_last
int config_last_size
int config_lastlog_case
int config_lastlog_noitems
int config_lastlog_display_all
int config_make_window
int config_mesg
int config_query_commands
int config_slash_messages
char * config_quit_reason
int config_save_password
int config_save_quit
char * config_session_default
int config_sessions_save
int config_send_white_lines
int config_sort_windows
char * config_sound_app
char * config_sound_chat_file
char * config_sound_msg_file
char * config_sound_sysmsg_file
char * config_sound_notify_file
char * config_sound_mail_file
char * config_speech_app
char * config_subject_prefix
char * config_subject_reply_prefix
char * config_tab_command
char * config_theme
int config_time_deviation
char * config_timestamp
int config_timestamp_show
int config_use_unicode
int config_use_iso
char * config_console_charset
int config_window_session_allow
char * config_windows_layout
int config_windows_save
char * config_dcc_dir
int config_version
char * config_exit_exec
int config_session_locks
char * config_nickname
char * home_dir
char * config_dir
char * console_charset
int in_autoexec
int ekg_watches_removed
time_t ekg_started
int quit_message_send
int batch_mode
char * batch_line
struct color_map color_map_default [16+10]

Dokumentacja definicji

#define DEBUG_MAX_LINES   50
#define ekg_update_status_n (   a)    ekg_update_status(session_find(a))
#define TIMER (   x)    int x(int type, void *data)
#define TIMER_SESSION (   x)    int x(int type, session_t *s)
#define xisalnum (   c)    isalnum((int) (unsigned char) c)
#define xisalpha (   c)    isalpha_pl((int) (unsigned char) c)
#define xisdigit (   c)    isdigit((int) (unsigned char) c)
#define xisspace (   c)    isspace((int) (unsigned char) c)
#define xisxdigit (   c)    isxdigit((int) (unsigned char) c)
#define xtolower (   c)    tolower((int) (unsigned char) c)
#define xtoupper (   c)    toupper((int) (unsigned char) c)

Dokumentacja definicji typów

typedef struct alias alias_t
typedef void(* child_handler_t)(struct child_s *c, pid_t pid, const char *name, int status, void *data)
typedef struct child_s child_t

Dokumentacja typów wyliczanych

enum mesg_t
Wartości wyliczeń:
MESG_CHECK 
MESG_OFF 
MESG_ON 
MESG_DEFAULT 

Dokumentacja funkcji

int alias_add ( const char *  string,
int  quiet,
int  append 
)
int alias_remove ( const char *  name,
int  quiet 
)
void aliases_destroy ( )
char* base64_decode ( const char *  buf)
char* base64_encode ( const char *  buf,
size_t  len 
)
int buffer_add ( struct buffer_info type,
const char *  target,
const char *  line 
)
int buffer_add_str ( struct buffer_info type,
const char *  target,
const char *  str 
)
void buffer_free ( struct buffer_info type)
char* buffer_tail ( struct buffer_info type)
void changed_auto_save ( const char *  var)
void changed_display_blinking ( const char *  var)
void changed_make_window ( const char *  var)
void changed_mesg ( const char *  var)
void changed_theme ( const char *  var)
child_t* child_add ( plugin_t plugin,
pid_t  pid,
const char *  name,
child_handler_t  handler,
void *  priv_data 
)
void children_destroy ( void  )
child_t* children_removei ( child_t c)
char color_map ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)
const char* compile_time ( )
struct conference* conference_add ( session_t session,
const char *  string,
const char *  nicklist,
int  quiet 
) [read]
struct conference* conference_create ( session_t session,
const char *  nicks 
) [read]
struct conference* conference_find ( const char *  name) [read]
struct conference* conference_find_by_uids ( session_t s,
const char *  from,
const char **  recipients,
int  count,
int  quiet 
) [read]
int conference_participant ( struct conference c,
const char *  uid 
)
int conference_remove ( const char *  name,
int  quiet 
)
int conference_rename ( const char *  oldname,
const char *  newname,
int  quiet 
)
int conference_set_ignore ( const char *  name,
int  flag,
int  quiet 
)
void conferences_destroy ( )
int ekg_close ( int  fd)

ekg_close()

close fd and all watches associated with that fd

Nota:
This _should_ be used as replacement for close() (especially in protocol plugins)
char* ekg_convert_string ( const char *  ps,
const char *  from,
const char *  to 
)

ekg_convert_string()

Converts string to specified encoding, replacing invalid chars with question marks.

Nota:
Deprecated, in favour of ekg_convert_string_p(). Should be used only on single conversions, where charset pair won't be used again.
Parametry:
ps- string to be converted (it won't be freed).
from- input encoding (if NULL, console_charset will be assumed).
to- output encoding (if NULL, console_charset will be assumed).
Zwraca:
Pointer to allocated result on success, NULL on failure or when both encodings are equal.
Zobacz również:
ekg_convert_string_p() - more optimized version.
void ekg_convert_string_destroy ( void *  ptr)

ekg_convert_string_destroy()

Frees internal data associated with given pointer, and uninitalizes iconv, if it's not needed anymore.

Nota:
If 'rev' param was used with ekg_convert_string_init(), this functions must be called two times
  • with returned value, and with rev-associated one.
Parametry:
ptr- pointer returned by ekg_convert_string_init().
Zobacz również:
ekg_convert_string_init() - init charset conversion.
ekg_convert_string_p() - main charset conversion function.
void* ekg_convert_string_init ( const char *  from,
const char *  to,
void **  rev 
)

ekg_convert_string_init()

Initialize string conversion thing for two given charsets.

Parametry:
from- input encoding (will be duped; if NULL, console_charset will be assumed).
to- output encoding (will be duped; if NULL, console_charset will be assumed).
rev- pointer to assign reverse conversion into; if NULL, no reverse converter will be initialized.
Zwraca:
Pointer that should be passed to other ekg_convert_string_*(), even if it's NULL.
Zobacz również:
ekg_convert_string_destroy() - deinits charset conversion.
ekg_convert_string_p() - main charset conversion function.
char* ekg_convert_string_p ( const char *  ps,
void *  ptr 
)

ekg_convert_string_p()

Converts string to specified encoding, using pointer returned by ekg_convert_string_init(). Invalid characters in input will be replaced with question marks.

Parametry:
ps- string to be converted (won't be freed).
ptr- pointer returned by ekg_convert_string_init().
Zwraca:
Pointer to allocated result or NULL, if some failure has occured or no conversion is needed (i.e. resulting string would be same as input).
Zobacz również:
ekg_convert_string_init() - init charset conversion.
ekg_convert_string_destroy() - deinits charset conversion.
string_t ekg_convert_string_t ( string_t  s,
const char *  from,
const char *  to 
)
string_t ekg_convert_string_t_p ( string_t  s,
void *  ptr 
)
int ekg_converters_display ( int  quiet)
void ekg_debug_handler ( int  level,
const char *  format,
va_list  ap 
)

ekg_debug_handler()

debug message [if config_debug set] coming direct from libgadu (by libgadu_debug_handler()) or by debug() or by debug_ext()
XXX, doc more. But function now is ok.

Zobacz również:
debug_ext()
Błąd:
It can happen than internal string_t line will be not freed.
Parametry:
level
format
ap
char* ekg_draw_descr ( const int  status)
void ekg_exit ( )
int ekg_hash ( const char *  name)
uint32_t* ekg_sent_message_format ( const char *  text)
int ekg_status_int ( const char *  text)
const char* ekg_status_label ( const int  status,
const char *  descr,
const char *  prefix 
)
const char* ekg_status_string ( const int  status,
const int  cmd 
)
void ekg_update_status ( session_t session)
int ekg_write ( int  fd,
const char *  buf,
int  len 
)

ekg_write()

write data to given fd, if it cannot be done [because system buffer is too small. it'll create watch, and write as soon as possible] XXX, for now it'll always create watch. (You can be notified about state of buffer when you call ekg_write(fd, NULL, -1))

Nota:
This _should_ be used as replacement for write()
int ekg_writef ( int  fd,
const char *  format,
  ... 
)
void ekg_yield_cpu ( ) [inline]

ekg_yield_cpu()

releases cpu meant to be called while busy-looping

FILE* help_path ( char *  name,
char *  plugin 
)
int is_utf8_string ( const char *  txt)
int isalpha_pl ( unsigned char  c)
int mesg_set ( int  what)
int mkdir_recursive ( const char *  pathname,
int  isdir 
)
int msg_all ( session_t s,
const char *  function,
const char *  what 
)
newconference_t* newconference_create ( session_t s,
const char *  name,
int  create_wnd 
)
void newconference_destroy ( newconference_t conf,
int  kill_wnd 
)
newconference_t* newconference_find ( session_t s,
const char *  name 
)
userlist_t* newconference_member_add ( newconference_t conf,
const char *  uid,
const char *  nick 
)
userlist_t* newconference_member_find ( newconference_t conf,
const char *  uid 
)
int newconference_member_remove ( newconference_t conf,
userlist_t u 
)
void newconferences_destroy ( )
char* password_input ( const char *  prompt,
const char *  rprompt,
const bool  norepeat 
)

password_input()

Try to get password through UI_PASSWORD_INPUT, printing error messages if needed.

Zwraca:
Pointer to new password (which needs to be freed) or NULL, if not succeeded (wrong input / no support).
int play_sound ( const char *  sound_path)
const char* prepare_path ( const char *  filename,
int  do_mkdir 
)
const char* prepare_path_user ( const char *  path)
const char* prepare_pathf ( const char *  filename,
  ... 
)
char* read_file ( FILE *  f,
int  alloc 
)
char* read_file_iso ( FILE *  f,
int  alloc 
)
char* saprintf ( const char *  format,
  ... 
)
int say_it ( const char *  str)
char* split_line ( char **  ptr)
char* strcasestr ( const char *  haystack,
const char *  needle 
)
char* strip_spaces ( char *  line)
size_t strlen_pl ( const char *  s)
int strncasecmp_pl ( const char *  cs,
const char *  ct,
size_t  count 
)
struct timer* timer_add ( plugin_t plugin,
const char *  name,
unsigned int  period,
int  persistent,
int(*)(int, void *)  function,
void *  data 
) [read]
struct timer* timer_add_ms ( plugin_t plugin,
const char *  name,
unsigned int  period,
int  persist,
int(*)(int, void *)  function,
void *  data 
) [read]
struct timer* timer_add_session ( session_t session,
const char *  name,
unsigned int  period,
int  persist,
int(*)(int, session_t *)  function 
) [read]
struct timer* timer_find_session ( session_t session,
const char *  name 
) [read]
int timer_handle_command ( int  type,
void *  data 
)
int timer_remove ( plugin_t plugin,
const char *  name 
)
int timer_remove_session ( session_t session,
const char *  name 
)
int timer_remove_user ( )
void timers_destroy ( )
void timers_remove ( struct timer t)
struct timer* timers_removei ( struct timer t) [read]
const char* timestamp ( const char *  format)
const char* timestamp_time ( const char *  format,
time_t  t 
)
void windows_save ( )
char* xstrmid ( const char *  str,
int  start,
int  length 
)
char* xstrncat_pl ( char *  dest,
const char *  src,
size_t  n 
)
void xstrtr ( char *  text,
char  from,
char  to 
)

Dokumentacja zmiennych

char* batch_line

debug buffer

speech buffer

char* config_dir
char* config_theme
time_t ekg_started
char* home_dir
time_t last_save
int no_mouse
pid_t speech_pid
struct timer* timers
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje