Anope IRC Services

Anope Development => Modules => Topic started by: Trystan Scott Lee on February 15, 2006, 03:44:29 AM

Title: zbot project
Post by: Trystan Scott Lee on February 15, 2006, 03:44:29 AM
Since drstein has been away for some time and hasn't had time to work on zbot, and people have asked for it to be updated I spent a few over the past few weeks improve it.

Changes
1. Split over many C files to make it easier to maintain and update
2. memory leaks cleaned up (mostly)
3. Code is updated to be stream lined.
4. Uses config file settings so it doesn't require edits to the code
5. works with 1.7.x (tested against current svn before this post)

I have setup space on my svn server for this project. You can grab the source from

svn co svn://svn.nomadirc.net/repos/zbot/trunk

place the zbot directory it downloads in src/modules and compile as normal

[Edited on 15-2-2006 by Trystan]
Title:
Post by: FiXato on February 15, 2006, 04:36:14 AM
Thanks a lot for the work Trystan :)
Nice work on splitting it over several modulair files!
I'll be testing it as soon as I find some time this week :)

By
Quote

4. Uses config file settings so it doesn't require edits to the code

you mean the zbot_config.c file?
Title:
Post by: Trystan Scott Lee on February 15, 2006, 04:51:08 AM
Can add the following lines to services.conf

zbotsqldb "module_bs_zbot"
zbotsqluser "Zbot"
zbotsqlpass "mypass"
zbotsqlhost "localhost"
zbotsqlport 3306
zbotsqlsock "/var/run/mysqld/mysqld.sock"
zbotUseChanPrivmsg
zbotUseNickPrivmsg

all the files make up one module.. but I had a hell of a time find stuff in all one file.. thats why I split it up over serval files so I could maintain it better
Title:
Post by: FiXato on February 15, 2006, 05:27:26 AM
Ahh, okay, that explains it!
Thanks a lot :)
I take it no database changes have to be done when updating from bs_zbot Version: 0.8.8 Author: DrStein?
Title:
Post by: Trystan Scott Lee on February 15, 2006, 01:56:41 PM
No database changes just fixed up the code
Title:
Post by: Gabriel Acevedo on February 19, 2006, 08:15:46 PM
You seem to have made a great work T, although I have not seen the code or tested the module yet I trust in your work.
I had made something but I guess I could help you out with your version or seomthing. We must to talk about.
Title:
Post by: Trystan Scott Lee on February 20, 2006, 10:58:17 PM
doc drop me a line, get you setup on svn so you can do some edits
Title:
Post by: thepitster on February 22, 2006, 12:52:03 AM
any chance of making a non-mysql version ?
Title:
Post by: Trystan Scott Lee on February 22, 2006, 01:53:57 AM
maybe in a bit.. I personally would find the non-sql one faster over all but would eat more memory..
Title:
Post by: thepitster on March 09, 2006, 12:30:01 AM
that would be sweet
Title:
Post by: SpaceDoG on March 10, 2006, 09:01:41 PM
Exactly what is zbot? Also how do you shut off the channel notices?

[Edited on 10-3-2006 by SpaceDoG]
Title:
Post by: Trystan Scott Lee on March 10, 2006, 10:20:01 PM
zbot project is based off a project done by dengle to act as an info bot

!learn word meaning
?word
get meaning

In my project version its a config file option, read the readme
Title:
Post by: SpaceDoG on March 10, 2006, 10:22:01 PM
I did and I commented out the this line zbotUseChanPrivmsg. After reloading the config file it still sends a channel message.
Title:
Post by: Gabriel Acevedo on March 14, 2006, 12:54:34 PM
Quote
Originally posted by thepitster
any chance of making a non-mysql version ?


I was working on that and have something done. As soon as I get in contact with T I will start some code.
Title:
Post by: thepitster on March 29, 2006, 06:05:43 AM
RIGHT ON!!! the doctor is IN!!!
Title:
Post by: Monk on April 02, 2006, 08:46:39 PM
Hi all,

Trystan, we installed your Zbot (SVN rev 3) on Anope-1.7.14 (1025). Channel adding to the zbot works fine but whenever we try to add a term botserv replies with "This key is already defined." although the mysql terms table is empty. If I add a term to the database manually also the ?-command works for this term. Just the adding of new terms does not work. Hope you can help-

Regards,

