This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Topic Recover script updated by me.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Topic Recover script updated by me.

Post by rosc2112 »

Having been unable to contact the author of this script, I've taken it upon myself to update and enhance it quite a bit. The script was barely working out of the box from the archives, so I fixed the problems. I've also done the following:

Code: Select all

# Updated by Rosc2112 at  yahoo.com  Feb.2006                   
#                                                               
# Originally based on:  Meltdowns Topic-Recover V0.2 08-03-2004 
#                       meltdown@gmx.at | #lamer or #meltdown on quakenet
#
# Stores every chantopic into a file to recover the last topic. 
#                                                               
# Changes:                                                      
#  Made all commands work by /msg (No sense spamming channels)  
#  Added a timer to check if the topic is empty, and reset it with recovertopic.
#  Added a deltopic function to allow deleting the topics.
#  Modified rolltopic to work based on Epoch time/index number which allows rolling back any topic you wish, 
#    not just the first one by date as originally scripted.
# Added an undotopic function, mainly for testing, but it's there for whatever may be useful.
# Added a default help file.
# Fixed various errors in proc:rectopic{} such as not having $aktuell, $aktuellnick and $aktuellzeit set before
#    trying to use them. TCL seems rather picky about that..I can't tell that those vars serve a useful function
#    but they were causing problems, so I took the path of least resistance.
#
# It ain't pretty, and I've left my debug putcmdlogs, commented out, and it's definitely not 
# optimized, since I've only been using eggdrop/tcl for 3 days now :P
# But it all works from my testing, ymmv. Updates/fixes/clues welcome :P
#                                                               
# Todo:                                                         
#  Make the script work with multiple channels in all functions.
#  Could probably remove the somewhat silly cleanup function, since you can delete topics manually now.
#  Better yet, redo the functions to CHECK for duplicate topics BEFORE adding them to the topic file.
#
# Commands:
#  .topic - in channel/public command, will show the current topic in msg to user.
#  topic  - /msg $botnick topic - will show the current topic, and if user is +o, 
#                                 will show the commands helpfile.
#  searchtopic - /msg $botnick searchtopic - shows the saved topics and their Epoch time/Index number
#  rolltopic   - /msg $botnick rolltopic   - roll back topic with the one specified by Epoch time/Index number
#  deltopic    - /msg $botnick deltopic    - delete topic with Epoch time/Index number
#  rectopic    - /msg $botnick rectopic    - recover the last saved topic 
#  retopic     - /msg $botnick retopic     - same as rectopic, except this UNSETS topic first, then recovers last set.
#  undotopic   - /msg $botnick undotopic   - simply unsets the topic, making it blank
#  
#
I would greatly appreciate any experienced tcl coders looking over the script and correcting any huge and ugly errors I've put into this effort. As stated above, I've only been using tcl for 3 days or so (I think I did pretty good considering! :)

I've put the script here:
TopicRecover v2112
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

why don't you just test it yourself?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

I would greatly appreciate any experienced tcl coders looking over the script and correcting any huge and ugly errors I've put into this effort.
Errors would mean it doesn't work. That's what i based my reply on.

Furthermore, you seem to global chan alot, i haven't taken a look as to where you define it but that would pretty much limit your script to 1 channel.

Maybe you should realise that's the reason why it was using pub, to allow multiple channels without problems.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

bloated script; restoring topic is as simple as:

Code: Select all

foreach c [channels] {
   if [botonchan $c] {set t($c) [topic $c]}
}
bind join - * foo
proc foo {n u h c} {
   if [isbotnick $n] {set ::t($c) [topic $c]}
}
bind pub o !restore bar
proc bar {n u h c t} {
   set t [topic $c]
   if [info exists ::t($c)] {
      puthelp "topic $c :$::t($c)"
      set ::t($c) $t
   }
}
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

v0.5 update

Post by rosc2112 »

# Aug 29 2006 - Changed .topicsearch to show newest to oldest topics. Fixed a typo "catc" shoulda been "catch".
Fixed help output to show correct synxtax (duh).

BTW,
The script was updated some time ago to work in multiple channels with set tchan "channel list"
Post Reply