diff --git a/misc/toxic.conf.example b/misc/toxic.conf.example index 955e515..6dd868c 100644 --- a/misc/toxic.conf.example +++ b/misc/toxic.conf.example @@ -45,6 +45,9 @@ tox = { // Path for downloaded files // download_path="/home/USERNAME/Downloads/"; + // Path for your avatar (file must be a .png and cannot exceed 16.3 KiB) + // avatar_path="/home/USERNAME/Pictures/youravatar.png"; + // Path for chatlogs // chatlogs_path="/home/USERNAME/toxic_chatlogs/"; }; diff --git a/src/global_commands.c b/src/global_commands.c index bd8e8b2..3872602 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -191,11 +191,11 @@ void cmd_avatar(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[ return; } - if (string_is_empty(argv[1])) + if (strlen(argv[1]) < 3) return; if (argv[1][0] != '\"') { - line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Note must be enclosed in quotes."); + line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Path must be enclosed in quotes."); return; } @@ -237,7 +237,7 @@ void cmd_avatar(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[ if (avatar == NULL) exit_toxic_err("Failed in set_avatar", FATALERR_MEMORY); - if (fread(avatar, sz, 1, fp) == -1) { + if (fread(avatar, sz, 1, fp) != 1) { fclose(fp); free(avatar); line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to set avatar: Read fail."); diff --git a/src/misc_tools.h b/src/misc_tools.h index 1190b04..c222fde 100644 --- a/src/misc_tools.h +++ b/src/misc_tools.h @@ -118,7 +118,7 @@ off_t file_size(const char *path); /* compares the first size bytes of fp and signature. Returns 0 if they are the same, 1 if they differ, and -1 on error. - On success this function will seek back to the beginning of fp and will not close fp */ + On success this function will seek back to the beginning of fp */ int check_file_signature(const char *signature, size_t size, FILE *fp); #endif /* #define MISC_TOOLS_H */