EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Feature Requests (https://www.eqemulator.org/forums/forumdisplay.php?f=612)
-   -   Record / Log Chat (https://www.eqemulator.org/forums/showthread.php?t=30997)

thepoetwarrior 04-09-2010 09:43 AM

Record / Log Chat
 
Whats the best way to record chat in ooc and other channels? Some players get out of hand and push the limits when I'm at work IRL. Would be AWSOME if all public chat could get recorded into a database table with date/time stamp, player name, and msg, etc. Otherwise, what options do we currently have?

Noport 04-09-2010 01:24 PM

type /log on in chat window

steve 04-09-2010 02:03 PM

I believe he means server-side, without having to be logged in.

thepoetwarrior 04-09-2010 03:00 PM

Yes, server side, cause we have auto reboots and I want to be logged in 24/7 to record. I know /log works with client, but wanted to know if there is a way the source code can do it, either into a text file or into the database would be great.

Secrets 04-09-2010 07:32 PM

Quote:

Originally Posted by thepoetwarrior (Post 186294)
Yes, server side, cause we have auto reboots and I want to be logged in 24/7 to record. I know /log works with client, but wanted to know if there is a way the source code can do it, either into a text file or into the database would be great.

I'll see if I can work something up for you.

It would be pretty easy to just dump all the chat to their own logfile with the way the logfile system is set up.

thepoetwarrior 04-09-2010 09:35 PM

Awsome, can't wait.

Secrets 04-10-2010 03:32 AM

I had finished this earlier, just forgot to post it.

It puts all chat into its own log file. If you need to disable it, you're gonna need to recompile and change the EQDEBUG flag for chat.

If that's just confusing for you, well, here's a diff that you can apply.

Keep in mind this doesn't guarantee the person on the other end has received the tell, this is just what gets sent to the server to be sent elsewhere (ie: to other clients.)

Code:

Index: common/debug.cpp
===================================================================
--- common/debug.cpp        (revision 1367)
+++ common/debug.cpp        (working copy)
@@ -28,8 +28,8 @@
 static EQEMuLog realLogFile;
 EQEMuLog *LogFile = &realLogFile;
 
-static const char* FileNames[EQEMuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands" };
-static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command" };
+static const char* FileNames[EQEMuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/eqemu_chat" };
+static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Chat" };
 
 EQEMuLog::EQEMuLog() {
 //        MOpen = new Mutex;
@@ -54,6 +54,7 @@
        pLogStatus[Error] = 2;
        pLogStatus[Quest] = 2;
        pLogStatus[Commands] = 1;
+        pLogStatus[Chat] = 1;
 #endif
        logFileValid = true;
 }
Index: common/debug.h
===================================================================
--- common/debug.h        (revision 1367)
+++ common/debug.h        (working copy)
@@ -112,6 +112,7 @@
                Debug,
                Quest,
                Commands,
+                Chat,
                MaxLogID
        };
       
Index: zone/client.cpp
===================================================================
--- zone/client.cpp        (revision 1367)
+++ zone/client.cpp        (working copy)
@@ -788,6 +788,7 @@
                else if (!worldserver.SendChannelMessage(this, targetname, chan_num, GuildID(), language, message))
                        Message(0, "Error: World server disconnected");
                break;
+                LogFile->write(EQEMuLog::Chat, "%s says to guild %i, %s", this->GetName(), GuildID(), message);
        }
        case 2: { // GroupChat
                Raid* raid = entity_list.GetRaidByClient(this);
@@ -800,12 +801,14 @@
                if(group != NULL) {
                        group->GroupMessage(this,language,lang_skill,(const char*) message);
                }
+                LogFile->write(EQEMuLog::Chat, "%s says to group, %s", this->GetName(), message);
                break;
        }
        case 15: { //raid say
                Raid* raid = entity_list.GetRaidByClient(this);
                if(raid){
                        raid->RaidSay((const char*) message, this);
+                        LogFile->write(EQEMuLog::Chat, "%s says to raid, %s", this->GetName(), message);
                }
                break;
        }
@@ -813,7 +816,7 @@
                Mob *sender = this;
                if (GetPet() && GetPet()->FindType(SE_VoiceGraft))
                        sender = GetPet();
-
+                LogFile->write(EQEMuLog::Chat, "%s shouts, %s", this->GetName(), message);
                entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
                  break;
          }
@@ -842,7 +845,7 @@
                                        return;
                                }
                        }
