-Make HTML charset to variable $cf->web_charset
-Make irc charset to variable $cf->irc_charset
-Introduces use warnings, added undef checks, etc.
-Added filename/line info to plugins
+2008-07-18 Jun Morimoto <morimoto@mrmt.net>
+ * \e$B$4$/C;;~4V$KF10lFbMF$NO"B3\e(BPOST\e$B$,$-$?>l9g$OL5;k\e(B.
+ au W63S (re) \e$BBP:v\e(B. thanks to Takuo KITAME.
2008-06-29 Jun Morimoto <morimoto@mrmt.net>
#!/usr/bin/perl
# -*- mode: perl; coding: utf-8 -*-
# keitairc
-# $Id: keitairc,v 1.59 2008-06-29 09:20:49 morimoto Exp $
+# $Id: keitairc,v 1.60 2008-07-17 15:35:52 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/keitairc,v $
#
# Copyright (c) 2003-2008 Jun Morimoto <morimoto@mrmt.net>
sub send_message{
my $request = shift;
my $channel = shift;
+ my $timestamp;
my $message = $request->content();
+ if(length($message)){
+ ($message, $timestamp) = split(/&/, $message);
+ $timestamp =~ s/^stamp=//g;
+ }
$message =~ s/^m=//;
$message =~ s/\+/ /g;
$message = uri_unescape($message);
}
$irc->yield(@postcmd);
} elsif(length($channel)){
- $irc->yield(privmsg => $channel => $jis);
- my $cid = $ib->name2cid($channel);
- $ib->add_message($cid, $euc, $cf->irc_nick());
+ if($ib->update_timestamp($timestamp)){
+ $irc->yield(privmsg => $channel => $jis);
+ my $cid = $ib->name2cid($channel);
+ $ib->add_message($cid, $euc, $cf->irc_nick());
+ }
$ib->message_added(1);
}
}
s/\s+/ /g;
$buf .= "$_<br />";
}
- # Encode::from_to($buf, 'euc-jp', $cf->web_charset());
return Encode::encode($cf->web_charset(), $buf);
}
# -*- mode: perl; coding: utf-8 -*-
# Keitairc::IrcBuffer
-# $Id: IrcBuffer.pm,v 1.17 2008-06-29 12:04:50 morimoto Exp $
+# $Id: IrcBuffer.pm,v 1.18 2008-07-17 15:35:52 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/IrcBuffer.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
# chk
$me->{message_added} = 0;
+ # timestamp of last posted message
+ $me->{timestamp} = 0;
+
bless $me;
}
$_;
}
+################################################################
+# 同一秒間の連続発言を防ぐためのチェック。
+#
+# 前回 update_timestamp() が呼ばれた時刻と同じ時刻に
+# 再度 update_timestamp() が呼ばれたら 0 を返す。
+#
+# 前回 update_timestamp() が呼ばれた時刻と異なる時刻に
+# 再度 update_timestamp() が呼ばれたら 1 を返す。
+#
+sub update_timestamp{
+ my $me = shift;
+ my $time = time;
+
+ if($me->{timestamp} != $time){
+ $me->{timestamp} = $time;
+ return 1;
+ }
+
+ return 0;
+}
+
1;
# -*- mode: perl; coding: utf-8 -*-
# keitairc/lib/plugins/00all
# チャネルの全メッセージ閲覧
-# $Id: 00all,v 1.9 2008-06-29 09:20:49 morimoto Exp $
+# $Id: 00all,v 1.10 2008-07-17 15:35:52 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00all,v $
# The line number (1 incremented) and filename below must be
buf => $buf,
channel_compact => $cname,
cid => $cid,
+ stamp => time,
});
}
};
# -*- mode: perl; coding: utf-8 -*-
# keitairc/lib/plugins/00unread
# チャネルの未読メッセージ閲覧
-# $Id: 00unread,v 1.8 2008-06-29 09:20:49 morimoto Exp $
+# $Id: 00unread,v 1.9 2008-07-17 15:35:52 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00unread,v $
# The line number (1 incremented) and filename below must be
buf => $buf,
channel_compact => $::ib->simple_escape(encode($::cf->web_charset(), $::ib->compact_channel_name($cid))),
cid => $cid,
+ stamp => time,
});
}
};
<tmpl_else>
<input type="text" name="m" />
</tmpl_if>
- <input type="submit" accesskey="1" value="[1] \94\8c¾/\8dX\90V" /><br />
+ <input type="submit" accesskey="1" value="[1] \94\8c¾/\8dX\90V" />
+ <input type="hidden" name="stamp" value="<!-- stamp -->" /><br />
</form>
<tmpl_if buf>
<tmpl_else>
<input type="text" name="m" />
</tmpl_if>
- <input type="submit" accesskey="1" value="[1] \94\8c¾/\8dX\90V" /><br />
+ <input type="submit" accesskey="1" value="[1] \94\8c¾/\8dX\90V" />
+ <input type="hidden" name="stamp" value="<!-- stamp -->" /><br />
</form>
<tmpl_if buf>