+2005-07-06 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * bobot++.texinfo (Misc Scripting Stuff): Documented bot:who and
+ bot:whois
+
+ * source/Interp.C (interp_init_helper): Add bot:who and bot:whois
+ bindings to Scheme
+
+ * source/ScriptCommands.C (Who): Implemented Who method
+ Removed IQUEUE macro (no longer needed)
+ (Whois): Implemented Whois method
+
+ * source/ScriptCommands.H: Added Who and Whois methods
+
+ * source/Commands.C (Who): Implemented Who
+ (Whois): Implemented Whois
+
+ * source/Commands.H: Add Who and Whois tethods
+
+ * source/Interp.C: Updated copyright notice
+ (interp_init_helper): Remove send from CTCP/CTCPReply method names
+
+ * source/Interp.H: Updated copyright notice
+
+ * source/ScriptCommands.C (CTCP): Renamed from sendCTCP
+ (CTCPReply): Renamed from sendCTCPReply
+
2005-07-05 Clinton Ebadi <clinton@unknownlamer.org>
* bobot++.texinfo (Low Level Message Functions): Updated docs to
deprecated feature support, they will not be available.
+ RENAME: bot:send-ctcp was renamed to bot:ctcp
+ RENAME: bot:send-ctcp-reply was renamed to bot:ctcp-reply
+ + Added bot:who function
+ + Added bot:whois function
- Documention
+ Reorganized a few sections
+ Every hook is now documented
* More detailed script error reporting
* Commands::sendCTCP, Commands::sendCTCPReply
* Add DCC_CHAT_END hook for Scheme
+* Finish adding commands to Scheme for sending messages
+* Finish adding hooks/send hooks
2.2:
* Finish Texinfo manual
-* Finish adding commands to Scheme for sending messages
- (e.g. bot:send-CTCP to send a CTCP message)
* Add util functions for doing stuff like quoting CTCP messages
-* Finish adding hooks/send hooks
2.4:
* Use configuration database class
(IRC Client Protocol) and CTCP spec. These functions all return
`*unspecified*' always, so don't use the return value for anything.
- -- Function: bot:send-ctcp to command message
+ -- Function: bot:ctcp to command message
TO is the target of your CTCP message, COMMAND is the CTCP
command, and MESSAGE is the message (or arguments) of the command.
Make sure to `bot:ctcp-quote' the message!
- -- Function: bot:send-ctcp-reply to command message
+ -- Function: bot:ctcp-reply to command message
TO is the target of your CTCP reply, COMMAND is the CTCP command,
and MESSAGE is the message (or arguments) of the command. Make
sure to `bot:ctcp-quote' the message!
-- Function: bot:unlock channel
Makes the bot unlock topic on CHANNEL.
+ -- Function: bot:who target
+ Sends a WHO command to TARGET. TARGET may be either a channel or a
+ user.
+
+ -- Function: bot:whois nick
+ Sends a WHOIS command to NICK. NICK *must* be a nickname, you
+ cannot send a WHOIS to a channel.
+
-- Function: bot:getnickname
[ Gets the bot's nickname? ]
* Menu:
* %bot:load-extensions: Misc Scripting Stuff.
- (line 206)
+ (line 214)
* bot:action: High Level Message Functions.
(line 13)
* bot:addcommand: Adding New Commands. (line 11)
* bot:addshit: Misc Scripting Stuff.
(line 38)
* bot:addtimer: Misc Scripting Stuff.
- (line 167)
+ (line 175)
* bot:adduser: Misc Scripting Stuff.
(line 22)
* bot:ban: Misc Scripting Stuff.
(line 49)
* bot:change-command-level: Misc Scripting Stuff.
(line 54)
+* bot:ctcp: Low Level Message Functions.
+ (line 13)
* bot:ctcp-quote: Misc Scripting Stuff.
- (line 200)
+ (line 208)
+* bot:ctcp-reply: Low Level Message Functions.
+ (line 18)
* bot:cycle: Misc Scripting Stuff.
(line 60)
* bot:dcc-chat-send: Misc Scripting Stuff.
- (line 171)
+ (line 179)
* bot:deban: Misc Scripting Stuff.
(line 63)
* bot:delcommand: Misc Scripting Stuff.
- (line 164)
+ (line 172)
* bot:delserver: Misc Scripting Stuff.
(line 67)
* bot:delshit: Misc Scripting Stuff.
(line 74)
* bot:deltimer: Misc Scripting Stuff.
- (line 169)
+ (line 177)
* bot:deluser: Misc Scripting Stuff.
(line 71)
* bot:deop: Misc Scripting Stuff.
* bot:do: Misc Scripting Stuff.
(line 83)
* bot:flush: Misc Scripting Stuff.
- (line 155)
+ (line 163)
* bot:flushport: Misc Scripting Stuff.
- (line 158)
+ (line 166)
* bot:getnickname: Misc Scripting Stuff.
- (line 148)
+ (line 156)
* bot:getserver: Misc Scripting Stuff.
- (line 151)
+ (line 159)
* bot:getserverlist: Misc Scripting Stuff.
- (line 153)
+ (line 161)
* bot:invite: Misc Scripting Stuff.
(line 85)
* bot:join: Misc Scripting Stuff.
* bot:kickban: Misc Scripting Stuff.
(line 98)
* bot:load: Misc Scripting Stuff.
- (line 184)
+ (line 192)
* bot:load-module: Misc Scripting Stuff.
- (line 186)
+ (line 194)
* bot:lock: Misc Scripting Stuff.
(line 102)
* bot:log: Misc Scripting Stuff.
- (line 179)
+ (line 187)
* bot:logport: Misc Scripting Stuff.
(line 105)
* bot:match-not-channel: Misc Scripting Stuff.
- (line 190)
+ (line 198)
* bot:match-to-me: Misc Scripting Stuff.
- (line 194)
+ (line 202)
* bot:mode: Misc Scripting Stuff.
(line 108)
* bot:msg: High Level Message Functions.
* bot:part: Misc Scripting Stuff.
(line 120)
* bot:random: Misc Scripting Stuff.
- (line 161)
+ (line 169)
* bot:reconnect: Misc Scripting Stuff.
(line 123)
* bot:say: High Level Message Functions.
(line 7)
-* bot:send-ctcp: Low Level Message Functions.
- (line 13)
-* bot:send-ctcp-reply: Low Level Message Functions.
- (line 18)
* bot:sent-to-me?: Misc Scripting Stuff.
- (line 198)
+ (line 206)
* bot:server: Misc Scripting Stuff.
(line 126)
* bot:setfloodrate: Misc Scripting Stuff.
* bot:unlock: Misc Scripting Stuff.
(line 145)
* bot:use-module: Misc Scripting Stuff.
- (line 188)
+ (line 196)
+* bot:who: Misc Scripting Stuff.
+ (line 148)
+* bot:whois: Misc Scripting Stuff.
+ (line 152)
* hooks/action: Received Message Hooks.
(line 9)
* hooks/ctcp: Received Message Hooks.
* Menu:
* %bot:loadpath: Misc Scripting Stuff.
- (line 204)
+ (line 212)
* exit-hook: Misc Scripting Stuff.
(line 9)
* user-friend: Scheme User Levels. (line 6)
Node: Sending Messages\7f33143
Node: High Level Message Functions\7f33759
Node: Low Level Message Functions\7f34539
-Node: Misc Scripting Stuff\7f35602
-Node: Concept Index\7f42178
-Node: Function Index\7f42397
-Node: Variable Index\7f53633
+Node: Misc Scripting Stuff\7f35592
+Node: Concept Index\7f42417
+Node: Function Index\7f42636
+Node: Variable Index\7f54144
\1f
End Tag Table
Makes the bot unlock topic on @var{channel}.
@end defun
+@defun bot:who target
+Sends a WHO command to @var{target}. @var{target} may be either a
+channel or a user.
+@end defun
+
+@defun bot:whois nick
+Sends a WHOIS command to @var{nick}. @var{nick} @strong{must} be a
+nickname, you cannot send a WHOIS to a channel.
+@end defun
+
@c (0, 0, 0)
@defun bot:getnickname
[ Gets the bot's nickname? ]
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#include "Macros.H"
#include "Message.H"
return Ok;
}
+
+Message
+Commands::Who (Bot *bot, String target)
+{
+ CHECK_CONNECTION;
+
+ QUEUE->sendWho (target);
+
+ return Ok;
+}
+
+Message
+Commands::Whois (Bot *bot, String nick)
+{
+ CHECK_CONNECTION;
+
+ if (!Utils::valid_nickname_p (bot, nick))
+ {
+ return InvalidNick (nick);
+ }
+ else
+ {
+ QUEUE->sendWhois (nick);
+ return Ok;
+ }
+}
+
+
// Commands.H -*- C++ -*-
// Copyright (c) 1997, 1998 Etienne BERNARD
-// Copyright (C) 2002 Clinton Ebadi
+// Copyright (C) 2002,2005 Clinton Ebadi
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
static Message TKBan(Bot *, String, String, int, String);
static Message Topic(Bot *, String, String);
static Message Unlock(Bot *, String);
+ static Message Who (Bot *, String);
+ static Message Whois (Bot *, String);
};
#endif
// Interp.C -*- C++ -*-
// Copyright (c) 1998 Etienne BERNARD
-// Copyright (C) 2002 Clinton Ebadi
+// Copyright (C) 2002,2005 Clinton Ebadi
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
bot_new_procedure ("bot:change-command-level",
(SCMFunc)ScriptCommands::ChangeCommandLevel,
2, 0, 0);
+ scm_c_define_gsubr ("bot:ctcp", 3, 0, 0,
+ (SCMFunc)ScriptCommands::CTCP);
+ scm_c_define_gsubr ("bot:ctcp-reply", 3, 0, 0,
+ (SCMFunc)ScriptCommands::CTCPReply);
bot_new_procedure ("bot:cycle", (SCMFunc)ScriptCommands::Action, 1, 0, 0);
bot_new_procedure ("bot:deban", (SCMFunc)ScriptCommands::Deban, 2, 0, 0);
bot_new_procedure ("bot:delserver", (SCMFunc)ScriptCommands::DelServer,
bot_new_procedure ("bot:tkban", (SCMFunc)ScriptCommands::TKBan, 3, 1, 0);
bot_new_procedure ("bot:topic", (SCMFunc)ScriptCommands::Topic, 2, 0, 0);
bot_new_procedure ("bot:unlock", (SCMFunc)ScriptCommands::Unlock, 1, 0, 0);
+ scm_c_define_gsubr ("bot:who", 1, 0, 0, (SCMFunc)ScriptCommands::Who);
+ scm_c_define_gsubr ("bot:whois", 1, 0, 0, (SCMFunc)ScriptCommands::Whois);
bot_new_procedure ("bot:getnickname", (SCMFunc)ScriptCommands::getNickname,
0, 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:ctcp", 3, 0, 0,
- (SCMFunc)ScriptCommands::sendCTCP);
- scm_c_define_gsubr ("bot:ctcp-reply", 3, 0, 0,
- (SCMFunc)ScriptCommands::sendCTCPReply);
}
#undef bot_new_procedure
// Interp.H -*- C++ -*-
// Copyright (c) 1998 Etienne BERNARD
-// Copyright (c) 2002 Clinton Ebadi
+// Copyright (c) 2002,2005 Clinton Ebadi
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// Message.H -*- C++ -*-
// Copyright (c) 1997, 1998 Etienne BERNARD
+// Copyright (c) 2005 Clinton Ebadi
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#ifndef MESSAGE_H
#define MESSAGE_H
SCM_STRING_COERCE_0TERMINATION_X (command);
std::string ccommand = SCM_STRING_CHARS (command);
- unsigned int llevel = scm_num2uint (level, 0, "ScriptCommands::ChangeCommandLevel");
+ unsigned int llevel = scm_num2uint
+ (level, 0, "ScriptCommands::ChangeCommandLevel");
if (llevel > 4)
return SCM_BOOL_F;
return SCM_BOOL_T;
}
+SCM
+ScriptCommands::CTCP(SCM to, SCM command , SCM message)
+{
+ VERIFY_STRING(to);
+ VERIFY_STRING(command);
+ VERIFY_STRING(message);
+
+ Commands::CTCP (Interp::bot, Utils::scm2str (to),
+ Utils::scm2str (command),
+ Utils::scm2str (message));
+
+ return SCM_UNSPECIFIED;
+}
+
+SCM
+ScriptCommands::CTCPReply (SCM to, SCM command , SCM message)
+{
+ VERIFY_STRING(to);
+ VERIFY_STRING(command);
+ VERIFY_STRING(message);
+
+ Commands::CTCPReply (Interp::bot, Utils::scm2str (to),
+ Utils::scm2str (command),
+ Utils::scm2str (message));
+
+ return SCM_UNSPECIFIED;
+}
+
SCM
ScriptCommands::Cycle(SCM channel)
{
return scm_long2num(m.getCode());
}
+SCM
+ScriptCommands::Who (SCM target)
+{
+ VERIFY_STRING (target);
+
+ Message m = Commands::Who (Interp::bot, Utils::scm2str (target));
+
+ return scm_long2num (m.getCode ());
+}
+
+SCM
+ScriptCommands::Whois (SCM nick)
+{
+ VERIFY_STRING (nick);
+
+ Message m = Commands::Whois (Interp::bot, Utils::scm2str (nick));
+
+ return scm_long2num (m.getCode ());
+}
+
SCM
ScriptCommands::getNickname(void)
{
Utils::scm2str (message)));
}
-// Message sending
-// FIXME: write these
-
-#define IQUEUE Interp::bot->serverConnection->queue
-SCM
-ScriptCommands::sendCTCP(SCM to, SCM command , SCM message)
-{
- VERIFY_STRING(to);
- VERIFY_STRING(command);
- VERIFY_STRING(message);
- Commands::CTCP (Interp::bot, Utils::scm2str (to),
- Utils::scm2str (command),
- Utils::scm2str (message));
- return SCM_UNSPECIFIED;
-}
-
-SCM
-ScriptCommands::sendCTCPReply (SCM to, SCM command , SCM message)
-{
- VERIFY_STRING(to);
- VERIFY_STRING(command);
- VERIFY_STRING(message);
-
- Commands::CTCPReply (Interp::bot, Utils::scm2str (to),
- Utils::scm2str (command),
- Utils::scm2str (message));
-
- return SCM_UNSPECIFIED;
-}
#endif
static SCM AddShit(SCM, SCM, SCM, SCM, SCM);
static SCM Ban(SCM, SCM);
static SCM ChangeCommandLevel(SCM, SCM);
+ static SCM CTCP(SCM, SCM, SCM);
+ static SCM CTCPReply(SCM, SCM, SCM);
static SCM Cycle(SCM);
static SCM Deban(SCM, SCM);
static SCM DelServer(SCM);
static SCM TKBan(SCM, SCM, SCM, SCM);
static SCM Topic(SCM, SCM);
static SCM Unlock(SCM);
+ static SCM Who(SCM);
+ static SCM Whois(SCM);
static SCM getNickname(void);
static SCM getServer(void);
// DCC CHAT
static SCM sendDCCChatMessage (SCM, SCM);
- // Message sending
- static SCM sendCTCP(SCM, SCM, SCM);
- static SCM sendCTCPReply(SCM, SCM, SCM);
/*
SCM sendChannelMode(SCM);
SCM sendChannelMode(SCM, SCM, SCM);
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#ifdef HAVE_CONFIG_H
#include "config.h"
void
UserCommands::Who(ServerConnection *cnx, Person *from,
- String channel, String rest)
+ String channel, String rest)
{
String nick = from->getNick();
User * u = cnx->bot->channelList->getChannel(channel)->getUser(nick);
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#ifndef UTILS_H
#define UTILS_H