~rcr/rirc

ref: c677d85e88b1397d0eaa9b99ad3acf531f64aa3f rirc/src/state.h -rw-r--r-- 1.2 KiB
c677d85e — Richard Robbins add -m/--mode flag 4 months ago
                                                                                
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
#ifndef RIRC_STATE_H
#define RIRC_STATE_H

#include "src/components/buffer.h"
#include "src/components/channel.h"
#include "src/components/server.h"

#define FROM_INFO    "--"
#define FROM_ERROR   "-!!-"
#define FROM_UNKNOWN "-\?\?-"
#define FROM_JOIN    ">>"
#define FROM_PART    "<<"
#define FROM_QUIT    "<<"

#define server_info(S, ...) \
	do { newlinef((S)->channel, BUFFER_LINE_SERVER_INFO, FROM_INFO, __VA_ARGS__); } while (0)

#define server_error(S, ...) \
	do { newlinef((S)->channel, BUFFER_LINE_SERVER_ERROR, FROM_ERROR, __VA_ARGS__); } while (0)

void state_init(void);
void state_term(void);

/* Get tty dimensions */
unsigned state_cols(void);
unsigned state_rows(void);

const char *action_message(void);
struct channel* channel_get_first(void);
struct channel* channel_get_last(void);
struct channel* channel_get_next(struct channel*);
struct channel* channel_get_prev(struct channel*);
struct channel* current_channel(void);
struct server_list* state_server_list(void);
void buffer_scrollback_back(struct channel*);
void buffer_scrollback_forw(struct channel*);
void channel_set_current(struct channel*);
void newlinef(struct channel*, enum buffer_line_type, const char*, const char*, ...);

#endif