summaryrefslogtreecommitdiff
path: root/src/plugins/typing/typing-status.h
blob: ee8c0da1abbba2e84f020e00d6c879072784fa6a (plain)
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
/*
 * Copyright (C) 2021-2024 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 <https://www.gnu.org/licenses/>.
 */

#ifndef WEECHAT_PLUGIN_TYPING_STATUS_H
#define WEECHAT_PLUGIN_TYPING_STATUS_H

#include <time.h>

enum t_typing_status_state
{
    TYPING_STATUS_STATE_OFF = 0,
    TYPING_STATUS_STATE_TYPING,
    TYPING_STATUS_STATE_PAUSED,
    TYPING_STATUS_STATE_CLEARED,
    /* number of typing status statuses */
    TYPING_STATUS_NUM_STATES,
};

/* typing status */

struct t_typing_status
{
    int state;                            /* current state                  */
    time_t last_typed;                    /* when was last char typed       */
};

extern char *typing_status_state_string[];
extern struct t_hashtable *typing_status_self;
extern struct t_hashtable *typing_status_nicks;

extern int typing_status_search_state (const char *state);
extern struct t_typing_status *typing_status_self_add (struct t_gui_buffer *buffer,
                                                       int state,
                                                       int last_typed);
extern struct t_typing_status *typing_status_self_search (struct t_gui_buffer *buffer);
extern struct t_typing_status *typing_status_nick_add (struct t_gui_buffer *buffer,
                                                       const char *nick,
                                                       int state,
                                                       int last_typed);
extern struct t_typing_status *typing_status_nick_search (struct t_gui_buffer *buffer,
                                                          const char *nick);
extern void typing_status_nick_remove (struct t_gui_buffer *buffer,
                                       const char *nick);
extern void typing_status_end ();

#endif /* WEECHAT_PLUGIN_TYPING_STATUS_H */