[[project @ 2002-07-12 03:27:05 by unknown_lamer] unknown_lamer**20020712032705 2002-07-11 Clinton Ebadi * source/ServerQueue.C (sendUser): Changed . . in USER command to 0 * (which is the Right Way to because must be a number...) * source/Parser.C (init): New method of Parse. This initalizes the functions map. functions replaces the old functions array, and should yield better performance (since the functions array had to be scanned for every incoming message) * source/Parser.H: New member, functions (private) 2002-07-10 Clinton Ebadi * source/Interp.C (Startup): New symbols: bot:user-* [none|user|trusted|friend|master] are defined in Scheme as the different levels of the users. (Startup): All bot-* variables are now bot:* 2002-07-09 Clinton Ebadi * source/Bot.H: Made some variables private because they shouldn't be changed at runtime * source/Parser.C (parseCTCP): Reneabled DCC CHAT (I want to test this out to see if it works and make it work) * source/Bot.C (Bot::Bot): New var: logs_dir. Set to the log file dir. * scripts/bobot-utils.scm: Fixed a typo (I forgot the / after scripts in the user scripts dir) that made bobot++ not able to load scripts from the user scripts dir ] { hunk ./ChangeLog 1 +2002-07-11 Clinton Ebadi + + * source/ServerQueue.C (sendUser): Changed . . in USER command to + 0 * (which is the Right Way to because must be a number...) + + * source/Parser.C (init): New method of Parse. This initalizes the + functions map. functions replaces the old functions array, and + should yield better performance (since the functions array had to + be scanned for every incoming message) + + * source/Parser.H: New member, functions (private) + +2002-07-10 Clinton Ebadi + + * source/Interp.C (Startup): New symbols: bot:user-* + [none|user|trusted|friend|master] are defined in Scheme as the + different levels of the users. + (Startup): All bot-* variables are now bot:* + +2002-07-09 Clinton Ebadi + + * source/Bot.H: Made some variables private because they shouldn't + be changed at runtime + + * source/Parser.C (parseCTCP): Reneabled DCC CHAT (I want to test + this out to see if it works and make it work) + + * source/Bot.C (Bot::Bot): New var: logs_dir. Set to the log file + dir. + + * scripts/bobot-utils.scm: Fixed a typo (I forgot the / after + scripts in the user scripts dir) that made bobot++ not able to + load scripts from the user scripts dir + hunk ./NEWS 21 - PREFIX/bobotpp/scripts (where PREFIX is /usr/local unless you + PREFIX/bobotpp/scripts/ (where PREFIX is /usr/local unless you hunk ./NEWS 28 +- Logs are now in ~/.bobotpp/logs/ +- bot-* procedures in Scheme are now bot:*. The onl bot-* functions + are defined as aliases in bobot-utils.scm hunk ./TODO 30 +* Fix logging stuff hunk ./TODO 39 -* Enable DCC support (I have to find docs on DCC first!) +* Enable DCC support (maybe not, you can always intercept CTCP from + Scheme) hunk ./TODO 42 + - maybe not, you can do this from Scheme (it would probably be + really slow though) +* Make connecting to irc.oftc.net work...I wonder if their ircd is b0rked hunk ./TODO 68 -* Move default config location to PREFIX/Bobot++/default/ and allow - users to specify a config folder under PREFIX/Bobot++ to use with - -c. E.g. To use PREFIX/Bobot++/foo/, call bobotpp -c foo. Keep -f - and -d. hunk ./bobot++.info 23 + Copyright 2002 Clinton Ebadi + + Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. + hunk ./bobot++.info 97 + Note that in previous versions the scripting commands where in the +form `bot-FUNCTION'. They are now in the form `bot:FUNCTION'. The old +names are still available, but are deprecated and will be removed in +Bobot++ 2.4. The command `perl -pi -e ``s/bot-/bot:/g'' YOUR-FILES' +should be enough to convert your code to use the new functions. + +* Menu: + +* Adding New Commands:: +* Hooks:: + + +File: bobot++.info, Node: Adding New Commands, Next: Hooks, Prev: Scripting, Up: Scripting + +Adding New Commands +=================== + + Not here yet. + + +File: bobot++.info, Node: Hooks, Prev: Adding New Commands, Up: Scripting + +Hooks +===== + + Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII +hooks and tiny fugue (a MUD bot) hooks. The basic idea of a hook if +that you match a text against regular expression and call a function if +text in a message matches that regex. The different types of hooks +provided by Bobot++ correspond to the different classes of messages +that Bobot++ can recieve. A Hook also has several properties, including +its priority and whether or not it is a fallthrough hook. Higher +priority hooks are executed before lower priority hooks and fallthrough +hooks are executed before non-fallthrough hooks. A fallthrough hook can +match and processing of hooks will continue; as soon as the first +non-fallthrough hooks matches processing of hooks stops. + +* Menu: + +* Creating a Hook:: +* Hook Types:: + + +File: bobot++.info, Node: Creating a Hook, Next: Hook Types, Prev: Hooks, Up: Hooks + +Creating a Hook +--------------- + + To add a new hook you use the function `bot:addhook'. `bot:addhook' +is prototyped as `(bot:addhook type regex function pri fall)'. `type' +specifies the type of hook (the types of hooks are listed in *Note Hook +Types::). `regex' is a standard regular expression. If `regex' is +matched, `function' will be called. `function' will take a different +number of args depending on the hook type. `pri' specifies the priority +of the hook-higher priority hooks are executed first. This argument is +optional and defaults to `0'. `fall' is `#t' if the hook is a +fallthrough hook and `#f' is the hook is not a fallthrough hook. This +arg is also optional and default to `#t'. + + +File: bobot++.info, Node: Hook Types, Prev: Creating a Hook, Up: Hooks + +Hook Types +---------- + + Here is a list of the various hooks are notes on each one. The +general format of a hook is: + + * `hooks/name' (this is the Scheme variable name of the hook) + - Description of the hook + + - # of args + - `arg1': desc + + - `arg2': desc + + - ... + + - `argN': desc + + That said, here is the list of available hooks: + + * `hooks/action' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/nickname' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/signoff' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/ctcp' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/ctcp-reply' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/disconnect' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/flood' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/invite' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/join' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/kick' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/part' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/mode' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/message' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/notice' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/public' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/public-notice' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/raw' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/timer' + - Description of the hook + + - # of args + - `arg1': desc + + + * `hooks/topic' + - Description of the hook + + - # of args + - `arg1': desc + + hunk ./bobot++.info 337 -Node: Introduction905 -Node: Configuration1096 -Node: Configuration File Syntax1478 -Node: Configure File Placement1680 -Node: Scripting2154 -Node: Concept Index2607 -Node: Function Index2739 -Node: Variable Index2878 +Node: Introduction1228 +Node: Configuration1419 +Node: Configuration File Syntax1801 +Node: Configure File Placement2003 +Node: Scripting2477 +Node: Adding New Commands3316 +Node: Hooks3473 +Node: Creating a Hook4363 +Node: Hook Types5153 +Node: Concept Index7626 +Node: Function Index7758 +Node: Variable Index7897 hunk ./bobot++.texinfo 47 + +Copyright 2002 Clinton Ebadi + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. hunk ./bobot++.texinfo 108 +Note that in previous versions the scripting commands where in the +form @code{bot-@var{function}}. They are now in the form +@code{bot:@var{function}}. The old names are still available, but are +deprecated and will be removed in Bobot++ 2.4. The command +@command{perl -pi -e ``s/bot-/bot:/g'' @var{your-files}} should be enough to +convert your code to use the new functions. + +@menu +* Adding New Commands:: +* Hooks:: +@end menu + +@node Adding New Commands, Hooks, Scripting, Scripting +@section Adding New Commands + +Not here yet. + +@node Hooks, , Adding New Commands, Scripting +@section Hooks + +Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII +hooks and tiny fugue (a MUD bot) hooks. The basic idea of a hook if +that you match a text against regular expression and call a function +if text in a message matches that regex. The different types of hooks +provided by Bobot++ correspond to the different classes of messages +that Bobot++ can recieve. A Hook also has several properties, +including its priority and whether or not it is a fallthrough +hook. Higher priority hooks are executed before lower priority hooks +and fallthrough hooks are executed before non-fallthrough hooks. A +fallthrough hook can match and processing of hooks will continue; as +soon as the first non-fallthrough hooks matches processing of hooks +stops. + +@menu +* Creating a Hook:: +* Hook Types:: +@end menu + +@node Creating a Hook, Hook Types, Hooks, Hooks +@subsection Creating a Hook + +To add a new hook you use the function +@code{bot:addhook}. @code{bot:addhook} is prototyped as +@code{(bot:addhook type regex function pri fall)}. @code{type} +specifies the type of hook (the types of hooks are listed in @ref{Hook +Types}). @code{regex} is a standard regular expression. If +@code{regex} is matched, @code{function} will be +called. @code{function} will take a different number of args depending +on the hook type. @code{pri} specifies the priority of the +hook--higher priority hooks are executed first. This argument is +optional and defaults to @code{0}. @code{fall} is @code{#t} if the +hook is a fallthrough hook and @code{#f} is the hook is not a +fallthrough hook. This arg is also optional and default to @code{#t}. + +@node Hook Types, , Creating a Hook, Hooks +@subsection Hook Types + +Here is a list of the various hooks are notes on each one. The general +format of a hook is: + +@itemize @bullet +@item +@code{hooks/name} (this is the Scheme variable name of the hook) +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@item +@code{arg2}: desc +@item +... +@item +@code{argN}: desc +@end itemize +@end itemize +@end itemize + +That said, here is the list of available hooks: + +@itemize @bullet +@item +@code{hooks/action} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/nickname} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/signoff} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/ctcp} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/ctcp-reply} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/disconnect} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/flood} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/invite} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/join} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/kick} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/part} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/mode} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/message} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/notice} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/public} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/public-notice} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/raw} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/timer} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize +@itemize @bullet +@item +@code{hooks/topic} +@itemize @minus +@item +Description of the hook +@item +# of args +@itemize @minus +@item +@code{arg1}: desc +@end itemize +@end itemize + +@end itemize + + hunk ./configure 3 -# Generated by GNU Autoconf 2.53. +# Generated by GNU Autoconf 2.53 for Bobot++ 2.1CVS. +# +# Report bugs to . hunk ./configure 257 -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= +PACKAGE_NAME='Bobot++' +PACKAGE_TARNAME='bobot--' +PACKAGE_VERSION='2.1CVS' +PACKAGE_STRING='Bobot++ 2.1CVS' +PACKAGE_BUGREPORT='clinton@unknownlamer.org' hunk ./configure 263 -ac_unique_file="source/Makefile.in" hunk ./configure 772 -\`configure' configures this package to adapt to many kinds of systems. +\`configure' configures Bobot++ 2.1CVS to adapt to many kinds of systems. hunk ./configure 833 - + case $ac_init_help in + short | recursive ) echo "Configuration of Bobot++ 2.1CVS:";; + esac hunk ./configure 860 +Report bugs to . hunk ./configure 923 +Bobot++ configure 2.1CVS +generated by GNU Autoconf 2.53 hunk ./configure 938 -It was created by $as_me, which was +It was created by Bobot++ $as_me 2.1CVS, which was hunk ./configure 1208 + + + + + + + + hunk ./configure 1572 - hunk ./configure 4781 -This file was extended by $as_me, which was +This file was extended by Bobot++ $as_me 2.1CVS, which was hunk ./configure 4843 -config.status +Bobot++ config.status 2.1CVS hunk ./configure 5936 -This file was extended by $as_me, which was +This file was extended by Bobot++ $as_me 2.1CVS, which was hunk ./configure 5998 -config.status +Bobot++ config.status 2.1CVS hunk ./configure 7092 -This file was extended by $as_me, which was +This file was extended by Bobot++ $as_me 2.1CVS, which was hunk ./configure 7154 -config.status +Bobot++ config.status 2.1CVS hunk ./configure.ac 3 -AC_INIT(source/Makefile.in) +dnl AC_INIT(source/Makefile.in) +AC_INIT([Bobot++], [2.1CVS], [clinton@unknownlamer.org]) hunk ./configure.ac 17 - hunk ./scripts/bobot-utils.scm 11 -;;; Bot load (loads a file from %bot-loadpath) +;;; Bot load (loads a file from %bot:loadpath) hunk ./scripts/bobot-utils.scm 13 -(define %bot-loadpath (list +(define %bot:loadpath (list hunk ./scripts/bobot-utils.scm 15 - "/.bobotpp/scripts") - bot-sys-scripts-dir)) + "/.bobotpp/scripts/") + bot:sys-scripts-dir)) hunk ./scripts/bobot-utils.scm 18 -(define (bot-load file) - (let loop ((load-path %bot-loadpath)) +(define (bot:load file) + (let loop ((load-path %bot:loadpath)) hunk ./scripts/bobot-utils.scm 30 - #f ))) - + (begin (bot:log "ERROR: File " file " Not Found!\n") #f)))) hunk ./scripts/bobot-utils.scm 37 - (string-append "[[:graph:]]* [&#+!][^ ,\a]+ [[:graph:][:space:]]*" regex)) + (string-append "^[[:graph:]]* [&#+!][^ ,\a]+ [[:graph:][:space:]]*" regex)) hunk ./scripts/bobot-utils.scm 42 - (string-append (match-not-channel (bot-getnickname)) + (string-append (match-not-channel (bot:getnickname)) hunk ./scripts/bobot-utils.scm 55 -(define (bot-log . messages) +(define (bot:log . messages) hunk ./scripts/bobot-utils.scm 62 - (bot-flushport)) + (bot:flushport)) + +;;; DEPRECATED FUNCTION NAMED +;;; These are provided for backwards compatibility +;;; and will be removed in the 2.3 dev tree + +(define bot-load bot:load) +(define bot-action bot:action) +(define bot-adduser bot:adduser) +(define bot-addserver bot:addserver) +(define bot-addshit bot:addshit) +(define bot-ban bot:ban) +(define bot-cycle bot:cycle) +(define bot-deban bot:deban) +(define bot-delserver bot:delserver) +(define bot-deluser bot:deluser) +(define bot-delshit bot:delshit) +(define bot-deop bot:deop) +(define bot-die bot:die) +(define bot-do bot:do) +(define bot-invite bot:invite) +(define bot-join bot:join) +(define bot-keep bot:keep) +(define bot-kick bot:kick) +(define bot-kickban bot:kickban) +(define bot-lock bot:lock) +(define bot-logport bot:logport) +(define bot-mode bot:mode) +(define bot-msg bot:msg) +(define bot-nextserver bot:nextserver) +(define bot-nick bot:nick) +(define bot-op bot:op) +(define bot-part bot:part) +(define bot-reconnect bot:reconnect) +(define bot-say bot:say) +(define bot-server bot:server) +(define bot-setversion bot:setversion) +(define bot-tban bot:tban) +(define bot-tkban bot:tkban) +(define bot-topic bot:topic) +(define bot-unlock bot:unlock) +(define bot-getnickname bot:getnickname) +(define bot-getserver bot:getserver) +(define bot-getserverlist bot:getserverlist) +(define bot-flush bot:flush) +(define bot-flushport bot:flushport) +(define bot-random bot:random) +(define bot-addcommand bot:addcommand) +(define bot-delcommand bot:delcommand) +(define bot-addhook bot:addhook) +(define bot-addtimer bot:addtimer) +(define bot-deltimer bot:deltimer) hunk ./scripts/boulet 6 -(bot-addcommand "shutup" shutup #f 0 2) +(bot:addcommand "shutup" shutup #f 0 2) hunk ./scripts/boulet 10 -(bot-addcommand "talk" dotalk #f 0 2) +(bot:addcommand "talk" dotalk #f 0 2) hunk ./scripts/boulet 44 - (if (string-ci=? n (bot-getnickname)) + (if (string-ci=? n (bot:getnickname)) hunk ./scripts/boulet 46 - (if (= 1 talk) (bot-say c "salut les gars, vous parlez de quoi ?")) - (set! dumbTimer (addChannel c (bot-addtimer (+ 600 (bot-random 3000)) (dumbLourd c)) dumbTimer)) + (if (= 1 talk) (bot:say c "salut les gars, vous parlez de quoi ?")) + (set! dumbTimer (addChannel c (bot:addtimer (+ 600 (bot:random 3000)) (dumbLourd c)) dumbTimer)) hunk ./scripts/boulet 49 - (if (= 1 talk) (bot-say c (string-append "euh humm euh..., " n "... une ptite question..."))) + (if (= 1 talk) (bot:say c (string-append "euh humm euh..., " n "... une ptite question..."))) hunk ./scripts/boulet 52 -(bot-addhook hooks/join ".*" joinLourd) +(bot:addhook hooks/join ".*" joinLourd) hunk ./scripts/boulet 56 - (bot-flushport) - (if (not (string-ci=? n (bot-getnickname))) - (if (= 1 talk) (bot-msg n "hey, reviens, on s'amusait bien")) + (bot:flushport) + (if (not (string-ci=? n (bot:getnickname))) + (if (= 1 talk) (bot:msg n "hey, reviens, on s'amusait bien")) hunk ./scripts/boulet 60 - (bot-deltimer (cadr timer)) + (bot:deltimer (cadr timer)) hunk ./scripts/boulet 65 -(bot-addhook hooks/part ".*" partLourd) +(bot:addhook hooks/part ".*" partLourd) hunk ./scripts/boulet 81 - (if (= 1 talk) (bot-say c (list-ref dumbList (bot-random (length dumbList))))) - (set! dumbTimer (changeChannel c (bot-addtimer (+ 600 (bot-random 3000)) (dumbLourd c)) dumbTimer)) + (if (= 1 talk) (bot:say c (list-ref dumbList (bot:random (length dumbList))))) + (set! dumbTimer (changeChannel c (bot:addtimer (+ 600 (bot:random 3000)) (dumbLourd c)) dumbTimer)) hunk ./scripts/boulet 87 -(bot-addhook hooks/public "oracle" (lambda (f t p) (if (= 1 talk) (bot-say t "oracle ! Un truc de dinosaures, ça !")))) -(bot-addhook hooks/public "linux" (lambda (f t p) (if (= 1 talk) (bot-say t (string-append f ", j'ai installé une Mandrake chez moi ce week-end, et j'ai réussi à faire marcher l'imprimante"))))) -(bot-addhook hooks/public "boulet" (lambda (f t p) (if (= 1 talk) (bot-say t "on parle de moi ?")))) -(bot-addhook hooks/public "lourd" (lambda (f t p) (if (= 1 talk) (bot-say t "vous le dites si je suis lourd !")))) -(bot-addhook hooks/public "csn" (lambda (f t p) (if (= 1 talk) (bot-say t "ahahah, je ne partirai jamais !")))) -(bot-addhook hooks/public "manger|pizza|pasta" (lambda (f t p) (if (= 1 talk) (bot-say t "je peux venir manger avec vous ?")))) -(bot-addhook hooks/public "regarde" (lambda (f t p) (if (= 1 talk) (bot-action t "se lève pour regarder...")))) +(bot:addhook hooks/public "oracle" (lambda (f t p) (if (= 1 talk) (bot:say t "oracle ! Un truc de dinosaures, ça !")))) +(bot:addhook hooks/public "linux" (lambda (f t p) (if (= 1 talk) (bot:say t (string-append f ", j'ai installé une Mandrake chez moi ce week-end, et j'ai réussi à faire marcher l'imprimante"))))) +(bot:addhook hooks/public "boulet" (lambda (f t p) (if (= 1 talk) (bot:say t "on parle de moi ?")))) +(bot:addhook hooks/public "lourd" (lambda (f t p) (if (= 1 talk) (bot:say t "vous le dites si je suis lourd !")))) +(bot:addhook hooks/public "csn" (lambda (f t p) (if (= 1 talk) (bot:say t "ahahah, je ne partirai jamais !")))) +(bot:addhook hooks/public "manger|pizza|pasta" (lambda (f t p) (if (= 1 talk) (bot:say t "je peux venir manger avec vous ?")))) +(bot:addhook hooks/public "regarde" (lambda (f t p) (if (= 1 talk) (bot:action t "se lève pour regarder...")))) hunk ./scripts/boulet 99 - (bot-say (caar l) "Bonjour les gars") + (bot:say (caar l) "Bonjour les gars") hunk ./scripts/boulet 104 -(bot-addhook hooks/timer "09:00" (lambda (h) (newDay dumbTimer) (talk))) +(bot:addhook hooks/timer "09:00" (lambda (h) (newDay dumbTimer) (talk))) hunk ./scripts/boulet 110 - (bot-say (caar l) "à demain !") - (bot-action (caar l) "rentre chez lui...") + (bot:say (caar l) "à demain !") + (bot:action (caar l) "rentre chez lui...") hunk ./scripts/boulet 116 -(bot-addhook hooks/timer "18:00" (lambda (h) (timeToGo dumbTimer) (shutup))) +(bot:addhook hooks/timer "18:00" (lambda (h) (timeToGo dumbTimer) (shutup))) hunk ./scripts/country 245 - (bot-say channel (string-append ext " is " (cadr t))) - (bot-say channel (string-append "I don't know which country stands for " ext))))) + (bot:say channel (string-append ext " is " (cadr t))) + (bot:say channel (string-append "I don't know which country stands for " ext))))) hunk ./scripts/country 248 -(bot-addcommand "country" get-country #t 2 1) +(bot:addcommand "country" get-country #t 2 1) hunk ./scripts/eval 6 -(define (bot-eval channel str) - (bot-say channel +(define (bot:eval channel str) + (bot:say channel hunk ./scripts/eval 11 -(bot-addcommand "eval" bot-eval #t 2 4) +(bot:addcommand "eval" bot:eval #t 2 4) hunk ./scripts/hello 3 - (bot-say c "Hello world !") - (bot-say c (string-append "Hello " n " !")) + (bot:say c "Hello world !") + (bot:say c (string-append "Hello " n " !")) hunk ./scripts/hello 8 -(bot-addcommand "hello" hello #t 2 0) +(bot:addcommand "hello" hello #t 2 0) hunk ./scripts/scheme_add_user 2 -;;; test of bot-adduser -(load "bobot-utils.scm") +;;; test of bot:adduser +(load "bobot:utils.scm") hunk ./scripts/scheme_add_user 13 - (bot-adduser who channel level protect aop expire passwd))) + (bot:adduser who channel level protect aop expire passwd))) hunk ./scripts/scheme_add_user 15 -(bot-addcommand "sadduser" scheme-adduser #f 7 4) +(bot:addcommand "sadduser" scheme-adduser #f 7 4) hunk ./scripts/scheme_add_user 18 - (bot-log "Adding lap_r_g\n") - (bot-adduser "lap_r_g" "#*" 4 0 #f) - (bot-log "Adding CowBot\n") - (bot-adduser "CowBot" "#*" 2 0 #f "2M18H") - (bot-log "Adding ZugBut\n") - (bot-adduser "ZugBot" "#*" 2 0 #f "1Y" "moo") - (bot-log "Done...\n")) + (bot:log "Adding lap_r_g\n") + (bot:adduser "lap_r_g" "#*" 4 0 #f) + (bot:log "Adding CowBot\n") + (bot:adduser "CowBot" "#*" 2 0 #f "2M18H") + (bot:log "Adding ZugBut\n") + (bot:adduser "ZugBot" "#*" 2 0 #f "1Y" "moo") + (bot:log "Done...\n")) hunk ./scripts/scheme_add_user 26 -(bot-addcommand "testadduser" test-adduser #f 0 4) +(bot:addcommand "testadduser" test-adduser #f 0 4) hunk ./scripts/scheme_add_user 29 - (bot-log "Adding root") - (bot-addshit "*!root@*.*" "*" 2)) + (bot:log "Adding root") + (bot:addshit "*!root@*.*" "*" 2)) hunk ./scripts/scheme_add_user 32 -;(bot-addcommand "testaddshit" test-addshit #f 0 4) +;(bot:addcommand "testaddshit" test-addshit #f 0 4) hunk ./scripts/stupid_stuff/stupid_stuff 14 -(load "../bobot-utils.scm") +(load "../bobot:utils.scm") hunk ./scripts/stupid_stuff/stupid_stuff 21 -(bot-addcommand "shutup" shutup #f 0 2) +(bot:addcommand "shutup" shutup #f 0 2) hunk ./scripts/stupid_stuff/stupid_stuff 25 -(bot-addcommand "talk" dotalk #f 0 2) +(bot:addcommand "talk" dotalk #f 0 2) hunk ./scripts/stupid_stuff/stupid_stuff 51 - (if (string-ci=? n (bot-getnickname)) + (if (string-ci=? n (bot:getnickname)) hunk ./scripts/stupid_stuff/stupid_stuff 53 - (if (= 1 talk) (bot-say c "I like limos")) + (if (= 1 talk) (bot:say c "I like limos")) hunk ./scripts/stupid_stuff/stupid_stuff 55 - (addChannel c (bot-addtimer (+ 600 (bot-random 300)) + (addChannel c (bot:addtimer (+ 600 (bot:random 300)) hunk ./scripts/stupid_stuff/stupid_stuff 57 - (if (= 1 talk) (bot-say c (string-append "Arf Moo Arf! " n + (if (= 1 talk) (bot:say c (string-append "Arf Moo Arf! " n hunk ./scripts/stupid_stuff/stupid_stuff 59 -(bot-addhook hooks/join ".*" joinLourd) +(bot:addhook hooks/join ".*" joinLourd) hunk ./scripts/stupid_stuff/stupid_stuff 63 - (bot-flushport) - (if (not (string-ci=? n (bot-getnickname))) - (if (= 1 talk) (bot-msg n "I HATED YOU ANYWAY")) + (bot:flushport) + (if (not (string-ci=? n (bot:getnickname))) + (if (= 1 talk) (bot:msg n "I HATED YOU ANYWAY")) hunk ./scripts/stupid_stuff/stupid_stuff 67 - (bot-deltimer (cadr timer)) + (bot:deltimer (cadr timer)) hunk ./scripts/stupid_stuff/stupid_stuff 69 -(bot-addhook hooks/part ".*" partLourd) +(bot:addhook hooks/part ".*" partLourd) hunk ./scripts/stupid_stuff/stupid_stuff 75 - (bot-say + (bot:say hunk ./scripts/stupid_stuff/stupid_stuff 77 - (vector-ref (list-ref dumbList (bot-random (length dumbList))) 0))) + (vector-ref (list-ref dumbList (bot:random (length dumbList))) 0))) hunk ./scripts/stupid_stuff/stupid_stuff 81 - (bot-addtimer (+ 600 (bot-random 300)) (dumbLourd c)) dumbTimer)))) + (bot:addtimer (+ 600 (bot:random 300)) (dumbLourd c)) dumbTimer)))) hunk ./scripts/stupid_stuff/stupid_stuff 88 -; (display "Reloaded sayings from db\n" (bot-logport)) -; (bot-flushport)) -; (bot-addcommand "reloadsayings" reload-sayings #f 0 4) +; (display "Reloaded sayings from db\n" (bot:logport)) +; (bot:flushport)) +; (bot:addcommand "reloadsayings" reload-sayings #f 0 4) hunk ./scripts/stupid_stuff/stupid_stuff 114 - (vector-ref (_select dumbDB (bot-random (_length dumbDB))) 0)) + (vector-ref (_select dumbDB (bot:random (_length dumbDB))) 0)) hunk ./scripts/stupid_stuff/stupid_stuff 121 -(bot-addhook +(bot:addhook hunk ./scripts/stupid_stuff/stupid_stuff 125 - (bot-say t + (bot:say t hunk ./scripts/stupid_stuff/stupid_stuff 129 -(bot-addhook hooks/public (match-not-channel "oracle") +(bot:addhook hooks/public (match-not-channel "oracle") hunk ./scripts/stupid_stuff/stupid_stuff 132 - (bot-say t "Oracle is evil! Use Postgres instead!")))) + (bot:say t "Oracle is evil! Use Postgres instead!")))) hunk ./scripts/stupid_stuff/stupid_stuff 135 - (bot-addhook hooks/public (match-not-channel word) + (bot:addhook hooks/public (match-not-channel word) hunk ./scripts/stupid_stuff/stupid_stuff 138 - (bot-say t + (bot:say t hunk ./scripts/stupid_stuff/stupid_stuff 142 -(bot-addhook hooks/public (match-not-channel "boulet") +(bot:addhook hooks/public (match-not-channel "boulet") hunk ./scripts/stupid_stuff/stupid_stuff 144 - (if (= 1 talk) (bot-say t "on parle de moi ?")))) + (if (= 1 talk) (bot:say t "on parle de moi ?")))) hunk ./scripts/stupid_stuff/stupid_stuff 146 -(bot-addhook hooks/public (match-not-channel "arf") +(bot:addhook hooks/public (match-not-channel "arf") hunk ./scripts/stupid_stuff/stupid_stuff 149 - (bot-say t (random-saying))))) + (bot:say t (random-saying))))) hunk ./scripts/stupid_stuff/stupid_stuff 151 -(bot-addhook hooks/public (match-not-channel "csn") +(bot:addhook hooks/public (match-not-channel "csn") hunk ./scripts/stupid_stuff/stupid_stuff 153 - (if (= 1 talk) (bot-say t "???")))) + (if (= 1 talk) (bot:say t "???")))) hunk ./scripts/stupid_stuff/stupid_stuff 155 -(bot-addhook hooks/public (match-not-channel "pizza|pasta|soda") +(bot:addhook hooks/public (match-not-channel "pizza|pasta|soda") hunk ./scripts/stupid_stuff/stupid_stuff 158 - (bot-say t (string-append f ": give me one too!"))))) + (bot:say t (string-append f ": give me one too!"))))) hunk ./scripts/stupid_stuff/stupid_stuff 161 - (bot-addhook hooks/public (match-not-channel word) + (bot:addhook hooks/public (match-not-channel word) hunk ./scripts/stupid_stuff/stupid_stuff 164 - (bot-action + (bot:action hunk ./scripts/stupid_stuff/stupid_stuff 169 -(bot-addhook hooks/public (match-not-channel "anal sex") +(bot:addhook hooks/public (match-not-channel "anal sex") hunk ./scripts/stupid_stuff/stupid_stuff 173 - (bot-action + (bot:action hunk ./scripts/stupid_stuff/stupid_stuff 177 -(bot-addhook +(bot:addhook hunk ./scripts/stupid_stuff/stupid_stuff 181 - (bot-say t + (bot:say t hunk ./scripts/stupid_stuff/stupid_stuff 184 -(bot-addhook hooks/public (match-to-me "burn") +(bot:addhook hooks/public (match-to-me "burn") hunk ./scripts/stupid_stuff/stupid_stuff 187 - (bot-say + (bot:say hunk ./scripts/stupid_stuff/stupid_stuff 196 -; (bot-say (caar l) "What is up my homey g-d0g?") +; (bot:say (caar l) "What is up my homey g-d0g?") hunk ./scripts/stupid_stuff/stupid_stuff 202 -;(bot-addhook hooks/timer "09:00" (lambda (h) (newDay dumbTimer) (talk))) +;(bot:addhook hooks/timer "09:00" (lambda (h) (newDay dumbTimer) (talk))) hunk ./scripts/stupid_stuff/stupid_stuff 208 -; (bot-say (caar l) "Give me food") -; (bot-action (caar l) "I'm bored") +; (bot:say (caar l) "Give me food") +; (bot:action (caar l) "I'm bored") hunk ./scripts/stupid_stuff/stupid_stuff 214 -;(bot-addhook hooks/timer "18:00" (lambda (h) (timeToGo dumbTimer) (shutup))) +;(bot:addhook hooks/timer "18:00" (lambda (h) (timeToGo dumbTimer) (shutup))) hunk ./scripts/tamere 20 - (list-ref where (bot-random (length where))) " " - (list-ref how (bot-random (length how))))) + (list-ref where (bot:random (length where))) " " + (list-ref how (bot:random (length how))))) hunk ./scripts/tamere 23 -(define (bot-tamere c w) - (bot-say c (tamere w))) +(define (bot:tamere c w) + (bot:say c (tamere w))) hunk ./scripts/tamere 26 -(bot-addcommand "tamere" bot-tamere #t 2 1) +(bot:addcommand "tamere" bot:tamere #t 2 1) hunk ./scripts/uname 7 - (bot-say c s))) + (bot:say c s))) hunk ./scripts/uname 9 -(bot-addcommand "uname" uname #t 0 1) +(bot:addcommand "uname" uname #t 0 1) hunk ./scripts/uptime 7 - (bot-say c s))) + (bot:say c s))) hunk ./scripts/uptime 9 -(bot-addcommand "uptime" uptime #t 0 1) +(bot:addcommand "uptime" uptime #t 0 1) hunk ./source/Bot.C 43 +#define DEFAULT_LOGDIR getenv ("HOME") + String("/.bobotpp/logs/") hunk ./source/Bot.C 62 + logs_dir (DEFAULT_LOGDIR), hunk ./source/Bot.C 93 - logFile.open(logFileName, std::ios_base::out | std::ios_base::ate - | std::ios_base::app); + logFile.open(logs_dir + logFileName, std::ios_base::out | + std::ios_base::ate | std::ios_base::app); hunk ./source/Bot.C 96 - logFile.open(logFileName, ios::out | ios::ate + logFile.open(logs_dir + logFileName, ios::out | ios::ate hunk ./source/Bot.C 158 - botInterp = new BotInterp(this, scriptLogFileName); + botInterp = new BotInterp(this, logs_dir + scriptLogFileName); hunk ./source/Bot.C 278 - logFileName = parameters; + logFileName = parameters; hunk ./source/Bot.H 70 - String configFileName; hunk ./source/Bot.H 72 - String logFileName; hunk ./source/Bot.H 74 -#ifdef USESCRIPTS - String scriptLogFileName; - String autoexecFileName; -#endif hunk ./source/Bot.H 114 +private: + String logFileName; + String logs_dir; + String configFileName; +#ifdef USESCRIPTS + String scriptLogFileName; + String autoexecFileName; +#endif + hunk ./source/Bot.H 137 + hunk ./source/Interp.C 54 - scm_c_define ("bot-sys-scripts-dir", + // Symbols + // bot:user-* + scm_c_define ("bot:user-none", scm_long2num (User::NONE)); + scm_c_define ("bot:user-user", scm_long2num (User::USER)); + scm_c_define ("bot:user-trusted", scm_long2num (User::TRUSTED_USER)); + scm_c_define ("bot:user-friend", scm_long2num (User::FRIEND)); + scm_c_define ("bot:user-master", scm_long2num (User::MASTER)); + // sys-dir + scm_c_define ("bot:sys-scripts-dir", hunk ./source/Interp.C 65 - scm_primitive_load - (scm_makfrom0str (String(PREFIX) + - "/share/bobotpp/scripts/bobot-utils.scm")); - - bot_new_procedure ("bot-action", (SCMFunc)ScriptCommands::Action, 2, 0, 0); - scm_c_define_gsubr ("bot-adduser", 5, 2, 0, - (SCMFunc)ScriptCommands::AddUser); - bot_new_procedure ("bot-addserver", (SCMFunc)ScriptCommands::Action, - 3, 4, 0); - scm_c_define_gsubr ("bot-addshit", 3, 2, 0, - (SCMFunc)ScriptCommands::AddShit); - bot_new_procedure ("bot-ban", (SCMFunc)ScriptCommands::Action, 2, 0, 0); - 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, - 1, 0, 0); - bot_new_procedure ("bot-deluser", (SCMFunc)ScriptCommands::DelUser, 2, 0, 0); - bot_new_procedure ("bot-delshit", (SCMFunc)ScriptCommands::DelShit, 2, 0, 0); - bot_new_procedure ("bot-deop", (SCMFunc)ScriptCommands::Deop, 2, 0, 0); - bot_new_procedure ("bot-die", (SCMFunc)ScriptCommands::Die, 1, 0, 0); - bot_new_procedure ("bot-do", (SCMFunc)ScriptCommands::Do, 1, 0, 0); - bot_new_procedure ("bot-invite", (SCMFunc)ScriptCommands::Invite, 2, 0, 0); - bot_new_procedure ("bot-join", (SCMFunc)ScriptCommands::Join, 1, 1, 0); - bot_new_procedure ("bot-keep", (SCMFunc)ScriptCommands::Keep, 2, 0, 0); - bot_new_procedure ("bot-kick", (SCMFunc)ScriptCommands::Kick, 2, 1, 0); - bot_new_procedure ("bot-kickban", (SCMFunc)ScriptCommands::KickBan, 2, 1, 0); - bot_new_procedure ("bot-lock", (SCMFunc)ScriptCommands::Lock, 1, 0, 0); - bot_new_procedure ("bot-logport", (SCMFunc)ScriptCommands::LogPort, 0, 0, 0); - bot_new_procedure ("bot-mode", (SCMFunc)ScriptCommands::Mode, 2, 0, 0); - bot_new_procedure ("bot-msg", (SCMFunc)ScriptCommands::Msg, 2, 0, 0); - bot_new_procedure ("bot-nextserver", (SCMFunc)ScriptCommands::NextServer, - 0, 0, 0); - bot_new_procedure ("bot-nick", (SCMFunc)ScriptCommands::Nick, 1, 0, 0); - bot_new_procedure ("bot-op", (SCMFunc)ScriptCommands::Op, 2, 0, 0); - bot_new_procedure ("bot-part", (SCMFunc)ScriptCommands::Part, 1, 0, 0); - bot_new_procedure ("bot-reconnect", (SCMFunc)ScriptCommands::Reconnect, - 0, 0, 0); - bot_new_procedure ("bot-say", (SCMFunc)ScriptCommands::Say, 2, 0, 0); - bot_new_procedure ("bot-server", (SCMFunc)ScriptCommands::Server, 1, 0, 0); - bot_new_procedure ("bot-setversion", (SCMFunc)ScriptCommands::SetVersion, - 1, 0, 0); - bot_new_procedure ("bot-tban", (SCMFunc)ScriptCommands::TBan, 3, 0, 0); - 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); - - bot_new_procedure ("bot-getnickname", (SCMFunc)ScriptCommands::getNickname, - 0, 0, 0); - bot_new_procedure ("bot-getserver", (SCMFunc)ScriptCommands::getServer, - 0, 0, 0); - bot_new_procedure ("bot-getserverlist", - (SCMFunc)ScriptCommands::getServerList, 0, 0, 0); - bot_new_procedure ("bot-flush", (SCMFunc)ScriptCommands::flushQueue, - 0, 0, 0); - bot_new_procedure ("bot-flushport", (SCMFunc)ScriptCommands::flushPort, - 0, 0, 0); - bot_new_procedure ("bot-random", (SCMFunc)ScriptCommands::random, - 1, 0, 0); - bot_new_procedure ("bot-addcommand", (SCMFunc)ScriptCommands::addCommand, - 5, 0, 0); - bot_new_procedure ("bot-delcommand", (SCMFunc)ScriptCommands::delCommand, - 1, 0, 0); - bot_new_procedure ("bot-addhook", (SCMFunc)ScriptCommands::AddHook, - 3, 2, 0); - bot_new_procedure ("bot-addtimer", (SCMFunc)ScriptCommands::AddTimer, - 2, 0, 0); - bot_new_procedure ("bot-deltimer", (SCMFunc)ScriptCommands::DelTimer, - 1, 0, 0); + // Hooks hunk ./source/Interp.C 87 + + + // procedures + bot_new_procedure ("bot:action", (SCMFunc)ScriptCommands::Action, 2, 0, 0); + scm_c_define_gsubr ("bot:adduser", 5, 2, 0, + (SCMFunc)ScriptCommands::AddUser); + bot_new_procedure ("bot:addserver", (SCMFunc)ScriptCommands::Action, + 3, 4, 0); + scm_c_define_gsubr ("bot:addshit", 3, 2, 0, + (SCMFunc)ScriptCommands::AddShit); + bot_new_procedure ("bot:ban", (SCMFunc)ScriptCommands::Action, 2, 0, 0); + 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, + 1, 0, 0); + bot_new_procedure ("bot:deluser", (SCMFunc)ScriptCommands::DelUser, 2, 0, 0); + bot_new_procedure ("bot:delshit", (SCMFunc)ScriptCommands::DelShit, 2, 0, 0); + bot_new_procedure ("bot:deop", (SCMFunc)ScriptCommands::Deop, 2, 0, 0); + bot_new_procedure ("bot:die", (SCMFunc)ScriptCommands::Die, 1, 0, 0); + bot_new_procedure ("bot:do", (SCMFunc)ScriptCommands::Do, 1, 0, 0); + bot_new_procedure ("bot:invite", (SCMFunc)ScriptCommands::Invite, 2, 0, 0); + bot_new_procedure ("bot:join", (SCMFunc)ScriptCommands::Join, 1, 1, 0); + bot_new_procedure ("bot:keep", (SCMFunc)ScriptCommands::Keep, 2, 0, 0); + bot_new_procedure ("bot:kick", (SCMFunc)ScriptCommands::Kick, 2, 1, 0); + bot_new_procedure ("bot:kickban", (SCMFunc)ScriptCommands::KickBan, 2, 1, 0); + bot_new_procedure ("bot:lock", (SCMFunc)ScriptCommands::Lock, 1, 0, 0); + bot_new_procedure ("bot:logport", (SCMFunc)ScriptCommands::LogPort, 0, 0, 0); + bot_new_procedure ("bot:mode", (SCMFunc)ScriptCommands::Mode, 2, 0, 0); + bot_new_procedure ("bot:msg", (SCMFunc)ScriptCommands::Msg, 2, 0, 0); + bot_new_procedure ("bot:nextserver", (SCMFunc)ScriptCommands::NextServer, + 0, 0, 0); + bot_new_procedure ("bot:nick", (SCMFunc)ScriptCommands::Nick, 1, 0, 0); + bot_new_procedure ("bot:op", (SCMFunc)ScriptCommands::Op, 2, 0, 0); + bot_new_procedure ("bot:part", (SCMFunc)ScriptCommands::Part, 1, 0, 0); + bot_new_procedure ("bot:reconnect", (SCMFunc)ScriptCommands::Reconnect, + 0, 0, 0); + bot_new_procedure ("bot:say", (SCMFunc)ScriptCommands::Say, 2, 0, 0); + bot_new_procedure ("bot:server", (SCMFunc)ScriptCommands::Server, 1, 0, 0); + bot_new_procedure ("bot:setversion", (SCMFunc)ScriptCommands::SetVersion, + 1, 0, 0); + bot_new_procedure ("bot:tban", (SCMFunc)ScriptCommands::TBan, 3, 0, 0); + 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); + + bot_new_procedure ("bot:getnickname", (SCMFunc)ScriptCommands::getNickname, + 0, 0, 0); + bot_new_procedure ("bot:getserver", (SCMFunc)ScriptCommands::getServer, + 0, 0, 0); + bot_new_procedure ("bot:getserverlist", + (SCMFunc)ScriptCommands::getServerList, 0, 0, 0); + bot_new_procedure ("bot:flush", (SCMFunc)ScriptCommands::flushQueue, + 0, 0, 0); + bot_new_procedure ("bot:flushport", (SCMFunc)ScriptCommands::flushPort, + 0, 0, 0); + bot_new_procedure ("bot:random", (SCMFunc)ScriptCommands::random, + 1, 0, 0); + bot_new_procedure ("bot:addcommand", (SCMFunc)ScriptCommands::addCommand, + 5, 0, 0); + bot_new_procedure ("bot:delcommand", (SCMFunc)ScriptCommands::delCommand, + 1, 0, 0); + bot_new_procedure ("bot:addhook", (SCMFunc)ScriptCommands::AddHook, + 3, 2, 0); + bot_new_procedure ("bot:addtimer", (SCMFunc)ScriptCommands::AddTimer, + 2, 0, 0); + bot_new_procedure ("bot:deltimer", (SCMFunc)ScriptCommands::DelTimer, + 1, 0, 0); + // load bobot-utils + scm_primitive_load + (scm_makfrom0str (String(PREFIX) + + "/share/bobotpp/scripts/bobot-utils.scm")); + + hunk ./source/Main.C 29 +#include +#include +#include hunk ./source/Main.C 187 + DIR * temp; + if (! (temp = opendir (String(getenv ("HOME")) + "/.bobotpp/logs"))) + mkdir (String(getenv ("HOME")) + "/.bobotpp/logs", + S_IRWXU); + else + closedir (temp); + hunk ./source/Main.C 217 + // initialize the Parser + Parser::init (); + hunk ./source/Parser.C 33 -struct { - char *name; - void (*function)(ServerConnection *, Person *, String); -} functions[] = +typedef void (*fptr)(ServerConnection *, Person *, String); +std::map > Parser::functions; + +void Parser::init () hunk ./source/Parser.C 38 - { "001", Parser::parse001 }, /* RPL_WELCOME */ - { "302", Parser::parse302 }, /* RPL_USERHOST */ - { "311", Parser::parse311 }, /* RPL_WHOISUSER */ - { "315", Parser::parse315 }, /* RPL_ENDOFWHO */ - { "324", Parser::parse324 }, /* RPL_CHANNELMODEIS */ - { "332", Parser::parse332 }, /* RPL_TOPIC */ - { "352", Parser::parse352 }, /* RPL_WHOREPLY */ - { "353", Parser::parse353 }, /* RPL_NAMESREPLY */ - { "366", Parser::parse366 }, /* RPL_ENDOFNAMES */ - { "367", Parser::parse367 }, /* RPL_BANLIST */ - { "401", Parser::parse401 }, /* ERR_NOSUCHNICK */ - { "433", Parser::parse433 }, /* ERR_NICKNAMEINUSE */ - { "437", Parser::parse433 }, /* ERR_UNAVAILRESOURCE */ - { "471", Parser::parse473 }, /* ERR_CHANNELISFULL */ - { "473", Parser::parse473 }, /* ERR_INVITEONLYCHAN */ - { "474", Parser::parse473 }, /* ERR_BANNEDFROMCHAN */ - { "475", Parser::parse473 }, /* ERR_BADCHANNELKEY */ - { "ERROR", Parser::parseError }, - { "INVITE", Parser::parseInvite }, - { "JOIN", Parser::parseJoin }, - { "KICK", Parser::parseKick }, - { "MODE", Parser::parseMode }, - { "NICK", Parser::parseNick }, - { "NOTICE", Parser::parseNotice }, - { "PART", Parser::parsePart }, - { "PING", Parser::parsePing }, - { "PONG", Parser::parsePong }, - { "PRIVMSG", Parser::parsePrivmsg }, - { "QUIT", Parser::parseQuit }, - { "TOPIC", Parser::parseTopic }, - { "", Parser::parseError }, - { 0, 0 } -}; + Parser::functions["001"] = Parser::parse001; /* RPL_WELCOME */ + Parser::functions["302"] = Parser::parse302; /* RPL_USERHOST */ + Parser::functions["311"] = Parser::parse311; /* RPL_WHOISUSER */ + Parser::functions["315"] = Parser::parse315; /* RPL_ENDOFWHO */ + Parser::functions["324"] = Parser::parse324; /* RPL_CHANNELMODEIS */ + Parser::functions["332"] = Parser::parse332; /* RPL_TOPIC */ + Parser::functions["352"] = Parser::parse352; /* RPL_WHOREPLY */ + Parser::functions["353"] = Parser::parse353; /* RPL_NAMESREPLY */ + Parser::functions["366"] = Parser::parse366; /* RPL_ENDOFNAMES */ + Parser::functions["367"] = Parser::parse367; /* RPL_BANLIST */ + Parser::functions["401"] = Parser::parse401; /* ERR_NOSUCHNICK */ + Parser::functions["433"] = Parser::parse433; /* ERR_NICKNAMEINUSE */ + Parser::functions["437"] = Parser::parse433; /* ERR_UNAVAILRESOURCE */ + Parser::functions["471"] = Parser::parse473; /* ERR_CHANNELISFULL */ + Parser::functions["473"] = Parser::parse473; /* ERR_INVITEONLYCHAN */ + Parser::functions["474"] = Parser::parse473; /* ERR_BANNEDFROMCHAN */ + Parser::functions["475"] = Parser::parse473; /* ERR_BADCHANNELKEY */ + Parser::functions["ERROR"] = Parser::parseError; + Parser::functions["INVITE"] = Parser::parseInvite; + Parser::functions["JOIN"] = Parser::parseJoin; + Parser::functions["KICK"] = Parser::parseKick ; + Parser::functions["MODE"] = Parser::parseMode ; + Parser::functions["NICK"] = Parser::parseNick ; + Parser::functions["NOTICE"] = Parser::parseNotice; + Parser::functions["PART"] = Parser::parsePart; + Parser::functions["PING"] = Parser::parsePing; + Parser::functions["PONG"] = Parser::parsePong; + Parser::functions["PRIVMSG"] = Parser::parsePrivmsg; + Parser::functions["QUIT"] = Parser::parseQuit; + Parser::functions["TOPIC"] = Parser::parseTopic; + Parser::functions[""] = Parser::parseError; +} hunk ./source/Parser.C 93 - for (int i = 0; functions[i].name != 0; i++) + /* for (int i = 0; functions[i].name != 0; i++) hunk ./source/Parser.C 98 + */ + if (fptr temp_func = functions[command]) + temp_func (cnx, from, rest); hunk ./source/Parser.C 795 -// st2.nextToken(); -// unsigned long address = -// htonl(strtoul((const char *)st2.nextToken(), 0, 0)); -// int port = atoi((const char *)st2.rest()); -// if (port >= 1024 && Utils::getLevel(cnx->bot, from->getAddress())) -// cnx->bot->addDCC(from, address, port); + st2.nextToken(); + unsigned long address = + ntohl (strtoul((const char *)st2.nextToken(), 0, 0)); + int port = atoi((const char *)st2.nextToken ()); + if (port >= 1024 && Utils::getLevel(cnx->bot, from->getAddress())) + cnx->bot->addDCC(from, address, port); hunk ./source/Parser.C 996 - gh_catch(SCM_BOOL_T, (scm_catch_body_t) scm_apply_wrapper, - (void *)&wd, (scm_catch_handler_t) Interp::ErrorHandler, + gh_catch(SCM_BOOL_T, (scm_t_catch_body) scm_apply_wrapper, + (void *)&wd, (scm_t_catch_handler) Interp::ErrorHandler, hunk ./source/Parser.H 35 +#include +#include + hunk ./source/Parser.H 82 + static void init (); hunk ./source/Parser.H 122 +private: + + typedef void (*fptr)(ServerConnection *, Person *, String); + static std::map > functions; hunk ./source/ScriptCommands.C 575 - bool fallt = false; // does this hook fall through? + bool fallt = true; // does this hook fall through? hunk ./source/ServerQueue.C 206 - addLine(String("USER ") + username + " . . :" + ircname, + addLine(String("USER ") + username + " 0 * :" + ircname, hunk ./source/Socket.C 2 +// Copyright (C) 2002 Clinton Ebadi hunk ./source/Socket.C 250 - do { - nb = ::read(fd->fd, &r, 1); - switch (nb) { - case 0: - return String(""); - case -1: - if (errno != EINTR && errno != EAGAIN) - return String(""); - sleep(1); - } - - if (nb != -1) - buf[pos++] = r; - } while (r != '\n'); + do + { + nb = ::read(fd->fd, &r, 1); + switch (nb) { + case 0: + return String(""); + case -1: + if (errno != EINTR && errno != EAGAIN) + return String(""); + sleep(1); + } + + if (nb != -1) + buf[pos++] = r; + } while (r != '\n'); hunk ./source/Socket.C 266 - if (pos > 1 && buf[pos-2] == '\r') +if (pos > 1 && buf[pos-2] == '\r') hunk ./source/Socket.C 269 - buf[pos-1] = '\0'; + buf[pos-1] = '\0'; hunk ./source/Socket.H 40 - char buf[1024]; }