notice($user, 'Syntax: REGISTER <#channel> [password] [description]');
}
}
+
elsif($cmd =~ /^(?:[uvhas]op|co?f(ounder)?)$/i) {
my ($cn, $cmd2) = splice(@args, 0, 2);
my $chan = { CHAN => $cn };
cs_join($user, @args);
}
}
- elsif($cmd =~ /^topic$/i) {
- my $chan = shift @args;
- if (@args == 0) {
- notice($user, 'Syntax: TOPIC <#channel> <message|NONE>');
- } else {
- $msg =~ s/^topic #(?:\S+)? //i;
- cs_topic($user, { CHAN => $chan }, $msg);
+ elsif($cmd =~ /^topic/i) {
+ my $cn = shift @args;
+ my $chan = { CHAN => $cn };
+ if($cmd =~ /^topicprepend$/i) {
+ if (@args == 0) {
+ notice($user, 'Syntax: TOPICAPPEND <#channel> <message>');
+ } else {
+ $msg =~ s/^topicappend $cn //i;
+ cs_topicappend($user, $chan, 0, $msg);
+ }
+ } elsif($cmd =~ /^topicprepend$/i) {
+ if (@args == 0) {
+ notice($user, 'Syntax: TOPICPREPEND <#channel> <message>');
+ } else {
+ $msg =~ s/^topicprepend $cn //i;
+ cs_topicappend($user, $chan, 1, $msg);
+ }
+ } elsif($cmd =~ /^topic$/i) {
+ if (@args == 0) {
+ notice($user, 'Syntax: TOPIC <#channel> <message|NONE>');
+ } else {
+ $msg =~ s/^topic $cn //i;
+ cs_topic($user, $chan, $msg);
+ }
}
}
else {
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));
-}
+}
+
+sub cs_topicappend {
+ my ($user, $chan, $front, $topicappend) = @_;
+ my $cn = $chan->{CHAN};
+ $get_topic->execute($cn);
+ my ($cur_topic, undef, undef) = $get_topic->fetchrow_array;
+ $get_topic->finish();
+ my $new_topic = $cur_topic;
+ if ($cur_topic) {
+ if($front) {
+ $new_topic = $topicappend . ' | ' . $cur_topic;
+ } else {
+ $new_topic .= ' | ' . $topicappend;
+ }
+ }
+ cs_topic ($user, $chan, $new_topic);
+}
### MISCELLANEA ###
$suser -> {AGENT} = agent($chan);
my $setter = $suser -> {NICK};
return if cr_chk_flag($chan, CRF_CLOSE, 1);
-
+
if(current_message->{SYNC}) { # We don't need to undo our own topic changes.
print "Line @{[__LINE__]}\n";
$set_topic1->execute($setter, $time, $cn);