This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Log all bot messages (patch)

Discussion of Eggdrop's code and module programming in C.
Post Reply
f
forbjok
Voice
Posts: 1
Joined: Wed Mar 21, 2007 8:54 pm

Log all bot messages (patch)

Post by forbjok »

Hi. Some time ago, i needed to have my eggdrop log all messages, including those said by the eggdrop bot itself. (by default, it will only log messages from other users, which leaves the logs incomplete)

To accomplish that, I made this small modification:

Code: Select all

Index: src/mod/irc.mod/cmdsirc.c
===================================================================
--- src/mod/irc.mod/cmdsirc.c	(revision 10)
+++ src/mod/irc.mod/cmdsirc.c	(revision 11)
@@ -112,6 +112,8 @@
   putlog(LOG_CMDS, "*", "#%s# (%s) act %s", dcc[idx].nick, chan->dname, par);
   dprintf(DP_HELP, "PRIVMSG %s :\001ACTION %s\001\n", chan->name, par);
   dprintf(idx, "Action to %s: %s\n", chan->dname, par);
+
+  putlog(LOG_PUBLIC, chan->dname, "Action: %s %s", botname, par);
 }
 
 static void cmd_msg(struct userrec *u, int idx, char *par)
@@ -158,6 +160,11 @@
   putlog(LOG_CMDS, "*", "#%s# (%s) say %s", dcc[idx].nick, chan->dname, par);
   dprintf(DP_HELP, "PRIVMSG %s :%s\n", chan->name, par);
   dprintf(idx, "Said to %s: %s\n", chan->dname, par);
+
+  if (me_op(chan))
+    putlog(LOG_PUBLIC, chan->dname, "@<%s> %s", botname, par);
+  else
+    putlog(LOG_PUBLIC, chan->dname, "<%s> %s", botname, par);
 }
 
 static void cmd_kickban(struct userrec *u, int idx, char *par)
It can also be downloaded as a patch file here: http://www.cerealsmoker.net/~forbjok/pa ... ages.patch
This patch was created for eggdrop 1.6.18, but might work for others as well. (I haven't tested)

Hopefully this will save someone the bother of looking for hours for information on how to accomplish this :wink:
d
dungeon
Voice
Posts: 11
Joined: Thu Apr 06, 2006 7:55 am

Post by dungeon »

This is EXACTLY what I was looking for.

In searching all forums, I couldn't work out why the bot's own messages weren't getting logged - I thought there was some problem with the PUB bind, but I still wasn't getting everything.

Way to go, forbjok. Thanks muchly for this! Yahoo! :D

Oh, one other thing... is there any easy way of actually printing out the mode characters in logfiles? Having <@opname> rather than just <opname> so that their channel level can be ascertained in the logfile?

I've tried a few logging scripts and someone started writing some TCL for me, but it involved running a ishop/isop etc on EVERY *PUB* line. Considering that there's a inbuilt logging function, I thought it'd be a simple recode of the source (but I'm not a C programmer, unfortunately).
d
dntel
Voice
Posts: 1
Joined: Mon Jan 07, 2008 2:57 pm

NO LOGS

Post by dntel »

Hi,

Its a missing log function that you did well done but ...

I patch my source (latest) but i have no logs from private messages from my bot.

Please responce the right way to patch or something usefull tip

Thanks.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Re: NO LOGS

Post by Alchera »

dntel wrote:Hi,

Its a missing log function that you did well done but ...

I patch my source (latest) but i have no logs from private messages from my bot.

Please responce the right way to patch or something usefull tip

Thanks.
Private messages to you when you initiate a DCC/CTCP Chat to your bot?? If so, check your IRC client's logs.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
s
sparc317
Voice
Posts: 11
Joined: Wed Jan 23, 2008 9:34 am

Post by sparc317 »

Hi,

Tried this patch but doesn't work for me. My bot just messages a channel (gets its input from a TCL script)

It logs all messages to the channel from other users, but not from itself.

Any ideas as would be nice for this to work?

Thanks
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

It appears eggdrop doesn't log it's own messages sent to a channel.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
s
sparc317
Voice
Posts: 11
Joined: Wed Jan 23, 2008 9:34 am

Post by sparc317 »

Yeah, quite annoying really but not a showstopper.

I just added an addition putlog command in my TCL script which logs the same message that is sent to the channel in the end.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

The big problem with logging outbound messages is that there is no hooks for adding messages to any of the queue's, neither is there one upon de-queueing (sending) any of the messages in the queue. Also, if these were available, you would still have to match the command to see what kind of command is being sent, possibly causing trouble with non-standard extensions (nick/chanserv, psybnc, etc).

The closest thing you can get to this, is activating "raw logging", which enables two new logflags, one for outbound server traffic (v), and one for inbound server traffic (r). See the "raw-log" setting in your eggdrop-configfile for further info.
NML_375
s
sparc317
Voice
Posts: 11
Joined: Wed Jan 23, 2008 9:34 am

Post by sparc317 »

nml375 wrote: The closest thing you can get to this, is activating "raw logging", which enables two new logflags, one for outbound server traffic (v), and one for inbound server traffic (r). See the "raw-log" setting in your eggdrop-configfile for further info.
Thanks, I'll check this out.
d
dungeon
Voice
Posts: 11
Joined: Thu Apr 06, 2006 7:55 am

Post by dungeon »

Is there any chance that this patch (or one that logs bot responses also) could be included into the main source?

I don't want to accuse it of being a bug, but the config file *does* say that the "p" option logs all public chat - which implies that output from bot SAY/ACT is not considered public (or perhaps a note in the config file to warn that text from bot is excluded).

I'm guessing that a setting in the config file could elect to flick on/off logging bot natter in the event that people still want the original behaviour. How about "p = all public (non-bot)" and "P = public (including bot)"...?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

You'd have to send this request to the eggheads devteam. See http://www.eggheads.org
NML_375
F
FallFromGrace
Voice
Posts: 17
Joined: Mon Jul 28, 2008 8:52 am

Post by FallFromGrace »

patch command doesnt work =\

can anyone upload patched 'cmdsirc.c' file (version 1.6.19)?
t
thommey
Halfop
Posts: 76
Joined: Tue Apr 01, 2008 2:59 pm

Post by thommey »

I don't see a chance for this making it into the eggdrop core. It is way more difficult to do this correctly. Imagine a channel mode +c which blocks messages with colors/control codes (as seen on QuakeNet). There is no guarantee the message actually reaches the channel. The bot might also be banned or muted and it would still log its own message.

To do this in a for-all-networks compatible way, with respect to blocked messages, one would need to maintain a list of negative replies to a PRIVMSG which indicate that delivery failed. And it'd be quite a mess to always remember the last message to which such an error token would refer. Unfortunately, there are no positive replies for PRIVMSGs in the IRC protocol.

Eggdrop1.6.20+ has "bind out" which will trigger when a message is sent to the server. This offers the possibility to make a tcl script which watches and putloglevs PRIVMSGs.

Backwards compatible script that logs eggdrop's own messages using bind out if available

Edit: Fixed a typo and added trace script

Update 2011-08: Changed link to a script that makes use of bind out to also catch modules and internal messages not sent from scripts. Eggdrop1.6.20 has bind out now.
Last edited by thommey on Sat Aug 13, 2011 8:30 pm, edited 3 times in total.
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

Thommey,

Thanks for the script to allow the bot to log itself, still works well on latest build.

Cheers!
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Post Reply