ekg/stuff.c File Reference

#include "ekg2-config.h"
#include "win32.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <sched.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "compat/strlcpy.h"
#include "compat/strlcat.h"
#include "debug.h"
#include "commands.h"
#include "dynstuff.h"
#include "protocol.h"
#include "stuff.h"
#include "themes.h"
#include "userlist.h"
#include "vars.h"
#include "windows.h"
#include "xmalloc.h"
#include "plugins.h"
#include "sessions.h"
#include "dynstuff_inline.h"
#include "queries.h"

Data Structures

struct  ekg_status_info

Defines

#define _XOPEN_SOURCE   600
#define __EXTENSIONS__
#define __USE_BSD
#define __sq(x)   ((x)*(x))

Functions

static LIST_FREE_ITEM (child_free_item, child_t *)
 DYNSTUFF_LIST_DECLARE (children, child_t, child_free_item, static __DYNSTUFF_LIST_ADD, __DYNSTUFF_LIST_REMOVE_ITER, __DYNSTUFF_LIST_DESTROY) alias_t *aliases
static LIST_FREE_ITEM (timer_free_item, struct timer *)
 DYNSTUFF_LIST_DECLARE2 (timers, struct timer, timer_free_item, static __DYNSTUFF_LIST_ADD, __DYNSTUFF_LIST_REMOVE_SAFE, __DYNSTUFF_LIST_REMOVE_ITER, __DYNSTUFF_LIST_DESTROY) struct conference *conferences
void windows_save ()
static LIST_FREE_ITEM (list_alias_free, alias_t *)
 DYNSTUFF_LIST_DECLARE (aliases, alias_t, list_alias_free, static __DYNSTUFF_LIST_ADD, static __DYNSTUFF_LIST_REMOVE_ITER, __DYNSTUFF_LIST_DESTROY) int alias_add(const char *string
char color_map (unsigned char r, unsigned char g, unsigned char b)
int isalpha_pl (unsigned char c)
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)
void debug_ext (debug_level_t level, const char *format,...)
void debug (const char *format,...)
char * base64_encode (const char *buf, size_t len)
char * base64_decode (const char *buf)
char * split_line (char **ptr)
const char * ekg_status_label (const int status, const char *descr, const char *prefix)
char * ekg_draw_descr (const int status)
void ekg_update_status (session_t *session)
static struct ekg_status_infostatus_find (const int status)
const char * ekg_status_string (const int status, const int cmd)
int ekg_status_int (const char *text)
uint32_t * ekg_sent_message_format (const char *text)
static int tolower_pl (const unsigned char c)
int strncasecmp_pl (const char *cs, const char *ct, size_t count)
int strcasecmp_pl (const char *cs, const char *ct)
char * saprintf (const char *format,...)
void xstrtr (char *text, char from, char to)
void ekg_yield_cpu ()
int ekg_write (int fd, const char *buf, int len)
int ekg_writef (int fd, const char *format,...)
int ekg_close (int fd)
char * password_input (const char *prompt, const char *rprompt, const bool norepeat)

Variables

