+2002-08-18 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * bobot++.texinfo (Hook Types): Fixed a typo (I wrote
+ user!nick@host instead of the correct nick!user@host).
+
+ * source/Interp.C (Startup): Register bot:DCC-chat-send
+
+ * source/ScriptCommands.C (sendDCCChatMessage): Added method again
+
2002-08-08 Clinton Ebadi <clinton@unknownlamer.org>
* source/String.C (String): The std::string copy constructor now
name for your hooks.
- Logging now works again (oops, I didn't realize I broke it until I
started to work on DCC).
-- DCC CHAT now "works." You can connect to the bot and talk to to it,
- but it doesn't do anything useful.
+- DCC CHAT now "works." You can connect to the bot and talk to to it
+ and use Scheme hooks to talk to the user.
+- New hooks: hooks/dcc/chat-begin and hooks/dcc/chat-message. These
+ are called when a new DCC Chat begin and when the user sends a
+ message.
+- New Function: bot:dcc-chat-send TO MESSAGE, sends a MESSAGE to the
+ person at address TO
- New hooks: hooks/send/... where ... is one of action, ctcp, public,
or message. These are triggered when the bot does an
ACTION, sends a CTCP (_not_ a ctcp-reply), sends a PRIVMSG to a
-pr#
+#
# Copyright (c) 1998 Etienne Bernard
# Copyright (c) 2002 Clinton Ebadi
#
- FROM, TO, ACTION
- FROM: this is the address of the person that performed
- the action in the form `USER ! NICK @ HOST' (without the
+ the action in the form `NICK ! USER @ HOST' (without the
spaces).
- TO: This is the target of the action, which is either a
- # of args
- `arg1': desc
+ * `hooks/dcc/begin'
+ - This hook is triggered when a user begins a DCC CHAT with the
+ bot.
+
+ - FROM
+ - FROM: This is the user's address in the form
+ `nick!user@host'.
+
+ * `hooks/dcc/message'
+ - This hook is triggered when a user sends a message to the bot
+ through a DCC CHAT
+
+ - FROM MESSAGE
+ - FROM: This is the user's address in the form
+ `nick!user@host'.
+
+ - MESSAGE: This is the message the user sent to the bot.
\1f
File: bobot++.info, Node: Scheme User Levels, Next: Sending Messages, Prev: Hooks, Up: Scripting
* hooks/action: Hook Types.
* hooks/ctcp: Hook Types.
* hooks/ctcp-reply: Hook Types.
+* hooks/dcc/begin: Hook Types.
+* hooks/dcc/message: Hook Types.
* hooks/disconnect: Hook Types.
* hooks/flood: Hook Types.
* hooks/invite: Hook Types.
Node: Hooks\7f5852
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
+Node: Scheme User Levels\7f11439
+Node: Sending Messages\7f12568
+Node: High Level Message Functions\7f13165
+Node: Low Level Message Functions\7f13379
+Node: Misc Scripting Stuff\7f14132
+Node: Concept Index\7f14551
+Node: Function Index\7f14733
+Node: Variable Index\7f14994
\1f
End Tag Table
@itemize @minus
@item
@var{from}: this is the address of the person that performed the
-action in the form @samp{@var{user} ! @var{nick} @@ @var{host}}
+action in the form @samp{@var{nick} ! @var{user} @@ @var{host}}
(without the spaces).
@item
@var{to}: This is the target of the action, which is either a channel
@end itemize
@end itemize
+@item
+@vindex hooks/dcc/begin
+@code{hooks/dcc/begin}
+@itemize @minus
+@item
+This hook is triggered when a user begins a DCC CHAT with the bot.
+@item
+@var{FROM}
+@itemize @minus
+@item
+@var{FROM}: This is the user's address in the form
+@samp{nick!user@@host}.
+@end itemize
+@end itemize
+
+@item
+@vindex hooks/dcc/message
+@code{hooks/dcc/message}
+@itemize @minus
+@item
+This hook is triggered when a user sends a message to the bot through
+a DCC CHAT
+@item
+@var{FROM} @var{MESSAGE}
+@itemize @minus
+@item
+@var{FROM}: This is the user's address in the form
+@samp{nick!user@@host}.
+@item
+@var{MESSAGE}: This is the message the user sent to the bot.
+@end itemize
+@end itemize
@end itemize
bot_new_procedure ("bot:deltimer", (SCMFunc)ScriptCommands::DelTimer,
1, 0, 0);
+ scm_c_define_gsubr ("bot:DCC-chat-send", 2, 0, 0,
+ (SCMFunc)ScriptCommands::sendDCCChatMessage);
+
// "Low Level" Message functuions
scm_c_define_gsubr ("bot:send-CTCP", 3, 0, 0,
(SCMFunc)ScriptCommands::sendCTCP);
#include "ScriptCommands.H"
#include "Interp.H"
#include "DCCPerson.H"
+#include "DCCManager.H"
#include <libguile.h>
#define VERIFY_STRING(par) if (!SCM_STRINGP((par))) \
return SCM_BOOL (Interp::bot->botInterp->DelTimer(timer));
}
+SCM
+ScriptCommands::sendDCCChatMessage (SCM to, SCM message)
+{
+
+ return SCM_BOOL (Interp::bot->dccConnections->sendMessage
+ (Utils::scm2String (to),
+ Utils::scm2String (message)));
+}
+
// Message sending
// FIXME: write these
static SCM AddTimer(SCM, SCM);
static SCM DelTimer(SCM);
+ // DCC CHAT
+ static SCM sendDCCChatMessage (SCM, SCM);
+
// Message sending
static SCM sendCTCP(SCM, SCM, SCM);
/*