xforever1313 / Chaskis

A framework for making IRC Bots.
Boost Software License 1.0
9 stars 2 forks source link

Add topic command and handlers #42

Open xforever1313 opened 6 years ago

xforever1313 commented 6 years ago

The IRC RFC mentions querying the channel's topic. We should add both a command to SET the topic, and a handler that will be fired if we get a RPL_TOPIC or RPL_NOTOPIC response from the server.

Examples of commands to set a topic:

   :WiZ!jto@tolsun.oulu.fi TOPIC #test :New topic ; User Wiz setting the
                                   topic.

   TOPIC #test :another topic      ; Command to set the topic on #test
                                   to "another topic".

   TOPIC #test :                   ; Command to clear the topic on
                                   #test.

   TOPIC #test                     ; Command to check the topic for
                                   #test.

We should have a function on IrcConnection called "SetTopic" that takes in the channel, and what the topic should be set to. An empty string is allowed while setting the topic.

Examples of getting a topic from IRC:

       331    RPL_NOTOPIC
              "<channel> :No topic is set"
       332    RPL_TOPIC
              "<channel> :<topic>"

         - When sending a TOPIC message to determine the
           channel topic, one of two replies is sent.  If
           the topic is set, RPL_TOPIC is sent back else
           RPL_NOTOPIC.

We should add handlers that will watch for RPL_NOTOPIC and RPL_TOPIC, and fire handlers if one of these are seen. Passed in parameter to the event should be the channel the topic was changed on, and the new topic (which can be an empty string).

xforever1313 commented 3 years ago

Also a handler for when we send the TOPIC command.