mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 22:03:27 +01:00
type fixes
This commit is contained in:
parent
50a37495f8
commit
d49e911fe4
@ -271,7 +271,7 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, int32_t num, uint8_t rec
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
uint8_t *filename;
|
const uint8_t *filename;
|
||||||
|
|
||||||
if (receive_send == 0)
|
if (receive_send == 0)
|
||||||
filename = friends[num].file_receiver.filenames[filenum];
|
filename = friends[num].file_receiver.filenames[filenum];
|
||||||
@ -714,7 +714,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
|
|
||||||
/* Draw name, status and note in statusbar */
|
/* Draw name, status and note in statusbar */
|
||||||
if (statusbar->is_online) {
|
if (statusbar->is_online) {
|
||||||
const char *status_text = "Unknown";
|
const uint8_t *status_text = "Unknown";
|
||||||
int colour = WHITE;
|
int colour = WHITE;
|
||||||
|
|
||||||
uint8_t status = statusbar->status;
|
uint8_t status = statusbar->status;
|
||||||
@ -837,7 +837,7 @@ static void chat_onInit(ToxWindow *self, Tox *m)
|
|||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToxWindow new_chat(Tox *m, int friendnum)
|
ToxWindow new_chat(Tox *m, int32_t friendnum)
|
||||||
{
|
{
|
||||||
ToxWindow ret;
|
ToxWindow ret;
|
||||||
memset(&ret, 0, sizeof(ret));
|
memset(&ret, 0, sizeof(ret));
|
||||||
|
@ -26,6 +26,6 @@
|
|||||||
#include "toxic_windows.h"
|
#include "toxic_windows.h"
|
||||||
|
|
||||||
void kill_chat_window(ToxWindow *self);
|
void kill_chat_window(ToxWindow *self);
|
||||||
ToxWindow new_chat(Tox *m, int friendnum);
|
ToxWindow new_chat(Tox *m, int32_t friendnum);
|
||||||
|
|
||||||
#endif /* end of include guard: CHAT_H_6489PZ13 */
|
#endif /* end of include guard: CHAT_H_6489PZ13 */
|
||||||
|
@ -86,6 +86,8 @@ static void update_friend_last_online(int32_t num, uint64_t timestamp)
|
|||||||
{
|
{
|
||||||
friends[num].last_online.last_on = timestamp;
|
friends[num].last_online.last_on = timestamp;
|
||||||
friends[num].last_online.tm = *localtime(×tamp);
|
friends[num].last_online.tm = *localtime(×tamp);
|
||||||
|
|
||||||
|
/* if the format changes make sure TIME_STR_SIZE is the correct size */
|
||||||
strftime(friends[num].last_online.hour_min_str, TIME_STR_SIZE, "%I:%M %p",
|
strftime(friends[num].last_online.hour_min_str, TIME_STR_SIZE, "%I:%M %p",
|
||||||
&friends[num].last_online.tm);
|
&friends[num].last_online.tm);
|
||||||
}
|
}
|
||||||
@ -519,11 +521,6 @@ void disable_chatwin(int32_t f_num)
|
|||||||
friends[f_num].chatwin = -1;
|
friends[f_num].chatwin = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onInit(ToxWindow *self, Tox *m)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _SUPPORT_AUDIO
|
#ifdef _SUPPORT_AUDIO
|
||||||
static void friendlist_onAv(ToxWindow *self, ToxAv *av)
|
static void friendlist_onAv(ToxWindow *self, ToxAv *av)
|
||||||
{
|
{
|
||||||
@ -563,7 +560,6 @@ ToxWindow new_friendlist(void)
|
|||||||
|
|
||||||
ret.onKey = &friendlist_onKey;
|
ret.onKey = &friendlist_onKey;
|
||||||
ret.onDraw = &friendlist_onDraw;
|
ret.onDraw = &friendlist_onDraw;
|
||||||
ret.onInit = &friendlist_onInit;
|
|
||||||
ret.onFriendAdded = &friendlist_onFriendAdded;
|
ret.onFriendAdded = &friendlist_onFriendAdded;
|
||||||
ret.onMessage = &friendlist_onMessage;
|
ret.onMessage = &friendlist_onMessage;
|
||||||
ret.onConnectionChange = &friendlist_onConnectionChange;
|
ret.onConnectionChange = &friendlist_onConnectionChange;
|
||||||
|
@ -53,10 +53,10 @@ typedef struct {
|
|||||||
} ToxicFriend;
|
} ToxicFriend;
|
||||||
|
|
||||||
ToxWindow new_friendlist(void);
|
ToxWindow new_friendlist(void);
|
||||||
void disable_chatwin(int f_num);
|
void disable_chatwin(int32_t f_num);
|
||||||
int get_friendnum(uint8_t *name);
|
int get_friendnum(uint8_t *name);
|
||||||
|
|
||||||
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int num, bool sort);
|
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int32_t num, bool sort);
|
||||||
|
|
||||||
/* sorts friendlist_index first by connection status then alphabetically */
|
/* sorts friendlist_index first by connection status then alphabetically */
|
||||||
void sort_friendlist_index(void);
|
void sort_friendlist_index(void);
|
||||||
|
@ -60,7 +60,7 @@ void cmd_accept(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int friendnum = tox_add_friend_norequest(m, pending_frnd_requests[req]);
|
int32_t friendnum = tox_add_friend_norequest(m, pending_frnd_requests[req]);
|
||||||
|
|
||||||
if (friendnum == -1)
|
if (friendnum == -1)
|
||||||
wprintw(window, "Failed to add friend.\n");
|
wprintw(window, "Failed to add friend.\n");
|
||||||
@ -134,7 +134,7 @@ void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
|
|||||||
id[i] = toupper(id[i]);
|
id[i] = toupper(id[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int f_num = tox_add_friend(m, id_bin, msg, strlen(msg) + 1);
|
int32_t f_num = tox_add_friend(m, id_bin, msg, strlen(msg) + 1);
|
||||||
|
|
||||||
switch (f_num) {
|
switch (f_num) {
|
||||||
case TOX_FAERR_TOOLONG:
|
case TOX_FAERR_TOOLONG:
|
||||||
|
@ -272,7 +272,7 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
|
|||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
print_time(ctx->history);
|
print_time(ctx->history);
|
||||||
|
|
||||||
uint8_t *event;
|
const uint8_t *event;
|
||||||
|
|
||||||
switch (change) {
|
switch (change) {
|
||||||
case TOX_CHAT_CHANGE_PEER_ADD:
|
case TOX_CHAT_CHANGE_PEER_ADD:
|
||||||
|
@ -78,7 +78,7 @@ void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log)
|
|||||||
free(user_config_dir);
|
free(user_config_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_to_log(uint8_t *msg, uint8_t *name, struct chatlog *log, bool event)
|
void write_to_log(const uint8_t *msg, uint8_t *name, struct chatlog *log, bool event)
|
||||||
{
|
{
|
||||||
if (!log->log_on)
|
if (!log->log_on)
|
||||||
return;
|
return;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log);
|
void init_logging_session(uint8_t *name, uint8_t *key, struct chatlog *log);
|
||||||
|
|
||||||
/* formats/writes line to log file */
|
/* formats/writes line to log file */
|
||||||
void write_to_log(uint8_t *msg, uint8_t *name, struct chatlog *log, bool event);
|
void write_to_log(const uint8_t *msg, uint8_t *name, struct chatlog *log, bool event);
|
||||||
|
|
||||||
/* enables logging for specified log and creates/fetches file if necessary */
|
/* enables logging for specified log and creates/fetches file if necessary */
|
||||||
void log_enable(uint8_t *name, uint8_t *key, struct chatlog *log);
|
void log_enable(uint8_t *name, uint8_t *key, struct chatlog *log);
|
||||||
|
@ -325,7 +325,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
|
|
||||||
if (statusbar->is_online) {
|
if (statusbar->is_online) {
|
||||||
int colour = WHITE;
|
int colour = WHITE;
|
||||||
const char *status_text = "Unknown";
|
const uint8_t *status_text = "Unknown";
|
||||||
|
|
||||||
switch (statusbar->status) {
|
switch (statusbar->status) {
|
||||||
case TOX_USERSTATUS_NONE:
|
case TOX_USERSTATUS_NONE:
|
||||||
@ -408,7 +408,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum
|
|||||||
wprintw(self->window, "\n");
|
wprintw(self->window, "\n");
|
||||||
print_time(self->window);
|
print_time(self->window);
|
||||||
|
|
||||||
uint8_t *msg;
|
const uint8_t *msg;
|
||||||
|
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
msg = "has come online";
|
msg = "has come online";
|
||||||
@ -452,7 +452,7 @@ static void prompt_onFriendRequest(ToxWindow *self, Tox *m, uint8_t *key, uint8_
|
|||||||
int n = add_friend_request(key);
|
int n = add_friend_request(key);
|
||||||
|
|
||||||
if (n == -1) {
|
if (n == -1) {
|
||||||
uint8_t *errmsg = "Friend request queue is full. Discarding request.\n";
|
const uint8_t *errmsg = "Friend request queue is full. Discarding request.\n";
|
||||||
wprintw(self->window, "%s", errmsg);
|
wprintw(self->window, "%s", errmsg);
|
||||||
write_to_log(errmsg, "", prt->log, true);
|
write_to_log(errmsg, "", prt->log, true);
|
||||||
return;
|
return;
|
||||||
@ -486,7 +486,7 @@ void prompt_init_statusbar(ToxWindow *self, Tox *m)
|
|||||||
/* load prev status message or show toxic version if it has never been set */
|
/* load prev status message or show toxic version if it has never been set */
|
||||||
uint8_t ver[strlen(TOXICVER) + 1];
|
uint8_t ver[strlen(TOXICVER) + 1];
|
||||||
strcpy(ver, TOXICVER);
|
strcpy(ver, TOXICVER);
|
||||||
uint8_t *toxic_ver = strtok(ver, "_");
|
const uint8_t *toxic_ver = strtok(ver, "_");
|
||||||
|
|
||||||
if ( (!strcmp("Online", statusmsg) || !strncmp("Toxing on Toxic", statusmsg, 15)) && toxic_ver != NULL)
|
if ( (!strcmp("Online", statusmsg) || !strncmp("Toxing on Toxic", statusmsg, 15)) && toxic_ver != NULL)
|
||||||
snprintf(statusmsg, MAX_STR_SIZE, "Toxing on Toxic v.%s", toxic_ver);
|
snprintf(statusmsg, MAX_STR_SIZE, "Toxing on Toxic v.%s", toxic_ver);
|
||||||
|
@ -241,6 +241,8 @@ int add_window(Tox *m, ToxWindow w)
|
|||||||
wbkgd(w.window, COLOR_PAIR(6));
|
wbkgd(w.window, COLOR_PAIR(6));
|
||||||
#endif
|
#endif
|
||||||
windows[i] = w;
|
windows[i] = w;
|
||||||
|
|
||||||
|
if (w.onInit)
|
||||||
w.onInit(&w, m);
|
w.onInit(&w, m);
|
||||||
|
|
||||||
++num_active_windows;
|
++num_active_windows;
|
||||||
|
Loading…
Reference in New Issue
Block a user