egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Log all bot messages (patch)

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming
View previous topic :: View next topic  
Author Message
forbjok
Voice


Joined: 21 Mar 2007
Posts: 1

PostPosted: Wed Mar 21, 2007 9:22 pm    Post subject: Log all bot messages (patch) Reply with quote

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:
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/patch/eggdrop_1.6.18_log-all-bot-messages.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
Back to top
View user's profile Send private message
dungeon
Voice


Joined: 06 Apr 2006
Posts: 11

PostPosted: Sun Mar 25, 2007 9:24 am    Post subject: Reply with quote

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! Very Happy

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).
Back to top
View user's profile Send private message
dntel
Voice


Joined: 07 Jan 2008
Posts: 1

PostPosted: Mon Jan 07, 2008 3:03 pm    Post subject: NO LOGS Reply with quote

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.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Wed Jan 09, 2008 7:50 am    Post subject: Re: NO LOGS Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
sparc317
Voice


Joined: 23 Jan 2008
Posts: 11

PostPosted: Tue Jan 29, 2008 2:54 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Tue Jan 29, 2008 7:48 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
sparc317
Voice


Joined: 23 Jan 2008
Posts: 11

PostPosted: Wed Jan 30, 2008 5:50 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2835

PostPosted: Wed Jan 30, 2008 2:01 pm    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
sparc317
Voice


Joined: 23 Jan 2008
Posts: 11

PostPosted: Wed Jan 30, 2008 4:20 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
dungeon
Voice


Joined: 06 Apr 2006
Posts: 11

PostPosted: Sun Mar 09, 2008 7:26 am    Post subject: Reply with quote

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)"...?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2835

PostPosted: Sun Mar 09, 2008 3:52 pm    Post subject: Reply with quote

You'd have to send this request to the eggheads devteam. See http://www.eggheads.org
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
FallFromGrace
Voice


Joined: 28 Jul 2008
Posts: 17

PostPosted: Thu Aug 21, 2008 1:09 pm    Post subject: Reply with quote

patch command doesnt work =\

can anyone upload patched 'cmdsirc.c' file (version 1.6.19)?
Back to top
View user's profile Send private message
thommey
Halfop


Joined: 01 Apr 2008
Posts: 73

PostPosted: Fri Jun 12, 2009 8:12 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Sat Jan 22, 2011 9:23 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber