From bf999f195a0be20519356644df1940cf18d905e7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 01:16:37 +0300 Subject: Add file reading, writing and appending functions that create folders if bool is true Fix server_address not being properly created in packet distribution Create a log file when you join a server in the logs//.log and update it every time there's a new chat entry minor refactor of chatlogpiece --- include/aoapplication.h | 12 ++++++++++++ include/chatlogpiece.h | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/aoapplication.h b/include/aoapplication.h index e63ab8e7..24dc35ce 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -201,6 +201,15 @@ public: //Returns the list of words in callwords.ini QStringList get_call_words(); + //Process a file and return its text as a QString + QString read_file(QString filename); + + //Write text to file. make_dir would auto-create the directory if it doesn't exist. + bool write_to_file(QString p_text, QString p_file, bool make_dir = false); + + //Append text to the end of the file. make_dir would auto-create the directory if it doesn't exist. + bool append_to_file(QString p_text, QString p_file, bool make_dir = false); + //Appends the argument string to serverlist.txt void write_to_serverlist_txt(QString p_line); @@ -337,6 +346,9 @@ public: // Get the message for the CM for casing alerts. QString get_casing_can_host_cases(); + //The file name of the log file in base/logs. + QString log_filename; + private: const int RELEASE = 2; const int MAJOR_VERSION = 6; diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 34c5926b..303c2351 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -14,7 +14,7 @@ public: QString get_name(); QString get_showname(); QString get_message(); - bool get_is_song(); + bool is_song(); QDateTime get_datetime(); QString get_datetime_as_string(); @@ -25,7 +25,7 @@ private: QString showname; QString message; QDateTime datetime; - bool is_song; + bool p_is_song; }; #endif // CHATLOGPIECE_H -- cgit