mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:33:02 +01:00
move window blink/beep to a function
This commit is contained in:
parent
83458c64ec
commit
b16ff16abc
16
src/chat.c
16
src/chat.c
@ -41,8 +41,7 @@ static void chat_onMessage(ToxWindow *self, Tox *m, int num, uint8_t *msg, uint1
|
||||
} else
|
||||
wprintw(ctx->history, "%s\n", msg);
|
||||
|
||||
self->blink = true;
|
||||
beep();
|
||||
alert_window(self);
|
||||
}
|
||||
|
||||
static void chat_onConnectionChange(ToxWindow *self, Tox *m, int num, uint8_t status)
|
||||
@ -70,8 +69,7 @@ static void chat_onAction(ToxWindow *self, Tox *m, int num, uint8_t *action, uin
|
||||
wprintw(ctx->history, "* %s %s\n", nick, action);
|
||||
wattroff(ctx->history, COLOR_PAIR(YELLOW));
|
||||
|
||||
self->blink = true;
|
||||
beep();
|
||||
alert_window(self);
|
||||
}
|
||||
|
||||
static void chat_onNickChange(ToxWindow *self, int num, uint8_t *nick, uint16_t len)
|
||||
@ -155,8 +153,7 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t fil
|
||||
friends[num].file_receiver.pending[filenum] = true;
|
||||
strcpy(friends[num].file_receiver.filenames[filenum], filename);
|
||||
|
||||
self->blink = true;
|
||||
beep();
|
||||
alert_window(self);
|
||||
}
|
||||
|
||||
static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive_send,
|
||||
@ -189,8 +186,7 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive
|
||||
break;
|
||||
}
|
||||
|
||||
self->blink = true;
|
||||
beep();
|
||||
alert_window(self);
|
||||
}
|
||||
|
||||
static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, uint8_t *data,
|
||||
@ -232,10 +228,8 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int friendnumber, uint8_
|
||||
}
|
||||
|
||||
memcpy(friends[friendnumber].pending_groupchat, group_pub_key, TOX_CLIENT_ID_SIZE);
|
||||
|
||||
wprintw(ctx->history, "Type \"/join\" to join the chat.\n");
|
||||
self->blink = true;
|
||||
beep();
|
||||
alert_window(self);
|
||||
}
|
||||
|
||||
static void send_action(ToxWindow *self, ChatContext *ctx, Tox *m, uint8_t *action) {
|
||||
|
@ -106,3 +106,10 @@ bool timed_out(uint64_t timestamp, uint64_t curtime, uint64_t timeout)
|
||||
{
|
||||
return timestamp + timeout <= curtime;
|
||||
}
|
||||
|
||||
/* Beeps and makes window tab blink */
|
||||
void alert_window(ToxWindow *self)
|
||||
{
|
||||
self->blink = true;
|
||||
beep();
|
||||
}
|
||||
|
@ -21,4 +21,7 @@ uint8_t *wcs_to_char(wchar_t *string);
|
||||
char *wc_to_char(wchar_t ch);
|
||||
|
||||
/* Returns true if connection has timed out, false otherwise */
|
||||
bool timed_out(uint64_t timestamp, uint64_t timeout, uint64_t curtime);
|
||||
bool timed_out(uint64_t timestamp, uint64_t timeout, uint64_t curtime);
|
||||
|
||||
/* Beeps and makes window tab blink */
|
||||
void alert_window(ToxWindow *self);
|
@ -227,8 +227,7 @@ static void prompt_onFriendRequest(ToxWindow *self, uint8_t *key, uint8_t *data,
|
||||
}
|
||||
|
||||
wprintw(self->window, "Type \"/accept %d\" to accept it.\n", n);
|
||||
self->blink = true;
|
||||
beep();
|
||||
alert_window(self);
|
||||
}
|
||||
|
||||
void prompt_init_statusbar(ToxWindow *self, Tox *m)
|
||||
|
Loading…
Reference in New Issue
Block a user