1 # Blosxom Plugin: ping_weblogs_com
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc ping_weblogs_com
6 package ping_weblogs_com;
8 # --- Configurable variables -----
10 # What URL should this plugin ping?
11 my $ping_url = "http://newhome.weblogs.com/pingSiteForm?name=" . encode($blosxom::blog_title) . "&url=" . encode($blosxom::url);
13 # What external program should this plugin use to ping Weblogs.com?
15 # 'wget --quiet -U "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" -O -';
19 # --------------------------------
24 # Keep track of the newest story's mtime
29 print STDERR "here\n";
34 my($pkg, $files_ref) = @_;
36 $newest = $files_ref->{( sort { $files_ref->{$b} <=> $files_ref->{$a} } keys %$files_ref )[0]};
42 # If no timestamped touch-file or newest is newer than the touch-file...
43 if ( !-e "$blosxom::plugin_state_dir/.ping_weblogs_com.output" or $newest > stat("$blosxom::plugin_state_dir/.ping_weblogs_com.output")->mtime ) {
47 my $fh = new FileHandle;
48 $fh->open(qq{$get_app "$ping_url" |});
51 $_ =~ /Thanks for the ping/ and $ping_success++, last;
55 $ping_success or return 0;
57 # Touch the touchfile (creates if doesn't already exist)
58 open TOUCH, "> $blosxom::plugin_state_dir/.ping_weblogs_com.output";
59 print TOUCH $response;
73 $encodings{chr($_)} = sprintf("%%%02X", $_);
76 $string =~ s/([^A-Za-z0-9\-_.!~*'()])/$encodings{$1}/g;
86 Blosxom Plug-in: ping_weblogs_com
90 Purpose: Notifies weblogs.com [http://www.weblogs.com] that your weblog
91 has been updated upon encountering any new story.
93 Maintains a touch-file ($blosxom::plugin_state_dir/.ping_weblogs_com.output)
94 to which to compare the newest story's creation date. Fills the
95 touch-file with the HTML results of the latest ping.
101 Version number coincides with the version of Blosxom with which the
102 current version was first bundled.
106 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
108 This plugin is now maintained by the Blosxom Sourceforge Team,
109 <blosxom-devel@lists.sourceforge.net>.
113 Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
115 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
119 None known; please send bug reports and feedback to the Blosxom
120 development mailing list <blosxom-devel@lists.sourceforge.net>.
124 Blosxom and this Blosxom Plug-in
125 Copyright 2003, Rael Dornfest
127 Permission is hereby granted, free of charge, to any person obtaining a
128 copy of this software and associated documentation files (the "Software"),
129 to deal in the Software without restriction, including without limitation
130 the rights to use, copy, modify, merge, publish, distribute, sublicense,
131 and/or sell copies of the Software, and to permit persons to whom the
132 Software is furnished to do so, subject to the following conditions:
134 The above copyright notice and this permission notice shall be included
135 in all copies or substantial portions of the Software.
137 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
138 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
139 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
140 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
141 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
142 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
143 OTHER DEALINGS IN THE SOFTWARE.