Anope IRC Services

Anope Development => Feature Requests => Topic started by: Victor Coss on July 10, 2016, 03:34:19 AM

Title: Store previous channel topics and have ability to restore them
Post by: Victor Coss on July 10, 2016, 03:34:19 AM
Hello, occasionally an op or messed up bot changes the topic of a channel to something you don't like or messes it up. Most of us forget what the topic previously was set to verbatim making it hard to set it right back again. I though of this idea, since Anope already stores channel topic data, why can't it store the previous (say 10) topics of a channel in it's database?

/msg ChanServ PREVIOUSTOPICS #channel
Will list the last 10 topics that were set in the channel and their deployment dates.
ex. output:
1) Apr 16 02:08:16 2016 EDT - Jul 09 22:04:32 2016 EDT I like to eat pie. Set By: GTAXL
2) Jan 06 01:12:52 2016 EST - Apr 16 02:08:16 2016 EDT I like to eat cake. Set By: DG
3) Oct 14 17:43:19 2015 EST - Jan 06 01:12:52 2016 EST I like cookies. Set By: GTAXL

/msg ChanServ PREVIOUSTOPICS #channel numb
Will set the channel to the previous topic selected.
/msg ChanServ PREVIOUSTOPICS #channel 2 would set the channel's topic to "I like to eat cake."

Of course it'll store any color codes as well and set them. :) I don't know about you, but I think this is a genius feature and should be implemented. I don't see it taking up that much space..

Thanks :D
Title: Re: Store previous channel topics and have ability to restore them
Post by: genius3000 on October 03, 2017, 07:26:35 AM
Alright, it may have been quite some time since this request was posted but I've got a 3rd Party module for it! With any luck, it will be a candidate for a ported feature in the next Anope version.
It's not approved on the Anope Modules site yet (just uploaded a few minutes ago), but you can access it in my GitHub repo: https://github.com/genius3000/anope-modules/blob/master/cs_topichistory.cpp (https://github.com/genius3000/anope-modules/blob/master/cs_topichistory.cpp)

If you choose to run the GitHub version, BACKUP your database prior to doing so (actually you should do this either way). I've tested this for a few days through reloads, restarts, and shutdowns; along with any scenario of a topic setting that I could think of and everything worked fine. Just a fair warning that it is the first version and probably needs a few bugs squashed yet.
Title: Re: Store previous channel topics and have ability to restore them
Post by: genius3000 on October 15, 2017, 11:42:56 PM
With some advice from Adam I cleaned up the code and made a couple improvements over the first commit to my GitHub repo. The module is now published on the Modules site at https://modules.anope.org/index.php?page=view&id=281 (https://modules.anope.org/index.php?page=view&id=281).