mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-13 02:23:01 +01:00
api update fixes
This commit is contained in:
parent
4e5e3be95f
commit
49b78c9fd4
@ -71,7 +71,7 @@ static void close_groupchatwin(Tox *m, int groupnum)
|
||||
group_chat_index = i;
|
||||
}
|
||||
|
||||
static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, uint8_t *msg, uint16_t len)
|
||||
static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int peernum, uint8_t *msg, uint16_t len)
|
||||
{
|
||||
if (self->num != groupnum)
|
||||
return;
|
||||
@ -79,14 +79,15 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, uint
|
||||
ChatContext *ctx = (ChatContext *) self->chatwin;
|
||||
struct tm *timeinfo = get_time();
|
||||
|
||||
// uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
||||
// tox_getname(m, num, nick);
|
||||
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
||||
tox_group_peername(m, groupnum, peernum, nick);
|
||||
nick[TOXIC_MAX_NAME_LENGTH] = '\0'; /* enforce client max name length */
|
||||
|
||||
wattron(ctx->history, COLOR_PAIR(CYAN));
|
||||
wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
||||
wattroff(ctx->history, COLOR_PAIR(CYAN));
|
||||
wattron(ctx->history, COLOR_PAIR(4));
|
||||
wprintw(ctx->history, "Toxicle: ");
|
||||
wprintw(ctx->history, "%s: ", nick);
|
||||
wattroff(ctx->history, COLOR_PAIR(4));
|
||||
wprintw(ctx->history, "%s\n", msg);
|
||||
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
#define MAX_WINDOWS_NUM 32
|
||||
#define MAX_FRIENDS_NUM 100
|
||||
#define MAX_GROUPCHAT_NUM 30
|
||||
#define MAX_GROUPCHAT_NUM MAX_WINDOWS_NUM - N_DEFAULT_WINS
|
||||
#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 */
|
||||
#define N_DEFAULT_WINS 3 /* number of permanent default windows */
|
||||
#define TOXIC_MAX_NAME_LENGTH 30 /* Must be <= TOX_MAX_NAME_LENGTH */
|
||||
#define N_DEFAULT_WINS 2 /* number of permanent default windows */
|
||||
#define UNKNOWN_NAME "Unknown"
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
@ -52,7 +52,7 @@ 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(*onGroupMessage)(ToxWindow *, Tox *, int, int, uint8_t *, uint16_t);
|
||||
void(*onGroupInvite)(ToxWindow *, Tox *, int, uint8_t *);
|
||||
|
||||
char name[TOX_MAX_NAME_LENGTH];
|
||||
@ -97,7 +97,7 @@ 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_groupmessage(Tox *m, int groupnumber, int peernumber, 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);
|
||||
|
@ -125,13 +125,13 @@ void on_friendadded(Tox *m, int friendnumber)
|
||||
wprintw(prompt->window, "\nCould not store Tox data\n");
|
||||
}
|
||||
|
||||
void on_groupmessage(Tox *m, int groupnumber, uint8_t *message, uint16_t length, void *userdata)
|
||||
void on_groupmessage(Tox *m, int groupnumber, int peernumber, uint8_t *message, uint16_t length, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i].onGroupMessage != NULL)
|
||||
windows[i].onGroupMessage(&windows[i], m, groupnumber, message, length);
|
||||
windows[i].onGroupMessage(&windows[i], m, groupnumber, peernumber, message, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user