[project @ 2002-08-18 21:32:48 by unknown_lamer]
authorunknown_lamer <unknown>
Sun, 18 Aug 2002 21:32:49 +0000 (21:32 +0000)
committerunknown_lamer <unknown>
Sun, 18 Aug 2002 21:32:49 +0000 (21:32 +0000)
You can now talk to the bot using bot:dcc-chat-send

ChangeLog
NEWS
acinclude.m4
bobot++.info
bobot++.texinfo
source/Interp.C
source/ScriptCommands.C
source/ScriptCommands.H

index e78405d..b032c2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
diff --git a/NEWS b/NEWS
index 8743d91..0ddbeb3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,8 +17,13 @@ Version 2.1.1: foom
   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
index d95ef2e..8b52437 100644 (file)
@@ -1,4 +1,4 @@
-pr#
+#
 # Copyright (c) 1998 Etienne Bernard
 # Copyright (c) 2002 Clinton Ebadi
 #
index a9712c3..114707e 100644 (file)
@@ -244,7 +244,7 @@ general format of a hook is:
 
         - 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
@@ -362,6 +362,23 @@ general format of a hook is:
         - # 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
@@ -476,6 +493,8 @@ Variable Index
 * 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.
@@ -513,13 +532,13 @@ Node: Adding New Commands\7f4585
 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
index 1dae231..b37b725 100644 (file)
@@ -269,7 +269,7 @@ This hook is triggered when someone performs an action.
 @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
@@ -533,6 +533,38 @@ Description of the hook
 @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
 
 
index 1e542af..c1514a6 100644 (file)
@@ -161,6 +161,9 @@ Interp::Startup()
   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);
index 266c969..be4053c 100644 (file)
@@ -29,6 +29,7 @@
 #include "ScriptCommands.H"
 #include "Interp.H"
 #include "DCCPerson.H"
+#include "DCCManager.H"
 #include <libguile.h>
 
 #define VERIFY_STRING(par) if (!SCM_STRINGP((par))) \
@@ -586,6 +587,15 @@ ScriptCommands::DelTimer(SCM timer)
   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
 
index d192182..afd7799 100644 (file)
@@ -78,6 +78,9 @@ public:
   static SCM AddTimer(SCM, SCM);
   static SCM DelTimer(SCM);
 
+  // DCC CHAT
+  static SCM sendDCCChatMessage (SCM, SCM);
+
   // Message sending
   static SCM sendCTCP(SCM, SCM, SCM);
   /*