mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-05 03:06:45 +02:00
added groupchats
This commit is contained in:
@ -1,9 +1,14 @@
|
||||
/*
|
||||
* Toxic -- Tox Curses Client
|
||||
*/
|
||||
|
||||
#ifndef _windows_h
|
||||
#define _windows_h
|
||||
|
||||
#ifndef TOXICVER
|
||||
#define TOXICVER "NOVER" /* Use the -D flag to set this */
|
||||
#endif
|
||||
|
||||
#include <curses.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@ -14,6 +19,7 @@
|
||||
|
||||
#define MAX_WINDOWS_NUM 32
|
||||
#define MAX_FRIENDS_NUM 100
|
||||
#define MAX_GROUPCHAT_NUM 32
|
||||
#define MAX_STR_SIZE 256
|
||||
#define KEY_SIZE_BYTES 32
|
||||
#define TOXIC_MAX_NAME_LENGTH 30 /* Not to be confused with TOX_MAX_NAME_LENGTH */
|
||||
@ -21,10 +27,7 @@
|
||||
#define UNKNOWN_NAME "Unknown"
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
|
||||
#ifndef TOXICVER
|
||||
#define TOXICVER "NOVER" //Use the -D flag to set this
|
||||
#endif
|
||||
#define CURS_Y_OFFSET 3 /* y-axis cursor offset for chat contexts */
|
||||
|
||||
/* Curses foreground colours (background is black) */
|
||||
#define WHITE 0
|
||||
@ -49,9 +52,11 @@ struct ToxWindow_ {
|
||||
void(*onStatusChange)(ToxWindow *, Tox *, int, TOX_USERSTATUS);
|
||||
void(*onStatusMessageChange)(ToxWindow *, int, uint8_t *, uint16_t);
|
||||
void(*onAction)(ToxWindow *, Tox *, int, uint8_t *, uint16_t);
|
||||
void(*onGroupMessage)(ToxWindow *, Tox *, int, uint8_t *, uint16_t);
|
||||
void(*onGroupInvite)(ToxWindow *, Tox *, int, uint8_t *);
|
||||
|
||||
char name[TOX_MAX_NAME_LENGTH];
|
||||
int friendnum;
|
||||
int num;
|
||||
int x;
|
||||
|
||||
void *chatwin;
|
||||
@ -72,6 +77,18 @@ typedef struct {
|
||||
bool is_online;
|
||||
} StatusBar;
|
||||
|
||||
typedef struct {
|
||||
wchar_t line[MAX_STR_SIZE];
|
||||
size_t pos;
|
||||
WINDOW *history;
|
||||
WINDOW *linewin;
|
||||
} ChatContext;
|
||||
|
||||
typedef struct {
|
||||
int chatwin;
|
||||
bool active;
|
||||
} GroupChat;
|
||||
|
||||
void on_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_connectionchange(Tox *m, int friendnumber, uint8_t status, void *userdata);
|
||||
void on_message(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
@ -80,6 +97,8 @@ void on_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, v
|
||||
void on_statuschange(Tox *m, int friendnumber, TOX_USERSTATUS status, void *userdata);
|
||||
void on_statusmessagechange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_friendadded(Tox *m, int friendnumber);
|
||||
void on_groupmessage(Tox *m, int groupnumber, uint8_t *message, uint16_t length, void *userdata);
|
||||
void on_groupinvite(Tox *m, int friendnumber, uint8_t *group_pub_key, void *userdata);
|
||||
ToxWindow *init_windows();
|
||||
void draw_active_window(Tox *m);
|
||||
int add_window(Tox *m, ToxWindow w);
|
||||
|
Reference in New Issue
Block a user