summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2009-08-26 18:32:32 -0400
committerMadCamel <madcamel@gmail.com>2009-08-26 18:34:50 -0400
commit79874123b9e62276c67bc2f8e300d6b88d43e151 (patch)
tree2a57e2672236482be073f51e1e2b08bee0dea0d3 /src/map/atcommand.c
parent5c2a36301c9cc39979137b93262f4e3db1071d5e (diff)
downloadtmwa-79874123b9e62276c67bc2f8e300d6b88d43e151.tar.gz
tmwa-79874123b9e62276c67bc2f8e300d6b88d43e151.tar.bz2
tmwa-79874123b9e62276c67bc2f8e300d6b88d43e151.tar.xz
tmwa-79874123b9e62276c67bc2f8e300d6b88d43e151.zip
Autobans are now logged, more chat spam improvements
Added a timeout to the total repeat counter. 5 minutes by default.
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 39e62da..de44d77 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -544,13 +544,27 @@ int get_atcommand_level(const AtCommandType type) {
/*========================================
* At-command logging
*/
+void log_atcommand(struct map_session_data *sd, const char *fmt, ...) {
+ char message[512];
+ va_list ap;
-int last_logfile_nr = 0;
-char *gm_logfile_name = NULL;
-static FILE *gm_logfile = NULL;
+ va_start(ap, fmt);
+ vsnprintf(message, 511, fmt, ap);
+ va_end(ap);
-void log_atcommand(struct map_session_data *sd, const char *fmt, ...)
-{
+ if (pc_isGM(sd))
+ gm_log("%s(%d,%d) %s : %s", map[sd->bl.m].name, sd->bl.x,
+ sd->bl.y, sd->status.name, message);
+}
+
+char *gm_logfile_name = NULL;
+/*==========================================
+ * Log a timestamped line to GM log file
+ *------------------------------------------
+ */
+void gm_log(const char *fmt, ...) {
+ static int last_logfile_nr = 0;
+ static FILE *gm_logfile = NULL;
time_t time_v;
struct tm ctime;
int month, year, logfile_nr;
@@ -588,16 +602,14 @@ void log_atcommand(struct map_session_data *sd, const char *fmt, ...)
last_logfile_nr = logfile_nr;
}
- if (gm_logfile && pc_isGM(sd)) {
- fprintf(gm_logfile, "[%04d-%02d-%02d %02d:%02d:%02d] %s(%d,%d) %s : %s\n",
- year, month, ctime.tm_mday,
- ctime.tm_hour, ctime.tm_min, ctime.tm_sec,
- map[sd->bl.m].name, sd->bl.x, sd->bl.y, sd->status.name,
- message);
- fflush(gm_logfile);
- }
+ fprintf(gm_logfile, "[%04d-%02d-%02d %02d:%02d:%02d] %s\n",
+ year, month, ctime.tm_mday, ctime.tm_hour,
+ ctime.tm_min, ctime.tm_sec, message);
+
+ fflush(gm_logfile);
}
+
/*==========================================
*is_atcommand @コマンドに存在するかどうか確認する
*------------------------------------------