[project @ 2005-06-23 06:43:12 by unknown_lamer]
authorunknown_lamer <unknown>
Thu, 23 Jun 2005 06:43:12 +0000 (06:43 +0000)
committerunknown_lamer <unknown>
Thu, 23 Jun 2005 06:43:12 +0000 (06:43 +0000)
Call hooks/disconnect when disconnected from a server.

ChangeLog
bobot++.info
bobot++.texinfo
source/Bot.C

index 786c239..7e09ba6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 2005-06-23  Clinton Ebadi  <clinton@unknownlamer.org>
 
+       * source/Bot.C (run): Added call to Hooks::DISCONNECT
+       (hooks/disconnect) when the bot is disconnected from the server
+
        * bobot++.texinfo: Applied documentation patch from Dale P. Smith
+       (Hook Types): Added hooks/disconnect argument
 
 2005-06-06  Clinton Ebadi  <clinton@unknownlamer.org>
 
index f5d33d9..45b958f 100644 (file)
@@ -636,8 +636,7 @@ write docs
 
  -- Function: hooks/ctcp-reply nick command rest
 
- -- Function: hooks/disconnect ?
-     [ Is this ever called?  I can't find it in the source ]
+ -- Function: hooks/disconnect server
 
  -- Function: hooks/flood nick
 
@@ -1106,29 +1105,29 @@ Function Index
 * hooks/action:                          Hook Types.          (line  22)
 * hooks/ctcp:                            Hook Types.          (line  36)
 * hooks/ctcp-reply:                      Hook Types.          (line  38)
-* hooks/dcc/chat-begin:                  Hook Types.          (line  80)
-* hooks/dcc/chat-message:                Hook Types.          (line  84)
+* hooks/dcc/chat-begin:                  Hook Types.          (line  79)
+* hooks/dcc/chat-message:                Hook Types.          (line  83)
 * hooks/disconnect:                      Hook Types.          (line  40)
-* hooks/flood:                           Hook Types.          (line  43)
-* hooks/invite:                          Hook Types.          (line  45)
-* hooks/join:                            Hook Types.          (line  47)
-* hooks/kick:                            Hook Types.          (line  49)
-* hooks/leave:                           Hook Types.          (line  51)
-* hooks/message:                         Hook Types.          (line  56)
-* hooks/mode:                            Hook Types.          (line  54)
+* hooks/flood:                           Hook Types.          (line  42)
+* hooks/invite:                          Hook Types.          (line  44)
+* hooks/join:                            Hook Types.          (line  46)
+* hooks/kick:                            Hook Types.          (line  48)
+* hooks/leave:                           Hook Types.          (line  50)
+* hooks/message:                         Hook Types.          (line  55)
+* hooks/mode:                            Hook Types.          (line  53)
 * hooks/nickname:                        Hook Types.          (line  30)
-* hooks/notice:                          Hook Types.          (line  58)
-* hooks/part:                            Hook Types.          (line  52)
-* hooks/public:                          Hook Types.          (line  60)
-* hooks/public-notice:                   Hook Types.          (line  62)
-* hooks/raw:                             Hook Types.          (line  64)
-* hooks/send/action:                     Hook Types.          (line  76)
-* hooks/send/ctcp:                       Hook Types.          (line  78)
-* hooks/send/message:                    Hook Types.          (line  74)
-* hooks/send/public:                     Hook Types.          (line  72)
+* hooks/notice:                          Hook Types.          (line  57)
+* hooks/part:                            Hook Types.          (line  51)
+* hooks/public:                          Hook Types.          (line  59)
+* hooks/public-notice:                   Hook Types.          (line  61)
+* hooks/raw:                             Hook Types.          (line  63)
+* hooks/send/action:                     Hook Types.          (line  75)
+* hooks/send/ctcp:                       Hook Types.          (line  77)
+* hooks/send/message:                    Hook Types.          (line  73)
+* hooks/send/public:                     Hook Types.          (line  71)
 * hooks/signoff:                         Hook Types.          (line  34)
-* hooks/timer:                           Hook Types.          (line  66)
-* hooks/topic:                           Hook Types.          (line  70)
+* hooks/timer:                           Hook Types.          (line  65)
+* hooks/topic:                           Hook Types.          (line  69)
 
 \1f
 File: bobot++.info,  Node: Variable Index,  Prev: Function Index,  Up: Top
@@ -1172,13 +1171,13 @@ Node: Adding New Commands\7f19150
 Node: Hooks\7f20473
 Node: Creating a Hook\7f21452
 Node: Hook Types\7f22635
-Node: Scheme User Levels\7f25478
-Node: Sending Messages\7f26612
-Node: High Level Message Functions\7f27228
-Node: Low Level Message Functions\7f27851
-Node: Misc Scripting Stuff\7f28619
-Node: Concept Index\7f35195
-Node: Function Index\7f35414
-Node: Variable Index\7f45258
+Node: Scheme User Levels\7f25422
+Node: Sending Messages\7f26556
+Node: High Level Message Functions\7f27172
+Node: Low Level Message Functions\7f27795
+Node: Misc Scripting Stuff\7f28563
+Node: Concept Index\7f35139
+Node: Function Index\7f35358
+Node: Variable Index\7f45202
 \1f
 End Tag Table
index 3533104..c9fd5e9 100644 (file)
@@ -684,8 +684,7 @@ This hook gets called when someone changes thir nickname from
 @defun hooks/ctcp-reply nick command rest
 @end defun
 
-@defun hooks/disconnect ?
-[ Is this ever called?  I can't find it in the source ]
+@defun hooks/disconnect server
 @end defun
 
 @defun hooks/flood nick
index 9c67822..741e2e1 100644 (file)
@@ -318,12 +318,25 @@ Bot::run()
 {
   nextServer();
 
-  while (!stop) {
-    waitForInput();  // This is the main event loop
-    dccConnections->checkStale ();
-    if (!serverConnection->queue->flush())
-      nextServer();
-  }
+  while (!stop) 
+    {
+      waitForInput();  // This is the main event loop
+      dccConnections->checkStale ();
+
+      if (!serverConnection->queue->flush())
+       {
+         // Disconnected
+#ifdef USESCRIPTS
+         // Run hooks/disconnected
+         this->botInterp->RunHooks 
+           (Hook::DISCONNECT, 
+            serverConnection->server->getHostName (),
+            scm_list_n 
+            (Utils::str2scm  (serverConnection->server->getHostName ())));
+#endif
+         nextServer();
+       }
+    }
 }
 
 void