dslinux/user/bitchx/dll/europa COPYING CREDITS Makefile.in README europa.c europa.h knowledgebase.sql

stsp stsp at user.in-berlin.de
Sun Jul 2 15:18:35 CEST 2006


Update of /cvsroot/dslinux/dslinux/user/bitchx/dll/europa
In directory antilope:/tmp/cvs-serv9280/dll/europa

Added Files:
	COPYING CREDITS Makefile.in README europa.c europa.h 
	knowledgebase.sql 
Log Message:
Adding pristine copy of BitchX so I can branch from it.


--- NEW FILE: README ---
Europa v0.01
Copyright (c) 1999, Ed Schlunder <zilym at asu.edu>

This is Free Software licensed under the GNU GPL. Please see COPYING for
details.

WARNING - YOUR MILEAGE MAY VARY. USE AT YOUR OWN RISK. AUTHOR IS NOT
RESPONSIBLE FOR ANY DAMAGES INCURRED THROUGH THE USE OF THIS PACKAGE.

SUMMARY
--------------------------------------------------------------------------
Europa is a BitchX (popular irc client) plugin to provide easy access to
an SQL knowledgebase. This is helpful for use in help channels where
common questions repeatedly come up.

BACKGROUND
--------------------------------------------------------------------------
For the past 2-3 years, we've been answering people's questions about Linux
in the EFnet IRC channel #linuxinfo. Jeremy Tregunna wrote a bot
in Perl called 'Penguin' that stored tons of keyword/answers pairs in
a database so that channel operators could store commonly asked question
answers in. When a Linux newbie came in and asked a question already
answered several times before in prior conversations, we simply ask
Penguin to please explain the keyword associated with the question, saving
us a lot of typing time.

I've always admired the Penguin bot a lot and wished I could run one
myself. However, I don't have access to any IRC servers that allow bots. 
This led to the developement of Europa, a BitchX plugin that listens to
channels you are chatting on and automatically responds when it sees
someone giving it a command. This lets you chat on IRC as a normal user
like you've always done, but also have a nice SQL knowledgebase available
at your (and your friends) finger tips.

