ekg2
GIT master
|
#include <glib.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"
#include "vars.h"
Idź do kodu źródłowego tego pliku.
Struktury danych | |
struct | alias |
struct | conference |
struct | newconference |
struct | buffer |
struct | buffer_info |
struct | color_map |
Definicje | |
#define | DEBUG_MAX_LINES 50 /* ile linii z debug zrzucać do pliku */ |
#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 | IGNORE_RESULT(X) (X) |
#define | ekg_update_status_n(a) ekg_update_status(session_find(a)) |
Definicje typów | |
typedef struct alias | alias_t |
typedef struct newconference | newconference_t |
Wyliczenia | |
enum | mesg_t { MESG_CHECK = -1, MESG_OFF, MESG_ON, MESG_DEFAULT } |
Funkcje | |
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) |
void | changed_config_timestamp (const char *var) |
const char * | compile_time () |
struct conference * | conference_add (session_t *session, const char *string, const char *nicklist, int quiet) |
int | conference_remove (const char *name, int quiet) |
struct conference * | conference_create (session_t *session, const char *nicks) |
struct conference * | conference_find (const char *name) |
struct conference * | conference_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_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) |
newconference_t * | newconference_create (session_t *s, const char *name, int create_wnd) |
newconference_t * | newconference_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) |
GDataInputStream * | help_open (const gchar *name, const gchar *plugin) |
gchar * | read_line (GDataInputStream *f) |
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_utf (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 | 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) |
void | ignore_result_helper (int __attribute__((unused)) dummy,...) |
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) |
guint32 * | 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 | variable_display (variable_t *v, int quiet) |
int | session_variable_display (session_t *s, const char *name, int quiet) |
void | session_variable_info (session_t *s, const char *name, int quiet) |
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,...) |
#define DEBUG_MAX_LINES 50 /* ile linii z debug zrzucać do pliku */ |
#define ekg_update_status_n | ( | a | ) | ekg_update_status(session_find(a)) |
#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) |
typedef struct newconference newconference_t |
enum mesg_t |
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 | ||
) |
Add new line to given buffer_t, if max_lines > 0 than it maintain list that we can have max: max_lines items on it.
type | - pointer to buffer beginning ptr |
target | - name of target.. or just name of smth we want to keep in b->target |
line | - line which we want to save. |
int buffer_add_str | ( | struct buffer_info * | type, |
const char * | target, | ||
const char * | str | ||
) |
Add new line to given buffer_t, if max_lines > 0 than it maintain list that we can have max: max_lines items on it.
type | - pointer to buffer beginning ptr |
target | - name of target, or just name of smth we want to keep in b->target |
str | - string in format: [time_when_it_happen proper line... blah, blah] time_when_it_happen should be in digits. |
void buffer_free | ( | struct buffer_info * | type | ) |
Free memory after given buffer.
After it set *type to NULL
type | - pointer to buffer beginning ptr |
char* buffer_tail | ( | struct buffer_info * | type | ) |
Return oldest b->line, free b->target and remove whole buffer_t from list
type | - pointer to buffer beginning ptr |
void changed_auto_save | ( | const char * | var | ) |
void changed_config_timestamp | ( | 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 | ) |
char color_map | ( | unsigned char | r, |
unsigned char | g, | ||
unsigned char | b | ||
) |
const char* compile_time | ( | ) |
Return compilation date, and time..
Used by /version command and ekg2 –version
struct conference* conference_add | ( | session_t * | session, |
const char * | string, | ||
const char * | nicklist, | ||
int | quiet | ||
) |
struct conference* conference_create | ( | session_t * | session, |
const char * | nicks | ||
) |
struct conference* conference_find | ( | const char * | name | ) |
struct conference* conference_find_by_uids | ( | session_t * | s, |
const char * | from, | ||
const char ** | recipients, | ||
int | count, | ||
int | quiet | ||
) |
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 | ) |
close fd and all watches associated with that fd
char* ekg_convert_string | ( | const char * | ps, |
const char * | from, | ||
const char * | to | ||
) |
Converts string to specified encoding, replacing invalid chars with question marks.
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). |
void ekg_convert_string_destroy | ( | void * | ptr | ) |
Frees internal data associated with given pointer, and uninitalizes iconv, if it's not needed anymore.
ptr | - pointer returned by ekg_convert_string_init(). |
void* ekg_convert_string_init | ( | const char * | from, |
const char * | to, | ||
void ** | rev | ||
) |
Initialize string conversion thing for two given charsets.
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. |
char* ekg_convert_string_p | ( | const char * | ps, |
void * | ptr | ||
) |
Converts string to specified encoding, using pointer returned by ekg_convert_string_init(). Invalid characters in input will be replaced with question marks.
ps | - string to be converted (won't be freed). |
ptr | - pointer returned by ekg_convert_string_init(). |
int ekg_converters_display | ( | int | quiet | ) |
void ekg_debug_handler | ( | int | level, |
const char * | format, | ||
va_list | ap | ||
) |
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.
level | |
format | |
ap |
char* ekg_draw_descr | ( | const int | status | ) |
void ekg_exit | ( | ) |
int ekg_hash | ( | const char * | name | ) |
guint32* 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 | ||
) |
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))
int ekg_writef | ( | int | fd, |
const char * | format, | ||
... | |||
) |
|
inline |
releases cpu meant to be called while busy-looping
GDataInputStream* help_open | ( | const gchar * | name, |
const gchar * | plugin | ||
) |
Open the help file in best language available.
name | - help file basename. |
plugin | - plugin name or NULL if core help is requested. |
void ignore_result_helper | ( | int __attribute__((unused)) | dummy, |
... | |||
) |
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 | ||
) |
Create directory pathname and all needed parent directories.
pathname | - path to directory or file (see isdir comment) |
isdir | - if isdir is set, than we should also create dir specified by full pathname path, else we shouldn't do it, because it's filename and we want to create directory only to last '/' char |
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 | ||
) |
Try to get password through UI_PASSWORD_INPUT, printing error messages if needed.
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 | ) |
Converts path given by user to absolute path.
path | - input path. |
const char* prepare_pathf | ( | const char * | filename, |
... | |||
) |
Return path to configdir/profiledir (~/.ekg2 or ~/.ekg2/$PROFILE) and append filename (formated using vsnprintf()) If length of this string is larger than PATH_MAX (4096 on Linux) than unlike prepare_path() it'll return NULL
char* read_file | ( | FILE * | f, |
int | alloc | ||
) |
Read next line from file f, if needed alloc memory for it.
Remove \r and \n chars from end of line if needed.
f | - opened FILE * |
alloc |
|
char* read_file_utf | ( | FILE * | f, |
int | alloc | ||
) |
gchar* read_line | ( | GDataInputStream * | f | ) |
Read a single line from GDataInputStream.
f | - GDataInputStream to read from. |
char* saprintf | ( | const char * | format, |
... | |||
) |
int say_it | ( | const char * | str | ) |
int session_variable_display | ( | session_t * | s, |
const char * | name, | ||
int | quiet | ||
) |
void session_variable_info | ( | session_t * | s, |
const char * | name, | ||
int | quiet | ||
) |
char* split_line | ( | char ** | ptr | ) |
char* strcasestr | ( | const char * | haystack, |
const char * | needle | ||
) |
char* strip_spaces | ( | char * | line | ) |
strips spaces from the begining and the end of string line
line | - given string |
int strncasecmp_pl | ( | const char * | cs, |
const char * | ct, | ||
size_t | count | ||
) |
const char* timestamp | ( | const char * | format | ) |
It returns static buffer with formated current time.
format | - format to pass to strftime() [man 3 strftime] |
const char* timestamp_time | ( | const char * | format, |
time_t | t | ||
) |
void variable_display | ( | variable_t * | v, |
int | quiet | ||
) |
void windows_save | ( | ) |
char* xstrmid | ( | const char * | str, |
int | start, | ||
int | length | ||
) |
void xstrtr | ( | char * | text, |
char | from, | ||
char | to | ||
) |
alias_t* aliases |
list_t autofinds |
char* batch_line |
int batch_mode |
struct buffer_info buffer_debug |
debug buffer
struct buffer_info buffer_speech |
speech buffer
struct color_map color_map_default[16+10] |
struct conference* conferences |
int config_auto_save |
int config_auto_user_add |
char* config_away_reason |
char* config_back_reason |
int config_beep |
int config_beep_chat |
int config_beep_msg |
int config_beep_notify |
int config_changed |
char* config_completion_char |
int config_completion_notify |
char* config_dcc_dir |
int config_debug |
int config_default_status_window |
char* config_dir |
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 |
char* config_exit_exec |
int config_expert_mode |
int config_history_savedups |
int config_keep_reason |
int config_last |
int config_last_size |
int config_make_window |
int config_mesg |
char* config_nickname |
char* config_profile |
int config_query_commands |
char* config_quit_reason |
int config_save_password |
int config_save_quit |
int config_send_white_lines |
char* config_session_default |
int config_session_locks |
int config_sessions_save |
int config_slash_messages |
int config_sort_windows |
char* config_sound_app |
char* config_sound_chat_file |
char* config_sound_mail_file |
char* config_sound_msg_file |
char* config_sound_notify_file |
char* config_sound_sysmsg_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_version |
int config_window_session_allow |
char* config_windows_layout |
int config_windows_save |
const char* console_charset |
gboolean console_charset_is_utf8 |
int ekg2_reason_changed |
time_t ekg_started |
int ekg_watches_removed |
char* formated_config_timestamp |
char* home_dir |
int in_autoexec |
int mesg_startup |
newconference_t* newconferences |
int no_mouse |
int old_stderr |
int quit_message_send |
pid_t speech_pid |