mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 16:03:25 +01:00
format fixes
This commit is contained in:
parent
713f2347bc
commit
ed68350424
11
src/chat.c
11
src/chat.c
@ -104,9 +104,7 @@ static void chat_onNickChange(ToxWindow *self, int num, uint8_t *nick, uint16_t
|
||||
nick[len - 1] = '\0';
|
||||
snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num);
|
||||
|
||||
wattron(ctx->history, COLOR_PAIR(3));
|
||||
wprintw(ctx->history, "* Your partner changed nick to '%s'\n", nick);
|
||||
wattroff(ctx->history, COLOR_PAIR(3));
|
||||
}
|
||||
|
||||
static void chat_onStatusChange(ToxWindow *self, int num, uint8_t *status, uint16_t len)
|
||||
@ -123,10 +121,7 @@ static void chat_onStatusChange(ToxWindow *self, int num, uint8_t *status, uint1
|
||||
|
||||
status[len - 1] = '\0';
|
||||
|
||||
wattron(ctx->history, COLOR_PAIR(3));
|
||||
wprintw(ctx->history, "* Your partner changed status to '%s'\n", status);
|
||||
wattroff(ctx->history, COLOR_PAIR(3));
|
||||
|
||||
wprintw(ctx->history, "* Your partner changed status message to '%s'\n", status);
|
||||
}
|
||||
|
||||
/* check that the string has one non-space character */
|
||||
@ -344,12 +339,12 @@ void execute(ToxWindow *self, ChatContext *ctx, Tox *m, char *cmd)
|
||||
|
||||
if (msg == NULL) {
|
||||
tox_set_userstatus(m, status_kind);
|
||||
wprintw(ctx->history, "Status set to: %s\n", status_text);
|
||||
wprintw(ctx->history, "Status message set to: %s\n", status_text);
|
||||
} else {
|
||||
msg++;
|
||||
tox_set_userstatus(m, status_kind);
|
||||
tox_set_statusmessage(m, ( uint8_t *) msg, strlen(msg) + 1);
|
||||
wprintw(ctx->history, "Status set to: %s, %s\n", status_text, msg);
|
||||
wprintw(ctx->history, "Status message set to: %s, %s\n", status_text, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
||||
|
||||
for (i = 0; i < num_friends; ++i) {
|
||||
if (friends[i].active) {
|
||||
bool is_online = tox_friendstatus(m, i) == TOX_FRIEND_ONLINE;
|
||||
bool is_online = tox_friendstatus(m, friends[i].num) == TOX_FRIEND_ONLINE;
|
||||
|
||||
if (i == num_selected)
|
||||
wprintw(self->window, " > ");
|
||||
@ -181,8 +181,8 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
||||
wprintw(self->window, " ");
|
||||
|
||||
if (is_online) {
|
||||
TOX_USERSTATUS status = tox_get_userstatus(m, i);
|
||||
int colour;
|
||||
TOX_USERSTATUS status = tox_get_userstatus(m, friends[i].num);
|
||||
int colour = 3;
|
||||
|
||||
switch(status) {
|
||||
case TOX_USERSTATUS_NONE:
|
||||
@ -206,8 +206,9 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
||||
|
||||
if (strncmp(friends[i].statusmsg, NOSTATUSMSG, strlen(NOSTATUSMSG)))
|
||||
wprintw(self->window, "(%s)\n", friends[i].statusmsg);
|
||||
|
||||
} else {
|
||||
wprintw(self->window, "%s (Offline)\n", friends[i].name);
|
||||
wprintw(self->window, "(Offline)\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void cmd_help(ToxWindow *self, Tox *m, char **args)
|
||||
wprintw(self->window, " connect <ip> <port> <key> : Connect to DHT server\n");
|
||||
wprintw(self->window, " add <id> <message> : Add friend\n");
|
||||
wprintw(self->window, " status <type> <message> : Set your status\n");
|
||||
wprintw(self->window, " statusmsg <message> : Set your status\n");
|
||||
wprintw(self->window, " statusmsg <message> : Set your status message\n");
|
||||
wprintw(self->window, " nick <nickname> : Set your nickname\n");
|
||||
wprintw(self->window, " mynick : Print your current nickname\n");
|
||||
wprintw(self->window, " accept <number> : Accept friend request\n");
|
||||
@ -310,11 +310,11 @@ void cmd_status(ToxWindow *self, Tox *m, char **args)
|
||||
|
||||
if (msg == NULL) {
|
||||
tox_set_userstatus(m, status_kind);
|
||||
wprintw(self->window, "Status set to: %s\n", status_text);
|
||||
wprintw(self->window, "Status message set to: %s\n", status_text);
|
||||
} else {
|
||||
tox_set_userstatus(m, status_kind);
|
||||
tox_set_statusmessage(m, (uint8_t *) msg, strlen(msg) + 1);
|
||||
wprintw(self->window, "Status set to: %s, %s\n", status_text, msg);
|
||||
wprintw(self->window, "Status message set to: %s, %s\n", status_text, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ void cmd_statusmsg(ToxWindow *self, Tox *m, char **args)
|
||||
{
|
||||
char *msg = args[1];
|
||||
tox_set_statusmessage(m, (uint8_t *) msg, strlen(msg) + 1);
|
||||
wprintw(self->window, "Status set to: %s\n", msg);
|
||||
wprintw(self->window, "Status message set to: %s\n", msg);
|
||||
}
|
||||
|
||||
static void execute(ToxWindow *self, Tox *m, char *u_cmd)
|
||||
|
@ -60,7 +60,7 @@ void on_action(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void
|
||||
|
||||
void on_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
{
|
||||
wprintw(prompt->window, "\n(nickchange) %d: %s\n", friendnumber, string);
|
||||
wprintw(prompt->window, "\n(nick change) %d: %s\n", friendnumber, string);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
@ -71,7 +71,7 @@ void on_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, v
|
||||
|
||||
void on_statuschange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
{
|
||||
wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string);
|
||||
wprintw(prompt->window, "\n(message change) %d: %s\n", friendnumber, string);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user