Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Store previous channel topics and have ability to restore them  (Read 11192 times)

0 Members and 1 Guest are viewing this topic.

Victor Coss

  • Anope User
  • Offline Offline
  • Gender: Male
  • Posts: 6
    • GTAXLnet

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
Logged

genius3000

  • Anope User
  • Offline Offline
  • Posts: 37
Re: Store previous channel topics and have ability to restore them
« Reply #1 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

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.
« Last Edit: October 03, 2017, 07:28:38 AM by genius3000 »
Logged
-genius3000

genius3000

  • Anope User
  • Offline Offline
  • Posts: 37
Re: Store previous channel topics and have ability to restore them
« Reply #2 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.
Logged
-genius3000
Pages: [1]   Go Up