child_tchildren = NULL
list_t autofinds = NULL
timertimers = NULL
newconference_tnewconferences = NULL
buffer_info buffer_debug = { NULL, 0, DEBUG_MAX_LINES }
buffer_info buffer_speech = { NULL, 0, 50 }
int old_stderr
char * config_subject_prefix
char * config_subject_reply_prefix
int in_autoexec = 0
int config_auto_save = 0
int config_auto_user_add = 0
time_t last_save = 0
int config_display_color = 1
int config_beep = 1
int config_beep_msg = 1
int config_beep_chat = 1
int config_beep_notify = 1
char * config_console_charset
char * config_dcc_dir
int config_display_blinking = 1
int config_display_pl_chars = 1
int config_events_delay = 3
int config_expert_mode = 0
int config_history_savedups = 1
char * config_sound_msg_file = NULL
char * config_sound_chat_file = NULL
char * config_sound_notify_file = NULL
char * config_sound_sysmsg_file = NULL
char * config_sound_mail_file = NULL
char * config_sound_app = NULL
int config_use_unicode
int config_use_iso
int config_changed = 0
int config_display_ack = 12
int config_completion_notify = 1
char * config_completion_char = NULL
time_t ekg_started = 0
int config_display_notify = 1
char * config_theme = NULL
int config_default_status_window = 0
char * home_dir = NULL
char * config_quit_reason = NULL
char * config_away_reason = NULL
char * config_back_reason = NULL
int config_query_commands = 0
int config_slash_messages = 0
int quit_message_send = 0
int batch_mode = 0
char * batch_line = NULL
int config_make_window = 6
char * config_tab_command = NULL
int config_save_password = 1
int config_save_quit = 1
char * config_timestamp = NULL
int config_timestamp_show = 1
int config_display_sent = 1
int config_sort_windows = 1
int config_keep_reason = 1
char * config_audio_device = NULL
char * config_speech_app = NULL
int config_time_deviation = 300
int config_mesg = MESG_DEFAULT
int config_display_welcome = 1
char * config_display_color_map = NULL
char * config_session_default = NULL
int config_sessions_save = 0
int config_window_session_allow = 0
int config_windows_save = 0
char * config_windows_layout = NULL
char * config_profile = NULL
int config_reason_limit = 1
int config_debug = 1
int config_lastlog_noitems = 0
int config_lastlog_case = 0
int config_lastlog_display_all = 0
int config_version = 0
char * config_exit_exec = NULL
int config_session_locks = 0
char * config_nickname = NULL
char * last_search_first_name = NULL
char * last_search_last_name = NULL
char * last_search_nickname = NULL
char * last_search_uid = 0
int reason_changed = 0
int quiet
static char base64_charset []
ekg_status_info ekg_statuses []

Define Documentation

#define __EXTENSIONS__

#define __sq (  )     ((x)*(x))

#define __USE_BSD

#define _XOPEN_SOURCE   600


Function Documentation

char* base64_decode ( const char *  buf  ) 

char* base64_encode ( const char *  buf,
size_t  len 
)

char color_map ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

void debug ( const char *  format,
  ... 
)

void debug_ext ( debug_level_t  level,
const char *  format,
  ... 
)

DYNSTUFF_LIST_DECLARE ( aliases  ,
alias_t  ,
list_alias_free  ,
static  __DYNSTUFF_LIST_ADD,
static  __DYNSTUFF_LIST_REMOVE_ITER,
__DYNSTUFF_LIST_DESTROY   
) const

DYNSTUFF_LIST_DECLARE ( children  ,
child_t  ,
child_free_item  ,
static  __DYNSTUFF_LIST_ADD,
__DYNSTUFF_LIST_REMOVE_ITER  ,
__DYNSTUFF_LIST_DESTROY   
)

DYNSTUFF_LIST_DECLARE2 ( timers  ,
struct  timer,
timer_free_item  ,
static  __DYNSTUFF_LIST_ADD,
__DYNSTUFF_LIST_REMOVE_SAFE  ,
__DYNSTUFF_LIST_REMOVE_ITER  ,
__DYNSTUFF_LIST_DESTROY   
)

int ekg_close ( int  fd  ) 

ekg_close()

close fd and all watches associated with that fd

Note:
This _should_ be used as replacement for close() (especially in protocol plugins)

char* ekg_draw_descr ( const int  status  ) 

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))

Note:
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

int isalpha_pl ( unsigned char  c  ) 

static LIST_FREE_ITEM ( list_alias_free  ,
alias_t  
) [static]

static LIST_FREE_ITEM ( timer_free_item  ,
struct timer  
) [static]

static LIST_FREE_ITEM ( child_free_item  ,
child_t  
) [static]

int msg_all ( session_t s,
const char *  function,
const char *  what 
)

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.

Returns:
Pointer to new password (which needs to be freed) or NULL, if not succeeded (wrong input / no support).

char* saprintf ( const char *  format,
  ... 
)

int say_it ( const char *  str  ) 

char* split_line ( char **  ptr  ) 

static struct ekg_status_info* status_find ( const int  status  )  [inline, static]

int strcasecmp_pl ( const char *  cs,
const char *  ct 
)

char* strcasestr ( const char *  haystack,
const char *  needle 
)

