1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/*
* Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_GUI_LINE_H
#define WEECHAT_GUI_LINE_H 1
#include <regex.h>
struct t_infolist;
/* line structures */
struct t_gui_line_data
{
struct t_gui_buffer *buffer; /* pointer to buffer */
int y; /* line position (for free buffer) */
time_t date; /* date/time of line (may be past) */
time_t date_printed; /* date/time when weechat print it */
char *str_time; /* time string (for display) */
int tags_count; /* number of tags for line */
char **tags_array; /* tags for line */
char displayed; /* 1 if line is displayed */
char highlight; /* 1 if line has highlight */
char refresh_needed; /* 1 if refresh asked (free buffer) */
char *prefix; /* prefix for line (may be NULL) */
int prefix_length; /* prefix length (on screen) */
char *message; /* line content (after prefix) */
};
struct t_gui_line
{
struct t_gui_line_data *data; /* pointer to line data */
struct t_gui_line *prev_line; /* link to previous line */
struct t_gui_line *next_line; /* link to next line */
};
struct t_gui_lines
{
struct t_gui_line *first_line; /* pointer to first line */
struct t_gui_line *last_line; /* pointer to last line */
struct t_gui_line *last_read_line; /* last read line */
int lines_count; /* number of lines */
int first_line_not_read; /* if 1, marker is before first line */
int lines_hidden; /* 1 if at least one line is hidden */
int buffer_max_length; /* max length for buffer name (for */
/* mixed lines only) */
int buffer_max_length_refresh; /* refresh asked for buffer max len. */
int prefix_max_length; /* max length for prefix align */
int prefix_max_length_refresh; /* refresh asked for prefix max len. */
};
/* line functions */
extern struct t_gui_lines *gui_lines_alloc ();
extern void gui_lines_free (struct t_gui_lines *lines);
extern void gui_line_get_prefix_for_display (struct t_gui_line *line,
char **prefix, int *length,
char **color, int *prefix_is_nick);
extern int gui_line_get_align (struct t_gui_buffer *buffer,
struct t_gui_line *line,
int with_suffix, int first_line);
extern int gui_line_is_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_line_get_first_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_line_get_last_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_line_get_prev_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_line_get_next_displayed (struct t_gui_line *line);
extern int gui_line_search_text (struct t_gui_buffer *buffer,
struct t_gui_line *line);
extern int gui_line_match_regex (struct t_gui_line_data *line_data,
regex_t *regex_prefix,
regex_t *regex_message);
extern int gui_line_has_tag_no_filter (struct t_gui_line_data *line_data);
extern int gui_line_match_tags (struct t_gui_line_data *line_data,
int tags_count, char ***tags_array);
extern const char *gui_line_search_tag_starting_with (struct t_gui_line *line,
const char *tag);
extern const char *gui_line_get_nick_tag (struct t_gui_line *line);
extern int gui_line_has_highlight (struct t_gui_line *line);
extern int gui_line_has_offline_nick (struct t_gui_line *line);
extern void gui_line_compute_buffer_max_length (struct t_gui_buffer *buffer,
struct t_gui_lines *lines);
extern void gui_line_compute_prefix_max_length (struct t_gui_lines *lines);
extern void gui_line_set_prefix_same_nick (struct t_gui_line *line);
extern void gui_line_mixed_free_buffer (struct t_gui_buffer *buffer);
extern void gui_line_mixed_free_all (struct t_gui_buffer *buffer);
extern void gui_line_free (struct t_gui_buffer *buffer,
struct t_gui_line *line);
extern void gui_line_free_all (struct t_gui_buffer *buffer);
extern int gui_line_get_notify_level (struct t_gui_line *line);
extern struct t_gui_line *gui_line_add (struct t_gui_buffer *buffer,
time_t date,
time_t date_printed,
const char *tags,
const char *prefix,
const char *message);
extern void gui_line_add_y (struct t_gui_buffer *buffer, int y,
const char *message);
extern void gui_line_clear (struct t_gui_line *line);
extern void gui_line_mix_buffers (struct t_gui_buffer *buffer);
extern struct t_hdata *gui_line_hdata_lines_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_line_hdata_line_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_line_hdata_line_data_cb (void *data,
const char *hdata_name);
extern int gui_line_add_to_infolist (struct t_infolist *infolist,
struct t_gui_lines *lines,
struct t_gui_line *line);
extern void gui_lines_print_log (struct t_gui_lines *lines);
#endif /* WEECHAT_GUI_LINE_H */
|