-
+                        LogFile->write(EQEMuLog::Chat, "%s says to auction, %s", this->GetName(), message);
            if (!worldserver.SendChannelMessage(this, 0, 4, 0, language, message))
                        Message(0, "Error: World server disconnected");
                }
@@ -886,6 +889,8 @@
                                        return;
                                }
                        }
+
+                        LogFile->write(EQEMuLog::Chat, "%s says out of character, %s", this->GetName(), message);
                       
                        if (!worldserver.SendChannelMessage(this, 0, 5, 0, language, message))
                        {
@@ -898,7 +903,7 @@
 
                        if (GetPet() && GetPet()->FindType(SE_VoiceGraft))
                                sender = GetPet();
-
+                        LogFile->write(EQEMuLog::Chat, "%s says out of character, %s", this->GetName(), message);
                        entity_list.ChannelMessage(sender, chan_num, language, message);
                }
                break;
@@ -909,7 +914,9 @@
                        Message(0, "Error: Only GMs can use this channel");
                else if (!worldserver.SendChannelMessage(this, targetname, chan_num, 0, language, message))
                        Message(0, "Error: World server disconnected");
+                LogFile->write(EQEMuLog::Chat, "%s BROADCASTS, %s", this->GetName(), message);
                break;
+
        }
        case 7: { // Tell
                        if(!global_channel_timer.Check())
@@ -935,6 +942,8 @@
                                }
                        }
 
+                        LogFile->write(EQEMuLog::Chat, "%s tells %s, %s", this->GetName(), targetname, message);
+
                        if(!worldserver.SendChannelMessage(this, targetname, chan_num, 0, language, message))
                                Message(0, "Error: World server disconnected");
                break;
@@ -949,6 +958,7 @@
                        sender = GetPet();
 
                printf("Message: %s\n",message);
+                LogFile->write(EQEMuLog::Chat, "%s says, %s", this->GetName(), message);
                entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
 
                if (sender != this)


thepoetwarrior 04-10-2010 12:04 PM

Awsome! Your a life saver. I saved this to file already, and will try to use it on our new server hardware this weekend during the install / setup.

Thanks a ton!

Lillu 04-10-2010 01:02 PM

Thank you Secrets, very handy.

bruise 10-24-2011 06:32 PM

I apologize for resurrecting an old thread but i was wondering, how would I run this? Thanks!

trevius 10-25-2011 03:45 AM

You have to manually edit the changes that Secrets posted into your source and compile it yourself. Keep in mind that this was posted a while back so the line numbers most likely don't match up exactly, but it isn't hard to figure out the correct places to make the changes with the current source.

bruise 10-25-2011 11:42 AM

Thanks for the quick response! I manually added everything and have rebooted my server but still I'm not seeing anything logged for chat. I have double and triple checked that everything is in the right place and the only thing I found different was where above it says:
Quote:

else if (!worldserver.SendChannelMessage(this, targetname, chan_num, 0, language, message))
Mine instead has target_name but i suspect that shouldn't make any difference for the logging. This may sound stupid but I'm not sure how to "compile" it after I editted the files. Thanks a bunch for your assistance!

Congdar 10-25-2011 12:11 PM

wiki info on compiling: http://www.eqemulator.net/wiki/wikka.php?wakka=VS2008

bruise 10-25-2011 12:37 PM

Thanks, I found 'compile' by right clicking the 2 cpp files in VB Express and it said they compiled successfully but the logging still isn't showing at all. I tried rebooting the server pc as well. Should i compile everything over again like shown in the wiki link above? I have custom items/rules/etc on my server that i really can't lose so before I compile everything, will i lose anything in the process? I see a log type in c:\eqemu\logs called eqemu_chatchannels_***.log but there's nothing really in there except stating the log was started.

Thanks!

revloc02c 10-26-2011 11:05 AM

I hope I am not belittling you by asking you about something you feel is obvious, but after you compiled did you copy the .exe files over to your server folder?


All times are GMT -4. The time now is 09:59 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.