ekg2  GIT master
stuff.h
Idź do dokumentacji tego pliku.
1 /* $Id: stuff.h 4597 2008-09-03 21:10:01Z darkjames $ */
2 
3 /*
4  * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl>
5  * Robert J. Woźny <speedy@ziew.org>
6  * Paweł Maziarz <drg@go2.pl>
7  * Dawid Jarosz <dawjar@poczta.onet.pl>
8  * Piotr Domagalski <szalik@szalik.net>
9  * Adam Mikuta <adammikuta@poczta.onet.pl>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License Version 2 as
13  * published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24 
25 #ifndef __EKG_STUFF_H
26 #define __EKG_STUFF_H
27 
28 #include <sys/types.h>
29 #include <sys/time.h>
30 #include <time.h>
31 
32 #include <ctype.h>
33 #include <stdarg.h>
34 #include <stdio.h>
35 
36 #include "plugins.h"
37 #include "sessions.h"
38 
39 #define BINDING_FUNCTION(x) void x(const char *arg)
40 
41 struct binding {
42  struct binding *next;
43 
44  char *key;
45 
46  char *action; /* akcja */
47  unsigned int internal : 1; /* czy domyślna kombinacja? */
48  void (*function)(const char *arg); /* funkcja obsługująca */
49  char *arg; /* argument funkcji */
50 
51  char *default_action; /* domyślna akcja */
52  void (*default_function)(const char *arg); /* domyślna funkcja */
53  char *default_arg; /* domyślny argument */
54 };
55 
56 typedef struct binding_added {
57  struct binding_added *next;
58 
59  char *sequence;
60  struct binding *binding;
62 
63 #define TIMER(x) int x(int type, void *data)
64 
65 struct timer {
66  struct timer *next;
67 
68  char *name; /* nazwa timera */
69  plugin_t *plugin; /* wtyczka obsługująca deksryptor */
70  struct timeval ends; /* kiedy się kończy? */
71  unsigned int period; /* ile milisekund ma trwać czekanie */
72  int (*function)(int, void *); /* funkcja do wywołania */
73  void *data; /* dane dla funkcji */
74 
75  unsigned int persist : 1; /* czy ma być na zawsze? */
76  unsigned int at : 1; /* /at? trzeba się tego jakoś pozbyć
77  * i ujednolicić z /timer */
78  unsigned int is_session : 1; /* czy sesyjny */
79 };
80 
81 extern char *config_console_charset; /* */
82 extern char *server_console_charset;
83 extern int config_use_unicode; /* for instance in jabber plugin if this is on, than we don't need to make iconv from / to unicode.. */
84 extern int config_use_iso; /* this for ncurses */
85 extern struct binding *bindings;
86 extern struct timer *timers;
88 extern int config_debug;
89 extern int config_display_welcome;
90 extern int config_query_commands;
91 extern int config_slash_messages;
92 extern int config_display_color;
93 extern int config_display_pl_chars;
94 extern int config_display_crap;
96 extern char *config_timestamp;
97 extern int config_timestamp_show;
98 extern int config_history_savedups;
99 extern int config_make_window;
100 extern int config_sort_windows;
101 extern int config_send_white_lines;
102 
103 extern char *config_tab_command;
104 extern int config_save_quit;
105 extern int config_lastlog_noitems;
106 extern int config_lastlog_case;
107 extern int config_lastlog_display_all;
108 extern char *config_completion_char;
109 
110 extern int config_changed;
111 
112 extern int no_mouse;
113 
114 extern int old_stderr;
115 
116 extern int in_autoexec;
117 
118 void binding_free();
119 
120 void changed_theme(const char *var);
121 
122 const char *compile_time();
123 
124 void iso_to_ascii(unsigned char *buf);
125 
126 #ifdef __GNUC__
127 char *saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
128 #else
129 char *saprintf(const char *format, ...);
130 #endif
131 
132 const char *timestamp(const char *format);
133 const char *timestamp_time(const char *format, time_t t);
134 
135 int isalpha_pl(unsigned char c);
136 /* makra, dzięki którym pozbywamy się warning'ów */
137 #define xisxdigit(c) isxdigit((int) (unsigned char) c)
138 #define xisdigit(c) isdigit((int) (unsigned char) c)
139 #define xisalpha(c) isalpha_pl((int) (unsigned char) c)
140 #define xisalnum(c) isalnum((int) (unsigned char) c)
141 #define xisspace(c) isspace((int) (unsigned char) c)
142 #define xtolower(c) tolower((int) (unsigned char) c)
143 #define xtoupper(c) toupper((int) (unsigned char) c)
144 
145 struct timer *timer_add(plugin_t *plugin, const char *name, unsigned int period, int persist, int (*function)(int, void *), void *data);
146 struct timer *timer_add_ms(plugin_t *plugin, const char *name, unsigned int period, int persist, int (*function)(int, void *), void *data);
147 int timer_remove(plugin_t *plugin, const char *name);
148 struct timer *timers_removei(struct timer *t);
149 void timers_destroy();
150 
151 const char *ekg_status_string(const int status, const int cmd);
152 
153 /* funkcje poza stuff.c */
154 void ekg_exit();
155 void ekg_debug_handler(int level, const char *format, va_list ap);
156 
157 int ekg_write(int fd, const char *buf, int len);
158 int remote_request(char *what, ...);
159 
160 #endif /* __EKG_STUFF_H */
161 
162 /*
163  * Local Variables:
164  * mode: c
165  * c-file-style: "k&r"
166  * c-basic-offset: 8
167  * indent-tabs-mode: t
168  * End:
169  */
void ekg_debug_handler(int level, const char *format, va_list ap)
Definition: ekg.c:343
char * saprintf(const char *format,...)
Definition: stuff.c:2369
int config_sort_windows
Definition: stuff.c:119
unsigned int at
Definition: stuff.h:76
int config_make_window
Definition: stuff.c:111
int timer_remove(plugin_t *plugin, const char *name)
Definition: stuff.c:202
int config_use_iso
Definition: ekg_hash_benchmark.c:47
char * sequence
Definition: bindings.h:28
struct binding_added binding_added_t
int config_send_white_lines
Definition: stuff.c:118
int old_stderr
Definition: stuff.c:71
unsigned int period
Definition: stuff.h:71
int isalpha_pl(unsigned char c)
Definition: stuff.c:1819
const char * compile_time()
Definition: stuff.c:634
struct timer * timers_removei(struct timer *t)
unsigned int persist
Definition: stuff.h:75
const char * ekg_status_string(const int status, const int cmd)
Definition: stuff.c:2191
Definition: stuff.h:65
Definition: plugins.h:76
Definition: rivchat.h:42
int config_history_savedups
Definition: stuff.c:87
char * default_action
Definition: bindings.h:20
int config_use_unicode
int config_display_color
Definition: stuff.c:78
void changed_theme(const char *var)
Definition: stuff.c:597
int config_slash_messages
Definition: stuff.c:107
void * data
Definition: stuff.h:73
binding_added_t * bindings_added
Definition: bindings.c:5
void timers_destroy()
int config_query_commands
Definition: stuff.c:106
int no_mouse
Definition: ekg.c:90
int config_display_crap
Definition: windows.c:43
const char * timestamp_time(const char *format, time_t t)
Definition: stuff.c:1699
int config_lastlog_display_all
Definition: lastlog.c:29
struct timer * next
Definition: stuff.h:66
int config_default_status_window
Definition: stuff.c:101
char * arg
Definition: bindings.h:18
char * action
Definition: bindings.h:15
char * key
Definition: bindings.h:13
Definition: bindings.h:25
char * config_tab_command
Definition: stuff.c:112
char * config_console_charset
char * default_arg
Definition: bindings.h:22
int config_lastlog_case
Definition: lastlog.c:28
struct timer * timer_add(plugin_t *plugin, const char *name, unsigned int period, int persist, int(*function)(int, void *), void *data)
Definition: stuff.c:198
char * config_timestamp
Definition: stuff.c:115
char * config_completion_char
Definition: stuff.c:97
char * server_console_charset
const char * name
Definition: remote.c:88
int config_display_pl_chars
char * name
Definition: stuff.h:68
void iso_to_ascii(unsigned char *buf)
Definition: stuff.c:109
int config_save_quit
Definition: stuff.c:114
struct binding * bindings
Definition: bindings.c:4
void ekg_exit()
Definition: ekg.c:811
int in_autoexec
Definition: stuff.c:75
int ekg_write(int fd, const char *buf, int len)
Definition: stuff.c:2427
struct timer * timer_add_ms(plugin_t *plugin, const char *name, unsigned int period, int persist, int(*function)(int, void *), void *data)
Definition: stuff.c:170
int config_lastlog_noitems
Definition: lastlog.c:27
Definition: bindings.h:10
struct timer * timers
plugin_t * plugin
Definition: stuff.h:69
void binding_free()
Definition: bindings.c:108
unsigned int is_session
Definition: stuff.h:78
int remote_request(char *what,...)
const char * timestamp(const char *format)
Definition: stuff.c:1684
unsigned int internal
Definition: bindings.h:16
int config_debug
Definition: stuff.c:132
struct binding * next
Definition: bindings.h:11
void(* default_function)(const char *arg)
Definition: bindings.h:21
int config_changed
Definition: stuff.c:94
int config_timestamp_show
Definition: stuff.c:116
int config_display_welcome
Definition: stuff.c:124