mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-27 02:03:26 +01:00
small fix
This commit is contained in:
parent
c3f68b60d3
commit
9d5fe03285
17
src/log.c
17
src/log.c
@ -44,7 +44,7 @@ static int init_logging_session(char *name, const char *selfkey, const char *oth
|
|||||||
if (!valid_nick(name))
|
if (!valid_nick(name))
|
||||||
name = UNKNOWN_NAME;
|
name = UNKNOWN_NAME;
|
||||||
|
|
||||||
const char *namedash = "-";
|
const char *namedash = logtype == LOG_PROMPT ? "" : "-";
|
||||||
const char *set_path = user_settings_->chatlogs_path;
|
const char *set_path = user_settings_->chatlogs_path;
|
||||||
|
|
||||||
char *user_config_dir = get_user_config_dir();
|
char *user_config_dir = get_user_config_dir();
|
||||||
@ -53,32 +53,27 @@ static int init_logging_session(char *name, const char *selfkey, const char *oth
|
|||||||
|
|
||||||
/* first 6 digits of selfkey */
|
/* first 6 digits of selfkey */
|
||||||
char self_id[32];
|
char self_id[32];
|
||||||
path_len += (KEY_IDENT_DIGITS * 3 + 5);
|
path_len += KEY_IDENT_DIGITS * 2;
|
||||||
sprintf(&self_id[0], "%02X", selfkey[0] & 0xff);
|
sprintf(&self_id[0], "%02X", selfkey[0] & 0xff);
|
||||||
sprintf(&self_id[2], "%02X", selfkey[1] & 0xff);
|
sprintf(&self_id[2], "%02X", selfkey[1] & 0xff);
|
||||||
sprintf(&self_id[4], "%02X", selfkey[2] & 0xff);
|
sprintf(&self_id[4], "%02X", selfkey[2] & 0xff);
|
||||||
self_id[KEY_IDENT_DIGITS * 3 + 1] = '\0';
|
self_id[KEY_IDENT_DIGITS * 2] = '\0';
|
||||||
|
|
||||||
char other_id[32] = {0};
|
char other_id[32] = {0};
|
||||||
|
|
||||||
switch (logtype) {
|
switch (logtype) {
|
||||||
case LOG_CHAT:
|
case LOG_CHAT:
|
||||||
path_len += (KEY_IDENT_DIGITS * 3 + 5);
|
path_len += KEY_IDENT_DIGITS * 2;
|
||||||
sprintf(&other_id[0], "%02X", otherkey[0] & 0xff);
|
sprintf(&other_id[0], "%02X", otherkey[0] & 0xff);
|
||||||
sprintf(&other_id[2], "%02X", otherkey[1] & 0xff);
|
sprintf(&other_id[2], "%02X", otherkey[1] & 0xff);
|
||||||
sprintf(&other_id[4], "%02X", otherkey[2] & 0xff);
|
sprintf(&other_id[4], "%02X", otherkey[2] & 0xff);
|
||||||
other_id[KEY_IDENT_DIGITS * 3 + 1] = '\0';
|
other_id[KEY_IDENT_DIGITS * 2] = '\0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOG_GROUP:
|
case LOG_GROUP:
|
||||||
strftime(other_id, sizeof(other_id), "%Y-%m-%d[%H:%M:%S]", get_time());
|
strftime(other_id, sizeof(other_id), "%Y-%m-%d[%H:%M:%S]", get_time());
|
||||||
path_len += strlen(other_id);
|
path_len += strlen(other_id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOG_PROMPT:
|
|
||||||
namedash = "";
|
|
||||||
--path_len;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char log_path[MAX_STR_SIZE];
|
char log_path[MAX_STR_SIZE];
|
||||||
@ -177,7 +172,7 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
|
|||||||
char *hstbuf = malloc(sz);
|
char *hstbuf = malloc(sz);
|
||||||
|
|
||||||
if (hstbuf == NULL)
|
if (hstbuf == NULL)
|
||||||
exit_toxic_err("failed in print_prev_chat_history", FATALERR_MEMORY);
|
exit_toxic_err("failed in load_chat_history", FATALERR_MEMORY);
|
||||||
|
|
||||||
if (fread(hstbuf, sz, 1, log->file) != 1) {
|
if (fread(hstbuf, sz, 1, log->file) != 1) {
|
||||||
free(hstbuf);
|
free(hstbuf);
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#define MAX_STR_SIZE TOX_MAX_MESSAGE_LENGTH
|
#define MAX_STR_SIZE TOX_MAX_MESSAGE_LENGTH
|
||||||
#define MAX_CMDNAME_SIZE 64
|
#define MAX_CMDNAME_SIZE 64
|
||||||
#define TOXIC_MAX_NAME_LENGTH 32 /* Must be <= TOX_MAX_NAME_LENGTH */
|
#define TOXIC_MAX_NAME_LENGTH 32 /* Must be <= TOX_MAX_NAME_LENGTH */
|
||||||
#define KEY_IDENT_DIGITS 2 /* number of hex digits to display for the pub-key based identifier */
|
#define KEY_IDENT_DIGITS 3 /* number of hex digits to display for the pub-key based identifier */
|
||||||
#define TIME_STR_SIZE 16
|
#define TIME_STR_SIZE 16
|
||||||
|
|
||||||
/* ASCII key codes */
|
/* ASCII key codes */
|
||||||
|
Loading…
Reference in New Issue
Block a user