REQUIREMENTS
--------------------------------------------------------------------------
Europa currently only support MySQL (http://www.mysql.com/) for the
database backend. You will need to have MySQL already installed
and working to use Europa.

To use Europa, you need to be using BitchX (http://www.bitchx.org/). In
addition, to compile Europa, you will need a copy of the BitchX source
code extracted as ../BitchX (relative to Europa's directory).

INSTALLATION
--------------------------------------------------------------------------
1. Extract the Europa source code and the BitchX source code:
   gzip -cd europa-xxx.tar.gz | tar xvf -
   gzip -cd BitchX-1.0c13.tar.gz | tar xvf -

   These should be extracted this way so that the Europa makefile can
   access the BitchX include files (see Makefile to see what I mean).

2. Compile and install BitchX
   cd BitchX/
   less INSTALL

3. Create a database for Europa to use on your mysql server:
   mysql mysql -u root -p
     create database europa;
     insert into user values('%','europa',password('APASSWD'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
     insert into db values('%','europa','europa','Y','Y','Y','Y','N','N','N','N','N','N');
     exit

   mysqladmin reload -u root -p
   mysql europa -u root -p < knowledgebase.sql

4. Edit europa.h to match your settings, should be self explanatory.

5. Compile the Europa source code:
   make

6. Copy the resulting europa.so file to your ~/.BitchX/plugins/ directory,
   or alternatively you could put it in your system wide BitchX plugins
   directory (/usr/local/lib/bx/plugins/ on my system).   

7. Start up BitchX. Do a "/loaddll europa.so" and you should see
   Europa load and connect to your SQL knowledgebase.

   You may want to add the command "LOADDLL europa.so" to your
   ~/.BitchX/BitchX.sav file so that Europa loads automatically everytime
   you start BitchX.

USING EUROPA
--------------------------------------------------------------------------
Now that you've got it running, what can you do? Join a channel with
some people on it. You may want to start another IRC session so you
can talk to yourself (Europa can only see public commands from other
clients, someone tell me how to fix that ;-). Suppose the client running
Europa has the nick "jonny" and your second session has the nick "jon".
A typical chat might look like:

<jon> jonny: explain winnt
<jonny> jon: Windows NT is a fully 32-bit operating system for the i386 and 
          Alpha hardware playforms with superb multi-tasking and server
          functionality.  Written by Microsoft Corporation 
	  (http://www.microsoft.com/).
<jon> jonny: forget winnt
<jonny> jon: winnt forgotten...
<jon> jonny learn winnt Windows NT is a 32-bit operating system for the i386
        and Alpha architectures with superb multitasking and server 
	functionality (yeah, uh-huh, and pigs fly)... See 
        http://www.microsoft.com/ and 
        http://www.cnn.com/TECH/computing/9907/15/nt-mare.idg/
<jonny> jon: winnt learned, thanks...

Public command reference:
NICK: explain KEYWORD
NICK: forget KEYWORD
NICK: learn KEYWORD ANSWER TEXT
NICK: shutup
  -- europa disables saying anything to others
NICK: hello
  -- europa turns back on and talks again

And thus is the gist of using Europa. Also, Europa installs a new
irc command "/explain USER KEYWORD" which lets you send a private
message to a specific user containing the answer to KEYWORD. You
could also do "/explain #CHANNEL KEYWORD" to send it to a channel 
you are currently on publically.

I haven't implemented "/forget KEYWORD" or "/learn KEYWORD ANSWER" yet,
sorry.

FUTURE PLANS
--------------------------------------------------------------------------
I'd really like to redo Europa in Java and implement some natural
language processing capabilities in it. You can see some of my 
experimenting with interfacing C to Java in the corba/ directory.

Processing text in C is not particularly easy to do in a safe manner.
Doing AI stuff is even harder to do without a nice garbage collector
taking care of memory management for you. Normally, I depise Java for
just about every project due to its closed sourced nature and buggy Linux
support. But this is one case where it might be a good choice, we'll see.

You can see my previous NLP work in the cse476/ folder. If you actually
figure out what the code is doing in there, you'll understand why a
garbage collector would be really nice for this and why C isn't.

--- NEW FILE: Makefile.in ---
# dll/europa/Makefile
# (c) David Walluck 2000

SHELL = @SHELL@

srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
topdir = @topdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = @oldincludedir@

local_dir = $(HOME)

# Where the BitchX binary will be installed.
# "make install" will compile and install the program.
INSTALL_IRC = @INSTALL_IRC@

# Where the BitchX library will be. Generally this is the place that
# you put the scripts, help pages and translation tables. It is
# very important that you set this correctly.
IRCLIB = @IRCLIB@

CC = @CC@
DEFS = @INCLUDES@
LIBS = @LIBS@

# Tcl library.
TCL_LIBS = @TCL_LIBS@

# These are for Tcl support.
TCL_OBJS = @TCL_OBJS@
# You don't have the following, so you'll want to leave this blank.
TCL_SRCS = @TCL_SRCS@

# Set this to -g if you want to be able to debug the client, otherwise
# use -O to have the compiler do some optimization instead.
CFLAGS = @CFLAGS@

# Set this to -s if you want the binary to be stripped.
LDFLAGS = @LDFLAGS@

# These are for the cd device player.
CD_SRCS = @CD_SRCS@
CD_OBJS = @CD_OBJS@

# This is the executable suffix for the target operating system.
EXEEXT = @EXEEXT@

# Extra files.
DEFAULT_CTOOLZ_DIR = @DEFAULT_CTOOLZ_DIR@
DEFAULT_MSGLOGFILE = @DEFAULT_MSGLOGFILE@
DEFAULT_BITCHX_HELP_FILE = @DEFAULT_BITCHX_HELP_FILE@
DEFAULT_SCRIPT_HELP_FILE = @DEFAULT_SCRIPT_HELP_FILE@
DEFAULT_BITCHX_KICK_FILE = @DEFAULT_BITCHX_KICK_FILE@
DEFAULT_BITCHX_QUIT_FILE = @DEFAULT_BITCHX_QUIT_FILE@
DEFAULT_BITCHX_IRCNAME_FILE = @DEFAULT_BITCHX_IRCNAME_FILE@

# Full path of the directory for BitchX help files.
HELPDIR = @HELPDIR@

# Full path of the directory for the BitchX scripts.
INSTALL_SCRIPT = @INSTALL_SCRIPT@

# Default setting for IRCPATH where BitchX will look for
# its script files if the environment variable is undefined.
# Usually, this should contain the same path as used for INSTALL_SCRIPT in
# the Makefile, but it can contain multiple path elements
# separated by colons. The path MUST lead to an existing directory,
# because the 'global' script is expected to be found there.
IRCPATH = @IRCPATH@

# Path for TRANSLATION variable.
TRANSLATION_PATH = @TRANSLATION_PATH@

# This command will be used to install the BitchX help files. If you don't
# want to install them, replace with the following:
# INSTALL_HELP_CMD = @echo The help files have not been installed.
INSTALL_HELP_CMD = @INSTALL_HELP_CMD@

# This is where the optional plugins will be copied to.
PLUGINDIR = @PLUGINDIR@

# Plugin flags.
SHLIB_LD = @SHLIB_LD@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_SUFFIX = @SHLIB_SUFFIX@

# This command will be used to install the BitchX files on Win32/OS2EMX
# systems.
WINNT_INSTALL = @WINNT_INSTALL@

# This program allows you to use screen/xterm's to put new BitchX windows
# on new screen/xterm windows.
INSTALL_WSERV = @INSTALL_WSERV@

# This program allows you to screen BitchX and reattach to it later.
INSTALL_SCRBX = @INSTALL_SCRBX@

# Set gzip and bzip2 options.
GZIP_ENV = @GZIP_ENV@
BZIP2 = @BZIP2@

# Standard programs.
RM = @RM@
LN = @LN_S@
CP = @CP@
MV = @MV@

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

VERSION = @VERSION@
_VERSION_ = @_VERSION_@

MAKE_BIN = @MAKE@
MAKE = $(MAKE_BIN) $(MFLAGS)
MFLAGS = \
	'local_dir=$(HOME)'			\
	'INSTALL_IRC=$(INSTALL_IRC)'		\
	'IRCLIB=$(IRCLIB)'			\
	'CC=$(CC)'				\
	'CFLAGS=$(CFLAGS)'			\
	'HELPDIR=$(HELPDIR)'			\
        'INSTALL_WSERV=$(INSTALL_WSERV)'	\
	'IRCPATH=$(IRCPATH)'			\
	'TRANSLATION_PATH=$(TRANSLATION_PATH)'	\
	'LDFLAGS=$(LDFLAGS)'			\
	'LIBS=$(LIBS)'				\
	'LN=$(LN)'				\
	'RM=$(RM)'				\
	'TCL_SRCS=$(TCL_SRCS)'			\
	'TCL_OBJS=$(TCL_OBJS)'			\
	'CD_PLAY=$(CD_PLAY)'			\
	'CD_SRCS=$(CD_SRCS)'			\
	'CD_OBJS=$(CD_OBJS)'			\
	'TCL_LIBS=$(TCL_LIBS)'			\
	'PLUGINDIR=$(PLUGINDIR)'		\
	'_VERSION_=$(_VERSION_)'		\
	'VERSION=$(VERSION)'			\
	'INSTALL_DATA=$(INSTALL_DATA)'		\
	'INSTALL_SCRIPT=$(INSTALL_SCRIPT)'	\
	'EXEEXT=$(EXEEXT)'			\
	'SHLIB_CFLAGS=$(SHLIB_CFLAGS)'		\
	'SHLIB_SUFFIX=$(SHLIB_SUFFIX)'

## Makefile starts here.

MYSQL_LIBS = @MYSQL_LIBS@

PLUGIN_NAME = europa

all: Makefile europa$(SHLIB_SUFFIX)

Makefile: Makefile.in
	cd $(topdir) \
	  && ./config.status

europa.o: $(srcdir)/europa.c
	$(CC) $(DEFS) $(CFLAGS) -c $(srcdir)/europa.c

europa$(SHLIB_SUFFIX): europa.o ../dllinit.o
	$(SHLIB_LD) europa.o ../dllinit.o $(SHLIB_CFLAGS) -o europa$(SHLIB_SUFFIX) $(MYSQL_LIBS)

clean:
	$(RM) *~ *.o *.a *.dll europa$(SHLIB_SUFFIX) *.def .#*

distclean: clean
	$(RM) Makefile

install:
	$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(PLUGINDIR)

--- NEW FILE: europa.c ---
/*
  Europa - Copyright (c) 1999, Ed Schlunder <zilym at asu.edu>

  This is free software distributable under the terms of the GNU GPL-- See
  the file COPYING for details.
 */

#define MOD_VERSION "0.01"
#define MOD_NAME "Europa"
#include "europa.h"

#include <mysql/mysql.h>

/* yay! mysql.h and irc.h both define NAME_LEN... */
#undef NAME_LEN
#include "irc.h"
#include "struct.h"
#include "server.h"
#include "ircaux.h"
#include "status.h"
#include "screen.h"
#include "vars.h"
#include "misc.h"
#include "output.h"
#include "hook.h"
#include "module.h"
#define INIT_MODULE
#include "modval.h"
#include "irc_std.h"

#define MAX_WORD 100
#define MAX_WORDS 1000
#define MAX_CHANNELS 10
#define MAX_QUERY 1000

int beQuiet = 0;
MYSQL mysql;

/* called when bitchx user enters IRC command "/europa DATA" */
BUILT_IN_DLL(europa)
{
  int i;

  put_it("** /europa %s baby!", args);
}

/* print some chat to both the IRC server (other channel members) and the local
   client window... */
void dualOut(const char *str, const char *chan) {
  put_it("<europa> %s", str);
  send_to_server("PRIVMSG %s :%s", chan, str);
}

/* a wrapper on dualOut() to do printf-like text formatting on outgoing text */
void sout(char *chan, const char *format, ...) {
  va_list args;
  char tmp[MAX_WORD * MAX_WORDS];

  if(beQuiet)
    return;

  va_start(args, format);
  vsnprintf(tmp, MAX_WORD*MAX_WORDS, format, args);
  va_end(args);

  dualOut(tmp, chan);
}

void sdunno(char *args[]) {
  sout(args[1], "%s: Hmm, I don't know that one...", args[0]);
}

void shello(char *chan, char *who) {
  if(who == NULL)
    sout(chan, "hey, how's it going?");
  else
    sout(chan, "%s: hey, how's it going?", who);
}

/* attempts to find an answer to a keyword that we've been asked about... */
char *dbLookup(char *keyword, char *table) {
  MYSQL_RES *res;
  MYSQL_ROW row;
  char query[MAX_QUERY];
  char *answer, *encodedKeyword = malloc(strlen(keyword) * 2 + 1);

  mysql_escape_string(encodedKeyword, keyword, strlen(keyword));
  if(snprintf(query, MAX_QUERY,
	      "select answer from %s where keyword like '%s'", 
	      table, encodedKeyword) == -1) {
    put_it("** Europa query overflow (increase MAX_QUERY)");

    free(encodedKeyword);
    return NULL;
  }
  free(encodedKeyword);

  if(mysql_query(&mysql, query))
    return NULL;

  if(!(res = mysql_store_result(&mysql))) {
    /* this shouldn't happen... */
    put_it("** Europa query failure: %s", query);
    return NULL;
  }
      
  row = mysql_fetch_row(res);
  if(row == NULL) {
      mysql_free_result(res);
      return NULL;
  }

  answer = strdup(row[0]);

  mysql_free_result(res);
  return answer;
}

/* args[0] - nick of sender
   args[1] - channel text was said on
  args[2] - actual text */
void processChat(int argc, char *args[], char *argl[]) {
  int i;

  if(argc < 3) return;
  if(strcmp(args[3], "shutup") == 0) {
    sout(args[1], "%s: okay, okay...", args[0]);
    beQuiet = -1;
    return;
  }

  if(strcmp(args[3], "hello") == 0 ||
     strcmp(args[3], "hello?") == 0) {
    if(beQuiet)
      beQuiet = 0;
    else
      shello(args[1], args[0]);
  }

  if(argc < 4) return;
  if(strcmp(args[3], "ex") == 0 ||
     strcmp(args[3], "explain") == 0) {
    int pengy = 0;
    char *answer;

    answer = dbLookup(args[4], "fact");
    if(answer == NULL) {
      answer = dbLookup(args[4], "facts");
      if(answer == NULL) {
	sdunno(args);
	return;
      }
      pengy = -1;
    }

    if(pengy)
      sout(args[1], "%s: %s (from Pengy)", args[0], answer);
    else
      sout(args[1], "%s: %s", args[0], answer);

    free(answer);
    return;
  }

  if(strcmp(args[3], "learn") == 0) {
    char query[MAX_QUERY];
    char *encodedKeyword = malloc(strlen(args[4]) * 2 + 1),
      *encodedAnswer = malloc(strlen(argl[5]) * 2 + 1);

    mysql_escape_string(encodedKeyword, args[4], strlen(args[4]));
    mysql_escape_string(encodedAnswer, argl[5], strlen(argl[5]));

    snprintf(query, MAX_QUERY, "insert into fact values('%s','%s')", 
	     encodedKeyword, encodedAnswer);

    free(encodedKeyword);
    free(encodedAnswer);

    if(mysql_query(&mysql, query))
      put_it("** Europa db query failed: %s", query);
    else
      sout(args[1], "%s: %s learned, thanks...", args[0], args[4]);

    return;
  }

  if(strcmp(args[3], "forget") == 0) {
    char query[MAX_QUERY];
    char *encodedKeyword = malloc(strlen(args[4]) * 2 + 1);

    mysql_escape_string(encodedKeyword, args[4], strlen(args[4]));
    snprintf(query, MAX_QUERY, 
	     "delete from fact where keyword='%s'", encodedKeyword);
    free(encodedKeyword);

    if(mysql_query(&mysql, query)) {
      snprintf(query, MAX_QUERY, 
	       "delete from facts where keyword='%s'", args[4]);
      if(mysql_query(&mysql, query)) {
	put_it("** Europa db query failed: %s", query);
	sout(args[1], "%s: I didn't know anything about %s anyway...", 
	     args[0], args[4]);
      }
      else
	sout(args[1], "%s: %s forgotten from Pengy db...", args[0], args[4]);
    }
    else
      sout(args[1], "%s: %s forgotten...", args[0], args[4]);

    return;
  }
}

/* called by BitchX whenever someone says something in the channel directed to
   this user... */
int public_ar_proc(char *which, char *str, char **unused) {
  char *local, *args[MAX_WORDS], *argl[MAX_WORDS];
  int i = 0, total, w = 0;

  /*
    we want to parse out the text into separate words. args[WORD_N] is
    a pointer to a single word while argl[WORD_N] is a pointer to the
    rest of the sentence beginning at word WORD_N.
  */
  argl[0] = str;
  while(i < strlen(str)) {
    if(str[i] != ' ') break;
    i++;
  }
  local = strdup(str + i);
  args[0] = local;

  total = strlen(local);
  while(i < total && w < MAX_WORDS) {
    if(local[i] == ' ') { 
      local[i] = 0;
      w++;
      while(++i < total)
	if(local[i] != ' ') break;

      args[w] = local + i;
      argl[w] = str + i;
    }

    i++;
  }

  processChat(w, args, argl);

  free(local);
  return 0;
}

int public_proc(char *which, char *str, char **unused) {
  char *local, *args[MAX_WORDS], *argl[MAX_WORDS];
  int i = 0, total, w = 0;

  /*
    we want to parse out the text into separate words. args[WORD_N] is
    a pointer to a single word while argl[WORD_N] is a pointer to the
    rest of the sentence beginning at word WORD_N.
  */
  argl[0] = str;
  while(i < strlen(str)) {
    if(str[i] != ' ') break;
    i++;
  }
  local = strdup(str + i);
  args[0] = local;

  total = strlen(local);
  while(i < total && w < MAX_WORDS) {
    if(local[i] == ' ') { 
      local[i] = 0;
      w++;
      while(++i < total)
	if(local[i] != ' ') break;

      args[w] = local + i;
      argl[w] = str + i;
    }

    i++;
  }

  if(w > 1) {
    if(strstr(argl[2], "hello") != NULL)
      shello(args[1], args[0]);
  }

  free(local);
  return 0;  
}

/* called when user enters irc command "/explain USER/CHANNEL KEYWORD" */
BUILT_IN_DLL(cmdExplain)
{
  char *local, *arg[MAX_WORDS], *argl[MAX_WORDS];
  int i = 0, total, w = 0;

  argl[0] = args;
  while(i < strlen(args)) {
    if(args[i] != ' ') break;
    i++;
  }
  local = strdup(args + i);
  arg[0] = local;

  total = strlen(local);
  while(i < total && w < MAX_WORDS) {
    if(local[i] == ' ') { 
      local[i] = 0;
      w++;
      while(++i < total)
	if(local[i] != ' ') break;

      arg[w] = local + i;
      argl[w] = args + i;
    }

    i++;
  }

  if(w) {
    int pengy = 0;
    char *answer = dbLookup(arg[1], "fact");

    if(answer == NULL) {
      answer = dbLookup(arg[1], "facts");
      if(answer == NULL) {
	put_it("** Europa doesn't know about %s", arg[1]);
	free(local);
	return;
      }

      pengy = -1;
    }

    if(pengy)
      sout(arg[0], "%s (from Pengy)", answer);
    else
      sout(arg[0], answer);
  }

  free(local);
  return;
}

int Europa_Init(IrcCommandDll **intp, Function_ptr *global_table) {
  initialize_module(MOD_NAME);

  add_module_proc(COMMAND_PROC, MOD_NAME, "europa", NULL, 0, 0, europa, NULL);
  add_module_proc(COMMAND_PROC, MOD_NAME, "explain", NULL, 0, 0, cmdExplain, NULL);
  add_module_proc(HOOK_PROC, MOD_NAME, NULL, "*", PUBLIC_AR_LIST, 1, NULL, public_ar_proc);
  add_module_proc(HOOK_PROC, MOD_NAME, NULL, "*", PUBLIC_LIST, 1, NULL, public_proc);

  put_it("** Europa v%s connecting to database backend...", MOD_VERSION);

  /* connect to the database server */
  if(!(mysql_connect(&mysql, DBHOST, DBUSER, DBPASSWD))) {
    put_it("** Server refused login/password.");
    return 0;
  }
  if(mysql_select_db(&mysql, DBNAME)) {
    put_it("** Server refused connection to '%s' database.", DBNAME);
    return 0;
  }

  put_it("** Europa loaded!");
  return 0;
}

--- NEW FILE: COPYING ---
		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

	    How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19yy name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.

--- NEW FILE: CREDITS ---
Jeremy Tregunna (aka zdt on EFnet #linuxinfo) contributed the pengy database
entries from his Pengy bot. This provides a nice knowledgebase that gives
Europa a running start towards being useful. Thanks!


--- NEW FILE: europa.h ---
#define DBNAME "europa"
#define DBHOST "localhost"
#define DBUSER "europa"
#define DBPASSWD "APASSWD"


--- NEW FILE: knowledgebase.sql ---
# MySQL dump 6.4
#
# Host: localhost    Database: europa
#--------------------------------------------------------
# Server version	3.22.27

#
# Table structure for table 'fact'
#
CREATE TABLE fact (
  keyword text,
  answer text
);

#
# Dumping data for table 'fact'
#

INSERT INTO fact VALUES ('europa','Europa is one of zilym\'s alternative personalities...');
[...6026 lines suppressed...]
INSERT INTO facts VALUES ('E','see enlightenment',0,19991202015749,'1999-12-02 01:57:49','N','dpkg!jeremy at AS52-01-30.cas-kit.golden.net','N',NULL,'N');
INSERT INTO facts VALUES ('LinuxURL','@from: LinuxURL is a bot in #linuxhelp that doesn\'t even come close to the performance I give, and my over 110 THOUSAND database entries. Beat that you infobot!',1,19991202025905,'1999-12-02 02:58:57','Y','dpkg!jeremy at AS52-01-30.cas-kit.golden.net','N',NULL,'Y');
INSERT INTO facts VALUES ('ppod','Plush Penguin of Discord(tm dpkg) [This one\'s a collector\'s item]',0,19991203032916,'1999-12-03 03:29:13','Y','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'N');
INSERT INTO facts VALUES ('fusion','A Macintosh 68k Emulator for the x86 and Amiga Computers. http://www.microcode-solutions.com',1,19991203035758,'1999-12-03 03:56:14','Y','[-Shadow-!teton at tpm0-110.ballistic.com','N',NULL,'N');
INSERT INTO facts VALUES ('e2fsresize','see ext2resize',0,19991203041047,'1999-12-03 04:10:45','Y','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'N');
INSERT INTO facts VALUES ('tequila','@from: One tequila, two tequila, three tequila more. Four tequila, five tequila, six tequila, floor.',1,19991203041637,'1999-12-03 04:16:02','N','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'Y');
INSERT INTO facts VALUES ('RTFM','Read The Fucking Manual!',0,19991203041826,'1999-12-03 04:18:09','Y','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'Y');
INSERT INTO facts VALUES ('STFW','Search The Fucking Web!',0,19991203041830,'1999-12-03 04:18:20','Y','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'Y');
INSERT INTO facts VALUES ('tsx-11','tsx-11.mit.edu is a large ftp site with lots of sources to many programs on it. Check it out at ftp://tsx-11.mit.edu/pub/linux for linux stuff.',0,19991203042418,'1999-12-03 04:24:12','Y','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'N');
INSERT INTO facts VALUES ('stuffit','A Un-compressing utility for macintosh computers http://www.aladdinsys.com',0,19991203043118,'1999-12-03 04:31:09','Y','[-Shadow-!teton at tpm0-110.ballistic.com','N',NULL,'N');
INSERT INTO facts VALUES ('win95','@from: Windows 95 is a 32-bit extention to a 16-bit patch to an 8-bit operating system, origionally written for the 4-bit microprocessor by a 2-bit company that can\'t stand 1 bit of competition',0,19991203050505,'1999-12-03 05:05:05','N','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'Y');
INSERT INTO facts VALUES ('quote','\"Nobody will ever need more than 640KB of RAM.\" -- Bill Gates, 1981. \"Windows 98 requires 16MB of RAM.\" -- Bill Gates, 1999. \"Nobody will ever need Windows 98.\" -- Logical conclusion.',1,19991203051234,'1999-12-03 05:12:30','Y','dpkg!jeremy at AS52-10-234.cas-kit.golden.net','N',NULL,'Y');
INSERT INTO facts VALUES ('Adonthell','CGI role-playing game. Category: X11/Games License: GPL Stable: None Development: 0.1.a Details: http://freshmeat.net/appindex/1999/12/02/944159313.html URL: http://adonthell.linuxgames.com/',0,19991203054304,'1999-12-03 05:43:04','Y','feed.freshmeat.net','Y',NULL,'N');
INSERT INTO facts VALUES ('AICMPSEND','ICMP packet sender with a lot of options. Category: Console/Networking License: GPL Stable: 1.0 Development: 1.1A Details: http://freshmeat.net/appindex/1999/12/01/944080988.html URL: http://www.elxsi.de/',1,19991203054857,'1999-12-03 05:43:05','Y','feed.freshmeat.net','Y',NULL,'N');
INSERT INTO facts VALUES ('ALINKARAISIN','Web based tool to build and administrate beowulf type clusters. Category: Web/Tools License: Free Trial Stable: 1.1.3 Details: http://freshmeat.net/appindex/1999/12/01/944046731.html URL: http://www.alinka.com/',0,19991203054305,'1999-12-03 05:43:05','Y','feed.freshmeat.net','Y',NULL,'N');
INSERT INTO facts VALUES ('aproxy','A forwarding TCP-proxy. Category: Daemons/Proxy License: GPL Stable: 0.81 Development: 1.0beta Details: http://freshmeat.net/appindex/1999/12/01/944055241.html URL: http://www.dilledabb.de/',0,19991203054307,'1999-12-03 05:43:07','Y','feed.freshmeat.net','Y',NULL,'N');
INSERT INTO facts VALUES ('atexit.py','Python modules that implement the atexit() function. Category: Development/Python Modules License: GPL Stable: 0.1.3 Details: http://freshmeat.net/appindex/1999/12/02/944170539.html URL: http://www.magnetic-ink.dk/download/snippets/',0,19991203054309,'1999-12-03 05:43:09','Y','feed.freshmeat.net','Y',NULL,'N');
INSERT INTO facts VALUES ('AutoSig','A Signature/Plan file generator. Category: Console/eMail License: GPL Stable: 1.0 Details: http://freshmeat.net/appindex/1999/12/01/944029312.html URL: http://web.wt.net/~feline/',1,19991203054924,'1999-12-03 05:43:10','Y','feed.freshmeat.net','Y',NULL,'N');
INSERT INTO facts VALUES ('BWwhois','A whois in perl that works with the newly mangled whois system as of 1 Dec 1999. Category: Console/Networking License: Artistic Stable: 1.0 Details: http://freshmeat.net/appindex/1999/12/02/944195464.html URL: http://bw.org/whois/',0,19991203054317,'1999-12-03 05:43:17','Y','feed.freshmeat.net','Y',NULL,'N');





More information about the dslinux-commit mailing list