[[project @ 2004-04-28 03:33:52 by unknown_lamer] unknown_lamer**20040428033352 Huge Update, see the ChangeLog ] { addfile ./source/DCCChatConnection.C addfile ./source/DCCChatConnection.H hunk ./ChangeLog 1 +2004-01-28 Clinton Ebadi + + * ChangeLog: Updated copyright notice + +2004-01-09 Clinton Ebadi + + * source/Interp.C (interp_init_helper): Register + bot:change-command-level + + * source/ScriptCommands.C (ChangeCommandLevel): Added + ChangeCommandLevel to change the level a user needs to be to run a + command + + * source/ScriptCommands.H: Added ChangeCommandLevel + +2003-10-12 Clinton Ebadi + + * source/String.H: Changed #define STRING_H to BSTRING_H + +2003-08-04 Clinton Ebadi + + * scripts/bobot-utils.scm (bot:sent-to-me?): New procedure, used + to see if a message was sent to the bot (this is better than + bot:match-to-me because the hook isn't invalidated when the bot's + nickname changes) + + * source/DCCConnection.H: Added `nuh' back and added an + accessor (get_nuh) + Added setter `set_autoRemove(bool)' + + * source/DCCConnection.H: Removed all friends + Added accessors (get_bot, get_lastSpoken, get_autoRemove; get_bot + reveals the pointer to the bot [PRIVATE POINTER] which probably + isn't so nice, but there isn't much to be done about it with the + current design of the bot) + + * source/DCCChatConnection.H: Removed all friends + + * source/DCCConnection.H: DCCConnection is now a pure virtual + class with the subclass DCCChatConnection + +2003-07-29 Clinton Ebadi + + * source/Socket.C (connect): log errors to the bot log instead of + printing to stderr + +2003-07-23 Clinton Ebadi + + * source/Parser.C (parseMessage): use the find method of std::map + to find the command to call instead of [] and then extract the + pointer to the userFunction from that if it exists. This appears + to fix the crash when one uses an undefined command followed by + any defined command. + hunk ./ChangeLog 58 - ScriptCmmands::SetFloodRate + ScriptCommands::SetFloodRate hunk ./ChangeLog 419 -Copyright 2002 Clinton Ebadi +Copyright 2002,2003,2004 Clinton Ebadi hunk ./NEWS 13 +Version 2.1.4: DCC Support Enhancements +- Internal Change: DCCConnection is now an abstract class +- Internal Change: DCCChatConnection provides the functionality of + the old DCCConnection so that DCC FILE support can be added +- New Scheme Procedure: (bot:sent-to-me? message), checks to see if a + message was addressed to the bot. This is better than using + bot:match-to-me because the hook will continue to function if the + bot's nick changes. The only downside to using it is that there may + be an increased overhead of calling more hooks than could be called, + but that shouldn't be much of a problem. +- New Scheme Procedure: (bot:change-command-level command level), + changes the level a user command to allow a user of `level' level or + above to run it. + hunk ./NEWS 31 -- The flood rate may also be set from Scheme using (bot:setfloodrate integer) +- The flood rate may also be set from Scheme using (bot:setfloodrate +integer) +- A very large crash bug has been fixed. Previously, if an undefined +command was called, any attempts to call a subsequent command would +cause the bot to crash. Now the bot doesn't crash. hunk ./TODO 25 + - This can be done as a script, but requires non-coop threads + support to be done easily hunk ./TODO 32 -* DCC FILE support (this can be done as a script) + - Maybe use SSL? +* DCC FILE support (this can be done as a script if a few changes are + made to the DCC support) hunk ./TODO 48 - more coop stuff. After 1.8 is released threads will probably be used. + more coop stuff. After 1.8 is released threads will probably be + used. + - To clarify: There will be one thread for DCCs and another thread + for the current irc server connection, each with its own select + loop. There may also be a thread for the network repls if I + implement that. hunk ./aclocal.m4 1 -# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- +# generated automatically by aclocal 1.7.6 -*- Autoconf -*- hunk ./aclocal.m4 3 -# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 hunk ./aclocal.m4 291 -# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 hunk ./aclocal.m4 309 -# serial 8 +# serial 10 hunk ./aclocal.m4 311 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -AC_PREREQ([2.52]) +AC_PREREQ([2.54]) hunk ./aclocal.m4 337 +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + hunk ./aclocal.m4 354 - AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl - AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl hunk ./aclocal.m4 376 +AC_REQUIRE([AM_SET_LEADING_DOT])dnl hunk ./aclocal.m4 379 -[AC_PROVIDE_IFELSE([AC_PROG_][CC], +[AC_PROVIDE_IFELSE([AC_PROG_CC], hunk ./aclocal.m4 381 - [define([AC_PROG_][CC], - defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_][CXX], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], hunk ./aclocal.m4 385 - [define([AC_PROG_][CXX], - defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl hunk ./aclocal.m4 390 + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + hunk ./aclocal.m4 431 -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) hunk ./aclocal.m4 438 - [AM_AUTOMAKE_VERSION([1.6.3])]) + [AM_AUTOMAKE_VERSION([1.7.6])]) hunk ./aclocal.m4 724 -# serial 4 -*- Autoconf -*- +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. + +# 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, or (at your option) +# any later version. hunk ./aclocal.m4 732 -# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. +# 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. + +# serial 1 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# serial 5 -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. hunk ./aclocal.m4 820 + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub hunk ./aclocal.m4 833 + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # hunk ./aclocal.m4 840 - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf hunk ./aclocal.m4 863 - source=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && hunk ./aclocal.m4 870 - am_cv_$1_dependencies_compiler_type=$depmode - break + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi hunk ./aclocal.m4 887 +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) hunk ./aclocal.m4 898 -[rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null -AC_SUBST([DEPDIR]) +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl hunk ./aclocal.m4 1001 -# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. hunk ./aclocal.m4 1028 -doit: +am__doit: hunk ./aclocal.m4 1030 +.PHONY: am__doit hunk ./aclocal.m4 1044 -if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then hunk ./aclocal.m4 1058 -AC_SUBST(am__include) -AC_SUBST(am__quote) -AC_MSG_RESULT($_am_result) +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) hunk ./aclocal.m4 1104 - AC_MSG_ERROR([conditional \"$1\" was never defined. + AC_MSG_ERROR([conditional "$1" was never defined. hunk ./aclocal.m4 1131 -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. We must strip everything past the first ":", -# and everything past the last "/". - -# _AM_DIRNAME(PATH) -# ----------------- -# Like AS_DIRNAME, only do it during macro expansion -AC_DEFUN([_AM_DIRNAME], - [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, - m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, - m4_if(regexp([$1], [^/.*]), -1, - [.], - patsubst([$1], [^\(/\).*], [\1])), - patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), - patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl -])# _AM_DIRNAME - - -# The stamp files are numbered to have different names. -# We could number them on a directory basis, but that's additional -# complications, let's have a unique counter. -m4_define([_AM_STAMP_Count], [0]) - - -# _AM_STAMP(HEADER) -# ----------------- -# The name of the stamp file for HEADER. -AC_DEFUN([_AM_STAMP], -[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl -AS_ESCAPE(_AM_DIRNAME(patsubst([$1], - [:.*])))/stamp-h[]_AM_STAMP_Count]) - - -# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) -# ------------------------------------------------------------ -# We used to try to get a real timestamp in stamp-h. But the fear is that -# that will cause unnecessary cvs conflicts. -AC_DEFUN([_AM_CONFIG_HEADER], -[# Add the stamp file to the list of files AC keeps track of, -# along with our hook. -AC_CONFIG_HEADERS([$1], - [# update the timestamp -echo 'timestamp for $1' >"_AM_STAMP([$1])" -$2], - [$3]) -])# _AM_CONFIG_HEADER - - -# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) -# -------------------------------------------------------------- -AC_DEFUN([AM_CONFIG_HEADER], -[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) -])# AM_CONFIG_HEADER +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) hunk ./bobot++.texinfo 27 -@c @vskip O plus 1filll +@vskip O plus 1filll hunk ./configure.ac 4 -AC_INIT([Bobot++], [2.1.3CVS], [clinton@unknownlamer.org], [bobotpp]) +AC_INIT([Bobot++], [2.1.4CVS], [clinton@unknownlamer.org], [bobotpp]) hunk ./scripts/bobot-utils.scm 86 + +(define-public (bot:sent-to-me? message) + (let ((to-me (make-regexp (bot:match-to-me "")))) + (if (regexp-exec to-me message) #t #f))) hunk ./source/Bot.C 3 -// Copyright (C) 2002 Clinton Ebadi +// Copyright (C) 2002,2003 Clinton Ebadi hunk ./source/Bot.C 31 +#include "DCCChatConnection.H" hunk ./source/Bot.C 527 -Bot::addDCC(Person * from, unsigned long address, int port) +Bot::addDCC(Person * from, unsigned long address, int port, int type) hunk ./source/Bot.C 529 - DCCConnection * d = new DCCConnection(this, from->getAddress (), - address, port); + DCCConnection *d = 0; + + if (type == CHAT) + d = new DCCChatConnection(this, from->getAddress (), + address, port); + else + return; hunk ./source/Bot.H 3 -// Copyright (c) 2002 Clinton Ebadi +// Copyright (c) 2002,2003 Clinton Ebadi hunk ./source/Bot.H 49 -#define VERSION_STRING PACKAGE" version "VERSION" by unknown_lamer@OPN \n1.97 and below by eb@IRCNet " -#define COPYRIGHT_STRING PACKAGE" version "VERSION", Copyright (C) 1997-2000 Etienne BERNARD\nCopyright (C) 2002 Clinton Ebadi" +#define VERSION_STRING PACKAGE" version "VERSION" by unknown_lamer@FreeNode \n1.97 and below by eb@IRCNet " +#define COPYRIGHT_STRING PACKAGE" version "VERSION", Copyright (C) 1997-2000 Etienne BERNARD\nCopyright (C) 2002,2003,2004 Clinton Ebadi" hunk ./source/Bot.H 158 - void addDCC(Person *, unsigned long, int); + enum DCC_TYPE { CHAT }; + void addDCC(Person *, unsigned long, int, int); hunk ./source/DCCChatConnection.C 1 +// DCCConnection.C -*- C++ -*- +// Copyright (c) 1998 Etienne BERNARD +// Copyright (C) 2002 Clinton Ebadi + +// 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 +// 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. + +#include +#include + +#include "Socket.H" +#include "DCCParser.H" +#include "DCCChatConnection.H" +#include "Person.H" +#include "BotInterp.H" +#include "Utils.H" + +DCCChatConnection::DCCChatConnection(Bot *b, String n, unsigned long address, + int port) + : DCCConnection(b, n, address, port) +{ } + +bool +DCCChatConnection::connect() +{ + if (!socket.connect()) + return false; + +#ifdef USESCRIPTS + // run hooks/dcc/chat-begin + DCCPerson *tmp = new DCCPerson (this); + bot->botInterp->RunHooks (Hook::DCC_CHAT_BEGIN, + tmp->getAddress (), + scm_list_n (Utils:: + string2SCM (tmp->getAddress ()), + SCM_UNDEFINED)); + delete tmp; +#endif + + + return true; +} + +bool +DCCChatConnection::handleInput() +{ + std::string line = socket.readLine(); + + lastSpoken = time(0); + + if (line.length() == 0) + return true; + + if (bot->debug) + std::cout << "DCC: <" << line << ">" << std::endl; + + DCCParser::parseLine(this, line); + + return false; +} + +void +DCCChatConnection::sendNotice(String message) +{ + socket.write(message, true); +} hunk ./source/DCCChatConnection.H 1 +// DCCChatConnection.H -*- C++ -*- +// Copyright (c) 2003 Clinton Ebadi + +// 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 +// 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. + +#ifndef DCCCHATCONNECTION_H +#define DCCCHATCONNECTION_H + +#include + +#include "Connection.H" +#include "Bot.H" +#include "DCCPerson.H" +#include "DCCConnection.H" + +class UserCommands; + +class DCCChatConnection : public DCCConnection { +public: + DCCChatConnection(Bot *, String, unsigned long, int); + + bool connect(); + bool handleInput(); + + void sendNotice(String); + +// friend class Bot; +// friend class DCCPerson; +// friend class DCCParser; +// friend class UserCommands; +// friend class DCCManager; +}; + +#endif hunk ./source/DCCConnection.C 29 -DCCConnection::DCCConnection(Bot *b, String n, unsigned long address, +DCCConnection::DCCConnection(unsigned long address, hunk ./source/DCCConnection.C 31 - : Connection(address, port), bot(b), nuh(n), - lastSpoken(time(0)), autoRemove(true) + : Connection(address, port) +{ } + +DCCConnection::DCCConnection(Bot *b, String n, unsigned long address, + int port) + : Connection(address, port), bot(b),lastSpoken(time(0)), autoRemove(true) hunk ./source/DCCConnection.C 39 -bool -DCCConnection::connect() -{ - if (!socket.connect()) - return false; +// bool +// DCCConnection::connect() +// { +// if (!socket.connect()) +// return false; hunk ./source/DCCConnection.C 45 -#ifdef USESCRIPTS - // run hooks/dcc/chat-begin - DCCPerson *tmp = new DCCPerson (this); - bot->botInterp->RunHooks (Hook::DCC_CHAT_BEGIN, - tmp->getAddress (), - scm_list_n (Utils:: - string2SCM (tmp->getAddress ()), - SCM_UNDEFINED)); - delete tmp; -#endif +// #ifdef USESCRIPTS +// // run hooks/dcc/chat-begin +// DCCPerson *tmp = new DCCPerson (this); +// bot->botInterp->RunHooks (Hook::DCC_CHAT_BEGIN, +// tmp->getAddress (), +// scm_list_n (Utils:: +// string2SCM (tmp->getAddress ()), +// SCM_UNDEFINED)); +// delete tmp; +// #endif hunk ./source/DCCConnection.C 57 - return true; -} +// return true; +// } hunk ./source/DCCConnection.C 60 -bool -DCCConnection::handleInput() -{ - std::string line = socket.readLine(); +// bool +// DCCConnection::handleInput() +// { +// std::string line = socket.readLine(); hunk ./source/DCCConnection.C 65 - lastSpoken = time(0); +// lastSpoken = time(0); hunk ./source/DCCConnection.C 67 - if (line.length() == 0) - return true; +// if (line.length() == 0) +// return true; hunk ./source/DCCConnection.C 70 - if (bot->debug) - std::cout << "DCC: <" << line << ">" << std::endl; +// if (bot->debug) +// std::cout << "DCC: <" << line << ">" << std::endl; hunk ./source/DCCConnection.C 73 - DCCParser::parseLine(this, line); +// DCCParser::parseLine(this, line); hunk ./source/DCCConnection.C 75 - return false; -} +// return false; +// } hunk ./source/DCCConnection.C 78 -void -DCCConnection::sendNotice(String message) -{ - socket.write(message, true); -} +// void +// DCCConnection::sendNotice(String message) +// { +// socket.write(message, true); +// } hunk ./source/DCCConnection.H 3 -// Copyright (c) 2002 Clinton Ebadi +// Copyright (c) 2002,2003 Clinton Ebadi hunk ./source/DCCConnection.H 32 +protected: hunk ./source/DCCConnection.H 37 + DCCConnection (unsigned long, int); hunk ./source/DCCConnection.H 42 - bool connect(); - bool handleInput(); + virtual bool connect()=0; + virtual bool handleInput()=0; hunk ./source/DCCConnection.H 45 - void sendNotice(String); + virtual void sendNotice(String)=0; hunk ./source/DCCConnection.H 47 - friend class Bot; - friend class DCCPerson; - friend class DCCParser; - friend class UserCommands; - friend class DCCManager; + // Accessors + virtual Bot* get_bot () const { return bot; }; + virtual std::time_t get_lastSpoken () const { return lastSpoken; }; + virtual bool get_autoRemove () const { return autoRemove; }; + virtual String get_nuh () const { return nuh;}; + // Setters + virtual void set_autoRemove (bool new_ar) { autoRemove = new_ar;}; + + // friend class Bot; + // friend class DCCPerson; + // friend class DCCParser; + // friend class UserCommands; + // friend class DCCManager; hunk ./source/DCCManager.C 53 - if (temp_cnx->autoRemove && std::time (0) >= - (std::time_t)(temp_cnx->lastSpoken + Bot::DCC_DELAY)) + if (temp_cnx->get_autoRemove () && std::time (0) >= + (std::time_t)(temp_cnx->get_lastSpoken () + Bot::DCC_DELAY)) hunk ./source/DCCParser.C 35 - cnx->bot->botInterp->RunHooks (Hook::DCC_CHAT_MESSAGE, + cnx->get_bot()->botInterp->RunHooks (Hook::DCC_CHAT_MESSAGE, hunk ./source/DCCParser.C 42 - Parser::parseMessage(cnx->bot->serverConnection, from, cnx->bot->nickName, + Parser::parseMessage(cnx->get_bot()->serverConnection, + from, cnx->get_bot()->nickName, hunk ./source/DCCPerson.C 22 - : Person(cnx->bot, cnx->nuh), dcc(cnx) + : Person(cnx->get_bot(), cnx->get_nuh()), dcc(cnx) hunk ./source/DCCPerson.C 44 - dcc->autoRemove = false; + dcc->set_autoRemove (false); hunk ./source/Interp.C 121 + bot_new_procedure ("bot:change-command-level", (SCMFunc)ScriptCommands::ChangeCommandLevel, + 2, 0, 0); hunk ./source/Makefile.am 10 + DCCChatConnection.C \ hunk ./source/Makefile.am 45 + DCCChatConnection.H \ hunk ./source/Parser.C 3 -// Copyright (C) 2002 Clinton Ebadi +// Copyright (C) 2002,2003 Clinton Ebadi hunk ./source/Parser.C 856 - cnx->bot->addDCC (from, address, port); + cnx->bot->addDCC (from, address, port, Bot::CHAT); hunk ./source/Parser.H 3 -// Copyright (c) 2002 Clinton Ebadi +// Copyright (c) 2002,2003 Clinton Ebadi hunk ./source/ScriptCommands.C 33 +#include "Parser.H" hunk ./source/ScriptCommands.C 149 + +SCM +ScriptCommands::ChangeCommandLevel(SCM command, SCM level) +{ + VERIFY_STRING (command); + VERIFY_NUMBER (level); + + SCM_STRING_COERCE_0TERMINATION_X (command); + std::string ccommand = SCM_STRING_CHARS (command); + unsigned int llevel = scm_num2uint (level, 0, "ScriptCommands::ChangeCommandLevel"); + + if (llevel > 4) + return SCM_BOOL_F; + + std::map >::const_iterator uf_iter + = Interp::bot->userFunctions.find (ccommand); + userFunction * f = 0; + + if (uf_iter != Interp::bot->userFunctions.end ()) + f = uf_iter->second; + else + return SCM_BOOL_F; + + f->minLevel = llevel; + return SCM_BOOL_T; +} hunk ./source/ScriptCommands.H 38 - static SCM ChangeLevel(SCM, SCM, SCM); + static SCM ChangeCommandLevel(SCM, SCM); hunk ./source/Socket.C 20 +#include "Bot.H" hunk ./source/Socket.C 196 - // I'd rather log this to the log file - std::cerr << strerror (errno) << std::endl; + // Bot::logLine (String("Socket Error: ") + // + strerror (errno) + String("\n")); hunk ./source/String.H 19 -#ifndef STRING_H -#define STRING_H +#ifndef BSTRING_H +#define BSTRING_H hunk ./source/UserCommands.C 413 - from->sendNotice(String(it->second->dcc->nuh).pad(32) + " " + + from->sendNotice(String(it->second->dcc->get_nuh()).pad(32) + " " + hunk ./source/UserCommands.C 415 - it->second->dcc->lastSpoken))); + it->second->dcc->get_lastSpoken()))); }