mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-29 19:56:07 -04:00
log: Dont shadow logp
Let's use another name.
This commit is contained in:
parent
a6fa8e8e0d
commit
5a42883c27
32
src/log.c
32
src/log.c
@ -485,32 +485,32 @@ _chat_log_chat(const char *const login, const char *const other, const char *con
|
|||||||
}
|
}
|
||||||
|
|
||||||
gchar *date_fmt = g_date_time_format(timestamp, "%H:%M:%S");
|
gchar *date_fmt = g_date_time_format(timestamp, "%H:%M:%S");
|
||||||
FILE *logp = fopen(dated_log->filename, "a");
|
FILE *chatlogp = fopen(dated_log->filename, "a");
|
||||||
g_chmod(dated_log->filename, S_IRUSR | S_IWUSR);
|
g_chmod(dated_log->filename, S_IRUSR | S_IWUSR);
|
||||||
if (logp) {
|
if (chatlogp) {
|
||||||
if (direction == PROF_IN_LOG) {
|
if (direction == PROF_IN_LOG) {
|
||||||
if (strncmp(msg, "/me ", 4) == 0) {
|
if (strncmp(msg, "/me ", 4) == 0) {
|
||||||
if (resourcepart) {
|
if (resourcepart) {
|
||||||
fprintf(logp, "%s - *%s %s\n", date_fmt, resourcepart, msg + 4);
|
fprintf(chatlogp, "%s - *%s %s\n", date_fmt, resourcepart, msg + 4);
|
||||||
} else {
|
} else {
|
||||||
fprintf(logp, "%s - *%s %s\n", date_fmt, other, msg + 4);
|
fprintf(chatlogp, "%s - *%s %s\n", date_fmt, other, msg + 4);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (resourcepart) {
|
if (resourcepart) {
|
||||||
fprintf(logp, "%s - %s: %s\n", date_fmt, resourcepart, msg);
|
fprintf(chatlogp, "%s - %s: %s\n", date_fmt, resourcepart, msg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(logp, "%s - %s: %s\n", date_fmt, other, msg);
|
fprintf(chatlogp, "%s - %s: %s\n", date_fmt, other, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strncmp(msg, "/me ", 4) == 0) {
|
if (strncmp(msg, "/me ", 4) == 0) {
|
||||||
fprintf(logp, "%s - *me %s\n", date_fmt, msg + 4);
|
fprintf(chatlogp, "%s - *me %s\n", date_fmt, msg + 4);
|
||||||
} else {
|
} else {
|
||||||
fprintf(logp, "%s - me: %s\n", date_fmt, msg);
|
fprintf(chatlogp, "%s - me: %s\n", date_fmt, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fflush(logp);
|
fflush(chatlogp);
|
||||||
int result = fclose(logp);
|
int result = fclose(chatlogp);
|
||||||
if (result == EOF) {
|
if (result == EOF) {
|
||||||
log_error("Error closing file %s, errno = %d", dated_log->filename, errno);
|
log_error("Error closing file %s, errno = %d", dated_log->filename, errno);
|
||||||
}
|
}
|
||||||
@ -599,17 +599,17 @@ _groupchat_log_chat(const gchar *const login, const gchar *const room, const gch
|
|||||||
|
|
||||||
gchar *date_fmt = g_date_time_format(dt, "%H:%M:%S");
|
gchar *date_fmt = g_date_time_format(dt, "%H:%M:%S");
|
||||||
|
|
||||||
FILE *logp = fopen(dated_log->filename, "a");
|
FILE *grpchatlogp = fopen(dated_log->filename, "a");
|
||||||
g_chmod(dated_log->filename, S_IRUSR | S_IWUSR);
|
g_chmod(dated_log->filename, S_IRUSR | S_IWUSR);
|
||||||
if (logp) {
|
if (grpchatlogp) {
|
||||||
if (strncmp(msg, "/me ", 4) == 0) {
|
if (strncmp(msg, "/me ", 4) == 0) {
|
||||||
fprintf(logp, "%s - *%s %s\n", date_fmt, nick, msg + 4);
|
fprintf(grpchatlogp, "%s - *%s %s\n", date_fmt, nick, msg + 4);
|
||||||
} else {
|
} else {
|
||||||
fprintf(logp, "%s - %s: %s\n", date_fmt, nick, msg);
|
fprintf(grpchatlogp, "%s - %s: %s\n", date_fmt, nick, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(logp);
|
fflush(grpchatlogp);
|
||||||
int result = fclose(logp);
|
int result = fclose(grpchatlogp);
|
||||||
if (result == EOF) {
|
if (result == EOF) {
|
||||||
log_error("Error closing file %s, errno = %d", dated_log->filename, errno);
|
log_error("Error closing file %s, errno = %d", dated_log->filename, errno);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user