From 5c73c60a95f257c87432f6b7fe9fb8ffa6cbfdef Mon Sep 17 00:00:00 2001 From: unknown_lamer Date: Fri, 24 Jun 2005 06:13:45 +0000 Subject: [PATCH] [project @ 2005-06-24 06:13:45 by unknown_lamer] bot:msg can now send messages to channels. bot:notice returns more detailed error codes (that still can't be used without knowledge of the C++, this will be fixed soon) --- ChangeLog | 8 ++++++++ NEWS | 4 +++- bobot++.info | 13 ++++++------- bobot++.texinfo | 3 +-- source/Commands.C | 16 +++++++++++----- source/ScriptCommands.C | 16 +++++----------- 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 297e9b7..e3cfd5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-06-24 Clinton Ebadi + + * source/ScriptCommands.C (sendNotice): Returns error code instead + of just #t or #f + + * source/Commands.C (Say): Check to make sure target is a channel + (Msg): Extended to send messages to channels + 2005-06-23 Clinton Ebadi * scripts/bot.scm: Added file ((bobotpp bot) module for other diff --git a/NEWS b/NEWS index 5378618..0fa13c1 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,8 @@ Version 2.1.8: + Misc * Added (bobotpp bot) module that modules may use to gain access to the bobot++ functions +- Documentation + + Merged documentation patch from Dale Smith (thanks) Version 2.1.7: @@ -65,7 +67,7 @@ Version 2.1.4: DCC Support Enhancements Version 2.1.3: Something - The flood rate can now be set using !setfloodrate INTEGER. The default is two messages per second before the bot will ignore -you. (thanks to Björn Gustavsson for requesting this) +you. (thanks to Björn Gustavsson for requesting this) - The flood rate may also be set from Scheme using (bot:setfloodrate integer) - A very large crash bug has been fixed. Previously, if an undefined diff --git a/bobot++.info b/bobot++.info index 772f7f4..aebacbb 100644 --- a/bobot++.info +++ b/bobot++.info @@ -751,8 +751,7 @@ File: bobot++.info, Node: High Level Message Functions, Next: Low Level Messag -- Function: bot:notice target message Sends MESSAGE as a NOTICE to TARGET. TARGET may be a user (nick) - or a channel. This returns `#t' if the message was sent - successfull, `#f' otherwise. + or a channel. This returns 0 on success.  File: bobot++.info, Node: Low Level Message Functions, Prev: High Level Message Functions, Up: Sending Messages @@ -1186,10 +1185,10 @@ Node: Hook Types22496 Node: Scheme User Levels25525 Node: Sending Messages26659 Node: High Level Message Functions27275 -Node: Low Level Message Functions28104 -Node: Misc Scripting Stuff28872 -Node: Concept Index35448 -Node: Function Index35667 -Node: Variable Index45655 +Node: Low Level Message Functions28055 +Node: Misc Scripting Stuff28823 +Node: Concept Index35399 +Node: Function Index35618 +Node: Variable Index45606  End Tag Table diff --git a/bobot++.texinfo b/bobot++.texinfo index 2db1f7a..873d00d 100644 --- a/bobot++.texinfo +++ b/bobot++.texinfo @@ -820,8 +820,7 @@ The same as if a user typed @code{/msg nick message} to their IRC client. @defun bot:notice target message Sends @var{message} as a NOTICE to @var{target}. @var{target} may be a -user (nick) or a channel. This returns @code{#t} if the message was -sent successfull, @code{#f} otherwise. +user (nick) or a channel. This returns 0 on success. @end defun @node Low Level Message Functions, , High Level Message Functions, Sending Messages diff --git a/source/Commands.C b/source/Commands.C index 7fb0bbc..29a7680 100644 --- a/source/Commands.C +++ b/source/Commands.C @@ -471,13 +471,19 @@ Commands::Msg(Bot *bot, String who, String message) CHECK_CONNECTION; if (who == "") - return EmptyAddressee; + { + return EmptyAddressee; + } if (Utils::channel_p(who)) - return NotToChannel; + { + return Commands::Say (bot, who, message); + } if (message == "") - return EmptyMessage; + { + return EmptyMessage; + } QUEUE->sendPrivmsg(who, message); @@ -599,8 +605,8 @@ Commands::Say(Bot *bot, String channel, String message) { CHECK_CONNECTION; -// if (!CHANNEL(channel)) -// return NotOnChannel(channel); + if (!CHANNEL(channel)) + return NotOnChannel(channel); QUEUE->sendPrivmsg(channel, message); diff --git a/source/ScriptCommands.C b/source/ScriptCommands.C index b2bdeaf..762549d 100644 --- a/source/ScriptCommands.C +++ b/source/ScriptCommands.C @@ -658,16 +658,10 @@ ScriptCommands::sendNotice (SCM to, SCM message) VERIFY_STRING (to); VERIFY_STRING (message); - if (Commands::Notice (Interp::bot, - Utils::scm2str (to), - Utils::scm2str (message)) - == Ok) - { - return SCM_BOOL_T; - } - else - { - return SCM_BOOL_F; - } + return (scm_long2num + (Commands::Notice (Interp::bot, + Utils::scm2str (to), + Utils::scm2str (message)).getCode ())); + } #endif -- 2.20.1