int strncasecmp_pl ( const char *  cs,
const char *  ct,
size_t  count 
)

static int tolower_pl ( const unsigned char  c  )  [static]

void windows_save (  ) 

void xstrtr ( char *  text,
char  from,
char  to 
)


Variable Documentation

list_t autofinds = NULL

char base64_charset[] [static]

Initial value:

        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

char* batch_line = NULL

int batch_mode = 0

struct buffer_info buffer_debug = { NULL, 0, DEBUG_MAX_LINES }

debug buffer

struct buffer_info buffer_speech = { NULL, 0, 50 }

speech buffer

child_t* children = NULL

char* config_audio_device = NULL

int config_auto_save = 0

int config_auto_user_add = 0

char* config_away_reason = NULL

char* config_back_reason = NULL

int config_beep = 1

int config_beep_chat = 1

int config_beep_msg = 1

int config_beep_notify = 1

int config_changed = 0

char* config_completion_char = NULL

int config_completion_notify = 1

char* config_console_charset

char* config_dcc_dir

int config_debug = 1

int config_default_status_window = 0

int config_display_ack = 12

int config_display_blinking = 1

int config_display_color = 1

char* config_display_color_map = NULL

int config_display_notify = 1

int config_display_pl_chars = 1

int config_display_sent = 1

int config_display_welcome = 1

int config_events_delay = 3

char* config_exit_exec = NULL

int config_expert_mode = 0

int config_history_savedups = 1

int config_keep_reason = 1

int config_lastlog_case = 0

int config_lastlog_display_all = 0

int config_lastlog_noitems = 0

int config_make_window = 6

int config_mesg = MESG_DEFAULT

char* config_nickname = NULL

char* config_profile = NULL

int config_query_commands = 0

char* config_quit_reason = NULL

int config_reason_limit = 1

int config_save_password = 1

int config_save_quit = 1

char* config_session_default = NULL

int config_session_locks = 0

int config_sessions_save = 0

int config_slash_messages = 0

int config_sort_windows = 1

char* config_sound_app = NULL

char* config_sound_chat_file = NULL

char* config_sound_mail_file = NULL

char* config_sound_msg_file = NULL

char* config_sound_notify_file = NULL

char* config_sound_sysmsg_file = NULL

char* config_speech_app = NULL

char* config_subject_prefix

char* config_subject_reply_prefix

char* config_tab_command = NULL

char* config_theme = NULL

int config_time_deviation = 300

char* config_timestamp = NULL

int config_timestamp_show = 1

int config_use_iso

int config_use_unicode

int config_version = 0

int config_window_session_allow = 0

char* config_windows_layout = NULL

int config_windows_save = 0

time_t ekg_started = 0

struct ekg_status_info ekg_statuses[]

Initial value:

 {
                { EKG_STATUS_ERROR,    "error"          },
                { EKG_STATUS_BLOCKED,  "blocking"       },
                { EKG_STATUS_UNKNOWN,  "unknown"        },
                { EKG_STATUS_NA,       "notavail"       },
                { EKG_STATUS_INVISIBLE,"invisible"      },
                { EKG_STATUS_DND,      "dnd"            },
                { EKG_STATUS_GONE,     "gone"           },
                { EKG_STATUS_XA,       "xa"             },
                { EKG_STATUS_AWAY,     "away"           },
                { EKG_STATUS_AVAIL,    "avail", "back", },
                { EKG_STATUS_FFC,      "chat",  "ffc"   },

                                
                { EKG_STATUS_AUTOAWAY,  "autoaway"      },
                { EKG_STATUS_AUTOXA,    "autoxa"        },
                { EKG_STATUS_AUTOBACK,  "autoback"      },
                { EKG_STATUS_NULL                       }
}

char* home_dir = NULL

int in_autoexec = 0

time_t last_save = 0

char* last_search_first_name = NULL

char* last_search_last_name = NULL

char* last_search_nickname = NULL

char* last_search_uid = 0

newconference_t* newconferences = NULL

int old_stderr

int quiet

int quit_message_send = 0

int reason_changed = 0

struct timer* timers = NULL


Generated on Sat Nov 22 22:30:44 2008 for ekg2 by  doxygen 1.5.1