Monk
Title:
Post by: myself on April 03, 2006, 06:03:10 AM
I have the same problem. ;(
Title:
Post by: paul on May 08, 2006, 12:19:19 AM
I had this same problem however i reverted to an earlier version I found and it works just fine on 1.7x  

The only down side i have now is the mysql connection drops so services has to restart around every 24 hours hehe.
Title:
Post by: DeMiNe0 on May 10, 2006, 03:44:37 AM
I get the following error when i try to load zbot in anope:

Quote
[May 09 21:40:49 2006] Trying to load module [zbot]
[May 09 21:40:49 2006] [zbot.so] Loaded successfully
[May 09 21:40:49 2006] Error: zbotsqldb missing
[May 09 21:40:49 2006] Error: zbotsqluser missing
[May 09 21:40:49 2006] Error: zbotsqlpass missing
[May 09 21:40:49 2006] Error: zbotsqlhost missing
[May 09 21:40:49 2006] zbot sql port set default of 3306
[May 09 21:40:49 2006] zbot requested unload...
[May 09 21:40:49 2006] [zbot.so] module unloaded



I configured the zbot_config.c with:


Code: [Select]
Directive confvalues[][1] = {
        {{"digtox_irc", {{PARAM_STRING, 0, &zbot_db}}}},
        {{"digtox_irc", {{PARAM_STRING, 0, &zbot_user}}}},
        {{"REMOVED", {{PARAM_STRING, 0, &zbot_pass}}}},
        {{"localhost", {{PARAM_STRING, 0, &zbot_host}}}},
        {{"3306", {{PARAM_PORT, 0, &zbot_port}}}},
        {{"/tmp/mysql.sock", {{PARAM_STRING, 0, &zbot_sock}}}},
        {{"zbotUseChanPrivmsg", {{PARAM_SET, 0, &zbot_use_chan_privmsg}}}},
        {{"zbotUseNickPrivmsg", {{PARAM_SET, 0, &zbot_use_nick_privmsg}}}},
    };
Title:
Post by: Trystan Scott Lee on May 10, 2006, 04:46:41 AM
Do NOT modify the code.. you need to edit your config file.. not the code
Title:
Post by: DeMiNe0 on May 10, 2006, 02:34:27 PM
Yup. I JUST noticed that. I got it working now, although now i'm having the same problem as "Monk" and "Myself":


Quote
Hi all,

Trystan, we installed your Zbot (SVN rev 3) on Anope-1.7.14 (1025). Channel adding to the zbot works fine but whenever we try to add a term botserv replies with "This key is already defined." although the mysql terms table is empty. If I add a term to the database manually also the ?-command works for this term. Just the adding of new terms does not work. Hope you can help-

Regards,

Monk



Quote
Originally posted by Trystan
Do NOT modify the code.. you need to edit your config file.. not the code
Title:
Post by: Trystan Scott Lee on May 11, 2006, 07:14:33 PM
I will look into this, I found a few other nasty little memory problems and lack of code checks, so will work on that and get rev4 ready
Title:
Post by: Trystan Scott Lee on June 02, 2006, 12:46:34 AM
Okay rev4 finally ready, tested it and its working all around again.

http://www.nomadinc.net/mymods/files/zbot-1.0.0-svn.tar.gz

rev5 will be a little time off as I want to work on some ideas for improvements, also looking for translators as the code is now globalized
Title:
Post by: Fault on June 04, 2006, 07:59:50 PM
zbot.c: In function `AnopeInit':
zbot.c:32: error: `ac' undeclared (first use in this function)
zbot.c:32: error: (Each undeclared identifier is reported only once
zbot.c:32: error: for each function it appears in.)
make[1]: *** [zbot.o] Error 1
make[1]: Leaving directory `/home/chris/anope-1.7.14/src/modules'
make: *** [modules] Error 2



all I get from zbot trying to make module.
Title:
Post by: Fault on June 08, 2006, 08:48:37 PM
4 days since ipostedfor help. Is this guy even supporting this anymore?
Title:
Post by: Charles Kingsley on June 08, 2006, 09:15:50 PM
Yeah, I'm sure he is but he works two jobs and has a family so I doubt its high on his priority list.

I'm guessing you have tried the latest svn version?
Title:
Post by: Trystan Scott Lee on June 08, 2006, 09:26:01 PM
***screams***

I work two jobs, I sleep about 4 hours a day, and squeeze in coding for you people when I can, and all I get is gumpy ass people whom want want and want more from me and can't imagine when I saw that I work two jobs that I can't find the time to please them...

I will fix this when I actually have a few hours of time in a day to do so... but zbot does not make me any money and people whom are willing to pay for my time get priority.
Title:
Post by: Charles Kingsley on June 08, 2006, 09:56:46 PM
*hugs* Trystan.
Title:
Post by: Dave Robson on June 09, 2006, 08:01:56 AM
Quote
Originally posted by Fault
4 days since ipostedfor help. Is this guy even supporting this anymore?


Ah see, you failed to notice that "this guy" did better that just offering support, he _gave_ you the source code, this means you can find anyone else to help you, or even, help yourself!

Now i know this idea is novell and scary, but its actaully possible to fix problems on your own without making sarcastic comments towards people who help others like you for well, nothing at all.

* on a side note, http://www.catb.org/~esr/faqs/smart-questions.html is a particually good page all about asking for help in open source projects and is certainly worth reading.  I'm sure that somewhere in there it mentions "dont make sarcastic/rude comments".
Title:
Post by: Monk on June 11, 2006, 12:09:29 AM
twelve, a coder in our team had a look on it. Changing line 32 in zbot.c from

if (ac) {

to

if (argc) {

made it compile except a warning about the uninitialized variable u.
Also the bot itself seems to work fine now. The only strange thing is when activating zbot for a channel it says:
[00:51:08] -BotServ- Zbot is now active on #IRCOps.
[00:51:08] -BotServ- Unknown option zbot.

but adding and calling a trigger works now. I'll report back when I have tested it more closely. As usual, many thanks for your work Trystan.

Regards,

Monk
Title:
Post by: Trystan Scott Lee on June 11, 2006, 05:06:32 AM
Thanks Monk, yeah I had it fixed not long after the report just had other things to do for it

The next release rev5 which is up now, adds !help (thanks to BuildSmart) and some code improvements
Title:
Post by: Monk on June 11, 2006, 11:12:58 AM
Thanks for the new release Trystan.

I tested it in Anope SVN r1042 and zbot r5. I found two instances when zbot commands segfaulted Anope and one command which doesn't seem to work like expected.

1. Segfault upon !learn
Happened only once. Sofar I have not been able to reproduce it. I had Anope running in gdb because I was hunting for segfault #2 so find the log attached as "learn_segfault.log"

2. Segfault upon /msg botserv set #chan zbot on/off
This one is reproducible. Playing with on/off makes it segfault eventually. Log is attached as "on_off_segfault.log"

3. !lock command
Trying to lock an existing key brings up an error message:
[11:51:50] (&TestBot): test1 is now known as test
[11:51:53] (~Monk): !lock test
[11:51:53] *TestBot* Syntax: !lock <key>
The debug log for it is attached as "lock_error.log"

I hope you'll find this information useful.

Regards,

Monk
Title:
Post by: Monk on June 11, 2006, 11:14:16 AM
Log for #2
Title:
Post by: Monk on June 11, 2006, 11:14:43 AM
Log for #3
Title:
Post by: Trystan Scott Lee on June 11, 2006, 07:31:31 PM
Okay..

1. lock message is fixed
2. I believe that both the on/off and learn segfault are simlar, a left over from the old code, which I have been correcting in the code as I go, I applied my patch in these areas and haven't seen the problem you reported

The code is in the svn and I will pack it up into a tarball in a few
Title:
Post by: Fault on June 19, 2006, 09:56:14 PM
Quote
Originally posted by Rob
Quote
Originally posted by Fault
4 days since ipostedfor help. Is this guy even supporting this anymore?


Ah see, you failed to notice that "this guy" did better that just offering support, he _gave_ you the source code, this means you can find anyone else to help you, or even, help yourself!

Now i know this idea is novell and scary, but its actaully possible to fix problems on your own without making sarcastic comments towards people who help others like you for well, nothing at all.

* on a side note, http://www.catb.org/~esr/faqs/smart-questions.html is a particually good page all about asking for help in open source projects and is certainly worth reading.  I'm sure that somewhere in there it mentions "dont make sarcastic/rude comments".


Asking if something is supported still is FAR from being sarcastic.

You need to take a course in "what is sarcasm"


this module simply refuses to load.
[4:54pm] -OperServ- Unable to load module zbot

[Edited on 19-6-2006 by Fault]
Title:
Post by: n00bie on August 18, 2006, 09:44:43 AM
i have zbot typed eggdrop bot tcl scripts but eggdrop is laggy. Does a non-mysql version of zbot exist :p ... i'd really like to try it on my net .. but my shell doesn;t supports mysql :~(
Title:
Post by: Trystan Scott Lee on August 18, 2006, 01:58:50 PM
its not currently near ready and I am swampped behind tons of other things
Title:
Post by: n00bie on August 18, 2006, 02:07:42 PM
ok... no problem with that. I'd better change my shell hosting :D
Title:
Post by: JeremiahGriffin on September 16, 2006, 07:22:00 PM
Windows-compatible source code (yes, it works, I'm using it on my server (irc.griffinsoft.net)): http://jeremiah.griffinsoft.net/files/zbot-0.8.9-src.zip
There's no pre-compiled DLL because I'm afraid it would raise too many questions.
You need to be able to compile Anope with MySQL support for this.
Extract it in your [Anope]\src\modules\ directory, open [Anope]\src\modules\makefile.inc.win32 and add zbot to your SUBS line. Compile as usual.
Still requires the same config directives as the Unix-based OS version -- I didn't change that much ;-P
Enjoy.
Title:
Post by: Trystan Scott Lee on September 16, 2006, 09:28:21 PM
hmm that is my source.. before claiming credit for something like this you should try and modify it a bit to make it clear that its yours

Note at this time the zbot that I have been providing very likely works with windows if someone wants a win32 build I will build from my svn and anope 1.7.15
Title:
Post by: JeremiahGriffin on September 16, 2006, 09:51:22 PM
I didn't claim credit, I simply posted the working win32 source.

Edit: I apologize if I did claim credit somewhere.

[Edited on 9-16-0606 by JeremiahGriffin]
Title:
Post by: andy on September 17, 2006, 12:16:17 AM
Trystan, this is off-topic, but:
MoraleServ doesn't seem to work with Anope-1.7.14... Any ideas why?

As in, I get it loaded and everything, but when I go to message it a command (such as help) I get a message back saying that it does not know that command (not even help)...

Could you please fix this, unless I messed something up :\