Anope IRC Services

Anope Support => 1.8.x/1.7.x Support (Read Only) => Topic started by: Adonis on June 20, 2008, 04:41:20 AM

Title: How to parse the anope .db database
Post by: Adonis on June 20, 2008, 04:41:20 AM
I know my previous topic was closed, and i know that full mysql support is not to be expected any time soon.

I was wondering if someone ever attempted to have php/perl or whatever, parse the Anope .db databases to human readable form, and then store it in MySQL? I want to make an app that does one way (read only) access to the Anope services database for several different purposes. Since it doesn't have to be real time, it would be sufficient to re-parse and store to MySQL only once per hour or so.

Any one ever done this? I would like to do it, but the .db files are hardly readable.
Title:
Post by: Jobe on June 20, 2008, 09:16:51 AM
You could always compile Anope with MySQL support and enable the MySQL options to make Anope save it's data to MySQL anyway.

As for parsing the .db files, they are a custom format with no specification that I know of.

[Edited on 20-6-2008 by Jobe1986]
Title:
Post by: Jan Milants on June 20, 2008, 12:35:39 PM
correct.. to parse them you d have take a look at how they are stored/read by anope and then copy that to your perl script. it s all custom binary, so there s no existing library or so that can parse them.
Maybe looking at some database conversion tools may also help, though those are usually very basic, it s easier to get the overall picture in them.
Title:
Post by: Trystan Scott Lee on June 20, 2008, 10:22:36 PM
Parsing a anope db with php is possible, I had a rough one done for half of the nickserv info at one time, mostly gotta port the read16 and read32 to php which if you can read C and know PHP the process is easy to do. After that follow the load_ns_db() functions duplicate what it does and you can get the info out of a database.
Title:
Post by: Adonis on June 21, 2008, 02:01:16 AM
Unfortunately i don't know C, but if you can possibly post an example, i'll be able to figure it out.