mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:43:01 +01:00
typging change callback update
This commit is contained in:
parent
25b5545644
commit
c1dfb741c9
12
src/chat.c
12
src/chat.c
@ -83,7 +83,7 @@ static const uint8_t chat_cmd_list[AC_NUM_CHAT_COMMANDS][MAX_CMDNAME_SIZE] = {
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
};
|
||||
|
||||
static void set_typingstatus(ToxWindow *self, Tox *m, bool is_typing)
|
||||
static void set_typingstatus(ToxWindow *self, Tox *m, uint8_t is_typing)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
@ -149,11 +149,11 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, int32_t num, uint8_
|
||||
friends[num].is_typing = tox_get_is_typing(m, num);
|
||||
} else {
|
||||
statusbar->is_online = false;
|
||||
friends[num].is_typing = false;
|
||||
friends[num].is_typing = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void chat_onTypingChange(ToxWindow *self, Tox *m, int32_t num, int is_typing)
|
||||
static void chat_onTypingChange(ToxWindow *self, Tox *m, int32_t num, uint8_t is_typing)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -626,7 +626,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
||||
}
|
||||
|
||||
if (!ctx->self_is_typing && ctx->line[0] != '/')
|
||||
set_typingstatus(self, m, true);
|
||||
set_typingstatus(self, m, 1);
|
||||
}
|
||||
/* RETURN key: Execute command or print line */
|
||||
else if (key == '\n') {
|
||||
@ -645,7 +645,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
||||
if (line[0] == '/') {
|
||||
if (strcmp(line, "/close") == 0) {
|
||||
if (ctx->self_is_typing)
|
||||
set_typingstatus(self, m, false);
|
||||
set_typingstatus(self, m, 0);
|
||||
|
||||
kill_chat_window(self);
|
||||
return;
|
||||
@ -683,7 +683,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
||||
}
|
||||
|
||||
if (ctx->len <= 0 && ctx->self_is_typing)
|
||||
set_typingstatus(self, m, false);
|
||||
set_typingstatus(self, m, 0);
|
||||
}
|
||||
|
||||
static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
|
@ -45,7 +45,7 @@ typedef struct {
|
||||
int chatwin;
|
||||
bool active;
|
||||
bool online;
|
||||
bool is_typing;
|
||||
uint8_t is_typing;
|
||||
bool logging_on; /* saves preference for friend irrespective of chat windows */
|
||||
uint8_t status;
|
||||
struct LastOnline last_online;
|
||||
|
@ -108,7 +108,7 @@ struct ToxWindow {
|
||||
void(*onFileSendRequest)(ToxWindow *, Tox *, int32_t, uint8_t, uint64_t, uint8_t *, uint16_t);
|
||||
void(*onFileControl)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t, uint8_t, uint8_t *, uint16_t);
|
||||
void(*onFileData)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t *, uint16_t);
|
||||
void(*onTypingChange)(ToxWindow *, Tox *, int32_t, int);
|
||||
void(*onTypingChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
||||
|
||||
#ifdef _SUPPORT_AUDIO
|
||||
|
||||
@ -180,7 +180,7 @@ struct ChatContext {
|
||||
int hst_pos;
|
||||
int hst_tot;
|
||||
|
||||
bool self_is_typing;
|
||||
uint8_t self_is_typing;
|
||||
|
||||
struct chatlog *log;
|
||||
|
||||
@ -253,7 +253,7 @@ void on_group_namelistchange(Tox *m, int groupnumber, int peernumber, uint8_t ch
|
||||
void on_file_sendrequest(Tox *m, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *pathname, uint16_t pathname_length, void *userdata);
|
||||
void on_file_control(Tox *m, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_file_data(Tox *m, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_typing_change(Tox *m, int32_t friendnumber, int is_typing, void *userdata);
|
||||
void on_typing_change(Tox *m, int32_t friendnumber, uint8_t is_typing, void *userdata);
|
||||
|
||||
ToxWindow *init_windows(Tox *m);
|
||||
void draw_active_window(Tox *m);
|
||||
|
@ -63,7 +63,7 @@ void on_connectionchange(Tox *m, int32_t friendnumber, uint8_t status, void *use
|
||||
}
|
||||
}
|
||||
|
||||
void on_typing_change(Tox *m, int32_t friendnumber, int is_typing, void *userdata)
|
||||
void on_typing_change(Tox *m, int32_t friendnumber, uint8_t is_typing, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user