1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 21:43:26 +01:00

format fixes

This commit is contained in:
Jfreegman 2013-09-02 05:15:29 -04:00
parent 713f2347bc
commit ed68350424
4 changed files with 14 additions and 18 deletions

View File

@ -104,9 +104,7 @@ static void chat_onNickChange(ToxWindow *self, int num, uint8_t *nick, uint16_t
nick[len - 1] = '\0'; nick[len - 1] = '\0';
snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num); 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); 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) 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'; status[len - 1] = '\0';
wattron(ctx->history, COLOR_PAIR(3)); wprintw(ctx->history, "* Your partner changed status message to '%s'\n", status);
wprintw(ctx->history, "* Your partner changed status to '%s'\n", status);
wattroff(ctx->history, COLOR_PAIR(3));
} }
/* check that the string has one non-space character */ /* 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) { if (msg == NULL) {
tox_set_userstatus(m, status_kind); 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 { } else {
msg++; msg++;
tox_set_userstatus(m, status_kind); tox_set_userstatus(m, status_kind);
tox_set_statusmessage(m, ( uint8_t *) msg, strlen(msg) + 1); 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);
} }
} }

View File

@ -173,7 +173,7 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
for (i = 0; i < num_friends; ++i) { for (i = 0; i < num_friends; ++i) {
if (friends[i].active) { 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) if (i == num_selected)
wprintw(self->window, " > "); wprintw(self->window, " > ");
@ -181,8 +181,8 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
wprintw(self->window, " "); wprintw(self->window, " ");
if (is_online) { if (is_online) {
TOX_USERSTATUS status = tox_get_userstatus(m, i); TOX_USERSTATUS status = tox_get_userstatus(m, friends[i].num);
int colour; int colour = 3;
switch(status) { switch(status) {
case TOX_USERSTATUS_NONE: case TOX_USERSTATUS_NONE:
@ -206,8 +206,9 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
if (strncmp(friends[i].statusmsg, NOSTATUSMSG, strlen(NOSTATUSMSG))) if (strncmp(friends[i].statusmsg, NOSTATUSMSG, strlen(NOSTATUSMSG)))
wprintw(self->window, "(%s)\n", friends[i].statusmsg); wprintw(self->window, "(%s)\n", friends[i].statusmsg);
} else { } else {
wprintw(self->window, "%s (Offline)\n", friends[i].name); wprintw(self->window, "(Offline)\n");
} }
} }
} }

View File

@ -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, " connect <ip> <port> <key> : Connect to DHT server\n");
wprintw(self->window, " add <id> <message> : Add friend\n"); wprintw(self->window, " add <id> <message> : Add friend\n");
wprintw(self->window, " status <type> <message> : Set your status\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, " nick <nickname> : Set your nickname\n");
wprintw(self->window, " mynick : Print your current nickname\n"); wprintw(self->window, " mynick : Print your current nickname\n");
wprintw(self->window, " accept <number> : Accept friend request\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) { if (msg == NULL) {
tox_set_userstatus(m, status_kind); 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 { } else {
tox_set_userstatus(m, status_kind); tox_set_userstatus(m, status_kind);
tox_set_statusmessage(m, (uint8_t *) msg, strlen(msg) + 1); 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]; char *msg = args[1];
tox_set_statusmessage(m, (uint8_t *) msg, strlen(msg) + 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) static void execute(ToxWindow *self, Tox *m, char *u_cmd)

View File

@ -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) 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; int i;
for (i = 0; i < MAX_WINDOWS_NUM; ++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) 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; int i;
for (i = 0; i < MAX_WINDOWS_NUM; ++i) { for (i = 0; i < MAX_WINDOWS_NUM; ++i) {