summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-09 11:03:40 +0100
committerHaru <haru@dotalux.com>2015-12-09 11:03:40 +0100
commit63abf092ab36d39ee4acc67d3c90091cb12b16f1 (patch)
tree88c6b593704b6956c8c289b86de35403b69c15eb /src/map
parentf8fb58594989a4be8e11be4d61beed527d94261d (diff)
downloadhercules-63abf092ab36d39ee4acc67d3c90091cb12b16f1.tar.gz
hercules-63abf092ab36d39ee4acc67d3c90091cb12b16f1.tar.bz2
hercules-63abf092ab36d39ee4acc67d3c90091cb12b16f1.tar.xz
hercules-63abf092ab36d39ee4acc67d3c90091cb12b16f1.zip
Fixed a nullpo check failure in log_chat
- Thanks to Michieru Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/log.c57
1 files changed, 51 insertions, 6 deletions
diff --git a/src/map/log.c b/src/map/log.c
index c5dd0d044..70f5dfc9a 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -338,7 +338,21 @@ void log_npc(struct map_session_data* sd, const char* message)
logs->npc_sub(sd,message);
}
-void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char* dst_charname, const char* message) {
+/**
+ * Logs a chat message to the SQL backend.
+ *
+ * @param type Chat type.
+ * @param type_id Additional ID, dependent on chat type (Guild ID, Party ID, etc). Zero when unused.
+ * @param src_charid Source character ID.
+ * @param src_accid Source account ID.
+ * @param mapname Source location map name
+ * @param x Source location x coordinate
+ * @param y Source location y coordinate
+ * @param dst_charname Destination character name. Must not be NULL.
+ * @param message Message to log.
+ */
+void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message)
+{
SqlStmt* stmt;
nullpo_retv(dst_charname);
@@ -355,7 +369,22 @@ void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src
}
SQL->StmtFree(stmt);
}
-void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char* dst_charname, const char* message) {
+
+/**
+ * Logs a chat message to the TXT backend.
+ *
+ * @param type Chat type.
+ * @param type_id Additional ID, dependent on chat type (Guild ID, Party ID, etc). Zero when unused.
+ * @param src_charid Source character ID.
+ * @param src_accid Source account ID.
+ * @param mapname Source location map name
+ * @param x Source location x coordinate
+ * @param y Source location y coordinate
+ * @param dst_charname Destination character name. Must not be NULL.
+ * @param message Message to log.
+ */
+void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message)
+{
char timestring[255];
time_t curtime;
FILE* logfp;
@@ -371,18 +400,34 @@ void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src
fclose(logfp);
}
-/// logs chat
-void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char* dst_charname, const char* message) {
- if( ( logs->config.chat&type ) == 0 ) {
+/**
+ * Logs a chat message.
+ *
+ * @param type Chat type.
+ * @param type_id Additional ID, dependent on chat type (Guild ID, Party ID, etc). Zero when unused.
+ * @param src_charid Source character ID.
+ * @param src_accid Source account ID.
+ * @param mapname Source location map name
+ * @param x Source location x coordinate
+ * @param y Source location y coordinate
+ * @param dst_charname Destination character name. May be NULL when unused.
+ * @param message Message to log.
+ */
+void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message)
+{
+ if ((logs->config.chat&type) == 0) {
// disabled
return;
}
- if( logs->config.log_chat_woe_disable && ( map->agit_flag || map->agit2_flag ) ) {
+ if (logs->config.log_chat_woe_disable && (map->agit_flag || map->agit2_flag)) {
// no chat logging during woe
return;
}
+ if (dst_charname == NULL)
+ dst_charname = "";
+
logs->chat_sub(type,type_id,src_charid,src_accid,mapname,x,y,dst_charname,message);
}