From 1520dfbdf9e2fe3f18248684337452f3bc508fcf Mon Sep 17 00:00:00 2001 From: unknown_lamer Date: Thu, 23 Jun 2005 06:43:12 +0000 Subject: [PATCH] [project @ 2005-06-23 06:43:12 by unknown_lamer] Call hooks/disconnect when disconnected from a server. --- ChangeLog | 4 ++++ bobot++.info | 59 ++++++++++++++++++++++++------------------------- bobot++.texinfo | 3 +-- source/Bot.C | 25 ++++++++++++++++----- 4 files changed, 53 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 786c239..7e09ba6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ 2005-06-23 Clinton Ebadi + * 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 diff --git a/bobot++.info b/bobot++.info index f5d33d9..45b958f 100644 --- a/bobot++.info +++ b/bobot++.info @@ -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)  File: bobot++.info, Node: Variable Index, Prev: Function Index, Up: Top @@ -1172,13 +1171,13 @@ Node: Adding New Commands19150 Node: Hooks20473 Node: Creating a Hook21452 Node: Hook Types22635 -Node: Scheme User Levels25478 -Node: Sending Messages26612 -Node: High Level Message Functions27228 -Node: Low Level Message Functions27851 -Node: Misc Scripting Stuff28619 -Node: Concept Index35195 -Node: Function Index35414 -Node: Variable Index45258 +Node: Scheme User Levels25422 +Node: Sending Messages26556 +Node: High Level Message Functions27172 +Node: Low Level Message Functions27795 +Node: Misc Scripting Stuff28563 +Node: Concept Index35139 +Node: Function Index35358 +Node: Variable Index45202  End Tag Table diff --git a/bobot++.texinfo b/bobot++.texinfo index 3533104..c9fd5e9 100644 --- a/bobot++.texinfo +++ b/bobot++.texinfo @@ -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 diff --git a/source/Bot.C b/source/Bot.C index 9c67822..741e2e1 100644 --- a/source/Bot.C +++ b/source/Bot.C @@ -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 -- 2.20.1