tg/interface.h

93 lines
2.9 KiB
C
Raw Normal View History

2013-10-23 18:26:17 +04:00
/*
This file is part of telegram-cli.
2013-10-23 18:26:17 +04:00
Telegram-cli is free software: you can redistribute it and/or modify
2013-10-23 18:26:17 +04:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Telegram-cli is distributed in the hope that it will be useful,
2013-10-23 18:26:17 +04:00
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 this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
2013-10-23 18:26:17 +04:00
2015-01-12 00:52:40 +03:00
Copyright Vitaly Valtman 2013-2015
2013-10-23 18:26:17 +04:00
*/
2013-10-03 16:38:25 +04:00
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
2014-11-12 17:38:44 +03:00
#include <tgl/tgl-structures.h>
#include <tgl/tgl-layout.h>
2013-10-23 14:24:59 +04:00
#define COLOR_RED "\033[0;31m"
#define COLOR_REDB "\033[1;31m"
#define COLOR_NORMAL "\033[0m"
#define COLOR_GREEN "\033[32;1m"
#define COLOR_GREY "\033[37;1m"
2013-10-16 23:19:39 +04:00
#define COLOR_YELLOW "\033[33;1m"
#define COLOR_BLUE "\033[34;1m"
2013-10-18 23:30:24 +04:00
#define COLOR_MAGENTA "\033[35;1m"
2013-11-04 21:34:27 +04:00
#define COLOR_CYAN "\033[36;1m"
#define COLOR_LCYAN "\033[0;36m"
#define COLOR_INVERSE "\033[7m"
2013-10-03 16:38:25 +04:00
char *get_default_prompt (void);
char *complete_none (const char *text, int state);
char **complete_text (char *text, int start, int end);
void interpreter (char *line);
2014-09-21 02:22:35 +04:00
void interpreter_ex (char *line, void *ex);
2013-10-12 00:52:20 +04:00
void rprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2)));
void logprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2)));
2014-08-13 16:56:55 +04:00
#define vlogprintf(v,...) \
do { \
if (TLS->verbosity >= (v)) {\
2014-08-13 16:56:55 +04:00
logprintf (__VA_ARGS__);\
}\
} while (0);\
2014-08-21 05:56:53 +04:00
//void hexdump (int *in_ptr, int *in_end);
2013-10-16 23:19:39 +04:00
2014-09-21 02:22:35 +04:00
struct bufferevent;
struct in_ev {
struct bufferevent *bev;
char in_buf[4096];
int in_buf_pos;
int refcnt;
int error;
2014-09-21 13:18:12 +04:00
int fd;
2014-09-21 02:22:35 +04:00
};
2014-08-13 19:55:16 +04:00
struct tgl_message;
2014-09-21 02:22:35 +04:00
struct in_ev;
void print_message (struct in_ev *ev, struct tgl_message *M);
void print_chat_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C);
2015-09-25 18:28:23 +03:00
void print_channel_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C);
2014-09-21 02:22:35 +04:00
void print_user_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *U);
void print_encr_chat_name_full (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C);
void print_encr_chat_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C);
2014-08-13 19:55:16 +04:00
//void print_media (struct tgl_message_media *M);
2014-09-21 02:22:35 +04:00
//
void pop_color (void);
void push_color (const char *color);
void print_start (void);
void print_end (void);
2014-09-21 02:22:35 +04:00
void print_date_full (struct in_ev *ev, long t);
void print_date (struct in_ev *ev, long t);
2014-02-27 09:48:05 +01:00
void play_sound (void);
void update_prompt (void);
void set_interface_callbacks (void);
char *print_permanent_msg_id (tgl_message_id_t id);
char *print_permanent_peer_id (tgl_peer_id_t id);
2015-10-02 14:56:24 +03:00
tgl_peer_id_t parse_input_peer_id (const char *s, int l, int mask);
tgl_message_id_t parse_input_msg_id (const char *s, int l);
2013-10-03 16:38:25 +04:00
#endif