From bc0920a59eec9de3889e566468076ebd6d8e5d8e Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Fri, 14 Jan 2011 22:23:02 -0700 Subject: [PATCH] German translation. Contributed by Chazz "Alexandria" Wolcott. --- lang/de.alf | 19 +++++++++++ src/DB/Flatfile.pm | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 lang/de.alf diff --git a/lang/de.alf b/lang/de.alf new file mode 100644 index 0000000..cae0057 --- /dev/null +++ b/lang/de.alf @@ -0,0 +1,19 @@ +# Auto IRC Bot. An advanced, lightweight and powerful IRC bot. +# Copyright (C) 2010-2011 Xelhua Development Team (doc/CREDITS) +# This program is free software; rights to this code are stated in doc/LICENSE. + +# German translation file. + + +# Permission denied - Keine Berechtigung +msge "Permission_denied" "Keine Berechtigung" + +# Access denied - Keine Zugang +msge "Access_denied" "Keine Zugang" + +# Not enough parameters - Nicht genug Parameter +msge "Not_enough_parameters" "Nicht genug Parameter" + +# Unknown command - Unbekannter Befehl +msge "Unknown_command" "Unbekannter Befehl" + diff --git a/src/DB/Flatfile.pm b/src/DB/Flatfile.pm index e69de29..3c0802a 100644 --- a/src/DB/Flatfile.pm +++ b/src/DB/Flatfile.pm @@ -0,0 +1,85 @@ +# Auto IRC Bot. An advanced, lightweight and powerful IRC bot. +# Copyright (C) 2010-2011 Xelhua Development Team (doc/CREDITS) +# This program is free software; rights to this code are stated in doc/LICENSE. +use strict; +use warnings; + +# Database subroutines for the Auto-Flatfile database format. +package DB; +my (%MEM); + + +# Database initial loading. +sub load +{ + # Open, read and close the database. + open FILE, "<$Auto::Bin/../etc/auto.db" or return 0; + my @fbuf = or return 0; + close FILE or return 0; + + # Make sure the database version is compatible. + if ($fbuf[0] ne "DBV Auto-Flatfile_1.0\n") { + # It is not. Bail. + return 0; + } + + # Iterate the buffer. + foreach my $buff (@fbuf) { + # Check if the buffer is defined. + if (defined $buff) { + # Space buffer. + my @lbuf = split(' ', $buff); + + # Check if the first two values are defined. + if (defined $lbuf[0] and defined $lbuf[1]) { + # Get a count of the values in the buffer minus one. + my $c = scalar(@lbuf) - 1; + + # Create an array of the values excluding the first. + my @vs; + for (my $i = $c; $i <= $c; $i++) { + push(@vs, $lbuf[$i]); + } + + # Insert data into memory. + if (defined $MEM{$lbuf[0]}) { + # There is a database entry of the same name already, add to existing array. + push(@{ $MEM{$lbuf[0]} }, [ @vs ]); + } + else { + # This is the first database entry of this name, create an array. + $MEM{$lbuf[0]} = [ @vs ]; + } + } + } + } + return 1; +} + +# Database flush to disk. +sub flush +{ + +} + +# Get database value. +sub get +{ + my ($name) = @_; + + if (defined $MEM{$name}) { + return $MEM{$name}; + } + else { + return 0; + } +} + +# Write to database. +sub write +{ + +} + + +1;