1 /* HexChat
2  * Copyright (C) 1998-2010 Peter Zelezny.
3  * Copyright (C) 2009-2013 Berke Viktor.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #include <time.h>
21 #include "textenums.h"
22 
23 #ifndef HEXCHAT_TEXT_H
24 #define HEXCHAT_TEXT_H
25 
26 /* timestamp is non-zero if we are using server-time */
27 #define EMIT_SIGNAL_TIMESTAMP(i, sess, a, b, c, d, e, timestamp) \
28 	text_emit(i, sess, a, b, c, d, timestamp)
29 #define EMIT_SIGNAL(i, sess, a, b, c, d, e) \
30 	text_emit(i, sess, a, b, c, d, 0)
31 
32 struct text_event
33 {
34 	char *name;
35 	char * const *help;
36 	int num_args;
37 	char *def;
38 };
39 
40 void scrollback_close (session *sess);
41 void scrollback_load (session *sess);
42 
43 int text_word_check (char *word, int len);
44 void PrintText (session *sess, char *text);
45 void PrintTextTimeStamp (session *sess, char *text, time_t timestamp);
46 void PrintTextf (session *sess, const char *format, ...) G_GNUC_PRINTF (2, 3);
47 void PrintTextTimeStampf (session *sess, time_t timestamp, const char *format, ...) G_GNUC_PRINTF (3, 4);
48 void log_close (session *sess);
49 void log_open_or_close (session *sess);
50 void load_text_events (void);
51 void pevent_save (char *fn);
52 int pevt_build_string (const char *input, char **output, int *max_arg);
53 int pevent_load (char *filename);
54 void pevent_make_pntevts (void);
55 int text_color_of (char *name);
56 void text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
57 		time_t timestamp);
58 int text_emit_by_name (char *name, session *sess, time_t timestamp,
59 					   char *a, char *b, char *c, char *d);
60 gchar *text_convert_invalid (const gchar* text, gssize len, GIConv converter, const gchar *fallback, gsize *len_out);
61 gchar *text_fixup_invalid_utf8 (const gchar* text, gssize len, gsize *len_out);
62 int get_stamp_str (char *fmt, time_t tim, char **ret);
63 void format_event (session *sess, int index, char **args, char *o, gsize sizeofo, unsigned int stripcolor_args);
64 char *text_find_format_string (char *name);
65 
66 extern const gchar* unicode_fallback_string;
67 extern const gchar* arbitrary_encoding_fallback_string;
68 
69 void sound_play (const char *file, gboolean quiet);
70 void sound_play_event (int i);
71 void sound_beep (session *);
72 void sound_load (void);
73 void sound_save (void);
74 
75 #endif
76