]> jfr.im git - irc/SurrealServices/srsv.git/commitdiff
Added CS TOPIC command, as well as a !topic command for BotServ bots
authormusashix90 <redacted>
Wed, 5 May 2010 15:14:41 +0000 (15:14 +0000)
committermusashix90 <redacted>
Wed, 5 May 2010 15:14:41 +0000 (15:14 +0000)
git-svn-id: http://svn.tabris.net/repos/srsv@3460 70d4eda1-72e9-0310-a436-91e5bd24443c

branches/0.4.3/help/chanbot.txt
branches/0.4.3/help/chanbot/abbreviations.txt
branches/0.4.3/help/chanserv.txt
branches/0.4.3/help/chanserv/topic.txt [new file with mode: 0644]
branches/0.4.3/modules/serviceslibs/botserv.pm
branches/0.4.3/modules/serviceslibs/chanserv.pm

index 27823d6e3e493f4608220b6ac8de4a44fc510940..bb46788b473b5872e4ac28f9e380d9a13177cc3c 100644 (file)
@@ -17,6 +17,7 @@ Commands:
   !dice          Rolls dice, !d 2d4 rolls 2 4 sided dice.
   !mode          Sets modes in a channel.
   !resync        Gives everyone the precise chan-ops they're supposed to have.
+  !topic         Sets the topic of the channel.
 
   !abbreviations Shows all short command aliases.
   !abbrev
index f922ca28e9a6b6eda51bfb55af52ec1ffbcdb837..cb81dd0366b4b8ecfa1e30970cd2bc513413b0bc 100644 (file)
@@ -8,4 +8,4 @@ Commands:
   !d             !dice
   !m             !mode
   !blist         !banlist
-
+  !t             !topic
index 470ec76ef3aa3227e3a9d24e7d36d03467e1a9f5..f2bc8a920315859feca185c96c28228c42a8c4e8 100644 (file)
@@ -21,10 +21,10 @@ Commands to change or check channel status:
    WHY      COUNT  ALIST     RESYNC
 
 Other available commands:
-   DICE   INVITE   GETKEY  CLOSE
-   CLEAR  WELCOME  DRONE   KICKMASK
-   KICK   KICKBAN  MLOCK   KICKBANMASK
-   JOIN   COPY     BANLIST
+   DICE   INVITE   GETKEY   CLOSE
+   CLEAR  WELCOME  DRONE    KICKMASK
+   KICK   KICKBAN  MLOCK    KICKBANMASK
+   JOIN   COPY     BANLIST  TOPIC
 
 Note that channels will be dropped after 21 days of inactivity.
  
diff --git a/branches/0.4.3/help/chanserv/topic.txt b/branches/0.4.3/help/chanserv/topic.txt
new file mode 100644 (file)
index 0000000..6adee5c
--- /dev/null
@@ -0,0 +1,4 @@
+%BChanServ TOPIC%B sets, or unsets, the current topic of the channel.
+To unset the topic, use NONE as the message.
+
+Syntax: %BTOPIC%B %U#channel%U <message|NONE>
index cfdd959123db668409f2dc235204ad3d8a485a7a..3ffbca2ad92ca3ebef8ae79a5bbbbab65ed6e8d2 100644 (file)
@@ -570,6 +570,9 @@ sub chan_dispatch($$$) {
                'm'             =>      \&mode,
 
                'resync'        =>      \&resync,
+
+               'topic'         =>      \&topic,
+               't'             =>      \&topic,
        );
 
        sub give_ops {
@@ -702,6 +705,13 @@ sub chan_dispatch($$$) {
                chanserv::cs_resync($user, $chan->{CHAN});
        }
 
+       sub topic {
+               my ($user, $cmd, $chan, @args) = @_;
+               if (@args >= 1) {
+                       chanserv::cs_topic($user, $chan, @args);
+               }
+       }
+
        if(defined($cmdhash{$cmd})) {
                return if flood_check($user);
 
index 9c882b6366226e98e96d454f27152bdb2b6d6217..33b6e1a0edf28ba8d287db966651c8df5c7a1975 100644 (file)
@@ -973,6 +973,14 @@ sub dispatch($$$) {
                        cs_join($user, @args);
                }
        }
+       elsif($cmd =~ /^topic$/i) {
+               my $chan = shift @args;
+               if (@args == 0) {
+                       notice($user, 'Syntax: TOPIC <#channel> <message|NONE>');
+               } else {
+                       cs_topic($user, { CHAN => $chan }, @args);
+               }
+       }
        else {
                notice($user, "Unrecognized command \002$cmd\002.", "For help, type: \002/msg chanserv help\002");
                wlog($csnick, LOG_DEBUG(), "$src tried to use $csnick $msg");
@@ -3276,6 +3284,13 @@ sub cs_join($@) {
        notice($user, @reply) if scalar @reply;
 }
 
+sub cs_topic($$@) {
+       my ($user, $cn, @args) = @_;
+       my ($chan, $msg) = ($cn->{CHAN}, join(" ", @args));
+       can_do($cn, 'SETTOPIC', $user) or return undef;
+       ircd::settopic(agent($cn), $chan, get_user_nick($user), time, ($msg =~ /^none/i ? "" : $msg));
+}   
+
 ### MISCELLANEA ###
 
 # these are helpers and do NOT check if $cn1 or $cn2 is reg'd