+2002-08-08 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * source/String.C (String): The std::string copy constructor now
+ extracts the c_str of the std::string and then takes the strlen of
+ that before copying it. This fixes a bug with DCC where if you did
+ e.g. "!help" the bot would reply with "No TOPIC PRIVMSG FOUND" or
+ something like that, depending on what the last message was
+ because Socket will insert a \0 into its semi-static buffer, so
+ the len of the String will not equal the strlen of its char*.
+
+2002-08-07 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * source/DCCPerson.H: Removed destructor (I = idiot)
+
+ * source/DCCConnection.H: DCCManager is now a friend of
+ DCCConnection (ugh, the bot has way too many friends).
+
+ * source/DCCPerson.H: Added DCC member that returns a const
+ DCCConnection* (the dcc connection). This isn't saved anywhere
+ because when a DCCPerson is destroyed, its connection is also
+ destroyed.
+
+ * source/Bot.H: dccConnections is now a DCCManager
+
+ * source/DCCPerson.H: Added destructor
+ Added handleInput method
+
+ * source/DCCManager.C: New file
+ (addConnection): Wrote method, add a DCCConection to the manager
+
+ * source/DCCManager.H: New file
+
+ * source/Interp.C (Startup): Register bot:DCC-chat-send
+ (Startup): Removed sendDCCChatMessage stuff
+
+ * source/ScriptCommands.C (sendDCCChatMessage): New method:
+ sendDCCChatMessage (to, message) sends message to to.
+
+ * source/DCCConnection.C (connect): Run DCC_CHAT_BEGIN hook with
+ one arg: from (user!nick@host).
+
+ * source/DCCParser.C (parseLine): Runs DCC_CHAT_MESSAGE hook with
+ two args: from (user!nick@host) and line
+
+2002-08-06 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * source/Interp.C (Startup): Two new Scheme values:
+ hooks/dcc/chat-begin and hooks/dcc/chat-message for the
+ DCC_CHAT_BEGIN and DCC_CHAT_MESSAGE hooks.
+
+ * source/BotInterp.H: Added two new enum values to Hook:
+ DCC_CHAT_BEGIN and DCC_CHAT_MESSAGE for the DCC chat start and DCC
+ chat message hooks
+
2002-08-05 Clinton Ebadi <clinton@unknownlamer.org>
* source/Parser.C (parseCTCP): Removed call to htonl and fixed
ACTION, sends a CTCP (_not_ a ctcp-reply), sends a PRIVMSG to a
channel, or sends a PRIVMSG to another user, respectively. There
will be more send hooks added later.
+- New hooks: hooks/dcc/chat-begin and
+ hooks/dcc/chat-message. chat-begin is called when the chat starts
+ and has one argument: the address (in user!nick@host
+ format). chat-message has two arguments: from (user!nick@host) and
+ message, which is the raw message (since there is no real protocol
+ for DCC). chat-start hooks are matched against the address and
+ chat-message hooks are matched against the text "ADDRESS MESSAGE"
+ where ADDRESS is the sender's address and MESSAGE is the message.
Version 2.1.0: Zug Zug
- Hooks can now be fallthrough or non fallthrough. You can set a hooks
changed the log file doesn't change after the Bot is started).
Scripting:
-* Make bot:random use the Guile RNG instead of C RNG (better?)
- - definition would be (define (bot:random) (random BIG_NUMBER))
- - Just use max-fixnum from the test scripts for BIG_NUMBER
* Add commands to delete a hook
- - return an iterator to the hook and let the user kill it?
+ - return an iterator to the Hook
- this would require a new SMOB to be created
+ - Scheme could pass Hook objects around and do nifty things
* Add Scheme utils function to convert "normal" dates into time since
1970.
* Finish adding commands to Scheme for sending messages
(e.g. bot:send-CTCP to send a CTCP message)
* Add util functions for doing stuff like quoting CTCP messages
-* Make it possible to use Scheme functions in the Parser itself
+* Finish adding hooks/send hooks
Networking:
-* Add hooks for DCC CHAT?
+* Add functions to talk to DCC chatters
* Add a networked interface to guile repl
- Admins only
- Telnet
- MUST HAVE PASSWORD
* Make connecting to irc.oftc.net work...I wonder if their ircd is
broken
-* DCC FILE support
+* DCC FILE support (this can be done as a script)
Documentation:
* Work on Texinfo manual (especially scripting section)
Other (post 2.2 release):
-* Remove gh_* when Guile 1.8 is released
\ No newline at end of file
+* Remove gh_* when Guile 1.8 is released
+* Make it possible to use Scheme functions in the Parser itself
+* Complete rewrite ;-)
\ No newline at end of file
=====
Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII
-hooks and tiny fugue (a MUD bot) hooks. The basic idea of a hook if
-that you match a text against regular expression and call a function if
-text in a message matches that regex. The different types of hooks
-provided by Bobot++ correspond to the different classes of messages
-that Bobot++ can recieve. A Hook also has several properties, including
-its priority and whether or not it is a fallthrough hook. Higher
-priority hooks are executed before lower priority hooks and fallthrough
-hooks are executed before non-fallthrough hooks of the same priority. A
-fallthrough hook can match and processing of hooks will continue; as
-soon as the first non-fallthrough hooks matches processing of hooks
-stops.
+and tiny fugue (a MUD bot) hooks with a little bit of extra stuff added
+in. The basic idea of a hook if that you match a text against regular
+expression and call a function if text in a message matches that regex.
+The different types of hooks provided by Bobot++ correspond to the
+different classes of messages that Bobot++ can recieve. A Hook also has
+several properties, including its priority and whether or not it is a
+fallthrough hook. Higher priority hooks are executed before lower
+priority hooks and fallthrough hooks are executed before
+non-fallthrough hooks of the same priority. A fallthrough hook can
+match and processing of hooks will continue; as soon as the first
+non-fallthrough hooks matches processing of hooks stops.
* Menu:
Node: Scripting\7f3677
Node: Adding New Commands\7f4585
Node: Hooks\7f5852
-Node: Creating a Hook\7f6790
-Node: Hook Types\7f7929
-Node: Scheme User Levels\7f10869
-Node: Sending Messages\7f11998
-Node: High Level Message Functions\7f12595
-Node: Low Level Message Functions\7f12809
-Node: Misc Scripting Stuff\7f13562
-Node: Concept Index\7f13981
-Node: Function Index\7f14163
-Node: Variable Index\7f14424
+Node: Creating a Hook\7f6826
+Node: Hook Types\7f7965
+Node: Scheme User Levels\7f10905
+Node: Sending Messages\7f12034
+Node: High Level Message Functions\7f12631
+Node: Low Level Message Functions\7f12845
+Node: Misc Scripting Stuff\7f13598
+Node: Concept Index\7f14017
+Node: Function Index\7f14199
+Node: Variable Index\7f14460
\1f
End Tag Table
#include "ServerConnection.H"
#include "Utils.H"
#include "UserCommands.H"
+#include "DCCManager.H"
#define DEFAULT_NICKNAME "Bobot"
#define DEFAULT_USERNAME "bobot"
userList = new UserList(userListFileName);
shitList = new ShitList(shitListFileName);
todoList = new TodoList();
+ dccConnections = new DCCManager ();
// Let's read the alias file
std::ifstream initFile(initFileName);
spyList.erase(spyList.begin());
delete p;
}
- DCCConnection *d;
- while (dccConnections.size() != 0) {
- d = *dccConnections.begin();
- dccConnections.erase(dccConnections.begin());
- delete d;
- }
-
+ delete dccConnections;
destroy_user_functions ();
wantedChannel *w;
while (!stop) {
waitForInput(); // This is the main event loop
+ dccConnections->checkStale ();
if (!serverConnection->queue->flush())
nextServer();
}
FD_SET(sock, &rd);
#endif
- for (std::list<DCCConnection *>::iterator it = dccConnections.begin();
- it != dccConnections.end(); ++it) {
- int s = (*it)->getFileDescriptor();
+ DCC_MAP* dccmap = dccConnections->MAP ();
+ for (DCC_MAP::iterator it = dccmap->begin ();
+ it != dccmap->end(); ++it) {
+ int s = it->second->DCC()->getFileDescriptor();
#ifdef _HPUX_SOURCE
rd |= s;
#else
if (serverConnection->handleInput())
nextServer();
- std::list<DCCConnection *>::iterator it = dccConnections.begin();
- std::list<DCCConnection *>::iterator it2;
-
- while (it != dccConnections.end()) {
- it2 = it;
- ++it;
-#ifdef _HPUX_SOURCE
- if (rd & (*it2)->getFileDescriptor()) {
-#else
- if (FD_ISSET((*it2)->getFileDescriptor(), &rd)) {
-#endif
- if ((*it2)->handleInput()) {
- delete *it2;
- dccConnections.erase(it2);
- }
- }
- }
+// std::list<DCCConnection *>::iterator it = dccConnections.begin();
+// std::list<DCCConnection *>::iterator it2;
+
+// while (it != dccConnections.end()) {
+// it2 = it;
+// ++it;
+// #ifdef _HPUX_SOURCE
+// if (rd & (*it2)->getFileDescriptor()) {
+// #else
+// if (FD_ISSET((*it2)->getFileDescriptor(), &rd)) {
+// #endif
+// if ((*it2)->handleInput()) {
+// delete *it2;
+// dccConnections.erase(it2);
+// }
+// }
+// }
+// }
+ dccConnections->checkInput (rd);
}
if (currentTime < std::time(NULL)) { // Actions that we do each second
serverConnection->queue->sendJoin((*it).first, (*it).second->key);
}
- std::list<DCCConnection *>::iterator it2;
+// std::list<DCCConnection *>::iterator it2;
- for (std::list<DCCConnection *>::iterator it = dccConnections.begin();
- it != dccConnections.end(); ) {
- it2 = it;
- ++it;
- if ((*it2)->autoRemove && currentTime >= (std::time_t)((*it2)->lastSpoken + Bot::DCC_DELAY)) {
- delete *it2;
- dccConnections.erase(it2);
- }
- }
+// for (std::list<DCCConnection *>::iterator it = dccConnections.begin();
+// it != dccConnections.end(); ) {
+// it2 = it;
+// ++it;
+// if ((*it2)->autoRemove && currentTime >= (std::time_t)((*it2)->lastSpoken + Bot::DCC_DELAY)) {
+// delete *it2;
+// dccConnections.erase(it2);
+// }
+// }
if (currentTime >= (std::time_t)(serverConnection->serverLastSpoken + Bot::PING_TIME) && !sentPing) {
serverConnection->queue->sendPing("Testing connection");
return;
}
logLine ("DCC CHAT accepted from" + from->getAddress ());
- dccConnections.push_back(d);
+ dccConnections->addConnection (d);
}
void
class DCCConnection;
class Parser;
class DCCParser;
+class DCCManager;
class ServerConnection;
class Commands;
class UserCommands;
std::time_t startTime, currentTime, lastNickNameChange, lastChannelJoin;
ServerConnection * serverConnection;
- std::list<DCCConnection *> dccConnections;
+ DCCManager* dccConnections;
std::map<unsigned long, String, std::less<unsigned long> > userhostMap;
unsigned long sentUserhostID;
MODE, MESSAGE, NAMES, NOTICE, PUBLIC,
PUBLIC_NOTICE, RAW, TIMER, TOPIC,
// send hooks
- SEND_ACTION, SEND_CTCP, SEND_PUBLIC, SEND_MESSAGE
+ SEND_ACTION, SEND_CTCP, SEND_PUBLIC, SEND_MESSAGE,
+ // DCC hooks
+ DCC_CHAT_BEGIN, DCC_CHAT_MESSAGE
};
};
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#include <ctime>
+#include <string>
#include "Socket.H"
#include "DCCParser.H"
#include "DCCConnection.H"
+#include "Person.H"
+#include "BotInterp.H"
+#include "Utils.H"
DCCConnection::DCCConnection(Bot *b, String n, unsigned long address,
int port)
{
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
DCCConnection::handleInput()
{
- String line = socket.readLine();
+ std::string line = socket.readLine();
lastSpoken = time(0);
friend class DCCPerson;
friend class DCCParser;
friend class UserCommands;
+ friend class DCCManager;
};
#endif
--- /dev/null
+// DCCManager.H -*- C++ -*-
+// 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 "DCCManager.H"
+
+void
+DCCManager::addConnection (DCCConnection *cnx)
+{
+ DCCPerson *person = new DCCPerson (cnx);
+ String temp = person->getAddress ();
+ if (dcc_map[temp])
+ delete dcc_map[temp];
+ dcc_map[person->getAddress ()] = person;
+}
+
+bool
+DCCManager::sendMessage (String to, String message)
+{
+ DCCPerson *person = dcc_map[to];
+ if (!person)
+ return false;
+
+ person->sendNotice (message);
+ return true;
+ return false;
+}
+
+// checks for stale connections and removes them
+void
+DCCManager::checkStale ()
+{
+ DCC_MAP::iterator it, it2;
+ DCCConnection const* temp_cnx;
+
+ for (it = dcc_map.begin (),it2 = dcc_map.end ();
+ it != it2; ++it)
+ {
+ temp_cnx = it->second->DCC ();
+ if (temp_cnx->autoRemove && std::time (0) >=
+ (std::time_t)(temp_cnx->lastSpoken + Bot::DCC_DELAY))
+ {
+ delete it->second;
+ dcc_map.erase (it);
+ }
+ }
+}
+
+void
+#ifdef _HPUX_SOURCE
+DCCManager::checkInput (int rd)
+#else
+DCCManager::checkInput (fd_set rd)
+#endif
+{
+
+ DCC_MAP::iterator it = dcc_map.begin();
+ DCC_MAP::iterator it2;
+
+ while (it != dcc_map.end ())
+ {
+ it2 = it;
+ ++it;
+#ifdef _HPUX_SOURCE
+ if (rd & it2->second->DCC()->getFileDescriptor())
+#else
+ if (FD_ISSET(it2->second->DCC()->getFileDescriptor(), &rd))
+#endif
+ {
+ if (it2->second->handleInput())
+ {
+ // I am an evil, evil person
+ delete const_cast<DCCConnection*> (it2->second->DCC());
+ delete it2->second;
+ dcc_map.erase(it2);
+ }
+ }
+ }
+}
+
+DCCManager::~DCCManager ()
+{
+ DCC_MAP::iterator it, it2;
+ it = dcc_map.begin ();
+ it2 = dcc_map.end();
+
+ for (; it != it2; ++it)
+ {
+ // I am an evil, evil person
+ delete const_cast<DCCConnection*> (it->second->DCC());
+ delete it->second;
+ }
+}
--- /dev/null
+// DCCManager.H -*- C++ -*-
+// 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.
+
+#ifndef DCC_MANAGER_H
+#define DCC_MANAGER_H
+
+#include <map>
+#include <list>
+#include "DCCPerson.H"
+#include "DCCConnection.H"
+#include "String.H"
+
+typedef std::map<String, DCCPerson*, std::less<String> > DCC_MAP;
+
+// Manages all active DCC connections and allows you to send a message
+// to each one using the string representation of the user's address
+class DCCManager
+{
+ DCC_MAP dcc_map;
+public:
+ void addConnection (DCCConnection*);
+ bool sendMessage (String, String);
+ void checkStale ();
+#ifdef _HPUX_SOURCE
+ void checkInput (int);
+#else
+ void checkInput (fd_set);
+#endif
+ DCC_MAP* MAP () { return &dcc_map; };
+ ~DCCManager ();
+};
+
+#endif
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "DCCParser.H"
#include "DCCPerson.H"
-#include "Macros.H"
#include "Parser.H"
-#include "Bot.H"
+#include "BotInterp.H"
+#include "Utils.H"
void
DCCParser::parseLine(DCCConnection *cnx, String line)
{
Person * from = new DCCPerson(cnx);
+#ifdef USESCRIPTS
+ // Call hooks/dcc/chat-message hook functions
+ cnx->bot->botInterp->RunHooks (Hook::DCC_CHAT_MESSAGE,
+ from->getAddress () + " " + line,
+ scm_list_n (Utils::
+ string2SCM (from->getAddress ()),
+ Utils::string2SCM (line),
+ SCM_UNDEFINED));
+#endif
Parser::parseMessage(cnx->bot->serverConnection, from, cnx->bot->nickName,
line);
delete from;
{
dcc->autoRemove = false;
}
+
+bool
+DCCPerson::handleInput ()
+{
+ return dcc->handleInput ();
+}
Person * copy();
- String getNick() const;
- String getAddress() const;
+ // String getNick() const;
+ // String getAddress() const;
void keepAlive();
+ bool handleInput ();
+ const DCCConnection* DCC () const { return dcc; };
void sendNotice(String);
};
scm_c_define ("hooks/part", scm_long2num(Hook::LEAVE));
scm_c_define ("hooks/mode", scm_long2num(Hook::MODE));
scm_c_define ("hooks/message", scm_long2num(Hook::MESSAGE));
- // scm_c_define ("hooks/names", scm_long2num(Hook::NAMES));
scm_c_define ("hooks/notice", scm_long2num(Hook::NOTICE));
scm_c_define ("hooks/public", scm_long2num(Hook::PUBLIC));
scm_c_define ("hooks/public-notice", scm_long2num(Hook::PUBLIC_NOTICE));
scm_c_define ("hooks/raw", scm_long2num(Hook::RAW));
scm_c_define ("hooks/timer", scm_long2num(Hook::TIMER));
scm_c_define ("hooks/topic", scm_long2num(Hook::TOPIC));
+ // send hooks
scm_c_define ("hooks/send/public", scm_long2num (Hook::SEND_PUBLIC));
scm_c_define ("hooks/send/message", scm_long2num (Hook::SEND_MESSAGE));
scm_c_define ("hooks/send/action", scm_long2num (Hook::SEND_ACTION));
scm_c_define ("hooks/send/ctcp", scm_long2num (Hook::SEND_CTCP));
-
+ // dcc hooks
+ scm_c_define ("hooks/dcc/chat-begin",
+ scm_long2num (Hook::DCC_CHAT_BEGIN));
+ scm_c_define ("hooks/dcc/chat-message",
+ scm_long2num (Hook::DCC_CHAT_MESSAGE));
// procedures
bot_new_procedure ("bot:action", (SCMFunc)ScriptCommands::Action, 2, 0, 0);
Commands.C \
Connection.C \
DCCConnection.C \
+ DCCManager.H \
+ DCCManager.C \
DCCParser.C \
DCCPerson.C \
Interp.C \
Commands.C \
Connection.C \
DCCConnection.C \
+ DCCManager.H \
+ DCCManager.C \
DCCParser.C \
DCCPerson.C \
Interp.C \
am_bobotpp_OBJECTS = BanEntry.$(OBJEXT) Bot.$(OBJEXT) \
BotInterp.$(OBJEXT) Channel.$(OBJEXT) ChannelList.$(OBJEXT) \
Commands.$(OBJEXT) Connection.$(OBJEXT) DCCConnection.$(OBJEXT) \
- DCCParser.$(OBJEXT) DCCPerson.$(OBJEXT) Interp.$(OBJEXT) \
- Main.$(OBJEXT) Mask.$(OBJEXT) Parser.$(OBJEXT) Person.$(OBJEXT) \
- Queue.$(OBJEXT) ScriptCommands.$(OBJEXT) Server.$(OBJEXT) \
- ServerConnection.$(OBJEXT) ServerList.$(OBJEXT) \
- ServerQueue.$(OBJEXT) ServerQueueItem.$(OBJEXT) \
- ShitEntry.$(OBJEXT) ShitList.$(OBJEXT) Socket.$(OBJEXT) \
- String.$(OBJEXT) StringTokenizer.$(OBJEXT) TodoList.$(OBJEXT) \
- User.$(OBJEXT) UserCommands.$(OBJEXT) UserList.$(OBJEXT) \
- Utils.$(OBJEXT)
+ DCCManager.$(OBJEXT) DCCParser.$(OBJEXT) DCCPerson.$(OBJEXT) \
+ Interp.$(OBJEXT) Main.$(OBJEXT) Mask.$(OBJEXT) Parser.$(OBJEXT) \
+ Person.$(OBJEXT) Queue.$(OBJEXT) ScriptCommands.$(OBJEXT) \
+ Server.$(OBJEXT) ServerConnection.$(OBJEXT) \
+ ServerList.$(OBJEXT) ServerQueue.$(OBJEXT) \
+ ServerQueueItem.$(OBJEXT) ShitEntry.$(OBJEXT) \
+ ShitList.$(OBJEXT) Socket.$(OBJEXT) String.$(OBJEXT) \
+ StringTokenizer.$(OBJEXT) TodoList.$(OBJEXT) User.$(OBJEXT) \
+ UserCommands.$(OBJEXT) UserList.$(OBJEXT) Utils.$(OBJEXT)
bobotpp_OBJECTS = $(am_bobotpp_OBJECTS)
bobotpp_DEPENDENCIES =
bobotpp_LDFLAGS =
@AMDEP_TRUE@ $(DEPDIR)/BotInterp.Po $(DEPDIR)/Channel.Po \
@AMDEP_TRUE@ $(DEPDIR)/ChannelList.Po $(DEPDIR)/Commands.Po \
@AMDEP_TRUE@ $(DEPDIR)/Connection.Po $(DEPDIR)/DCCConnection.Po \
-@AMDEP_TRUE@ $(DEPDIR)/DCCParser.Po $(DEPDIR)/DCCPerson.Po \
-@AMDEP_TRUE@ $(DEPDIR)/Interp.Po $(DEPDIR)/Main.Po \
-@AMDEP_TRUE@ $(DEPDIR)/Mask.Po $(DEPDIR)/Parser.Po \
-@AMDEP_TRUE@ $(DEPDIR)/Person.Po $(DEPDIR)/Queue.Po \
-@AMDEP_TRUE@ $(DEPDIR)/ScriptCommands.Po $(DEPDIR)/Server.Po \
-@AMDEP_TRUE@ $(DEPDIR)/ServerConnection.Po \
+@AMDEP_TRUE@ $(DEPDIR)/DCCManager.Po $(DEPDIR)/DCCParser.Po \
+@AMDEP_TRUE@ $(DEPDIR)/DCCPerson.Po $(DEPDIR)/Interp.Po \
+@AMDEP_TRUE@ $(DEPDIR)/Main.Po $(DEPDIR)/Mask.Po \
+@AMDEP_TRUE@ $(DEPDIR)/Parser.Po $(DEPDIR)/Person.Po \
+@AMDEP_TRUE@ $(DEPDIR)/Queue.Po $(DEPDIR)/ScriptCommands.Po \
+@AMDEP_TRUE@ $(DEPDIR)/Server.Po $(DEPDIR)/ServerConnection.Po \
@AMDEP_TRUE@ $(DEPDIR)/ServerList.Po $(DEPDIR)/ServerQueue.Po \
@AMDEP_TRUE@ $(DEPDIR)/ServerQueueItem.Po $(DEPDIR)/ShitEntry.Po \
@AMDEP_TRUE@ $(DEPDIR)/ShitList.Po $(DEPDIR)/Socket.Po \
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Commands.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Connection.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/DCCConnection.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/DCCManager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/DCCParser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/DCCPerson.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Interp.Po@am__quote@
#include "ServerQueue.H"
#include "ScriptCommands.H"
#include "Interp.H"
+#include "DCCPerson.H"
#include <libguile.h>
#define VERIFY_STRING(par) if (!SCM_STRINGP((par))) \
Utils::scm2String (message));
return SCM_UNSPECIFIED;
}
-
-
#endif
SCM sendWho(SCM);
SCM sendWhois(SCM);
*/
-
};
#endif
String::String(const std::string & s)
{
p = new srep;
- len = s.length ();
+ // We do this instead of just s.length () because there might be a
+ // \0 in the string before the end (e.g. this is a message from the
+ // Socket's buffer).
+ const char* temp_str = s.c_str ();
+ len = strlen (temp_str);
p->s = new char[len + 1];
- std::strcpy (p->s, s.c_str ());
+ std::strcpy (p->s, temp_str);
}
String::String(const String & s)
#include "Commands.H"
#include "UserCommands.H"
#include "DCCConnection.H"
+#include "DCCManager.H"
#include "Parser.H"
#include "Macros.H"
#include "StringTokenizer.H"
from->sendNotice("\002DCClist:\002");
from->sendNotice("\002Hostname Last used\002");
- for (std::list<DCCConnection *>::iterator it =
- cnx->bot->dccConnections.begin();
- it != cnx->bot->dccConnections.end();
+ for (DCC_MAP::iterator it =
+ cnx->bot->dccConnections->MAP()->begin ();
+ it != cnx->bot->dccConnections->MAP()->end();
++it) {
- from->sendNotice((*it)->nuh.pad(32) + " " +
+ from->sendNotice(String(it->second->DCC()->nuh).pad(32) + " " +
String((long)(current_time -
- (*it)->lastSpoken)));
+ it->second->DCC()->lastSpoken)));
}
from->sendNotice("\002End of dcclist.\002");