+2005-07-04 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * source/DCCManager.C (checkInput):
+
+ * scripts/bobot-utils.scm (bot:log): Updated to use bot:logport
+ instead of bot-logport
+
+ * source/Interp.C (interp_init_helper): Add hooks/dcc/chat-end
+ constant to Scheme
+
+ * bobot++.texinfo (DCC CHAT Hooks): Document hooks/dcc/chat-end
+
+ * source/BotInterp.H: Add DCC_CHAT_END to enum
+
+ * source/DCCManager.C (checkStale): Run hooks/dcc/chat-end when
+ deleting a stale connection.
+
2005-07-03 Clinton Ebadi <clinton@unknownlamer.org>
* bobot++.texinfo (Hook Types): Documented all hooks
* Utils::valid_nickname_p should have a configurable max nick length
* More detailed script error reporting
* Commands::sendCTCP, Commands::sendCTCPReply
+* Add DCC_CHAT_END hook for Scheme
2.2:
* Finish Texinfo manual
(e.g. bot:send-CTCP to send a CTCP message)
* Add util functions for doing stuff like quoting CTCP messages
* Finish adding hooks/send hooks
-* Add DCC_CHAT_END hook for Scheme
2.4:
* Use configuration database class
This hook is called when a user begins a DCC CHAT with the bot.
FROM is the user's address in the form `nick!user@host'.
+ -- Function: hooks/dcc/chat-end address
+ This hook is called when a DCC CHAT is purged after being idle for
+ a while, or when the user closes the DCC CHAT. As such, you cannot
+ write any more data to the DCC CHAT.
+
+ ADDRESS is the address (nick!user@host) of the person on the other
+ side of the DCC.
+
-- Function: hooks/dcc/chat-message from message
This hook is called when a user sends a message to the bot through
a DCC CHAT.
* hooks/ctcp-reply: Received Message Hooks.
(line 43)
* hooks/dcc/chat-begin: DCC CHAT Hooks. (line 10)
-* hooks/dcc/chat-message: DCC CHAT Hooks. (line 14)
+* hooks/dcc/chat-end: DCC CHAT Hooks. (line 14)
+* hooks/dcc/chat-message: DCC CHAT Hooks. (line 22)
* hooks/disconnect: Received Message Hooks.
(line 54)
* hooks/flood: Miscellaneous Hooks. (line 7)
Node: Received Message Hooks\7f23185
Node: Sent Message Hooks\7f28412
Node: DCC CHAT Hooks\7f29809
-Node: Miscellaneous Hooks\7f30526
-Node: Scheme User Levels\7f30975
-Node: Sending Messages\7f32109
-Node: High Level Message Functions\7f32725
-Node: Low Level Message Functions\7f33505
-Node: Misc Scripting Stuff\7f34568
-Node: Concept Index\7f41144
-Node: Function Index\7f41363
-Node: Variable Index\7f52526
+Node: Miscellaneous Hooks\7f30849
+Node: Scheme User Levels\7f31298
+Node: Sending Messages\7f32432
+Node: High Level Message Functions\7f33048
+Node: Low Level Message Functions\7f33828
+Node: Misc Scripting Stuff\7f34891
+Node: Concept Index\7f41467
+Node: Function Index\7f41686
+Node: Variable Index\7f52922
\1f
End Tag Table
@var{from} is the user's address in the form @samp{nick!user@@host}.
@end defun
+@defun hooks/dcc/chat-end address
+This hook is called when a DCC CHAT is purged after being idle for a
+while, or when the user closes the DCC CHAT. As such, you cannot write
+any more data to the DCC CHAT.
+
+@var{address} is the address (nick!user@@host) of the person on the
+other side of the DCC.
+@end defun
+
@defun hooks/dcc/chat-message from message
This hook is called when a user sends a message to the bot through
a DCC CHAT.
(for-each
(lambda (x)
(if (thunk? x)
- (display (x) (bot-logport))
- (display x (bot-logport))))
+ (display (x) (bot:logport))
+ (display x (bot:logport))))
messages)
(bot:flushport))
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#include <fstream>
#include <algorithm>
// send hooks
SEND_ACTION, SEND_CTCP, SEND_PUBLIC, SEND_MESSAGE,
// DCC hooks
- DCC_CHAT_BEGIN, DCC_CHAT_MESSAGE
+ DCC_CHAT_BEGIN, DCC_CHAT_END, DCC_CHAT_MESSAGE
};
};
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#ifndef DCCCONNECTION_H
#define DCCCONNECTION_H
// DCCManager.H -*- C++ -*-
-// Copyright (c) 2002 Clinton Ebadi
+// Copyright (c) 2002,2005 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
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#include "DCCManager.H"
+#include "Utils.H"
void
DCCManager::addConnection (DCCConnection *cnx)
if (temp_cnx->get_autoRemove () && std::time (0) >=
(std::time_t)(temp_cnx->get_lastSpoken () + Bot::DCC_DELAY))
{
+#ifdef USESCRIPTS
+ DCCPerson *dp = new DCCPerson ((DCCConnection *) temp_cnx);
+
+ // run hooks/dcc/chat-end
+ dp->bot->botInterp->RunHooks
+ (Hook::DCC_CHAT_END,
+ dp->getAddress (),
+ scm_list_n (Utils::
+ str2scm (dp->getAddress ()),
+ SCM_UNDEFINED));
+ delete dp;
+#endif
delete it->second;
dcc_map.erase (it);
}
{
if (it2->second->handleInput())
{
+#ifdef USESCRIPTS
+ DCCPerson *dp = new DCCPerson (*it2->second);
+
+ // run hooks/dcc/chat-end
+ dp->bot->botInterp->RunHooks
+ (Hook::DCC_CHAT_END,
+ dp->getAddress (),
+ scm_list_n (Utils::
+ str2scm (dp->getAddress ()),
+ SCM_UNDEFINED));
+ delete dp;
+#endif
+
delete it2->second->dcc;
delete it2->second;
dcc_map.erase(it2);
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#ifdef HAVE_CONFIG_H
#include "config.h"
// Call hooks/dcc/chat-message hook functions
cnx->get_bot()->botInterp->RunHooks (Hook::DCC_CHAT_MESSAGE,
from->getAddress () + " " + line,
- scm_list_n (Utils::str2scm (from->getAddress ()),
- Utils::str2scm (line),
- SCM_UNDEFINED));
+ scm_list_n
+ (Utils::str2scm (from->getAddress ()),
+ Utils::str2scm (line),
+ SCM_UNDEFINED));
#endif
Parser::parseMessage(cnx->get_bot()->serverConnection,
from, cnx->get_bot()->nickName,
// dcc hooks
scm_c_define ("hooks/dcc/chat-begin",
scm_long2num (Hook::DCC_CHAT_BEGIN));
+ scm_c_define ("hooks/dcc/chat-end",
+ scm_long2num (Hook::DCC_CHAT_END));
scm_c_define ("hooks/dcc/chat-message",
scm_long2num (Hook::DCC_CHAT_MESSAGE));
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#ifndef SERVERQUEUE_H
#define SERVERQUEUE_H